aboutsummaryrefslogtreecommitdiff
path: root/m68k-semi.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2011-04-18 16:34:26 +0100
committerRiku Voipio <riku.voipio@iki.fi>2011-06-21 20:29:01 +0300
commit5382a012e8ce7cf5ea612d291286be827574c181 (patch)
tree38e6f625a2313694b7c0fd3c1a8cbfc75ea7a4d0 /m68k-semi.c
parent206ae74aea5593f5f5bad769a6b4f101f17bc6fd (diff)
downloadqemu-5382a012e8ce7cf5ea612d291286be827574c181.zip
qemu-5382a012e8ce7cf5ea612d291286be827574c181.tar.gz
qemu-5382a012e8ce7cf5ea612d291286be827574c181.tar.bz2
m68k-semi.c: Use correct check for failure of do_brk()
In the m68k semihosting implementation of HOSTED_INIT_SIM, 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 <peter.maydell@linaro.org> Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
Diffstat (limited to 'm68k-semi.c')
-rw-r--r--m68k-semi.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/m68k-semi.c b/m68k-semi.c
index 0371089..7fde10e 100644
--- a/m68k-semi.c
+++ b/m68k-semi.c
@@ -370,7 +370,7 @@ void do_m68k_semihosting(CPUM68KState *env, int nr)
TaskState *ts = env->opaque;
/* Allocate the heap using sbrk. */
if (!ts->heap_limit) {
- long ret;
+ abi_ulong ret;
uint32_t size;
uint32_t base;
@@ -379,8 +379,9 @@ void do_m68k_semihosting(CPUM68KState *env, int nr)
/* Try a big heap, and reduce the size if that fails. */
for (;;) {
ret = do_brk(base + size);
- if (ret != -1)
+ if (ret >= (base + size)) {
break;
+ }
size >>= 1;
}
ts->heap_limit = base + size;