Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2015-02-17 12:30:52 +0300
committerCorinna Vinschen <corinna@vinschen.de>2015-02-17 12:30:52 +0300
commit8d98f956cc398d086794e19051c3380d599022da (patch)
treeaf3db37f2ffd2e68c9e6587a58551dfbf14aaef3 /libgloss/arm
parent72ba8b107a891d6b4094f1fc74b548062dd2ead7 (diff)
* 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.
Diffstat (limited to 'libgloss/arm')
-rw-r--r--libgloss/arm/crt0.S5
-rw-r--r--libgloss/arm/syscalls.c7
2 files changed, 11 insertions, 1 deletions
diff --git a/libgloss/arm/crt0.S b/libgloss/arm/crt0.S
index cc1c37091..cb9021df3 100644
--- a/libgloss/arm/crt0.S
+++ b/libgloss/arm/crt0.S
@@ -123,6 +123,11 @@
#endif
ldr r0, .LC0 /* point at values read */
+ /* Set __heap_limit. */
+ ldr r1, [r0, #4]
+ ldr r2, =__heap_limit
+ str r1, [r2]
+
ldr r1, [r0, #0]
cmp r1, #0
bne .LC32
diff --git a/libgloss/arm/syscalls.c b/libgloss/arm/syscalls.c
index 54e3d74f0..0ccad215c 100644
--- a/libgloss/arm/syscalls.c
+++ b/libgloss/arm/syscalls.c
@@ -587,6 +587,9 @@ _getpid (int n __attribute__ ((unused)))
return 1;
}
+/* Heap limit returned from SYS_HEAPINFO Angel semihost call. */
+uint __heap_limit = 0xcafedead;
+
caddr_t __attribute__((weak))
_sbrk (int incr)
{
@@ -599,7 +602,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. */