diff options
author | dzwdz | 2021-07-20 21:26:46 +0200 |
---|---|---|
committer | dzwdz | 2021-07-20 21:26:46 +0200 |
commit | 2bd8511dbd19ec09aa92cec2888a5ec3c8b1fded (patch) | |
tree | 49a52f182e955a8c72ba202fee770ad21c98f840 /src/kernel/arch | |
parent | e3de0bdced81720fd904ff38d7c62fc55764c42f (diff) |
only enable paging when jumping into ring 0
The kernel can't use the limited paging tables of user processes.
Alternatively, sysenter could accept a parameter with a new cr3. That
would allow/require using paging in the kernel - so I'll switch to it
later, but I want to get other stuff done first.
Diffstat (limited to 'src/kernel/arch')
-rw-r--r-- | src/kernel/arch/i386/pagedir.c | 7 | ||||
-rw-r--r-- | src/kernel/arch/i386/sysenter.s | 5 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/kernel/arch/i386/pagedir.c b/src/kernel/arch/i386/pagedir.c index 264508b..b52075d 100644 --- a/src/kernel/arch/i386/pagedir.c +++ b/src/kernel/arch/i386/pagedir.c @@ -89,10 +89,5 @@ void pagedir_map(struct pagedir *dir, void *virt, void *phys, } void pagedir_use(struct pagedir *dir) { - asm volatile("mov %0, %%cr3;" - - "mov %%cr0, %%eax;" - "or $0x80000001, %%eax;" - "mov %%eax, %%cr0;" - : : "r" (dir) : "eax"); + asm volatile("mov %0, %%cr3;" : : "r" (dir) : "memory"); } diff --git a/src/kernel/arch/i386/sysenter.s b/src/kernel/arch/i386/sysenter.s index 666c0f0..5630c3b 100644 --- a/src/kernel/arch/i386/sysenter.s +++ b/src/kernel/arch/i386/sysenter.s @@ -18,6 +18,11 @@ sysexit: mov %ax, %fs mov %ax, %gs + // enable paging + mov %cr0, %eax + or $0x80000000, %eax + mov %eax, %cr0 + sysexit |