mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-29 13:01:52 -06:00
qom: Add cpu_exec_enter and cpu_exec_exit hooks
In preparation for removing a bunch of ifdefs from cpu_exec. Cc: Andreas Färber <afaerber@suse.de> Signed-off-by: Richard Henderson <rth@twiddle.net> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-id: 1410626734-3804-2-git-send-email-rth@twiddle.net Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
1ba50f4ea0
commit
cffe7b3249
3 changed files with 11 additions and 9 deletions
|
@ -317,10 +317,7 @@ volatile sig_atomic_t exit_request;
|
||||||
int cpu_exec(CPUArchState *env)
|
int cpu_exec(CPUArchState *env)
|
||||||
{
|
{
|
||||||
CPUState *cpu = ENV_GET_CPU(env);
|
CPUState *cpu = ENV_GET_CPU(env);
|
||||||
#if !(defined(CONFIG_USER_ONLY) && \
|
|
||||||
(defined(TARGET_M68K) || defined(TARGET_PPC) || defined(TARGET_S390X)))
|
|
||||||
CPUClass *cc = CPU_GET_CLASS(cpu);
|
CPUClass *cc = CPU_GET_CLASS(cpu);
|
||||||
#endif
|
|
||||||
#ifdef TARGET_I386
|
#ifdef TARGET_I386
|
||||||
X86CPU *x86_cpu = X86_CPU(cpu);
|
X86CPU *x86_cpu = X86_CPU(cpu);
|
||||||
#endif
|
#endif
|
||||||
|
@ -382,9 +379,8 @@ int cpu_exec(CPUArchState *env)
|
||||||
#elif defined(TARGET_XTENSA)
|
#elif defined(TARGET_XTENSA)
|
||||||
#elif defined(TARGET_TRICORE)
|
#elif defined(TARGET_TRICORE)
|
||||||
/* XXXXX */
|
/* XXXXX */
|
||||||
#else
|
|
||||||
#error unsupported target CPU
|
|
||||||
#endif
|
#endif
|
||||||
|
cc->cpu_exec_enter(cpu);
|
||||||
cpu->exception_index = -1;
|
cpu->exception_index = -1;
|
||||||
|
|
||||||
/* Calculate difference between guest clock and host clock.
|
/* Calculate difference between guest clock and host clock.
|
||||||
|
@ -856,9 +852,8 @@ int cpu_exec(CPUArchState *env)
|
||||||
#elif defined(TARGET_S390X)
|
#elif defined(TARGET_S390X)
|
||||||
#elif defined(TARGET_XTENSA)
|
#elif defined(TARGET_XTENSA)
|
||||||
/* XXXXX */
|
/* XXXXX */
|
||||||
#else
|
|
||||||
#error unsupported target CPU
|
|
||||||
#endif
|
#endif
|
||||||
|
cc->cpu_exec_exit(cpu);
|
||||||
|
|
||||||
/* fail safe : never use current_cpu outside cpu_exec() */
|
/* fail safe : never use current_cpu outside cpu_exec() */
|
||||||
current_cpu = NULL;
|
current_cpu = NULL;
|
||||||
|
|
|
@ -99,6 +99,8 @@ struct TranslationBlock;
|
||||||
* @vmsd: State description for migration.
|
* @vmsd: State description for migration.
|
||||||
* @gdb_num_core_regs: Number of core registers accessible to GDB.
|
* @gdb_num_core_regs: Number of core registers accessible to GDB.
|
||||||
* @gdb_core_xml_file: File name for core registers GDB XML description.
|
* @gdb_core_xml_file: File name for core registers GDB XML description.
|
||||||
|
* @cpu_exec_enter: Callback for cpu_exec preparation.
|
||||||
|
* @cpu_exec_exit: Callback for cpu_exec cleanup.
|
||||||
*
|
*
|
||||||
* Represents a CPU family or model.
|
* Represents a CPU family or model.
|
||||||
*/
|
*/
|
||||||
|
@ -149,6 +151,9 @@ typedef struct CPUClass {
|
||||||
const struct VMStateDescription *vmsd;
|
const struct VMStateDescription *vmsd;
|
||||||
int gdb_num_core_regs;
|
int gdb_num_core_regs;
|
||||||
const char *gdb_core_xml_file;
|
const char *gdb_core_xml_file;
|
||||||
|
|
||||||
|
void (*cpu_exec_enter)(CPUState *cpu);
|
||||||
|
void (*cpu_exec_exit)(CPUState *cpu);
|
||||||
} CPUClass;
|
} CPUClass;
|
||||||
|
|
||||||
#ifdef HOST_WORDS_BIGENDIAN
|
#ifdef HOST_WORDS_BIGENDIAN
|
||||||
|
|
|
@ -202,7 +202,7 @@ static bool cpu_common_virtio_is_big_endian(CPUState *cpu)
|
||||||
return target_words_bigendian();
|
return target_words_bigendian();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cpu_common_debug_excp_handler(CPUState *cpu)
|
static void cpu_common_noop(CPUState *cpu)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,7 +344,9 @@ static void cpu_class_init(ObjectClass *klass, void *data)
|
||||||
k->gdb_read_register = cpu_common_gdb_read_register;
|
k->gdb_read_register = cpu_common_gdb_read_register;
|
||||||
k->gdb_write_register = cpu_common_gdb_write_register;
|
k->gdb_write_register = cpu_common_gdb_write_register;
|
||||||
k->virtio_is_big_endian = cpu_common_virtio_is_big_endian;
|
k->virtio_is_big_endian = cpu_common_virtio_is_big_endian;
|
||||||
k->debug_excp_handler = cpu_common_debug_excp_handler;
|
k->debug_excp_handler = cpu_common_noop;
|
||||||
|
k->cpu_exec_enter = cpu_common_noop;
|
||||||
|
k->cpu_exec_exit = cpu_common_noop;
|
||||||
dc->realize = cpu_common_realizefn;
|
dc->realize = cpu_common_realizefn;
|
||||||
/*
|
/*
|
||||||
* Reason: CPUs still need special care by board code: wiring up
|
* Reason: CPUs still need special care by board code: wiring up
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue