From 067d6e340be698b0e26b7732215a1969e0e683f3 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Wed, 28 Apr 2021 15:07:12 +0200 Subject: Refactoring --- src/core/paging.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/core/paging.cc') diff --git a/src/core/paging.cc b/src/core/paging.cc index da442bf..ae390ff 100644 --- a/src/core/paging.cc +++ b/src/core/paging.cc @@ -9,7 +9,7 @@ int kpages_next=1; // First page is for the pml4 u64* paging_allocate_table(){ u64 addr=(u64)kpages[kpages_next]; - u64* allocated=(u64*)(addr-kernel_vma); + u64* allocated=(u64*)(addr-kvar_kernel_vma); kpages_next++; return allocated; } @@ -29,17 +29,17 @@ void paging_enable() { // Allocate paging for the kernel (to not override the source // code during the next paging_allocate_table() calls) - paging_allocate_contiguous(userspace_pma/4096); + paging_allocate_contiguous(kvar_userspace_pma/4096); // Setting up new kernel address space for(u64 i=0;i<=0x10000000;i+=4096){ - paging_allocate_addr(kpages[0],kernel_vma+i,i, 0x3,0); // Identity map + paging_allocate_addr(kpages[0],kvar_kernel_vma+i,i, 0x3,0); // Identity map } // 4096 bytes stack - paging_allocate_addr(kpages[0],kernel_vma-4096,stack_pma,0x3,0); + paging_allocate_addr(kpages[0],kvar_kernel_vma-4096,kvar_stack_pma,0x3,0); // Load new pml4 - u64 kpage_phy=((u64)kpages[0]-kernel_vma); + u64 kpage_phy=((u64)kpages[0]-kvar_kernel_vma); asm volatile( "mov %0, %%rax \n\t" "mov %%rax, %%cr3 \n\t" -- cgit v1.2.3