diff options
author | Andreas Färber <afaerber@suse.de> | 2013-08-25 18:53:55 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2014-03-13 19:01:49 +0100 |
commit | 8c2e1b0093aa4a89548df47d969217d8b0dfd070 (patch) | |
tree | 16656127c1a0c6194b25f29bd54f612b9c1f8679 /include | |
parent | 1cf5ccbca8915277098727d900d52c495a711f88 (diff) | |
download | qemu-8c2e1b0093aa4a89548df47d969217d8b0dfd070.zip qemu-8c2e1b0093aa4a89548df47d969217d8b0dfd070.tar.gz qemu-8c2e1b0093aa4a89548df47d969217d8b0dfd070.tar.bz2 |
cpu: Turn cpu_has_work() into a CPUClass hook
Default to false.
Tidy variable naming and inline cast uses while at it.
Tested-by: Jia Liu <proljc@gmail.com> (or32)
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/qom/cpu.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/include/qom/cpu.h b/include/qom/cpu.h index d734be8..89d5dd1 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -70,6 +70,7 @@ struct TranslationBlock; * instantiatable CPU type. * @reset: Callback to reset the #CPUState to its initial state. * @reset_dump_flags: #CPUDumpFlags to use for reset logging. + * @has_work: Callback for checking if there is work to do. * @do_interrupt: Callback for interrupt handling. * @do_unassigned_access: Callback for unassigned access handling. * @memory_rw_debug: Callback for GDB memory access. @@ -99,6 +100,7 @@ typedef struct CPUClass { void (*reset)(CPUState *cpu); int reset_dump_flags; + bool (*has_work)(CPUState *cpu); void (*do_interrupt)(CPUState *cpu); CPUUnassignedAccess do_unassigned_access; int (*memory_rw_debug)(CPUState *cpu, vaddr addr, @@ -348,14 +350,20 @@ void cpu_reset(CPUState *cpu); ObjectClass *cpu_class_by_name(const char *typename, const char *cpu_model); /** - * qemu_cpu_has_work: + * cpu_has_work: * @cpu: The vCPU to check. * * Checks whether the CPU has work to do. * * Returns: %true if the CPU has work, %false otherwise. */ -bool qemu_cpu_has_work(CPUState *cpu); +static inline bool cpu_has_work(CPUState *cpu) +{ + CPUClass *cc = CPU_GET_CLASS(cpu); + + g_assert(cc->has_work); + return cc->has_work(cpu); +} /** * qemu_cpu_is_self: |