mirror of https://github.com/proxmox/mirror_qemu
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>master
parent
206ae74aea
commit
5382a012e8
|
@ -370,7 +370,7 @@ void do_m68k_semihosting(CPUM68KState *env, int nr)
|
||||||
TaskState *ts = env->opaque;
|
TaskState *ts = env->opaque;
|
||||||
/* Allocate the heap using sbrk. */
|
/* Allocate the heap using sbrk. */
|
||||||
if (!ts->heap_limit) {
|
if (!ts->heap_limit) {
|
||||||
long ret;
|
abi_ulong ret;
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
uint32_t base;
|
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. */
|
/* Try a big heap, and reduce the size if that fails. */
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ret = do_brk(base + size);
|
ret = do_brk(base + size);
|
||||||
if (ret != -1)
|
if (ret >= (base + size)) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
size >>= 1;
|
size >>= 1;
|
||||||
}
|
}
|
||||||
ts->heap_limit = base + size;
|
ts->heap_limit = base + size;
|
||||||
|
|
Loading…
Reference in New Issue