diff --git a/src/kernel/memory/malloc.h b/src/kernel/memory/malloc.h index 6ddfa08..eb4ccb9 100644 --- a/src/kernel/memory/malloc.h +++ b/src/kernel/memory/malloc.h @@ -39,7 +39,7 @@ AllocationData allocationData; extern void *_malloc(void *, uintptr_t); -void *malloc(uint32_t size) { _malloc(&allocationData, size); } +void *malloc(uint32_t size) { return _malloc(&allocationData, size); } #else extern void *malloc(uint32_t size); diff --git a/src/kernel/memory/malloc.h b/src/kernel/memory/malloc.h index 6ddfa08..eb4ccb9 100644 --- a/src/kernel/memory/malloc.h +++ b/src/kernel/memory/malloc.h @@ -39,7 +39,7 @@ AllocationData allocationData; extern void *_malloc(void *, uintptr_t); -void *malloc(uint32_t size) { _malloc(&allocationData, size); } +void *malloc(uint32_t size) { return _malloc(&allocationData, size); } #else extern void *malloc(uint32_t size); diff --git a/src/userland/crashTest/main.c b/src/userland/crashTest/main.c index 262be03..834c6a7 100644 --- a/src/userland/crashTest/main.c +++ b/src/userland/crashTest/main.c @@ -1,6 +1,10 @@ -#define ALLOC_MAIN #include +extern AllocationData allocationData[]; + +extern void *_malloc(void *, uintptr_t); +void *malloc(uint32_t size) { return _malloc(&allocationData, size); } + void testFunction() { printf("0/0 = %i\n", 0 / 0); } int32_t main() { diff --git a/src/kernel/memory/malloc.h b/src/kernel/memory/malloc.h index 6ddfa08..eb4ccb9 100644 --- a/src/kernel/memory/malloc.h +++ b/src/kernel/memory/malloc.h @@ -39,7 +39,7 @@ AllocationData allocationData; extern void *_malloc(void *, uintptr_t); -void *malloc(uint32_t size) { _malloc(&allocationData, size); } +void *malloc(uint32_t size) { return _malloc(&allocationData, size); } #else extern void *malloc(uint32_t size); diff --git a/src/userland/crashTest/main.c b/src/userland/crashTest/main.c index 262be03..834c6a7 100644 --- a/src/userland/crashTest/main.c +++ b/src/userland/crashTest/main.c @@ -1,6 +1,10 @@ -#define ALLOC_MAIN #include +extern AllocationData allocationData[]; + +extern void *_malloc(void *, uintptr_t); +void *malloc(uint32_t size) { return _malloc(&allocationData, size); } + void testFunction() { printf("0/0 = %i\n", 0 / 0); } int32_t main() { diff --git a/src/userland/link.ld b/src/userland/link.ld index d0fdcd5..0fe5e27 100644 --- a/src/userland/link.ld +++ b/src/userland/link.ld @@ -19,6 +19,9 @@ .bss : { *(.bss) + . = ALIGN(4); + allocationData = .; + . += 0x1000 * 12; } . = 0xFF000000;