diff options
author | Eduardo Habkost <ehabkost@redhat.com> | 2020-12-12 16:55:17 +0100 |
---|---|---|
committer | Eduardo Habkost <ehabkost@redhat.com> | 2020-12-16 15:50:33 -0500 |
commit | 80c4750ba8840f48638aa88a84aab6fff9427914 (patch) | |
tree | 55388232db58c92fcb4d3007952048b3258e9bcc | |
parent | 035ba06c2e372f071c223f3ba9973ce474619601 (diff) | |
download | qemu-80c4750ba8840f48638aa88a84aab6fff9427914.zip qemu-80c4750ba8840f48638aa88a84aab6fff9427914.tar.gz qemu-80c4750ba8840f48638aa88a84aab6fff9427914.tar.bz2 |
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>
-rw-r--r-- | accel/tcg/cpu-exec.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 58117f1..36dde32 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -240,14 +240,18 @@ static void cpu_exec_enter(CPUState *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) { 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) @@ -619,7 +623,8 @@ static inline bool cpu_handle_interrupt(CPUState *cpu, True when it is, and we should restart on a new TB, and via longjmp via cpu_loop_exit. */ 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)) { replay_interrupt(); } |