diff options
author | Danny Holman <dholman@gymli.org> | 2024-06-21 21:48:46 -0500 |
---|---|---|
committer | Danny Holman <dholman@gymli.org> | 2024-06-21 21:50:55 -0500 |
commit | 056087596de64696f18f9b32f604b69280be079e (patch) | |
tree | 4ebdbe12197736d69898ff7437ff9e6af97940ed /arch/i386/include/kernel/asm.h | |
parent | f1a0f10f54e17803f7d7095a61117aec52fafbf0 (diff) |
arch: i386: paging: do the recursive paging trick
Map the page directory to the last page table. This allows the kernel to
access every page table on the system from the address 0xFFC00000 plus
an offset.
Signed-off-by: Danny Holman <dholman@gymli.org>
Diffstat (limited to 'arch/i386/include/kernel/asm.h')
-rw-r--r-- | arch/i386/include/kernel/asm.h | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/arch/i386/include/kernel/asm.h b/arch/i386/include/kernel/asm.h index a002a44..d692917 100644 --- a/arch/i386/include/kernel/asm.h +++ b/arch/i386/include/kernel/asm.h @@ -4,13 +4,6 @@ #include <kernel/gdt.h> #include <stdint.h> -extern uintptr_t _kernel_start; -extern uintptr_t _kernel_end; -#define KSTART ((uintptr_t)&_kernel_start) -#define KEND ((uintptr_t)&_kernel_end - 0xC0000000) - -#define PAGE_SIZE 4096 - #define PCI_CONFIG_ADDR 0xCF8 #define PCI_CONFIG_DATA 0xCFC @@ -108,7 +101,6 @@ void aquire_lock(int *lock); void release_lock(int *lock); void enable_paging(uint32_t new_cr3); - void flush_gdt(void); static inline void outb(uint16_t port, uint8_t value) { @@ -153,6 +145,10 @@ static inline void flush_tss(void) { __asm__ volatile("movw $0x28, %ax; ltr %ax"); } +static inline void flush_tlb(void) { + __asm__ volatile("movl %cr3, %eax; movl %eax, %cr3"); +} + static inline void invlpg(void *addr) { __asm__ volatile("invlpg (%0)" : : "b"(addr) : "memory"); } |