Skip to content

Instantly share code, notes, and snippets.

@iNvEr7
Created March 6, 2021 08:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iNvEr7/f99fe1219a30480ba692762c98fde829 to your computer and use it in GitHub Desktop.
Save iNvEr7/f99fe1219a30480ba692762c98fde829 to your computer and use it in GitHub Desktop.
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