From 056087596de64696f18f9b32f604b69280be079e Mon Sep 17 00:00:00 2001 From: Danny Holman Date: Fri, 21 Jun 2024 21:48:46 -0500 Subject: 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 --- arch/i386/include/kernel/asm.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'arch/i386/include/kernel/asm.h') 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 #include -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"); } -- cgit v1.2.3