summaryrefslogtreecommitdiffstats
path: root/memory/memory.c
blob: 2a0e8f2920e6093cb598eef4f73738fd41931df2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "memory.h"
#include "alloc/malloc.h"
#include "zone.h"
#include "bump.h"

heap_cache_t heap_cache;

void*
kmalloc(size_t width)
{
    return __malloc_impl(&heap_cache, width);
}

void*
krealloc(void *ptr, size_t width)
{
    return __realloc_impl(&heap_cache, ptr, width);
}

void
kfree(void *ptr)
{
    __free_impl(&heap_cache, ptr);
}

void
mm_setup_early(void)
{
    pm_zone_setup();
    vm_setup_early();
}

void
mm_setup(void)
{
    heap_cache = (heap_cache_t) { NULL, NULL };
    bump_setup();
    vm_setup();
}