Add base code

This commit is contained in:
2024-11-02 19:07:52 +01:00
parent 9c1b7d0321
commit 6587c8498f
10 changed files with 184 additions and 0 deletions

14
os/alloc.c Normal file
View 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;
}