diff options
author | Alexander Fedotov <alfedotov@gmail.com> | 2019-08-02 07:33:44 -0500 |
---|---|---|
committer | Richard Earnshaw <Richard.Earnshaw@arm.com> | 2019-08-05 13:00:53 +0100 |
commit | dfffe683038357d106893ef1ba30462b31e7b589 (patch) | |
tree | 1f567eeb4bd7b78b543d59d4862f40bc45d11764 /libgloss/arm | |
parent | 37e80fbb1c329ab39d154a78fa6d99f28d220dfe (diff) | |
download | newlib-dfffe683038357d106893ef1ba30462b31e7b589.zip newlib-dfffe683038357d106893ef1ba30462b31e7b589.tar.gz newlib-dfffe683038357d106893ef1ba30462b31e7b589.tar.bz2 |
Align libgloss/arm and libc/sys/arm sources: HeapInfo and __heap_limit
Applied changes from commit 8d98f95:
* arm/crt0.S: Initialise __heap_limit when ARM_RDI_MONITOR is defined.
* arm/syscalls.c: define __heap_limit global symbol.
* arm/syscalls.c (_sbrk): Honour __heap_limit.
Applied changes from commit 8d98f95:
Fixed semihosting for ARM when heapinfo not provided by debugger
Diffstat (limited to 'libgloss/arm')
-rw-r--r-- | libgloss/arm/syscalls.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libgloss/arm/syscalls.c b/libgloss/arm/syscalls.c index dacd1a9..3605e0f 100644 --- a/libgloss/arm/syscalls.c +++ b/libgloss/arm/syscalls.c @@ -707,15 +707,15 @@ uint __heap_limit = 0xcafedead; void * __attribute__((weak)) _sbrk (ptrdiff_t incr) { - extern char end asm ("end"); /* Defined by the linker. */ + extern char end asm ("end"); /* Defined by the linker. */ static char * heap_end; - char * prev_heap_end; + char * prev_heap_end; if (heap_end == NULL) heap_end = & end; - + prev_heap_end = heap_end; - + if ((heap_end + incr > stack_ptr) /* Honour heap limit if it's valid. */ || (__heap_limit != 0xcafedead && heap_end + incr > (char *)__heap_limit)) @@ -726,14 +726,14 @@ _sbrk (ptrdiff_t incr) extern void abort (void); _write (1, "_sbrk: Heap and stack collision\n", 32); - + abort (); #else errno = ENOMEM; return (void *) -1; #endif } - + heap_end += incr; return (void *) prev_heap_end; |