bsd-user, linux-user: introduce qemu_process_cpu_events

Add a user-mode emulation version of the function.  More will be
added later, for now it is just process_queued_cpu_work.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini
2025-09-17 19:00:56 +02:00
parent 871de7078f
commit 758e5de501
25 changed files with 36 additions and 23 deletions
+5
View File
@@ -52,6 +52,11 @@ void qemu_cpu_kick(CPUState *cpu)
tcg_kick_vcpu_thread(cpu);
}
void qemu_process_cpu_events(CPUState *cpu)
{
process_queued_cpu_work(cpu);
}
/*
* Adjust the pc to pass to cpu_restore_state; return the memop type.
*/
+1 -1
View File
@@ -54,7 +54,7 @@ static inline G_NORETURN void target_cpu_loop(CPUARMState *env)
cpu_exec_start(cs);
trapnr = cpu_exec(cs);
cpu_exec_end(cs);
process_queued_cpu_work(cs);
qemu_process_cpu_events(cs);
switch (trapnr) {
case EXCP_SWI:
+1 -1
View File
@@ -46,7 +46,7 @@ static inline G_NORETURN void target_cpu_loop(CPUARMState *env)
cpu_exec_start(cs);
trapnr = cpu_exec(cs);
cpu_exec_end(cs);
process_queued_cpu_work(cs);
qemu_process_cpu_events(cs);
switch (trapnr) {
case EXCP_UDEF:
case EXCP_NOCP:
+1 -1
View File
@@ -113,7 +113,7 @@ static inline G_NORETURN void target_cpu_loop(CPUX86State *env)
cpu_exec_start(cs);
trapnr = cpu_exec(cs);
cpu_exec_end(cs);
process_queued_cpu_work(cs);
qemu_process_cpu_events(cs);
switch (trapnr) {
case 0x80: {
+1 -1
View File
@@ -49,7 +49,7 @@ static inline G_NORETURN void target_cpu_loop(CPURISCVState *env)
cpu_exec_start(cs);
trapnr = cpu_exec(cs);
cpu_exec_end(cs);
process_queued_cpu_work(cs);
qemu_process_cpu_events(cs);
signo = 0;
+1 -1
View File
@@ -121,7 +121,7 @@ static inline G_NORETURN void target_cpu_loop(CPUX86State *env)
cpu_exec_start(cs);
trapnr = cpu_exec(cs);
cpu_exec_end(cs);
process_queued_cpu_work(cs);
qemu_process_cpu_events(cs);
switch (trapnr) {
case EXCP_SYSCALL:
+9
View File
@@ -1145,6 +1145,15 @@ AddressSpace *cpu_get_address_space(CPUState *cpu, int asidx);
G_NORETURN void cpu_abort(CPUState *cpu, const char *fmt, ...)
G_GNUC_PRINTF(2, 3);
/**
* qemu_process_cpu_events:
* @cpu: CPU that left the execution loop
*
* Perform accelerator-independent work after the CPU has left
* the inner execution loop.
*/
void qemu_process_cpu_events(CPUState *cpu);
/* $(top_srcdir)/cpu.c */
void cpu_class_init_props(DeviceClass *dc);
void cpu_exec_class_post_init(CPUClass *cc);
-1
View File
@@ -18,7 +18,6 @@ bool cpu_thread_is_idle(CPUState *cpu);
bool all_cpu_threads_idle(void);
bool cpu_can_run(CPUState *cpu);
void qemu_process_cpu_events_common(CPUState *cpu);
void qemu_process_cpu_events(CPUState *cpu);
void cpu_thread_signal_created(CPUState *cpu);
void cpu_thread_signal_destroyed(CPUState *cpu);
void cpu_handle_guest_debug(CPUState *cpu);
+1 -1
View File
@@ -38,7 +38,7 @@ void cpu_loop(CPUARMState *env)
cpu_exec_start(cs);
trapnr = cpu_exec(cs);
cpu_exec_end(cs);
process_queued_cpu_work(cs);
qemu_process_cpu_events(cs);
switch (trapnr) {
case EXCP_SWI:
+1 -1
View File
@@ -35,7 +35,7 @@ void cpu_loop(CPUAlphaState *env)
cpu_exec_start(cs);
trapnr = cpu_exec(cs);
cpu_exec_end(cs);
process_queued_cpu_work(cs);
qemu_process_cpu_events(cs);
switch (trapnr) {
case EXCP_RESET:
+1 -1
View File
@@ -295,7 +295,7 @@ void cpu_loop(CPUARMState *env)
cpu_exec_start(cs);
trapnr = cpu_exec(cs);
cpu_exec_end(cs);
process_queued_cpu_work(cs);
qemu_process_cpu_events(cs);
switch(trapnr) {
case EXCP_UDEF:
+1 -1
View File
@@ -36,7 +36,7 @@ void cpu_loop(CPUHexagonState *env)
cpu_exec_start(cs);
trapnr = cpu_exec(cs);
cpu_exec_end(cs);
process_queued_cpu_work(cs);
qemu_process_cpu_events(cs);
switch (trapnr) {
case EXCP_INTERRUPT:
+1 -1
View File
@@ -119,7 +119,7 @@ void cpu_loop(CPUHPPAState *env)
cpu_exec_start(cs);
trapnr = cpu_exec(cs);
cpu_exec_end(cs);
process_queued_cpu_work(cs);
qemu_process_cpu_events(cs);
switch (trapnr) {
case EXCP_SYSCALL:
+1 -1
View File
@@ -214,7 +214,7 @@ void cpu_loop(CPUX86State *env)
cpu_exec_start(cs);
trapnr = cpu_exec(cs);
cpu_exec_end(cs);
process_queued_cpu_work(cs);
qemu_process_cpu_events(cs);
switch(trapnr) {
case 0x80:
+1 -1
View File
@@ -27,7 +27,7 @@ void cpu_loop(CPULoongArchState *env)
cpu_exec_start(cs);
trapnr = cpu_exec(cs);
cpu_exec_end(cs);
process_queued_cpu_work(cs);
qemu_process_cpu_events(cs);
switch (trapnr) {
case EXCP_INTERRUPT:
+1 -1
View File
@@ -33,7 +33,7 @@ void cpu_loop(CPUM68KState *env)
cpu_exec_start(cs);
trapnr = cpu_exec(cs);
cpu_exec_end(cs);
process_queued_cpu_work(cs);
qemu_process_cpu_events(cs);
switch(trapnr) {
case EXCP_ILLEGAL:
+1 -1
View File
@@ -32,7 +32,7 @@ void cpu_loop(CPUMBState *env)
cpu_exec_start(cs);
trapnr = cpu_exec(cs);
cpu_exec_end(cs);
process_queued_cpu_work(cs);
qemu_process_cpu_events(cs);
switch (trapnr) {
case EXCP_INTERRUPT:
+1 -1
View File
@@ -74,7 +74,7 @@ void cpu_loop(CPUMIPSState *env)
cpu_exec_start(cs);
trapnr = cpu_exec(cs);
cpu_exec_end(cs);
process_queued_cpu_work(cs);
qemu_process_cpu_events(cs);
switch(trapnr) {
case EXCP_SYSCALL:
+1 -1
View File
@@ -33,7 +33,7 @@ void cpu_loop(CPUOpenRISCState *env)
cpu_exec_start(cs);
trapnr = cpu_exec(cs);
cpu_exec_end(cs);
process_queued_cpu_work(cs);
qemu_process_cpu_events(cs);
switch (trapnr) {
case EXCP_SYSCALL:
+1 -1
View File
@@ -77,7 +77,7 @@ void cpu_loop(CPUPPCState *env)
cpu_exec_start(cs);
trapnr = cpu_exec(cs);
cpu_exec_end(cs);
process_queued_cpu_work(cs);
qemu_process_cpu_events(cs);
arch_interrupt = true;
switch (trapnr) {

Some files were not shown because too many files have changed in this diff Show More