mem: implement buddy allocator
This commit is contained in:
parent
fe93196a01
commit
4f4af0946d
6 changed files with 245 additions and 14 deletions
|
|
@ -9,6 +9,7 @@
|
|||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <kernel/bitwise.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,29 @@ struct cr3 {
|
|||
};
|
||||
};
|
||||
|
||||
struct mem_region {
|
||||
paddr_t base;
|
||||
size_t len;
|
||||
};
|
||||
|
||||
struct mem_region_header {
|
||||
paddr_t usable_base;
|
||||
size_t usable_len;
|
||||
|
||||
struct buddy_free_list *flist;
|
||||
|
||||
size_t bitmap_len;
|
||||
char bitmap[];
|
||||
};
|
||||
|
||||
struct buddy_free_list {
|
||||
size_t len;
|
||||
size_t depth;
|
||||
|
||||
struct buddy_free_list *next;
|
||||
struct buddy_free_list *prev;
|
||||
};
|
||||
|
||||
extern uintptr_t __data_end;
|
||||
extern uintptr_t __bss_start;
|
||||
extern uintptr_t __bss_end;
|
||||
|
|
|
|||
Loading…
Reference in a new issue