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.hpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/core/paging.hpp') diff --git a/src/core/paging.hpp b/src/core/paging.hpp index 01e45a7..5817765 100644 --- a/src/core/paging.hpp +++ b/src/core/paging.hpp @@ -2,6 +2,7 @@ #include "core/types.hpp" +#define MAX_TABLES 280 #define PAGING_MAX_PAGE (20*512) /** * Current number of page (from the beginning of the ram) used by the kernel that @@ -18,15 +19,17 @@ /// @brief Get page address that contain addr #define PAGE(addr) (addr&(~(0xFFF))) -#define PAGING_MAP(addr) paging_allocate_addr(kpages[0],(u64)(addr),(u64)(addr),PAGING_OPT_P|PAGING_OPT_RW,kernel_vma) -#define MAX_TABLES 280 +#define PAGING_MAP(addr) paging_allocate_addr(kpages[0],(u64)(addr),(u64)(addr),PAGING_OPT_P|PAGING_OPT_RW,kvar_kernel_vma) +#define PAGING_MAP_RANGE(addr, n) { \ + for(u64 i=0;i<(n);i++){ \ + paging_allocate_addr(kpages[0],((u64)(addr))+i,((u64)(addr))+i,PAGING_OPT_P|PAGING_OPT_RW,kvar_kernel_vma); \ +}} /// @brief All PAE table structures are allocated here extern u64 kpages[MAX_TABLES][512]; -/// cf boucane.hpp -extern u64 kernel_vma,stack_pma,userspace_pma; - +/// CF boucane.hpp +extern u64 kvar_kernel_vma,kvar_stack_pma,kvar_userspace_pma; /** * Setup and enable PAE paging -- cgit v1.2.3