alloc_stack ok (HHDM mapped from mmap)
This commit is contained in:
@@ -6,8 +6,9 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include <limine.h>
|
||||
#include "mem/heap/kheap.h"
|
||||
|
||||
void paging_init(struct limine_kernel_address_response* kaddr, struct limine_framebuffer* fb);
|
||||
void paging_init();
|
||||
void paging_map_page(uint64_t* root_table, uint64_t virt, uint64_t phys, uint64_t flags);
|
||||
|
||||
extern uint64_t hhdm_off;
|
||||
@@ -15,10 +16,14 @@ extern uint64_t hhdm_off;
|
||||
#define PHYS_TO_VIRT(x) ((void*)((uintptr_t)(x) + hhdm_off))
|
||||
#define VIRT_TO_PHYS(x) ((uintptr_t)(x) - hhdm_off)
|
||||
|
||||
#define PTE_ADDR_MASK 0x000FFFFFFFFFF000
|
||||
// Stole it
|
||||
#define ALIGN_UP(x, align) (((x) + ((align) - 1)) & ~((align) - 1))
|
||||
#define ALIGN_DOWN(x, align) ((x) & ~((align) - 1))
|
||||
#define PAGE_ALIGN_DOWN(x) ((x) & ~0xFFFULL)
|
||||
#define PAGE_ALIGN_DOWN(x) ((x) & PTE_ADDR_MASK)
|
||||
|
||||
#define ALIGN(size) ALIGN_UP(size, 16)
|
||||
#define BLOCK_MIN_SIZE (sizeof(struct heap_block_t) + 16)
|
||||
|
||||
#define PML4_INDEX(x) (((x) >> 39) & 0x1FF)
|
||||
#define PDPT_INDEX(x) (((x) >> 30) & 0x1FF)
|
||||
|
||||
Reference in New Issue
Block a user