X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=m68k-semi.c;h=7fde10e8f36254685058e153c93a39c4d4a28a94;hb=46daff13c854769bfa8c51e77719325ea0f47b1b;hp=d16bc671c6c7f39f92a31a79f47cbf26523a4c04;hpb=0e1c9c54afb9ce6be2339923ced025a0d2a541ea;p=qemu.git diff --git a/m68k-semi.c b/m68k-semi.c index d16bc671c..7fde10e8f 100644 --- a/m68k-semi.c +++ b/m68k-semi.c @@ -33,10 +33,10 @@ #define SEMIHOSTING_HEAP_SIZE (128 * 1024 * 1024) #else #include "qemu-common.h" -#include "sysemu.h" #include "gdbstub.h" #include "softmmu-semi.h" #endif +#include "sysemu.h" #define HOSTED_EXIT 0 #define HOSTED_INIT_SIM 1 @@ -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;