Beginnings of vfs_initrd driver
diff --git a/src/kernel/alloc.c b/src/kernel/alloc.c
index c6e092c..0268928 100644
--- a/src/kernel/alloc.c
+++ b/src/kernel/alloc.c
@@ -269,3 +269,27 @@
return new;
}
}
+
+void test_allocator()
+{
+ int *one = malloc(sizeof(int));
+ int *two = malloc(sizeof(int));
+
+ *one = 1;
+ *two = 2;
+
+ int *array = malloc(sizeof(int[12]));
+
+ for (int i = 0; i < 12; i++)
+ array[i] = i;
+
+ kprintf("Allocated one, two, array[3] = %d, %d, %d\n", *one, *two,
+ array[3]);
+ kprintf("[%x, %x, %x]\n", one, two, array);
+
+ kprintf("Freeing two\n");
+ free(two);
+ int *four = malloc(sizeof(int));
+ *four = 4;
+ kprintf("Allocated four = %d (%x)\n", *four, four);
+}