mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
cpu: hook plugin vcpu events
Signed-off-by: Emilio G. Cota <cota@braap.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
This commit is contained in:
parent
c36f7a642c
commit
30865f3168
3 changed files with 14 additions and 0 deletions
10
cpus.c
10
cpus.c
|
@ -45,6 +45,7 @@
|
|||
#include "exec/exec-all.h"
|
||||
|
||||
#include "qemu/thread.h"
|
||||
#include "qemu/plugin.h"
|
||||
#include "sysemu/cpus.h"
|
||||
#include "sysemu/qtest.h"
|
||||
#include "qemu/main-loop.h"
|
||||
|
@ -1264,9 +1265,18 @@ static void qemu_tcg_rr_wait_io_event(void)
|
|||
|
||||
static void qemu_wait_io_event(CPUState *cpu)
|
||||
{
|
||||
bool slept = false;
|
||||
|
||||
while (cpu_thread_is_idle(cpu)) {
|
||||
if (!slept) {
|
||||
slept = true;
|
||||
qemu_plugin_vcpu_idle_cb(cpu);
|
||||
}
|
||||
qemu_cond_wait(cpu->halt_cond, &qemu_global_mutex);
|
||||
}
|
||||
if (slept) {
|
||||
qemu_plugin_vcpu_resume_cb(cpu);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
/* Eat dummy APC queued by qemu_cpu_kick_thread. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue