first commit
This commit is contained in:
commit
cab7a75780
264 changed files with 5833 additions and 0 deletions
28
kernel/src/mm/pmm.h
Executable file
28
kernel/src/mm/pmm.h
Executable file
|
@ -0,0 +1,28 @@
|
|||
#ifndef PMM_H
|
||||
#define PMM_H
|
||||
|
||||
#include <stdint.h>
|
||||
#define PMM_PAGE_SIZE 4096
|
||||
|
||||
typedef struct pmm_stack
|
||||
{
|
||||
uintptr_t *pages;
|
||||
uint64_t idx;
|
||||
uint64_t max;
|
||||
} pmm_stack_t;
|
||||
|
||||
extern uint64_t hhdm_offset;
|
||||
|
||||
#define DIV_ROUND_UP(x, y) (((uint64_t)(x) + ((uint64_t)(y) - 1)) / (uint64_t)(y))
|
||||
#define ALIGN_UP(x, y) (DIV_ROUND_UP(x, y) * (uint64_t)(y))
|
||||
#define ALIGN_DOWN(x, y) (((uint64_t)(x) / (uint64_t)(y)) * (uint64_t)(y))
|
||||
|
||||
#define HIGHER_HALF(ptr) ((void *)((uint64_t)ptr) + hhdm_offset)
|
||||
#define PHYSICAL(ptr) ((void *)((uint64_t)ptr) - hhdm_offset)
|
||||
|
||||
int pmm_init();
|
||||
void *pmm_request_page();
|
||||
void pmm_free_page(void *ptr);
|
||||
void pmm_dump();
|
||||
|
||||
#endif // PMM_H
|
Loading…
Add table
Add a link
Reference in a new issue