aboutsummaryrefslogtreecommitdiff
path: root/include/kern/mem.h
blob: bc6c4e27624af1d13ab436ff277bd2a30bfd23b2 (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
#ifndef MEM_H_
#define MEM_H_

#include "arch.h"
#include <stddef.h>

void kalloc_init();

/* allocates memory on the head, which is stored in sram2 */
void* kalloc(size_t n);

/* Frees the memory allocated by kalloc. */
void kfree(void* mem);

#ifdef FOR_TESTING

void* debug_kalloc_get_next_ptr(void* ptr);

void* debug_kalloc_get_prev_ptr(void* ptr);

int debug_kalloc_assert_consistency(char* error, size_t len);

void debug_print_blocks();

int debug_is_heap_empty();

#endif


#endif