From 7b974c7088ac932fa4c234fed279e9908c6089a1 Mon Sep 17 00:00:00 2001 From: chaoskagami Date: Thu, 4 Aug 2016 01:10:33 -0400 Subject: [PATCH] Fix a missed bit (ugh) --- include/common.h | 2 +- source/std/allocator.c | 10 ++++------ source/std/fs.c | 1 - 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/include/common.h b/include/common.h index d120c7d..4f2e521 100644 --- a/include/common.h +++ b/include/common.h @@ -15,7 +15,7 @@ #include #include -#include +#include #include #include diff --git a/source/std/allocator.c b/source/std/allocator.c index 0479be3..7cda16e 100644 --- a/source/std/allocator.c +++ b/source/std/allocator.c @@ -4,19 +4,17 @@ #define SALLOC_ALIGN 16 struct alloc_info* first_mem = NULL; +static uint32_t *heap_end = NULL; +extern uint32_t __end__; /* Defined by the linker */ -void* sbrk(int incr) { - extern uint32_t __end__; /* Defined by the linker */ - static uint32_t *heap_end; +void* sbrk(size_t incr) { uint32_t *prev_heap_end; - if (heap_end == 0) { + if (heap_end == NULL) { heap_end = &__end__; } prev_heap_end = heap_end; - if (heap_end + incr > stack_ptr) - abort("Heap overflowed!\n"); heap_end += incr; return (void*) prev_heap_end; diff --git a/source/std/fs.c b/source/std/fs.c index 9ef5e1e..aa654d7 100644 --- a/source/std/fs.c +++ b/source/std/fs.c @@ -1,7 +1,6 @@ #include #include #include -#include // ctr_nand_crypto_interface ctr_io; // ctr_nand_crypto_interface twl_io; -- 2.39.5