diff options
author | Richard Henderson | 2022-05-01 21:31:08 +0200 |
---|---|---|
committer | Richard Henderson | 2022-06-28 01:05:52 +0200 |
commit | e7fb6f320548c1b0c25d291466a0249ee80d91b6 (patch) | |
tree | 418c8dc3bae7cc3dfcb21b749ed5fcd5a9f60fe5 /semihosting/arm-compat-semi.c | |
parent | semihosting: Pass CPUState to qemu_semihosting_console_inc (diff) | |
download | qemu-e7fb6f320548c1b0c25d291466a0249ee80d91b6.tar.gz qemu-e7fb6f320548c1b0c25d291466a0249ee80d91b6.tar.xz qemu-e7fb6f320548c1b0c25d291466a0249ee80d91b6.zip |
semihosting: Expand qemu_semihosting_console_inc to read
Allow more than one character to be read at one time.
Will be used by m68k and nios2 semihosting for stdio.
Reviewed-by: Luc Michel <lmichel@kalray.eu>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'semihosting/arm-compat-semi.c')
-rw-r--r-- | semihosting/arm-compat-semi.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c index 40f3730778..fdb143ace8 100644 --- a/semihosting/arm-compat-semi.c +++ b/semihosting/arm-compat-semi.c @@ -428,8 +428,15 @@ void do_common_semihosting(CPUState *cs) break; case TARGET_SYS_READC: - ret = qemu_semihosting_console_inc(cs); - common_semi_set_ret(cs, ret); + { + uint8_t ch; + int ret = qemu_semihosting_console_read(cs, &ch, 1); + if (ret == 1) { + common_semi_cb(cs, ch, 0); + } else { + common_semi_cb(cs, -1, EIO); + } + } break; case TARGET_SYS_ISERROR: |