diff --git a/sandbox/base/main.c b/sandbox/base/main.c index 795e768..18cc69b 100644 --- a/sandbox/base/main.c +++ b/sandbox/base/main.c @@ -1,6 +1,8 @@ #include #include +#include #include +#include #include #include #include @@ -22,6 +24,7 @@ static void *system_memory = NULL; int main(int argc, const char **argv) { + srand(time(NULL)); system_memory = mmap( NULL, MB_TO_BYTES(MEMORY_SIZE_MB), @@ -50,8 +53,13 @@ int main(int argc, const char **argv) memblock_reserve(0x30000, 0x40000); memblock_reserve(0x100000, 0x10000); - phys_addr_t alloc = memblock_alloc_phys(512); - printf("allocated 512 bytes at 0x%" PRIxPTR "\n", alloc); + for (int i = 0; i < 8; i++) { + int size = 512 + (rand() % 16384); + + phys_addr_t alloc = memblock_alloc_phys(size); + printf("allocated %d bytes at 0x%" PRIxPTR "\n", size, alloc); + } + printf("memory regions:\n");