Add base code
This commit is contained in:
14
os/alloc.c
Normal file
14
os/alloc.c
Normal file
@@ -0,0 +1,14 @@
|
||||
#include "alloc.h"
|
||||
#include "stdint.h"
|
||||
|
||||
void* *first_mem_avail = (void*) 0x20000000;
|
||||
|
||||
void init_allocator() {
|
||||
*first_mem_avail = (void*) 0x20000000 +sizeof(void*);
|
||||
}
|
||||
|
||||
void* malloc(size_t size) {
|
||||
void* block = *first_mem_avail;
|
||||
*first_mem_avail += size;
|
||||
return block;
|
||||
}
|
||||
Reference in New Issue
Block a user