Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
From c54f1e4b1f3678397e8d7b39d5666b40ac51be2a Mon Sep 17 00:00:00 2001
From: iNvEr7 <iNvEr7@protonmail.com>
Date: Mon, 22 Feb 2021 23:42:31 -0800
Subject: [PATCH] fix: semihosting heapinfo return address
---
hw/semihosting/arm-compat-semi.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/hw/semihosting/arm-compat-semi.c b/hw/semihosting/arm-compat-semi.c
index 23c6e3edcb..4dc7573e86 100644
--- a/hw/semihosting/arm-compat-semi.c
+++ b/hw/semihosting/arm-compat-semi.c
@@ -1232,7 +1232,16 @@ target_ulong do_common_semihosting(CPUState *cs)
for (i = 0; i < ARRAY_SIZE(retvals); i++) {
bool fail;
- fail = SET_ARG(i, retvals[i]);
+#ifdef TARGET_ARM
+ if (is_a64(env)) {
+ fail = put_user_u64(retvals[i], arg0 + i * 8);
+ } else {
+ fail = put_user_u32(retvals[i], arg0 + i * 4);
+ }
+#endif
+#ifdef TARGET_RISCV
+ fail = put_user_utl(retvals[i], arg0 + i * sizeof(target_ulong));
+#endif
if (fail) {
/* Couldn't write back to argument block */
--
2.27.0.windows.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment