blob: 08eb285d24e8890d52def268cd9fc2ec36be1006 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
#include <kernel/mem.h>
extern void *_kernel_end;
static void *highest_page;
void mem_init() {
highest_page = &_kernel_end;
}
void *page_alloc(size_t pages) {
void *bottom = highest_page;
highest_page += pages * PAGE_SIZE;
return bottom;
}
// frees `pages` consecutive pages starting from *first
void page_free(void *first, size_t pages) {
// not implemented
}
|