diff options
author | Anton Kling <anton@kling.gg> | 2024-03-20 18:08:57 +0100 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2024-03-20 19:08:18 +0100 |
commit | a950021011e41b7d4fd285dde278cf9b06f89574 (patch) | |
tree | 1d88d00ac2f31d8d7c47dc84a954caea68c0b5f2 /kernel/process.s | |
parent | 553b43d2e563dcff74d4c86904fa3737e96d7365 (diff) |
MMU: Fixed massive problem in assumption of RAM layout
This caused certain addreses which where not RAM memory to be assigned
to virtual addresses incorrectly. This caused a significant slowdown
when running it with KVM due to constantly having to exit the VM if the
OS writes to memory that is not RAM.
This fix increased the performance of KVM significantly and improved TCG
performance.
Diffstat (limited to 'kernel/process.s')
-rw-r--r-- | kernel/process.s | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/kernel/process.s b/kernel/process.s index caef941..934d627 100644 --- a/kernel/process.s +++ b/kernel/process.s @@ -128,15 +128,13 @@ switch_to_task: mov eax,[esi+TCB.CR3] # eax = address of page directory for next task mov ebx,[esi+TCB.ESP0] # ebx = address for the top of the next task's kernel stack # mov [TSS.ESP0],ebx # Adjust the ESP0 field in the TSS (used by CPU for for CPL=3 -> CPL=0 privilege level changes) -# mov ecx,cr3 # ecx = previous task's virtual address space + mov ecx,cr3 # ecx = previous task's virtual address space -# FIXME: This branch gets a from the assembler, something about "relaxed branches". -# this branch would probably not be used anyway but should be checked on later anyway. -# cmp eax,ecx # Does the virtual address space need to being changed? + cmp eax,ecx # Does the virtual address space need to being changed? -# je .doneVAS # no, virtual address space is the same, so don't reload it and cause TLB flushes + je .doneVAS # no, virtual address space is the same, so don't reload it and cause TLB flushes mov cr3,eax # yes, load the next task's virtual address space -#.doneVAS: +.doneVAS: pop ebp pop edi |