diff options
author | Alexander Fedotov <alfedotov@gmail.com> | 2017-10-11 14:52:20 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2017-10-24 18:27:51 +0300 |
commit | f6ef29c48fcb87b042f067b0815bcada64e6dd10 (patch) | |
tree | 53ee2d61e84ae29f2ee9f36960469de93e6ef572 /libgloss/aarch64/syscalls.c | |
parent | 56e494c074ef1c790e455f10c37337c6009c814c (diff) |
Fixed semihosting for AArch64 when heapinfo parameters are not provided by debugger
Diffstat (limited to 'libgloss/aarch64/syscalls.c')
-rw-r--r-- | libgloss/aarch64/syscalls.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libgloss/aarch64/syscalls.c b/libgloss/aarch64/syscalls.c index af206a1d4..4de4e0dcc 100644 --- a/libgloss/aarch64/syscalls.c +++ b/libgloss/aarch64/syscalls.c @@ -625,6 +625,9 @@ _getpid (int n __attribute__ ((unused))) return 1; } +/* Heap limit returned from SYS_HEAPINFO Angel semihost call. */ +ulong __heap_limit __attribute__ ((aligned (8))) = 0xcafedead; + caddr_t _sbrk (int incr) { @@ -637,7 +640,9 @@ _sbrk (int incr) prev_heap_end = heap_end; - if (heap_end + incr > stack_ptr) + if ((heap_end + incr > stack_ptr) + /* Honour heap limit if it's valid. */ + || ((__heap_limit != 0xcafedead) && (heap_end + incr > __heap_limit))) { /* Some of the libstdc++-v3 tests rely upon detecting out of memory errors, so do not abort here. */ |