diff options
author | Brett Weiland <brett_weiland@bpcspace.com> | 2021-09-21 10:50:33 -0500 |
---|---|---|
committer | Brett Weiland <brett_weiland@bpcspace.com> | 2021-09-21 10:50:33 -0500 |
commit | cf7cd8be60c254b44b444c97dcb238d7cf3afd4c (patch) | |
tree | e86fe62827f4dbc5f1b6b74cf7bd89c78e797711 /src/kernel/heap.c | |
parent | 907fb823bf8329066b1bcff60ea6c4faa54a3642 (diff) |
palloc smp safe (testing required, NOT pfree)
Diffstat (limited to 'src/kernel/heap.c')
-rw-r--r-- | src/kernel/heap.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/kernel/heap.c b/src/kernel/heap.c index db6392f..e2dcbc7 100644 --- a/src/kernel/heap.c +++ b/src/kernel/heap.c @@ -26,10 +26,11 @@ typedef struct __attribute__((packed)) heap_chunk { - unsigned int free:1; unsigned int size:4; //will use with flags later if needed unsigned int lsize:4; - unsigned long reserved:55; + unsigned int free:1; + unsigned int mutex:1; + unsigned long reserved:54; struct heap_chunk *fd; struct heap_chunk *bk; } chunk; @@ -203,6 +204,7 @@ void *malloc(size_t size) { return (void *)on_chunk + sizeof(chunk); } + void *realloc(void *old_chunk, size_t size) { void *new_chunk = malloc(size); memcpy(new_chunk, old_chunk, CHUNK_SIZE_FROM_INDEX(((chunk *)(old_chunk-24))->size)); |