mirror of
https://github.com/hermitcore/libhermit.git
synced 2025-03-09 00:00:03 +01:00
use correct boundaries for the VMA reservation
- for the kernel we use huge pages => use 2MB boundaries for the VMA reservation
This commit is contained in:
parent
a4bd6b0d22
commit
488ef16266
1 changed files with 9 additions and 2 deletions
|
@ -39,6 +39,9 @@
|
|||
extern const void kernel_start;
|
||||
extern const void kernel_end;
|
||||
|
||||
#define PAGE_2M_FLOOR(addr) (((addr) + (1L << 21) - 1) & (-1L << 21))
|
||||
#define PAGE_2M_CEIL(addr) ( (addr) & (-1L << 21))
|
||||
|
||||
/*
|
||||
* Kernel space VMA list and lock
|
||||
*
|
||||
|
@ -55,9 +58,13 @@ int vma_init(void)
|
|||
{
|
||||
int ret;
|
||||
|
||||
kprintf("vma_init: reserve vma region 0x%llx - 0x%llx\n",
|
||||
PAGE_2M_CEIL((size_t) &kernel_start),
|
||||
PAGE_2M_FLOOR((size_t) &kernel_end));
|
||||
|
||||
// add Kernel
|
||||
ret = vma_add(PAGE_CEIL((size_t) &kernel_start),
|
||||
PAGE_FLOOR((size_t) &kernel_end),
|
||||
ret = vma_add(PAGE_2M_CEIL((size_t) &kernel_start),
|
||||
PAGE_2M_FLOOR((size_t) &kernel_end),
|
||||
VMA_READ|VMA_WRITE|VMA_EXECUTE|VMA_CACHEABLE);
|
||||
if (BUILTIN_EXPECT(ret, 0))
|
||||
goto out;
|
||||
|
|
Loading…
Add table
Reference in a new issue