mirror of https://gitee.com/openkylin/qemu.git
tcg: make CPUClass.cpu_exec_* optional
This will let us simplify the code that initializes CPU class methods, when we move cpu_exec_*() to a separate struct. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Claudio Fontana <cfontana@suse.de> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20201212155530.23098-11-cfontana@suse.de> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
parent
035ba06c2e
commit
80c4750ba8
|
@ -240,14 +240,18 @@ static void cpu_exec_enter(CPUState *cpu)
|
||||||
{
|
{
|
||||||
CPUClass *cc = CPU_GET_CLASS(cpu);
|
CPUClass *cc = CPU_GET_CLASS(cpu);
|
||||||
|
|
||||||
cc->cpu_exec_enter(cpu);
|
if (cc->cpu_exec_enter) {
|
||||||
|
cc->cpu_exec_enter(cpu);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cpu_exec_exit(CPUState *cpu)
|
static void cpu_exec_exit(CPUState *cpu)
|
||||||
{
|
{
|
||||||
CPUClass *cc = CPU_GET_CLASS(cpu);
|
CPUClass *cc = CPU_GET_CLASS(cpu);
|
||||||
|
|
||||||
cc->cpu_exec_exit(cpu);
|
if (cc->cpu_exec_exit) {
|
||||||
|
cc->cpu_exec_exit(cpu);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cpu_exec_step_atomic(CPUState *cpu)
|
void cpu_exec_step_atomic(CPUState *cpu)
|
||||||
|
@ -619,7 +623,8 @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
|
||||||
True when it is, and we should restart on a new TB,
|
True when it is, and we should restart on a new TB,
|
||||||
and via longjmp via cpu_loop_exit. */
|
and via longjmp via cpu_loop_exit. */
|
||||||
else {
|
else {
|
||||||
if (cc->cpu_exec_interrupt(cpu, interrupt_request)) {
|
if (cc->cpu_exec_interrupt &&
|
||||||
|
cc->cpu_exec_interrupt(cpu, interrupt_request)) {
|
||||||
if (need_replay_interrupt(interrupt_request)) {
|
if (need_replay_interrupt(interrupt_request)) {
|
||||||
replay_interrupt();
|
replay_interrupt();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue