[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 45/49] semihosting: Use console_out_gf for SYS_WRITEC
From: |
Richard Henderson |
Subject: |
[PATCH v3 45/49] semihosting: Use console_out_gf for SYS_WRITEC |
Date: |
Fri, 20 May 2022 17:03:56 -0700 |
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
semihosting/arm-compat-semi.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c
index 9230c69ff2..e24e9284c2 100644
--- a/semihosting/arm-compat-semi.c
+++ b/semihosting/arm-compat-semi.c
@@ -228,6 +228,15 @@ static void common_semi_cb(CPUState *cs, uint64_t ret, int
err)
common_semi_set_ret(cs, ret);
}
+/*
+ * Use 0xdeadbeef as the return value when there isn't a defined
+ * return value for the call.
+ */
+static void common_semi_dead_cb(CPUState *cs, uint64_t ret, int err)
+{
+ common_semi_set_ret(cs, 0xdeadbeef);
+}
+
/*
* SYS_READ and SYS_WRITE always return the number of bytes not read/written.
* There is no error condition, other than returning the original length.
@@ -329,8 +338,7 @@ static const uint8_t featurefile_data[] = {
* The specification always says that the "return register" either
* returns a specific value or is corrupted, so we don't need to
* report to our caller whether we are returning a value or trying to
- * leave the register unchanged. We use 0xdeadbeef as the return value
- * when there isn't a defined return value for the call.
+ * leave the register unchanged.
*/
void do_common_semihosting(CPUState *cs)
{
@@ -407,8 +415,12 @@ void do_common_semihosting(CPUState *cs)
break;
case TARGET_SYS_WRITEC:
- qemu_semihosting_console_outc(env, args);
- common_semi_set_ret(cs, 0xdeadbeef);
+ /*
+ * FIXME: the byte to be written is in a target_ulong slot,
+ * which means this is wrong for a big-endian guest.
+ */
+ semihost_sys_write_gf(cs, common_semi_dead_cb,
+ &console_out_gf, args, 1);
break;
case TARGET_SYS_WRITE0:
--
2.34.1
- Re: [PATCH v3 36/49] gdbstub: Widen gdb_syscall_complete_cb return value, (continued)
- [PATCH v3 03/49] semihosting: Improve condition for config.c and console.c, Richard Henderson, 2022/05/20
- [PATCH v3 23/49] semihosting: Split out semihost_sys_open, Richard Henderson, 2022/05/20
- [PATCH v3 40/49] semihosting: Cleanup chardev init, Richard Henderson, 2022/05/20
- [PATCH v3 42/49] semihosting: Add GuestFDConsole, Richard Henderson, 2022/05/20
- [PATCH v3 43/49] semihosting: Create qemu_semihosting_guestfd_init, Richard Henderson, 2022/05/20
- [PATCH v3 44/49] semihosting: Use console_in_gf for SYS_READC, Richard Henderson, 2022/05/20
- [PATCH v3 46/49] semihosting: Remove qemu_semihosting_console_outc, Richard Henderson, 2022/05/20
- [PATCH v3 41/49] semihosting: Create qemu_semihosting_console_write, Richard Henderson, 2022/05/20
- [PATCH v3 45/49] semihosting: Use console_out_gf for SYS_WRITEC,
Richard Henderson <=
- [PATCH v3 47/49] semihosting: Use console_out_gf for SYS_WRITE0, Richard Henderson, 2022/05/20
- [PATCH v3 49/49] semihosting: Create semihost_sys_poll_one, Richard Henderson, 2022/05/20
- [PATCH v3 48/49] semihosting: Remove qemu_semihosting_console_outs, Richard Henderson, 2022/05/20