-
Notifications
You must be signed in to change notification settings - Fork 1
/
heap.c
54 lines (37 loc) · 739 Bytes
/
heap.c
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
40
41
42
43
44
45
46
47
48
49
50
51
/* (CC-BY-NC-SA) ROBIN KRENS - ROBIN @ ROBINKRENS.NL
*
* $LOG$
* 2019/10/20 - ROBIN KRENS
* Initial version
*
* $DESCRIPTION$
*
* kalloc();
* kfree();
*
*/
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <lib/pool.h>
#define BLOCKSIZE 0x10
#define BLOCKS 10
/* #define KHEAP_SIZE 0x100 SEE LINK.LD */
static mem_pool_t kheap_pool;
void kheap_init() {
extern unsigned char * _beginofheap;
pool_init(&kheap_pool, BLOCKSIZE, BLOCKS, (unsigned char *) &_beginofheap);
//kalloc = &alloc;
}
void * kalloc(void * s) {
return alloc(s);
}
void kfree(void * s, void * p) {
free(s, p);
}
void kheap_info(void *s) {
heap_info(s);
}
void * get_kheap() {
return (void *) &kheap_pool;
}