diff options
Diffstat (limited to 'libpsx/src/memory.c')
| -rw-r--r-- | libpsx/src/memory.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libpsx/src/memory.c b/libpsx/src/memory.c index 9b18556..1d0e6de 100644 --- a/libpsx/src/memory.c +++ b/libpsx/src/memory.c @@ -12,6 +12,7 @@ extern int __bss_start[]; extern int __bss_end[]; static unsigned int first_free_page; +static int init; // 1K granularity and "pages", so more allocations which are small can be done @@ -22,7 +23,7 @@ static unsigned int alloc_size[2048]; // 0x80000000 - 0x8000FFFF RAM used by the BIOS // 0x80010000 - 0x801FFFFF Program memory -void malloc_setup() +static void malloc_setup() { int x; @@ -53,6 +54,14 @@ void malloc_setup() void *malloc(size_t size) { + if (!init) + { + // Setup memory allocation functions + malloc_setup(); + dprintf("Finished setting up memory allocation functions.\n"); + init = 1; + } + dprintf("malloc(%d)\n", size); int x, y; |
