From: chaoskagami Date: Fri, 14 Oct 2016 08:17:39 +0000 (-0400) Subject: Revert a few changes that caused a severe regression, causing inability to firmlaunch. X-Git-Tag: v0.3.1~72 X-Git-Url: https://chaos.moe/g/?a=commitdiff_plain;h=d7df9971d0dcae8a1724d9af0c6d625260143250;p=corbenik%2Fcorbenik.git Revert a few changes that caused a severe regression, causing inability to firmlaunch. These commits are reverted (partially): "Fixup" da1a41cf95fc9aea198f621fc6fe2692870bb4f6 "Improve some documentation based on in-progress RE, zero-fill new program break (remind me not to rely on this)" 330cd376ccc71c89b0568ab3741ce56e2fa667f2 --- diff --git a/source/std/allocator.c b/source/std/allocator.c index 01f6bd7..4b21ed9 100644 --- a/source/std/allocator.c +++ b/source/std/allocator.c @@ -8,21 +8,18 @@ static uint32_t *heap_end = NULL; extern uint32_t __end__; /* Defined by the linker */ void* sbrk(size_t incr) { - uint32_t *prev_heap_end; + uint32_t *prev_heap_end; - if (heap_end == NULL) { - heap_end = &__end__; - } - - // FIXME - Make sure heap isn't leaking into stack here. That would be bad. - - prev_heap_end = heap_end; + if (heap_end == NULL) { + heap_end = &__end__; + } - heap_end += incr; + // FIXME - Make sure heap isn't leaking into stack here. That would be bad. - memset(prev_heap_end, 0, (uint32_t)heap_end - (uint32_t)prev_heap_end); // Clear heap. + prev_heap_end = heap_end; - return (void*) prev_heap_end; + heap_end += incr; + return (void*) prev_heap_end; } // This is an incredibly crappy and inefficient implementation of malloc/free nicked from stackoverflow.