diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2021-04-28 10:46:36 +0200 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2021-04-28 10:46:36 +0200 |
| commit | 152f14654bfb438d074833e3c8d5392d300f5095 (patch) | |
| tree | 633e4dad7153a1d01f7f24b8fd0386c6fe7848ca /src/core/paging.cc | |
| parent | f13b26eeb4f9afba3a1aed2516655b34139979aa (diff) | |
Debug trampoline and paging
Diffstat (limited to 'src/core/paging.cc')
| -rw-r--r-- | src/core/paging.cc | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/core/paging.cc b/src/core/paging.cc index 73a5c63..da442bf 100644 --- a/src/core/paging.cc +++ b/src/core/paging.cc @@ -4,7 +4,6 @@ #include "libs/string.hpp" char paging_status[PAGING_MAX_PAGE / 8]; -u64 kernel_vma,stack_pma,userspace_pma; u64 kpages[MAX_TABLES][512] __attribute__((aligned(4096))); int kpages_next=1; // First page is for the pml4 @@ -16,10 +15,6 @@ u64* paging_allocate_table(){ } void paging_enable() { - // Init linker variables - asm("movq $__kernel_vma, %0":"=r"(kernel_vma)); - asm("movq $__userspace_pma, %0":"=r"(userspace_pma)); - asm("movq $__stack_pma, %0":"=r"(stack_pma)); // Init status for (int i = 0; i < PAGING_MAX_PAGE / 8; i++) { @@ -28,9 +23,10 @@ void paging_enable() { // Init tables for(int i=0;i<MAX_TABLES;i++){ - memset(kpages[i], 0, 512*64); + for(int j=0;j<512;j++) + kpages[i][j]=0; } - + // Allocate paging for the kernel (to not override the source // code during the next paging_allocate_table() calls) paging_allocate_contiguous(userspace_pma/4096); @@ -41,7 +37,7 @@ void paging_enable() { } // 4096 bytes stack paging_allocate_addr(kpages[0],kernel_vma-4096,stack_pma,0x3,0); - + // Load new pml4 u64 kpage_phy=((u64)kpages[0]-kernel_vma); asm volatile( |
