summaryrefslogtreecommitdiff
path: root/src/kernel/mem.c
blob: f383e8b5c58cc61675c572a71b407b0b3e63f85b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <arch/generic.h>
#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
}