summaryrefslogtreecommitdiffstats
path: root/accel/tcg
diff options
context:
space:
mode:
authorEduardo Habkost2020-12-12 16:55:17 +0100
committerEduardo Habkost2020-12-16 21:50:33 +0100
commit80c4750ba8840f48638aa88a84aab6fff9427914 (patch)
tree55388232db58c92fcb4d3007952048b3258e9bcc /accel/tcg
parenttcg: cpu_exec_{enter,exit} helpers (diff)
downloadqemu-80c4750ba8840f48638aa88a84aab6fff9427914.tar.gz
qemu-80c4750ba8840f48638aa88a84aab6fff9427914.tar.xz
qemu-80c4750ba8840f48638aa88a84aab6fff9427914.zip
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>
Diffstat (limited to 'accel/tcg')
-rw-r--r--accel/tcg/cpu-exec.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
index 58117f175a..36dde32ff9 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();
}