[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 05/18] arm-semi.c: Use correct check for failure of
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PATCH 05/18] arm-semi.c: Use correct check for failure of do_brk() |
Date: |
Mon, 20 Jun 2011 19:20:10 +0300 |
From: Peter Maydell <address@hidden>
In the ARM semihosting implementation of SYS_HEAPINFO, use the correct
check for whether do_brk() has failed -- it does not return -1 but the
previous value of the break limit.
Signed-off-by: Peter Maydell <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
arm-semi.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/arm-semi.c b/arm-semi.c
index e9e6f89..5a62d03 100644
--- a/arm-semi.c
+++ b/arm-semi.c
@@ -440,15 +440,16 @@ uint32_t do_arm_semihosting(CPUState *env)
/* Some C libraries assume the heap immediately follows .bss, so
allocate it using sbrk. */
if (!ts->heap_limit) {
- long ret;
+ abi_ulong ret;
ts->heap_base = do_brk(0);
limit = ts->heap_base + ARM_ANGEL_HEAP_SIZE;
/* Try a big heap, and reduce the size if that fails. */
for (;;) {
ret = do_brk(limit);
- if (ret != -1)
+ if (ret >= limit) {
break;
+ }
limit = (ts->heap_base >> 1) + (limit >> 1);
}
ts->heap_limit = limit;
--
1.7.4.1
- [Qemu-devel] [PATCH 00/18] pending linux-user patches, riku . voipio, 2011/06/20
- [Qemu-devel] [PATCH 01/18] Don't translate pointer when in restore_sigcontext, riku . voipio, 2011/06/20
- [Qemu-devel] [PATCH 05/18] arm-semi.c: Use correct check for failure of do_brk(),
riku . voipio <=
- [Qemu-devel] [PATCH 04/18] linux-user: Don't use MAP_FIXED in do_brk(), riku . voipio, 2011/06/20
- [Qemu-devel] [PATCH 02/18] linux-user: Fix the load of ELF files that have no "useful" symbol, riku . voipio, 2011/06/20
- [Qemu-devel] [PATCH 07/18] linux-user: Fix the computation of the requested heap size, riku . voipio, 2011/06/20
- [Qemu-devel] [PATCH 03/18] linux-user: Handle images where lowest vaddr is not page aligned, riku . voipio, 2011/06/20
- [Qemu-devel] [PATCH 06/18] m68k-semi.c: Use correct check for failure of do_brk(), riku . voipio, 2011/06/20
- [Qemu-devel] [PATCH 08/18] linux-user: add pselect6 syscall support, riku . voipio, 2011/06/20
- [Qemu-devel] [PATCH 09/18] linux-user: Define AT_RANDOM to support target stack protection mechanism., riku . voipio, 2011/06/20