summaryrefslogtreecommitdiff
path: root/src/kernel/mem/alloc.h
blob: 14c43613be789ee333c0657fbeb8d730e1aa37c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#pragma once
#include <kernel/arch/generic.h>
#include <kernel/main.h>
#include <stddef.h>

extern struct malloc_hdr *malloc_last;

void mem_init(struct kmain_info *);
void mem_debugprint(void);

// allocates `pages` consecutive pages
// TODO deprecate
void *page_alloc(size_t pages);
// zeroes the allocated pages
void *page_zalloc(size_t pages);

// frees `pages` consecutive pages starting from *first
void page_free(void *first, size_t pages);

void kmalloc_sanity(const void *addr);
void *kmalloc(size_t len);
void kfree(void *ptr);