Memory Zones

First draft of memory zone functionality. Can create a zone and allocate
you memory from the zone. Also has the ability to clear zones and to
free. There is no way yet to free anything that has been allocated on
the zones.
This commit is contained in:
2024-02-07 18:25:13 -05:00
parent 6f32314daa
commit 1448d3336b
7 changed files with 128 additions and 9 deletions

View File

@@ -1,7 +1,30 @@
#include <test.h>
#include <defines.h>
#include <memory/zone.h>
#include <stdio.h>
int main() {
hello_quantum();
printf("Size of i16: %i\n", sizeof(i16));
printf("Size of u16: %i\n", sizeof(u16));
printf("Size of i32: %i\n", sizeof(i32));
printf("Size of u32: %i\n", sizeof(u32));
printf("Size of i64: %i\n", sizeof(i64));
printf("Size of u64: %i\n", sizeof(u64));
printf("Size of f32: %i\n", sizeof(f32));
printf("Size of f64: %i\n", sizeof(f64));
printf("\nCreating new zone 4K in size...\n");
Zone *test_zone = zoneCreate(4096);
void *test_alloc = zoneAlloc(test_zone, 4);
void *test_alloc2 = zoneAlloc(test_zone, 4);
printf("Address of test_zone: %p\n", (void *)test_zone);
printf("Address of test_alloc: %p\n", test_alloc);
printf("Address of test_alloc2: %p\n", test_alloc2);
zoneClear(test_zone);
zoneDestroy(test_zone);
return 0;
}