summaryrefslogtreecommitdiffstats
path: root/semihosting
diff options
context:
space:
mode:
authorRichard Henderson2022-05-01 21:21:19 +0200
committerRichard Henderson2022-06-28 01:05:52 +0200
commit3367d452b001e91547634756e32246610701df5c (patch)
treec1fdad55d16972979e481a1582a9d1faed743be3 /semihosting
parentsemihosting: Fix docs comment for qemu_semihosting_console_inc (diff)
downloadqemu-3367d452b001e91547634756e32246610701df5c.tar.gz
qemu-3367d452b001e91547634756e32246610701df5c.tar.xz
qemu-3367d452b001e91547634756e32246610701df5c.zip
semihosting: Pass CPUState to qemu_semihosting_console_inc
We don't need CPUArchState, and we do want the CPUState of the thread performing the operation -- use this instead of current_cpu. Reviewed-by: Luc Michel <lmichel@kalray.eu> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'semihosting')
-rw-r--r--semihosting/arm-compat-semi.c2
-rw-r--r--semihosting/console.c12
2 files changed, 7 insertions, 7 deletions
diff --git a/semihosting/arm-compat-semi.c b/semihosting/arm-compat-semi.c
index 1b0505987a..40f3730778 100644
--- a/semihosting/arm-compat-semi.c
+++ b/semihosting/arm-compat-semi.c
@@ -428,7 +428,7 @@ void do_common_semihosting(CPUState *cs)
break;
case TARGET_SYS_READC:
- ret = qemu_semihosting_console_inc(env);
+ ret = qemu_semihosting_console_inc(cs);
common_semi_set_ret(cs, ret);
break;
diff --git a/semihosting/console.c b/semihosting/console.c
index 4e49202b2a..17ece6bdca 100644
--- a/semihosting/console.c
+++ b/semihosting/console.c
@@ -144,17 +144,17 @@ static void console_read(void *opaque, const uint8_t *buf, int size)
c->sleeping_cpus = NULL;
}
-target_ulong qemu_semihosting_console_inc(CPUArchState *env)
+target_ulong qemu_semihosting_console_inc(CPUState *cs)
{
uint8_t ch;
SemihostingConsole *c = &console;
+
g_assert(qemu_mutex_iothread_locked());
- g_assert(current_cpu);
if (fifo8_is_empty(&c->fifo)) {
- c->sleeping_cpus = g_slist_prepend(c->sleeping_cpus, current_cpu);
- current_cpu->halted = 1;
- current_cpu->exception_index = EXCP_HALTED;
- cpu_loop_exit(current_cpu);
+ c->sleeping_cpus = g_slist_prepend(c->sleeping_cpus, cs);
+ cs->halted = 1;
+ cs->exception_index = EXCP_HALTED;
+ cpu_loop_exit(cs);
/* never returns */
}
ch = fifo8_pop(&c->fifo);