Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
semihosting/arm-compat-semi.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c
index 23319552a31..550c8f3589a 100644
--- a/semihosting/arm-compat-semi.c
+++ b/semihosting/arm-compat-semi.c
@@ -501,10 +501,13 @@ void do_common_semihosting(CPUState *cs)
break;
case TARGET_SYS_ISERROR:
+ {
GET_ARG(0);
- common_semi_set_ret(cs, (target_long)arg0 < 0);
+ bool ret = is_64bit_semihosting(env) ?
+ (int64_t)arg0 < 0 : (int32_t)arg0 < 0;
+ common_semi_set_ret(cs, ret);
break;
-
+ }
case TARGET_SYS_ISTTY:
GET_ARG(0);
semihost_sys_isatty(cs, common_semi_istty_cb, arg0);
--
2.47.2