1
The following changes since commit d0dddab40e472ba62b5f43f11cc7dba085dabe71:
1
The following changes since commit 0319ad22bd5789e1eaa8a2dd5773db2d2c372f20:
2
2
3
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (2021-02-05 15:27:02 +0000)
3
Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-and-misc-updates-250521-2' into staging (2021-05-25 17:31:04 +0100)
4
4
5
are available in the Git repository at:
5
are available in the Git repository at:
6
6
7
https://gitlab.com/rth7680/qemu.git tags/pull-tcg-20210205
7
https://gitlab.com/rth7680/qemu.git tags/pull-tcg-20210526
8
8
9
for you to fetch changes up to fb6916dd6ca8bb4b42d44baba9c67ecaf2279577:
9
for you to fetch changes up to 119065574d02deffc28fe5b6a864db9b467c6ffd:
10
10
11
accel: introduce AccelCPUClass extending CPUClass (2021-02-05 10:24:15 -1000)
11
hw/core: Constify TCGCPUOps (2021-05-26 15:33:59 -0700)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
TCGCPUOps cleanups (claudio)
14
Adjust types for some memory access functions.
15
tcg/s390 compare fix (phil)
15
Reduce inclusion of tcg headers.
16
tcg/aarch64 rotli_vec fix
16
Fix watchpoints vs replay.
17
tcg/tci cleanups and fixes
17
Fix tcg/aarch64 roli expansion.
18
Introduce SysemuCPUOps structure.
18
19
19
----------------------------------------------------------------
20
----------------------------------------------------------------
20
Claudio Fontana (13):
21
Pavel Dovgalyuk (1):
21
target/riscv: remove CONFIG_TCG, as it is always TCG
22
replay: fix watchpoint processing for reverse debugging
22
accel/tcg: split TCG-only code from cpu_exec_realizefn
23
target/arm: do not use cc->do_interrupt for KVM directly
24
cpu: move cc->do_interrupt to tcg_ops
25
cpu: move cc->transaction_failed to tcg_ops
26
cpu: move do_unaligned_access to tcg_ops
27
physmem: make watchpoint checking code TCG-only
28
cpu: move adjust_watchpoint_address to tcg_ops
29
cpu: move debug_check_watchpoint to tcg_ops
30
cpu: tcg_ops: move to tcg-cpu-ops.h, keep a pointer in CPUClass
31
accel: extend AccelState and AccelClass to user-mode
32
accel: replace struct CpusAccel with AccelOpsClass
33
accel: introduce AccelCPUClass extending CPUClass
34
23
35
Eduardo Habkost (5):
24
Philippe Mathieu-Daudé (27):
36
cpu: Introduce TCGCpuOperations struct
25
exec/memory_ldst_cached: Sort declarations
37
cpu: Move synchronize_from_tb() to tcg_ops
26
exec/memory_ldst_phys: Sort declarations
38
cpu: Move cpu_exec_* to tcg_ops
27
exec/memory_ldst: Use correct type sizes
39
cpu: Move tlb_fill to tcg_ops
28
exec/memory_ldst_phys: Use correct type sizes
40
cpu: Move debug_excp_handler to tcg_ops
29
exec/memory_ldst_cached: Use correct type size
30
exec/memory: Use correct type size
31
accel/tcg: Reduce 'exec/tb-context.h' inclusion
32
accel/tcg: Keep TranslationBlock headers local to TCG
33
cpu: Remove duplicated 'sysemu/hw_accel.h' header
34
cpu: Split as cpu-common / cpu-sysemu
35
cpu: Un-inline cpu_get_phys_page_debug and cpu_asidx_from_attrs
36
cpu: Introduce cpu_virtio_is_big_endian()
37
cpu: Directly use cpu_write_elf*() fallback handlers in place
38
cpu: Directly use get_paging_enabled() fallback handlers in place
39
cpu: Directly use get_memory_mapping() fallback handlers in place
40
cpu: Assert DeviceClass::vmsd is NULL on user emulation
41
cpu: Rename CPUClass vmsd -> legacy_vmsd
42
cpu: Move AVR target vmsd field from CPUClass to DeviceClass
43
cpu: Introduce SysemuCPUOps structure
44
cpu: Move CPUClass::vmsd to SysemuCPUOps
45
cpu: Move CPUClass::virtio_is_big_endian to SysemuCPUOps
46
cpu: Move CPUClass::get_crash_info to SysemuCPUOps
47
cpu: Move CPUClass::write_elf* to SysemuCPUOps
48
cpu: Move CPUClass::asidx_from_attrs to SysemuCPUOps
49
cpu: Move CPUClass::get_phys_page_debug to SysemuCPUOps
50
cpu: Move CPUClass::get_memory_mapping to SysemuCPUOps
51
cpu: Move CPUClass::get_paging_enabled to SysemuCPUOps
41
52
42
Philippe Mathieu-Daudé (2):
53
Richard Henderson (2):
43
tcg/s390: Fix compare instruction from extended-immediate facility
54
target/mips: Fold jazz behaviour into mips_cpu_do_transaction_failed
44
exec/cpu-defs: Remove TCG backends dependency
55
hw/core: Constify TCGCPUOps
45
56
46
Richard Henderson (24):
57
Yasuo Kuwahara (1):
47
tcg/aarch64: Do not convert TCGArg to temps that are not temps
58
tcg/aarch64: Fix tcg_out_rotl
48
configure: Fix --enable-tcg-interpreter
49
tcg/tci: Make tci_tb_ptr thread-local
50
tcg/tci: Inline tci_write_reg32s into the only caller
51
tcg/tci: Inline tci_write_reg8 into its callers
52
tcg/tci: Inline tci_write_reg16 into the only caller
53
tcg/tci: Inline tci_write_reg32 into all callers
54
tcg/tci: Inline tci_write_reg64 into 64-bit callers
55
tcg/tci: Merge INDEX_op_ld8u_{i32,i64}
56
tcg/tci: Merge INDEX_op_ld8s_{i32,i64}
57
tcg/tci: Merge INDEX_op_ld16u_{i32,i64}
58
tcg/tci: Merge INDEX_op_ld16s_{i32,i64}
59
tcg/tci: Merge INDEX_op_{ld_i32,ld32u_i64}
60
tcg/tci: Merge INDEX_op_st8_{i32,i64}
61
tcg/tci: Merge INDEX_op_st16_{i32,i64}
62
tcg/tci: Move stack bounds check to compile-time
63
tcg/tci: Merge INDEX_op_{st_i32,st32_i64}
64
tcg/tci: Use g_assert_not_reached
65
tcg/tci: Remove dead code for TCG_TARGET_HAS_div2_*
66
tcg/tci: Implement 64-bit division
67
tcg/tci: Remove TODO as unused
68
tcg/tci: Restrict TCG_TARGET_NB_REGS to 16
69
tcg/tci: Fix TCG_REG_R4 misusage
70
tcg/tci: Remove TCG_CONST
71
59
72
Stefan Weil (2):
60
{include/exec => accel/tcg}/tb-context.h | 0
73
tcg/tci: Implement INDEX_op_ld16s_i32
61
{include/exec => accel/tcg}/tb-hash.h | 0
74
tcg/tci: Implement INDEX_op_ld8s_i64
62
{include/exec => accel/tcg}/tb-lookup.h | 2 +-
63
include/exec/exec-all.h | 1 -
64
include/exec/memory.h | 2 +-
65
include/hw/core/cpu.h | 94 +++++---------------
66
include/hw/core/sysemu-cpu-ops.h | 92 ++++++++++++++++++++
67
include/migration/vmstate.h | 2 -
68
include/tcg/tcg.h | 1 -
69
plugins/plugin.h | 1 +
70
target/mips/cpu-qom.h | 3 +
71
include/exec/memory_ldst.h.inc | 16 ++--
72
include/exec/memory_ldst_cached.h.inc | 46 +++++-----
73
include/exec/memory_ldst_phys.h.inc | 72 +++++++--------
74
accel/tcg/cpu-exec.c | 5 +-
75
accel/tcg/cputlb.c | 2 +-
76
accel/tcg/tcg-runtime.c | 2 +-
77
accel/tcg/translate-all.c | 3 +-
78
cpu.c | 18 ++--
79
hw/core/{cpu.c => cpu-common.c} | 116 -------------------------
80
hw/core/cpu-sysemu.c | 145 +++++++++++++++++++++++++++++++
81
hw/mips/jazz.c | 35 +-------
82
hw/virtio/virtio.c | 4 +-
83
softmmu/physmem.c | 10 +++
84
stubs/vmstate.c | 2 -
85
target/alpha/cpu.c | 12 ++-
86
target/arm/cpu.c | 22 +++--
87
target/arm/cpu_tcg.c | 2 +-
88
target/avr/cpu.c | 12 ++-
89
target/avr/machine.c | 4 +-
90
target/cris/cpu.c | 14 ++-
91
target/hexagon/cpu.c | 2 +-
92
target/hppa/cpu.c | 12 ++-
93
target/i386/cpu.c | 30 ++++---
94
target/i386/tcg/tcg-cpu.c | 2 +-
95
target/m68k/cpu.c | 12 ++-
96
target/microblaze/cpu.c | 12 ++-
97
target/mips/cpu.c | 14 ++-
98
target/mips/tcg/op_helper.c | 3 +-
99
target/nios2/cpu.c | 12 ++-
100
target/openrisc/cpu.c | 12 ++-
101
target/ppc/cpu_init.c | 24 ++---
102
target/riscv/cpu.c | 19 ++--
103
target/rx/cpu.c | 14 ++-
104
target/s390x/cpu.c | 18 ++--
105
target/sh4/cpu.c | 15 +++-
106
target/sparc/cpu.c | 14 ++-
107
target/tricore/cpu.c | 10 ++-
108
target/xtensa/cpu.c | 14 ++-
109
memory_ldst.c.inc | 20 ++---
110
tcg/aarch64/tcg-target.c.inc | 5 +-
111
MAINTAINERS | 1 -
112
hw/core/meson.build | 3 +-
113
53 files changed, 602 insertions(+), 406 deletions(-)
114
rename {include/exec => accel/tcg}/tb-context.h (100%)
115
rename {include/exec => accel/tcg}/tb-hash.h (100%)
116
rename {include/exec => accel/tcg}/tb-lookup.h (98%)
117
create mode 100644 include/hw/core/sysemu-cpu-ops.h
118
rename hw/core/{cpu.c => cpu-common.c} (73%)
119
create mode 100644 hw/core/cpu-sysemu.c
75
120
76
configure | 5 +-
77
accel/accel-softmmu.h | 15 +
78
accel/kvm/kvm-cpus.h | 2 -
79
.../{tcg-cpus-icount.h => tcg-accel-ops-icount.h} | 2 +
80
accel/tcg/tcg-accel-ops-mttcg.h | 19 +
81
accel/tcg/{tcg-cpus-rr.h => tcg-accel-ops-rr.h} | 0
82
accel/tcg/{tcg-cpus.h => tcg-accel-ops.h} | 6 +-
83
include/exec/cpu-all.h | 11 +-
84
include/exec/cpu-defs.h | 3 -
85
include/exec/exec-all.h | 2 +-
86
include/hw/boards.h | 2 +-
87
include/hw/core/accel-cpu.h | 38 ++
88
include/hw/core/cpu.h | 86 +---
89
include/hw/core/tcg-cpu-ops.h | 97 +++++
90
include/{sysemu => qemu}/accel.h | 16 +-
91
include/sysemu/accel-ops.h | 45 ++
92
include/sysemu/cpus.h | 26 +-
93
include/sysemu/hvf.h | 2 +-
94
include/sysemu/kvm.h | 2 +-
95
include/sysemu/kvm_int.h | 2 +-
96
target/arm/internals.h | 6 +
97
target/i386/hax/{hax-cpus.h => hax-accel-ops.h} | 2 -
98
target/i386/hax/hax-windows.h | 2 +-
99
target/i386/hvf/{hvf-cpus.h => hvf-accel-ops.h} | 2 -
100
target/i386/hvf/hvf-i386.h | 2 +-
101
target/i386/whpx/{whpx-cpus.h => whpx-accel-ops.h} | 2 -
102
tcg/tci/tcg-target-con-set.h | 6 +-
103
tcg/tci/tcg-target.h | 37 +-
104
accel/accel-common.c | 105 +++++
105
accel/{accel.c => accel-softmmu.c} | 61 ++-
106
accel/accel-user.c | 24 ++
107
accel/kvm/{kvm-cpus.c => kvm-accel-ops.c} | 28 +-
108
accel/kvm/kvm-all.c | 2 -
109
accel/qtest/qtest.c | 25 +-
110
accel/tcg/cpu-exec.c | 53 ++-
111
accel/tcg/cputlb.c | 34 +-
112
.../{tcg-cpus-icount.c => tcg-accel-ops-icount.c} | 21 +-
113
.../{tcg-cpus-mttcg.c => tcg-accel-ops-mttcg.c} | 14 +-
114
accel/tcg/{tcg-cpus-rr.c => tcg-accel-ops-rr.c} | 13 +-
115
accel/tcg/{tcg-cpus.c => tcg-accel-ops.c} | 47 +-
116
accel/tcg/tcg-all.c | 19 +-
117
accel/tcg/user-exec.c | 8 +-
118
accel/xen/xen-all.c | 26 +-
119
bsd-user/main.c | 11 +-
120
cpu.c | 66 +--
121
hw/core/cpu.c | 21 +-
122
hw/mips/jazz.c | 12 +-
123
linux-user/main.c | 7 +-
124
softmmu/cpus.c | 12 +-
125
softmmu/memory.c | 2 +-
126
softmmu/physmem.c | 149 ++++---
127
softmmu/qtest.c | 2 +-
128
softmmu/vl.c | 9 +-
129
target/alpha/cpu.c | 21 +-
130
target/arm/cpu.c | 45 +-
131
target/arm/cpu64.c | 4 +-
132
target/arm/cpu_tcg.c | 32 +-
133
target/arm/helper.c | 4 +
134
target/arm/kvm64.c | 6 +-
135
target/avr/cpu.c | 19 +-
136
target/avr/helper.c | 5 +-
137
target/cris/cpu.c | 43 +-
138
target/cris/helper.c | 5 +-
139
target/hppa/cpu.c | 24 +-
140
target/i386/hax/{hax-cpus.c => hax-accel-ops.c} | 33 +-
141
target/i386/hax/hax-all.c | 7 +-
142
target/i386/hax/hax-mem.c | 2 +-
143
target/i386/hax/hax-posix.c | 2 +-
144
target/i386/hax/hax-windows.c | 2 +-
145
target/i386/hvf/{hvf-cpus.c => hvf-accel-ops.c} | 29 +-
146
target/i386/hvf/hvf.c | 5 +-
147
target/i386/hvf/x86_task.c | 2 +-
148
target/i386/hvf/x86hvf.c | 2 +-
149
target/i386/tcg/tcg-cpu.c | 26 +-
150
target/i386/whpx/{whpx-cpus.c => whpx-accel-ops.c} | 33 +-
151
target/i386/whpx/whpx-all.c | 9 +-
152
target/lm32/cpu.c | 19 +-
153
target/m68k/cpu.c | 19 +-
154
target/microblaze/cpu.c | 25 +-
155
target/mips/cpu.c | 35 +-
156
target/moxie/cpu.c | 15 +-
157
target/nios2/cpu.c | 18 +-
158
target/openrisc/cpu.c | 17 +-
159
target/riscv/cpu.c | 26 +-
160
target/riscv/cpu_helper.c | 2 +-
161
target/rx/cpu.c | 20 +-
162
target/s390x/cpu.c | 33 +-
163
target/s390x/excp_helper.c | 2 +-
164
target/sh4/cpu.c | 21 +-
165
target/sparc/cpu.c | 25 +-
166
target/tilegx/cpu.c | 17 +-
167
target/tricore/cpu.c | 12 +-
168
target/unicore32/cpu.c | 17 +-
169
target/xtensa/cpu.c | 23 +-
170
target/xtensa/helper.c | 4 +-
171
tcg/tcg-common.c | 4 -
172
tcg/tci.c | 479 ++++++++-------------
173
target/ppc/translate_init.c.inc | 39 +-
174
tcg/aarch64/tcg-target.c.inc | 7 +-
175
tcg/s390/tcg-target.c.inc | 2 +-
176
tcg/tci/tcg-target.c.inc | 149 ++-----
177
MAINTAINERS | 7 +-
178
accel/kvm/meson.build | 2 +-
179
accel/meson.build | 4 +-
180
accel/tcg/meson.build | 10 +-
181
target/i386/hax/meson.build | 2 +-
182
target/i386/hvf/meson.build | 2 +-
183
target/i386/whpx/meson.build | 2 +-
184
108 files changed, 1565 insertions(+), 1065 deletions(-)
185
create mode 100644 accel/accel-softmmu.h
186
rename accel/tcg/{tcg-cpus-icount.h => tcg-accel-ops-icount.h} (88%)
187
create mode 100644 accel/tcg/tcg-accel-ops-mttcg.h
188
rename accel/tcg/{tcg-cpus-rr.h => tcg-accel-ops-rr.h} (100%)
189
rename accel/tcg/{tcg-cpus.h => tcg-accel-ops.h} (72%)
190
create mode 100644 include/hw/core/accel-cpu.h
191
create mode 100644 include/hw/core/tcg-cpu-ops.h
192
rename include/{sysemu => qemu}/accel.h (94%)
193
create mode 100644 include/sysemu/accel-ops.h
194
rename target/i386/hax/{hax-cpus.h => hax-accel-ops.h} (95%)
195
rename target/i386/hvf/{hvf-cpus.h => hvf-accel-ops.h} (94%)
196
rename target/i386/whpx/{whpx-cpus.h => whpx-accel-ops.h} (96%)
197
create mode 100644 accel/accel-common.c
198
rename accel/{accel.c => accel-softmmu.c} (64%)
199
create mode 100644 accel/accel-user.c
200
rename accel/kvm/{kvm-cpus.c => kvm-accel-ops.c} (72%)
201
rename accel/tcg/{tcg-cpus-icount.c => tcg-accel-ops-icount.c} (89%)
202
rename accel/tcg/{tcg-cpus-mttcg.c => tcg-accel-ops-mttcg.c} (92%)
203
rename accel/tcg/{tcg-cpus-rr.c => tcg-accel-ops-rr.c} (97%)
204
rename accel/tcg/{tcg-cpus.c => tcg-accel-ops.c} (63%)
205
rename target/i386/hax/{hax-cpus.c => hax-accel-ops.c} (69%)
206
rename target/i386/hvf/{hvf-cpus.c => hvf-accel-ops.c} (84%)
207
rename target/i386/whpx/{whpx-cpus.c => whpx-accel-ops.c} (71%)
208
diff view generated by jsdifflib
1
From: Claudio Fontana <cfontana@suse.de>
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
2
3
cc->do_interrupt is in theory a TCG callback used in accel/tcg only,
3
To ease the file review, sort the declarations by the size of
4
to prepare the emulated architecture to take an interrupt as defined
4
the access (8, 16, 32). Simple code movement, no logical change.
5
in the hardware specifications,
6
5
7
but in reality the _do_interrupt style of functions in targets are
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
also occasionally reused by KVM to prepare the architecture state in a
7
Message-Id: <20210518183655.1711377-2-philmd@redhat.com>
9
similar way where userspace code has identified that it needs to
10
deliver an exception to the guest.
11
12
In the case of ARM, that includes:
13
14
1) the vcpu thread got a SIGBUS indicating a memory error,
15
and we need to deliver a Synchronous External Abort to the guest to
16
let it know about the error.
17
2) the kernel told us about a debug exception (breakpoint, watchpoint)
18
but it is not for one of QEMU's own gdbstub breakpoints/watchpoints
19
so it must be a breakpoint the guest itself has set up, therefore
20
we need to deliver it to the guest.
21
22
So in order to reuse code, the same arm_do_interrupt function is used.
23
This is all fine, but we need to avoid calling it using the callback
24
registered in CPUClass, since that one is now TCG-only.
25
26
Fortunately this is easily solved by replacing calls to
27
CPUClass::do_interrupt() with explicit calls to arm_do_interrupt().
28
29
Signed-off-by: Claudio Fontana <cfontana@suse.de>
30
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
31
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
32
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
33
Cc: Peter Maydell <peter.maydell@linaro.org>
34
Message-Id: <20210204163931.7358-9-cfontana@suse.de>
35
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
36
---
9
---
37
target/arm/helper.c | 4 ++++
10
include/exec/memory_ldst_cached.h.inc | 46 +++++++++++++--------------
38
target/arm/kvm64.c | 6 ++----
11
1 file changed, 23 insertions(+), 23 deletions(-)
39
2 files changed, 6 insertions(+), 4 deletions(-)
40
12
41
diff --git a/target/arm/helper.c b/target/arm/helper.c
13
diff --git a/include/exec/memory_ldst_cached.h.inc b/include/exec/memory_ldst_cached.h.inc
42
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
43
--- a/target/arm/helper.c
15
--- a/include/exec/memory_ldst_cached.h.inc
44
+++ b/target/arm/helper.c
16
+++ b/include/exec/memory_ldst_cached.h.inc
45
@@ -XXX,XX +XXX,XX @@ static void handle_semihosting(CPUState *cs)
17
@@ -XXX,XX +XXX,XX @@
46
* Do any appropriate logging, handle PSCI calls, and then hand off
18
#define LD_P(size) \
47
* to the AArch64-entry or AArch32-entry function depending on the
19
glue(glue(ld, size), glue(ENDIANNESS, _p))
48
* target exception level's register width.
20
49
+ *
21
+static inline uint32_t ADDRESS_SPACE_LD_CACHED(uw)(MemoryRegionCache *cache,
50
+ * Note: this is used for both TCG (as the do_interrupt tcg op),
22
+ hwaddr addr, MemTxAttrs attrs, MemTxResult *result)
51
+ * and KVM to re-inject guest debug exceptions, and to
23
+{
52
+ * inject a Synchronous-External-Abort.
24
+ assert(addr < cache->len && 2 <= cache->len - addr);
53
*/
25
+ fuzz_dma_read_cb(cache->xlat + addr, 2, cache->mrs.mr);
54
void arm_cpu_do_interrupt(CPUState *cs)
26
+ if (likely(cache->ptr)) {
27
+ return LD_P(uw)(cache->ptr + addr);
28
+ } else {
29
+ return ADDRESS_SPACE_LD_CACHED_SLOW(uw)(cache, addr, attrs, result);
30
+ }
31
+}
32
+
33
static inline uint32_t ADDRESS_SPACE_LD_CACHED(l)(MemoryRegionCache *cache,
34
hwaddr addr, MemTxAttrs attrs, MemTxResult *result)
55
{
35
{
56
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
36
@@ -XXX,XX +XXX,XX @@ static inline uint64_t ADDRESS_SPACE_LD_CACHED(q)(MemoryRegionCache *cache,
57
index XXXXXXX..XXXXXXX 100644
37
}
58
--- a/target/arm/kvm64.c
38
}
59
+++ b/target/arm/kvm64.c
39
60
@@ -XXX,XX +XXX,XX @@ static void kvm_inject_arm_sea(CPUState *c)
40
-static inline uint32_t ADDRESS_SPACE_LD_CACHED(uw)(MemoryRegionCache *cache,
41
- hwaddr addr, MemTxAttrs attrs, MemTxResult *result)
42
-{
43
- assert(addr < cache->len && 2 <= cache->len - addr);
44
- fuzz_dma_read_cb(cache->xlat + addr, 2, cache->mrs.mr);
45
- if (likely(cache->ptr)) {
46
- return LD_P(uw)(cache->ptr + addr);
47
- } else {
48
- return ADDRESS_SPACE_LD_CACHED_SLOW(uw)(cache, addr, attrs, result);
49
- }
50
-}
51
-
52
#undef ADDRESS_SPACE_LD_CACHED
53
#undef ADDRESS_SPACE_LD_CACHED_SLOW
54
#undef LD_P
55
@@ -XXX,XX +XXX,XX @@ static inline uint32_t ADDRESS_SPACE_LD_CACHED(uw)(MemoryRegionCache *cache,
56
#define ST_P(size) \
57
glue(glue(st, size), glue(ENDIANNESS, _p))
58
59
-static inline void ADDRESS_SPACE_ST_CACHED(l)(MemoryRegionCache *cache,
60
- hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result)
61
-{
62
- assert(addr < cache->len && 4 <= cache->len - addr);
63
- if (likely(cache->ptr)) {
64
- ST_P(l)(cache->ptr + addr, val);
65
- } else {
66
- ADDRESS_SPACE_ST_CACHED_SLOW(l)(cache, addr, val, attrs, result);
67
- }
68
-}
69
-
70
static inline void ADDRESS_SPACE_ST_CACHED(w)(MemoryRegionCache *cache,
71
hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result)
61
{
72
{
62
ARMCPU *cpu = ARM_CPU(c);
73
@@ -XXX,XX +XXX,XX @@ static inline void ADDRESS_SPACE_ST_CACHED(w)(MemoryRegionCache *cache,
63
CPUARMState *env = &cpu->env;
74
}
64
- CPUClass *cc = CPU_GET_CLASS(c);
65
uint32_t esr;
66
bool same_el;
67
68
@@ -XXX,XX +XXX,XX @@ static void kvm_inject_arm_sea(CPUState *c)
69
70
env->exception.syndrome = esr;
71
72
- cc->do_interrupt(c);
73
+ arm_cpu_do_interrupt(c);
74
}
75
}
75
76
76
#define AARCH64_CORE_REG(x) (KVM_REG_ARM64 | KVM_REG_SIZE_U64 | \
77
+static inline void ADDRESS_SPACE_ST_CACHED(l)(MemoryRegionCache *cache,
77
@@ -XXX,XX +XXX,XX @@ bool kvm_arm_handle_debug(CPUState *cs, struct kvm_debug_exit_arch *debug_exit)
78
+ hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result)
79
+{
80
+ assert(addr < cache->len && 4 <= cache->len - addr);
81
+ if (likely(cache->ptr)) {
82
+ ST_P(l)(cache->ptr + addr, val);
83
+ } else {
84
+ ADDRESS_SPACE_ST_CACHED_SLOW(l)(cache, addr, val, attrs, result);
85
+ }
86
+}
87
+
88
static inline void ADDRESS_SPACE_ST_CACHED(q)(MemoryRegionCache *cache,
89
hwaddr addr, uint64_t val, MemTxAttrs attrs, MemTxResult *result)
78
{
90
{
79
int hsr_ec = syn_get_ec(debug_exit->hsr);
80
ARMCPU *cpu = ARM_CPU(cs);
81
- CPUClass *cc = CPU_GET_CLASS(cs);
82
CPUARMState *env = &cpu->env;
83
84
/* Ensure PC is synchronised */
85
@@ -XXX,XX +XXX,XX @@ bool kvm_arm_handle_debug(CPUState *cs, struct kvm_debug_exit_arch *debug_exit)
86
env->exception.vaddress = debug_exit->far;
87
env->exception.target_el = 1;
88
qemu_mutex_lock_iothread();
89
- cc->do_interrupt(cs);
90
+ arm_cpu_do_interrupt(cs);
91
qemu_mutex_unlock_iothread();
92
93
return false;
94
--
91
--
95
2.25.1
92
2.25.1
96
93
97
94
diff view generated by jsdifflib
1
Restrict all operands to registers. All constants will be forced
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
into registers by the middle-end. Removing the difference in how
3
immediate integers were encoded will allow more code to be shared
4
between 32-bit and 64-bit operations.
5
2
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
3
To ease the file review, sort the declarations by the size of
4
the access (8, 16, 32). Simple code movement, no logical change.
5
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Message-Id: <20210518183655.1711377-3-philmd@redhat.com>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
---
9
---
9
tcg/tci/tcg-target-con-set.h | 6 +-
10
include/exec/memory_ldst_phys.h.inc | 78 ++++++++++++++---------------
10
tcg/tci/tcg-target.h | 3 -
11
1 file changed, 39 insertions(+), 39 deletions(-)
11
tcg/tci.c | 189 +++++++++++++----------------------
12
tcg/tci/tcg-target.c.inc | 85 ++++------------
13
4 files changed, 89 insertions(+), 194 deletions(-)
14
12
15
diff --git a/tcg/tci/tcg-target-con-set.h b/tcg/tci/tcg-target-con-set.h
13
diff --git a/include/exec/memory_ldst_phys.h.inc b/include/exec/memory_ldst_phys.h.inc
16
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
17
--- a/tcg/tci/tcg-target-con-set.h
15
--- a/include/exec/memory_ldst_phys.h.inc
18
+++ b/tcg/tci/tcg-target-con-set.h
16
+++ b/include/exec/memory_ldst_phys.h.inc
19
@@ -XXX,XX +XXX,XX @@
17
@@ -XXX,XX +XXX,XX @@
20
* tcg-target-con-str.h; the constraint combination is inclusive or.
21
*/
18
*/
22
C_O0_I2(r, r)
19
23
-C_O0_I2(r, ri)
20
#ifdef TARGET_ENDIANNESS
24
C_O0_I3(r, r, r)
21
+static inline uint32_t glue(lduw_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
25
-C_O0_I4(r, r, ri, ri)
22
+{
26
C_O0_I4(r, r, r, r)
23
+ return glue(address_space_lduw, SUFFIX)(ARG1, addr,
27
C_O1_I1(r, r)
24
+ MEMTXATTRS_UNSPECIFIED, NULL);
28
C_O1_I2(r, 0, r)
25
+}
29
-C_O1_I2(r, ri, ri)
26
+
30
C_O1_I2(r, r, r)
27
static inline uint32_t glue(ldl_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
31
-C_O1_I2(r, r, ri)
28
{
32
-C_O1_I4(r, r, r, ri, ri)
29
return glue(address_space_ldl, SUFFIX)(ARG1, addr,
33
+C_O1_I4(r, r, r, r, r)
30
@@ -XXX,XX +XXX,XX @@ static inline uint64_t glue(ldq_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
34
C_O2_I1(r, r, r)
31
MEMTXATTRS_UNSPECIFIED, NULL);
35
C_O2_I2(r, r, r, r)
36
C_O2_I4(r, r, r, r, r, r)
37
diff --git a/tcg/tci/tcg-target.h b/tcg/tci/tcg-target.h
38
index XXXXXXX..XXXXXXX 100644
39
--- a/tcg/tci/tcg-target.h
40
+++ b/tcg/tci/tcg-target.h
41
@@ -XXX,XX +XXX,XX @@ typedef enum {
42
43
TCG_AREG0 = TCG_REG_R14,
44
TCG_REG_CALL_STACK = TCG_REG_R15,
45
-
46
- /* Special value UINT8_MAX is used by TCI to encode constant values. */
47
- TCG_CONST = UINT8_MAX
48
} TCGReg;
49
50
/* Used for function call generation. */
51
diff --git a/tcg/tci.c b/tcg/tci.c
52
index XXXXXXX..XXXXXXX 100644
53
--- a/tcg/tci.c
54
+++ b/tcg/tci.c
55
@@ -XXX,XX +XXX,XX @@ tci_read_ulong(const tcg_target_ulong *regs, const uint8_t **tb_ptr)
56
return taddr;
57
}
32
}
58
33
59
-/* Read indexed register or constant (native size) from bytecode. */
34
-static inline uint32_t glue(lduw_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
60
-static tcg_target_ulong
35
+static inline void glue(stw_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
61
-tci_read_ri(const tcg_target_ulong *regs, const uint8_t **tb_ptr)
36
{
37
- return glue(address_space_lduw, SUFFIX)(ARG1, addr,
38
- MEMTXATTRS_UNSPECIFIED, NULL);
39
+ glue(address_space_stw, SUFFIX)(ARG1, addr, val,
40
+ MEMTXATTRS_UNSPECIFIED, NULL);
41
}
42
43
static inline void glue(stl_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
44
@@ -XXX,XX +XXX,XX @@ static inline void glue(stl_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
45
MEMTXATTRS_UNSPECIFIED, NULL);
46
}
47
48
-static inline void glue(stw_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
62
-{
49
-{
63
- tcg_target_ulong value;
50
- glue(address_space_stw, SUFFIX)(ARG1, addr, val,
64
- TCGReg r = **tb_ptr;
51
- MEMTXATTRS_UNSPECIFIED, NULL);
65
- *tb_ptr += 1;
66
- if (r == TCG_CONST) {
67
- value = tci_read_i(tb_ptr);
68
- } else {
69
- value = tci_read_reg(regs, r);
70
- }
71
- return value;
72
-}
52
-}
73
-
53
-
74
-/* Read indexed register or constant (32 bit) from bytecode. */
54
static inline void glue(stq_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val)
75
-static uint32_t tci_read_ri32(const tcg_target_ulong *regs,
55
{
76
- const uint8_t **tb_ptr)
56
glue(address_space_stq, SUFFIX)(ARG1, addr, val,
57
MEMTXATTRS_UNSPECIFIED, NULL);
58
}
59
#else
60
+static inline uint32_t glue(ldub_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
61
+{
62
+ return glue(address_space_ldub, SUFFIX)(ARG1, addr,
63
+ MEMTXATTRS_UNSPECIFIED, NULL);
64
+}
65
+
66
+static inline uint32_t glue(lduw_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
67
+{
68
+ return glue(address_space_lduw_le, SUFFIX)(ARG1, addr,
69
+ MEMTXATTRS_UNSPECIFIED, NULL);
70
+}
71
+
72
+static inline uint32_t glue(lduw_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
73
+{
74
+ return glue(address_space_lduw_be, SUFFIX)(ARG1, addr,
75
+ MEMTXATTRS_UNSPECIFIED, NULL);
76
+}
77
+
78
static inline uint32_t glue(ldl_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
79
{
80
return glue(address_space_ldl_le, SUFFIX)(ARG1, addr,
81
@@ -XXX,XX +XXX,XX @@ static inline uint64_t glue(ldq_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
82
MEMTXATTRS_UNSPECIFIED, NULL);
83
}
84
85
-static inline uint32_t glue(ldub_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
77
-{
86
-{
78
- uint32_t value;
87
- return glue(address_space_ldub, SUFFIX)(ARG1, addr,
79
- TCGReg r = **tb_ptr;
88
- MEMTXATTRS_UNSPECIFIED, NULL);
80
- *tb_ptr += 1;
81
- if (r == TCG_CONST) {
82
- value = tci_read_i32(tb_ptr);
83
- } else {
84
- value = tci_read_reg32(regs, r);
85
- }
86
- return value;
87
-}
89
-}
88
-
90
-
89
-#if TCG_TARGET_REG_BITS == 32
91
-static inline uint32_t glue(lduw_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
90
-/* Read two indexed registers or constants (2 * 32 bit) from bytecode. */
91
-static uint64_t tci_read_ri64(const tcg_target_ulong *regs,
92
- const uint8_t **tb_ptr)
93
-{
92
-{
94
- uint32_t low = tci_read_ri32(regs, tb_ptr);
93
- return glue(address_space_lduw_le, SUFFIX)(ARG1, addr,
95
- return tci_uint64(tci_read_ri32(regs, tb_ptr), low);
94
- MEMTXATTRS_UNSPECIFIED, NULL);
96
-}
97
-#elif TCG_TARGET_REG_BITS == 64
98
-/* Read indexed register or constant (64 bit) from bytecode. */
99
-static uint64_t tci_read_ri64(const tcg_target_ulong *regs,
100
- const uint8_t **tb_ptr)
101
-{
102
- uint64_t value;
103
- TCGReg r = **tb_ptr;
104
- *tb_ptr += 1;
105
- if (r == TCG_CONST) {
106
- value = tci_read_i64(tb_ptr);
107
- } else {
108
- value = tci_read_reg64(regs, r);
109
- }
110
- return value;
111
-}
112
-#endif
113
-
114
static tcg_target_ulong tci_read_label(const uint8_t **tb_ptr)
115
{
116
tcg_target_ulong label = tci_read_i(tb_ptr);
117
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
118
119
switch (opc) {
120
case INDEX_op_call:
121
- t0 = tci_read_ri(regs, &tb_ptr);
122
+ t0 = tci_read_i(&tb_ptr);
123
tci_tb_ptr = (uintptr_t)tb_ptr;
124
#if TCG_TARGET_REG_BITS == 32
125
tmp64 = ((helper_function)t0)(tci_read_reg(regs, TCG_REG_R0),
126
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
127
case INDEX_op_setcond_i32:
128
t0 = *tb_ptr++;
129
t1 = tci_read_r32(regs, &tb_ptr);
130
- t2 = tci_read_ri32(regs, &tb_ptr);
131
+ t2 = tci_read_r32(regs, &tb_ptr);
132
condition = *tb_ptr++;
133
tci_write_reg(regs, t0, tci_compare32(t1, t2, condition));
134
break;
135
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
136
case INDEX_op_setcond2_i32:
137
t0 = *tb_ptr++;
138
tmp64 = tci_read_r64(regs, &tb_ptr);
139
- v64 = tci_read_ri64(regs, &tb_ptr);
140
+ v64 = tci_read_r64(regs, &tb_ptr);
141
condition = *tb_ptr++;
142
tci_write_reg(regs, t0, tci_compare64(tmp64, v64, condition));
143
break;
144
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
145
case INDEX_op_setcond_i64:
146
t0 = *tb_ptr++;
147
t1 = tci_read_r64(regs, &tb_ptr);
148
- t2 = tci_read_ri64(regs, &tb_ptr);
149
+ t2 = tci_read_r64(regs, &tb_ptr);
150
condition = *tb_ptr++;
151
tci_write_reg(regs, t0, tci_compare64(t1, t2, condition));
152
break;
153
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
154
155
case INDEX_op_add_i32:
156
t0 = *tb_ptr++;
157
- t1 = tci_read_ri32(regs, &tb_ptr);
158
- t2 = tci_read_ri32(regs, &tb_ptr);
159
+ t1 = tci_read_r32(regs, &tb_ptr);
160
+ t2 = tci_read_r32(regs, &tb_ptr);
161
tci_write_reg(regs, t0, t1 + t2);
162
break;
163
case INDEX_op_sub_i32:
164
t0 = *tb_ptr++;
165
- t1 = tci_read_ri32(regs, &tb_ptr);
166
- t2 = tci_read_ri32(regs, &tb_ptr);
167
+ t1 = tci_read_r32(regs, &tb_ptr);
168
+ t2 = tci_read_r32(regs, &tb_ptr);
169
tci_write_reg(regs, t0, t1 - t2);
170
break;
171
case INDEX_op_mul_i32:
172
t0 = *tb_ptr++;
173
- t1 = tci_read_ri32(regs, &tb_ptr);
174
- t2 = tci_read_ri32(regs, &tb_ptr);
175
+ t1 = tci_read_r32(regs, &tb_ptr);
176
+ t2 = tci_read_r32(regs, &tb_ptr);
177
tci_write_reg(regs, t0, t1 * t2);
178
break;
179
case INDEX_op_div_i32:
180
t0 = *tb_ptr++;
181
- t1 = tci_read_ri32(regs, &tb_ptr);
182
- t2 = tci_read_ri32(regs, &tb_ptr);
183
+ t1 = tci_read_r32(regs, &tb_ptr);
184
+ t2 = tci_read_r32(regs, &tb_ptr);
185
tci_write_reg(regs, t0, (int32_t)t1 / (int32_t)t2);
186
break;
187
case INDEX_op_divu_i32:
188
t0 = *tb_ptr++;
189
- t1 = tci_read_ri32(regs, &tb_ptr);
190
- t2 = tci_read_ri32(regs, &tb_ptr);
191
+ t1 = tci_read_r32(regs, &tb_ptr);
192
+ t2 = tci_read_r32(regs, &tb_ptr);
193
tci_write_reg(regs, t0, t1 / t2);
194
break;
195
case INDEX_op_rem_i32:
196
t0 = *tb_ptr++;
197
- t1 = tci_read_ri32(regs, &tb_ptr);
198
- t2 = tci_read_ri32(regs, &tb_ptr);
199
+ t1 = tci_read_r32(regs, &tb_ptr);
200
+ t2 = tci_read_r32(regs, &tb_ptr);
201
tci_write_reg(regs, t0, (int32_t)t1 % (int32_t)t2);
202
break;
203
case INDEX_op_remu_i32:
204
t0 = *tb_ptr++;
205
- t1 = tci_read_ri32(regs, &tb_ptr);
206
- t2 = tci_read_ri32(regs, &tb_ptr);
207
+ t1 = tci_read_r32(regs, &tb_ptr);
208
+ t2 = tci_read_r32(regs, &tb_ptr);
209
tci_write_reg(regs, t0, t1 % t2);
210
break;
211
case INDEX_op_and_i32:
212
t0 = *tb_ptr++;
213
- t1 = tci_read_ri32(regs, &tb_ptr);
214
- t2 = tci_read_ri32(regs, &tb_ptr);
215
+ t1 = tci_read_r32(regs, &tb_ptr);
216
+ t2 = tci_read_r32(regs, &tb_ptr);
217
tci_write_reg(regs, t0, t1 & t2);
218
break;
219
case INDEX_op_or_i32:
220
t0 = *tb_ptr++;
221
- t1 = tci_read_ri32(regs, &tb_ptr);
222
- t2 = tci_read_ri32(regs, &tb_ptr);
223
+ t1 = tci_read_r32(regs, &tb_ptr);
224
+ t2 = tci_read_r32(regs, &tb_ptr);
225
tci_write_reg(regs, t0, t1 | t2);
226
break;
227
case INDEX_op_xor_i32:
228
t0 = *tb_ptr++;
229
- t1 = tci_read_ri32(regs, &tb_ptr);
230
- t2 = tci_read_ri32(regs, &tb_ptr);
231
+ t1 = tci_read_r32(regs, &tb_ptr);
232
+ t2 = tci_read_r32(regs, &tb_ptr);
233
tci_write_reg(regs, t0, t1 ^ t2);
234
break;
235
236
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
237
238
case INDEX_op_shl_i32:
239
t0 = *tb_ptr++;
240
- t1 = tci_read_ri32(regs, &tb_ptr);
241
- t2 = tci_read_ri32(regs, &tb_ptr);
242
+ t1 = tci_read_r32(regs, &tb_ptr);
243
+ t2 = tci_read_r32(regs, &tb_ptr);
244
tci_write_reg(regs, t0, t1 << (t2 & 31));
245
break;
246
case INDEX_op_shr_i32:
247
t0 = *tb_ptr++;
248
- t1 = tci_read_ri32(regs, &tb_ptr);
249
- t2 = tci_read_ri32(regs, &tb_ptr);
250
+ t1 = tci_read_r32(regs, &tb_ptr);
251
+ t2 = tci_read_r32(regs, &tb_ptr);
252
tci_write_reg(regs, t0, t1 >> (t2 & 31));
253
break;
254
case INDEX_op_sar_i32:
255
t0 = *tb_ptr++;
256
- t1 = tci_read_ri32(regs, &tb_ptr);
257
- t2 = tci_read_ri32(regs, &tb_ptr);
258
+ t1 = tci_read_r32(regs, &tb_ptr);
259
+ t2 = tci_read_r32(regs, &tb_ptr);
260
tci_write_reg(regs, t0, ((int32_t)t1 >> (t2 & 31)));
261
break;
262
#if TCG_TARGET_HAS_rot_i32
263
case INDEX_op_rotl_i32:
264
t0 = *tb_ptr++;
265
- t1 = tci_read_ri32(regs, &tb_ptr);
266
- t2 = tci_read_ri32(regs, &tb_ptr);
267
+ t1 = tci_read_r32(regs, &tb_ptr);
268
+ t2 = tci_read_r32(regs, &tb_ptr);
269
tci_write_reg(regs, t0, rol32(t1, t2 & 31));
270
break;
271
case INDEX_op_rotr_i32:
272
t0 = *tb_ptr++;
273
- t1 = tci_read_ri32(regs, &tb_ptr);
274
- t2 = tci_read_ri32(regs, &tb_ptr);
275
+ t1 = tci_read_r32(regs, &tb_ptr);
276
+ t2 = tci_read_r32(regs, &tb_ptr);
277
tci_write_reg(regs, t0, ror32(t1, t2 & 31));
278
break;
279
#endif
280
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
281
#endif
282
case INDEX_op_brcond_i32:
283
t0 = tci_read_r32(regs, &tb_ptr);
284
- t1 = tci_read_ri32(regs, &tb_ptr);
285
+ t1 = tci_read_r32(regs, &tb_ptr);
286
condition = *tb_ptr++;
287
label = tci_read_label(&tb_ptr);
288
if (tci_compare32(t0, t1, condition)) {
289
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
290
break;
291
case INDEX_op_brcond2_i32:
292
tmp64 = tci_read_r64(regs, &tb_ptr);
293
- v64 = tci_read_ri64(regs, &tb_ptr);
294
+ v64 = tci_read_r64(regs, &tb_ptr);
295
condition = *tb_ptr++;
296
label = tci_read_label(&tb_ptr);
297
if (tci_compare64(tmp64, v64, condition)) {
298
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
299
300
case INDEX_op_add_i64:
301
t0 = *tb_ptr++;
302
- t1 = tci_read_ri64(regs, &tb_ptr);
303
- t2 = tci_read_ri64(regs, &tb_ptr);
304
+ t1 = tci_read_r64(regs, &tb_ptr);
305
+ t2 = tci_read_r64(regs, &tb_ptr);
306
tci_write_reg(regs, t0, t1 + t2);
307
break;
308
case INDEX_op_sub_i64:
309
t0 = *tb_ptr++;
310
- t1 = tci_read_ri64(regs, &tb_ptr);
311
- t2 = tci_read_ri64(regs, &tb_ptr);
312
+ t1 = tci_read_r64(regs, &tb_ptr);
313
+ t2 = tci_read_r64(regs, &tb_ptr);
314
tci_write_reg(regs, t0, t1 - t2);
315
break;
316
case INDEX_op_mul_i64:
317
t0 = *tb_ptr++;
318
- t1 = tci_read_ri64(regs, &tb_ptr);
319
- t2 = tci_read_ri64(regs, &tb_ptr);
320
+ t1 = tci_read_r64(regs, &tb_ptr);
321
+ t2 = tci_read_r64(regs, &tb_ptr);
322
tci_write_reg(regs, t0, t1 * t2);
323
break;
324
case INDEX_op_div_i64:
325
t0 = *tb_ptr++;
326
- t1 = tci_read_ri64(regs, &tb_ptr);
327
- t2 = tci_read_ri64(regs, &tb_ptr);
328
+ t1 = tci_read_r64(regs, &tb_ptr);
329
+ t2 = tci_read_r64(regs, &tb_ptr);
330
tci_write_reg(regs, t0, (int64_t)t1 / (int64_t)t2);
331
break;
332
case INDEX_op_divu_i64:
333
t0 = *tb_ptr++;
334
- t1 = tci_read_ri64(regs, &tb_ptr);
335
- t2 = tci_read_ri64(regs, &tb_ptr);
336
+ t1 = tci_read_r64(regs, &tb_ptr);
337
+ t2 = tci_read_r64(regs, &tb_ptr);
338
tci_write_reg(regs, t0, (uint64_t)t1 / (uint64_t)t2);
339
break;
340
case INDEX_op_rem_i64:
341
t0 = *tb_ptr++;
342
- t1 = tci_read_ri64(regs, &tb_ptr);
343
- t2 = tci_read_ri64(regs, &tb_ptr);
344
+ t1 = tci_read_r64(regs, &tb_ptr);
345
+ t2 = tci_read_r64(regs, &tb_ptr);
346
tci_write_reg(regs, t0, (int64_t)t1 % (int64_t)t2);
347
break;
348
case INDEX_op_remu_i64:
349
t0 = *tb_ptr++;
350
- t1 = tci_read_ri64(regs, &tb_ptr);
351
- t2 = tci_read_ri64(regs, &tb_ptr);
352
+ t1 = tci_read_r64(regs, &tb_ptr);
353
+ t2 = tci_read_r64(regs, &tb_ptr);
354
tci_write_reg(regs, t0, (uint64_t)t1 % (uint64_t)t2);
355
break;
356
case INDEX_op_and_i64:
357
t0 = *tb_ptr++;
358
- t1 = tci_read_ri64(regs, &tb_ptr);
359
- t2 = tci_read_ri64(regs, &tb_ptr);
360
+ t1 = tci_read_r64(regs, &tb_ptr);
361
+ t2 = tci_read_r64(regs, &tb_ptr);
362
tci_write_reg(regs, t0, t1 & t2);
363
break;
364
case INDEX_op_or_i64:
365
t0 = *tb_ptr++;
366
- t1 = tci_read_ri64(regs, &tb_ptr);
367
- t2 = tci_read_ri64(regs, &tb_ptr);
368
+ t1 = tci_read_r64(regs, &tb_ptr);
369
+ t2 = tci_read_r64(regs, &tb_ptr);
370
tci_write_reg(regs, t0, t1 | t2);
371
break;
372
case INDEX_op_xor_i64:
373
t0 = *tb_ptr++;
374
- t1 = tci_read_ri64(regs, &tb_ptr);
375
- t2 = tci_read_ri64(regs, &tb_ptr);
376
+ t1 = tci_read_r64(regs, &tb_ptr);
377
+ t2 = tci_read_r64(regs, &tb_ptr);
378
tci_write_reg(regs, t0, t1 ^ t2);
379
break;
380
381
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
382
383
case INDEX_op_shl_i64:
384
t0 = *tb_ptr++;
385
- t1 = tci_read_ri64(regs, &tb_ptr);
386
- t2 = tci_read_ri64(regs, &tb_ptr);
387
+ t1 = tci_read_r64(regs, &tb_ptr);
388
+ t2 = tci_read_r64(regs, &tb_ptr);
389
tci_write_reg(regs, t0, t1 << (t2 & 63));
390
break;
391
case INDEX_op_shr_i64:
392
t0 = *tb_ptr++;
393
- t1 = tci_read_ri64(regs, &tb_ptr);
394
- t2 = tci_read_ri64(regs, &tb_ptr);
395
+ t1 = tci_read_r64(regs, &tb_ptr);
396
+ t2 = tci_read_r64(regs, &tb_ptr);
397
tci_write_reg(regs, t0, t1 >> (t2 & 63));
398
break;
399
case INDEX_op_sar_i64:
400
t0 = *tb_ptr++;
401
- t1 = tci_read_ri64(regs, &tb_ptr);
402
- t2 = tci_read_ri64(regs, &tb_ptr);
403
+ t1 = tci_read_r64(regs, &tb_ptr);
404
+ t2 = tci_read_r64(regs, &tb_ptr);
405
tci_write_reg(regs, t0, ((int64_t)t1 >> (t2 & 63)));
406
break;
407
#if TCG_TARGET_HAS_rot_i64
408
case INDEX_op_rotl_i64:
409
t0 = *tb_ptr++;
410
- t1 = tci_read_ri64(regs, &tb_ptr);
411
- t2 = tci_read_ri64(regs, &tb_ptr);
412
+ t1 = tci_read_r64(regs, &tb_ptr);
413
+ t2 = tci_read_r64(regs, &tb_ptr);
414
tci_write_reg(regs, t0, rol64(t1, t2 & 63));
415
break;
416
case INDEX_op_rotr_i64:
417
t0 = *tb_ptr++;
418
- t1 = tci_read_ri64(regs, &tb_ptr);
419
- t2 = tci_read_ri64(regs, &tb_ptr);
420
+ t1 = tci_read_r64(regs, &tb_ptr);
421
+ t2 = tci_read_r64(regs, &tb_ptr);
422
tci_write_reg(regs, t0, ror64(t1, t2 & 63));
423
break;
424
#endif
425
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
426
#endif
427
case INDEX_op_brcond_i64:
428
t0 = tci_read_r64(regs, &tb_ptr);
429
- t1 = tci_read_ri64(regs, &tb_ptr);
430
+ t1 = tci_read_r64(regs, &tb_ptr);
431
condition = *tb_ptr++;
432
label = tci_read_label(&tb_ptr);
433
if (tci_compare64(t0, t1, condition)) {
434
diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc
435
index XXXXXXX..XXXXXXX 100644
436
--- a/tcg/tci/tcg-target.c.inc
437
+++ b/tcg/tci/tcg-target.c.inc
438
@@ -XXX,XX +XXX,XX @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op)
439
case INDEX_op_rem_i64:
440
case INDEX_op_remu_i32:
441
case INDEX_op_remu_i64:
442
- return C_O1_I2(r, r, r);
443
-
444
case INDEX_op_add_i32:
445
case INDEX_op_add_i64:
446
case INDEX_op_sub_i32:
447
@@ -XXX,XX +XXX,XX @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op)
448
case INDEX_op_rotl_i64:
449
case INDEX_op_rotr_i32:
450
case INDEX_op_rotr_i64:
451
- /* TODO: Does R, RI, RI result in faster code than R, R, RI? */
452
- return C_O1_I2(r, ri, ri);
453
+ case INDEX_op_setcond_i32:
454
+ case INDEX_op_setcond_i64:
455
+ return C_O1_I2(r, r, r);
456
457
case INDEX_op_deposit_i32:
458
case INDEX_op_deposit_i64:
459
@@ -XXX,XX +XXX,XX @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op)
460
461
case INDEX_op_brcond_i32:
462
case INDEX_op_brcond_i64:
463
- return C_O0_I2(r, ri);
464
-
465
- case INDEX_op_setcond_i32:
466
- case INDEX_op_setcond_i64:
467
- return C_O1_I2(r, r, ri);
468
+ return C_O0_I2(r, r);
469
470
#if TCG_TARGET_REG_BITS == 32
471
/* TODO: Support R, R, R, R, RI, RI? Will it be faster? */
472
@@ -XXX,XX +XXX,XX @@ static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op)
473
case INDEX_op_sub2_i32:
474
return C_O2_I4(r, r, r, r, r, r);
475
case INDEX_op_brcond2_i32:
476
- return C_O0_I4(r, r, ri, ri);
477
+ return C_O0_I4(r, r, r, r);
478
case INDEX_op_mulu2_i32:
479
return C_O2_I2(r, r, r, r);
480
case INDEX_op_setcond2_i32:
481
- return C_O1_I4(r, r, r, ri, ri);
482
+ return C_O1_I4(r, r, r, r, r);
483
#endif
484
485
case INDEX_op_qemu_ld_i32:
486
@@ -XXX,XX +XXX,XX @@ static void tcg_out_r(TCGContext *s, TCGArg t0)
487
tcg_out8(s, t0);
488
}
489
490
-/* Write register or constant (native size). */
491
-static void tcg_out_ri(TCGContext *s, int const_arg, TCGArg arg)
492
-{
493
- if (const_arg) {
494
- tcg_debug_assert(const_arg == 1);
495
- tcg_out8(s, TCG_CONST);
496
- tcg_out_i(s, arg);
497
- } else {
498
- tcg_out_r(s, arg);
499
- }
500
-}
95
-}
501
-
96
-
502
-/* Write register or constant (32 bit). */
97
-static inline uint32_t glue(lduw_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
503
-static void tcg_out_ri32(TCGContext *s, int const_arg, TCGArg arg)
504
-{
98
-{
505
- if (const_arg) {
99
- return glue(address_space_lduw_be, SUFFIX)(ARG1, addr,
506
- tcg_debug_assert(const_arg == 1);
100
- MEMTXATTRS_UNSPECIFIED, NULL);
507
- tcg_out8(s, TCG_CONST);
508
- tcg_out32(s, arg);
509
- } else {
510
- tcg_out_r(s, arg);
511
- }
512
-}
101
-}
513
-
102
-
514
-#if TCG_TARGET_REG_BITS == 64
103
-static inline void glue(stl_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
515
-/* Write register or constant (64 bit). */
516
-static void tcg_out_ri64(TCGContext *s, int const_arg, TCGArg arg)
517
-{
104
-{
518
- if (const_arg) {
105
- glue(address_space_stl_le, SUFFIX)(ARG1, addr, val,
519
- tcg_debug_assert(const_arg == 1);
106
- MEMTXATTRS_UNSPECIFIED, NULL);
520
- tcg_out8(s, TCG_CONST);
521
- tcg_out64(s, arg);
522
- } else {
523
- tcg_out_r(s, arg);
524
- }
525
-}
107
-}
526
-#endif
527
-
108
-
528
/* Write label. */
109
-static inline void glue(stl_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
529
static void tci_out_label(TCGContext *s, TCGLabel *label)
110
-{
111
- glue(address_space_stl_be, SUFFIX)(ARG1, addr, val,
112
- MEMTXATTRS_UNSPECIFIED, NULL);
113
-}
114
-
115
static inline void glue(stb_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
530
{
116
{
531
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_call(TCGContext *s, const tcg_insn_unit *arg)
117
glue(address_space_stb, SUFFIX)(ARG1, addr, val,
118
@@ -XXX,XX +XXX,XX @@ static inline void glue(stw_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t va
119
MEMTXATTRS_UNSPECIFIED, NULL);
120
}
121
122
+static inline void glue(stl_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
123
+{
124
+ glue(address_space_stl_le, SUFFIX)(ARG1, addr, val,
125
+ MEMTXATTRS_UNSPECIFIED, NULL);
126
+}
127
+
128
+static inline void glue(stl_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
129
+{
130
+ glue(address_space_stl_be, SUFFIX)(ARG1, addr, val,
131
+ MEMTXATTRS_UNSPECIFIED, NULL);
132
+}
133
+
134
static inline void glue(stq_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val)
532
{
135
{
533
uint8_t *old_code_ptr = s->code_ptr;
136
glue(address_space_stq_le, SUFFIX)(ARG1, addr, val,
534
tcg_out_op_t(s, INDEX_op_call);
535
- tcg_out_ri(s, 1, (uintptr_t)arg);
536
+ tcg_out_i(s, (uintptr_t)arg);
537
old_code_ptr[1] = s->code_ptr - old_code_ptr;
538
}
539
540
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,
541
case INDEX_op_setcond_i32:
542
tcg_out_r(s, args[0]);
543
tcg_out_r(s, args[1]);
544
- tcg_out_ri32(s, const_args[2], args[2]);
545
+ tcg_out_r(s, args[2]);
546
tcg_out8(s, args[3]); /* condition */
547
break;
548
#if TCG_TARGET_REG_BITS == 32
549
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,
550
tcg_out_r(s, args[0]);
551
tcg_out_r(s, args[1]);
552
tcg_out_r(s, args[2]);
553
- tcg_out_ri32(s, const_args[3], args[3]);
554
- tcg_out_ri32(s, const_args[4], args[4]);
555
+ tcg_out_r(s, args[3]);
556
+ tcg_out_r(s, args[4]);
557
tcg_out8(s, args[5]); /* condition */
558
break;
559
#elif TCG_TARGET_REG_BITS == 64
560
case INDEX_op_setcond_i64:
561
tcg_out_r(s, args[0]);
562
tcg_out_r(s, args[1]);
563
- tcg_out_ri64(s, const_args[2], args[2]);
564
+ tcg_out_r(s, args[2]);
565
tcg_out8(s, args[3]); /* condition */
566
break;
567
#endif
568
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,
569
case INDEX_op_rotl_i32: /* Optional (TCG_TARGET_HAS_rot_i32). */
570
case INDEX_op_rotr_i32: /* Optional (TCG_TARGET_HAS_rot_i32). */
571
tcg_out_r(s, args[0]);
572
- tcg_out_ri32(s, const_args[1], args[1]);
573
- tcg_out_ri32(s, const_args[2], args[2]);
574
+ tcg_out_r(s, args[1]);
575
+ tcg_out_r(s, args[2]);
576
break;
577
case INDEX_op_deposit_i32: /* Optional (TCG_TARGET_HAS_deposit_i32). */
578
tcg_out_r(s, args[0]);
579
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,
580
case INDEX_op_rem_i64: /* Optional (TCG_TARGET_HAS_div_i64). */
581
case INDEX_op_remu_i64: /* Optional (TCG_TARGET_HAS_div_i64). */
582
tcg_out_r(s, args[0]);
583
- tcg_out_ri64(s, const_args[1], args[1]);
584
- tcg_out_ri64(s, const_args[2], args[2]);
585
+ tcg_out_r(s, args[1]);
586
+ tcg_out_r(s, args[2]);
587
break;
588
case INDEX_op_deposit_i64: /* Optional (TCG_TARGET_HAS_deposit_i64). */
589
tcg_out_r(s, args[0]);
590
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,
591
break;
592
case INDEX_op_brcond_i64:
593
tcg_out_r(s, args[0]);
594
- tcg_out_ri64(s, const_args[1], args[1]);
595
+ tcg_out_r(s, args[1]);
596
tcg_out8(s, args[2]); /* condition */
597
tci_out_label(s, arg_label(args[3]));
598
break;
599
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,
600
case INDEX_op_rem_i32: /* Optional (TCG_TARGET_HAS_div_i32). */
601
case INDEX_op_remu_i32: /* Optional (TCG_TARGET_HAS_div_i32). */
602
tcg_out_r(s, args[0]);
603
- tcg_out_ri32(s, const_args[1], args[1]);
604
- tcg_out_ri32(s, const_args[2], args[2]);
605
+ tcg_out_r(s, args[1]);
606
+ tcg_out_r(s, args[2]);
607
break;
608
#if TCG_TARGET_REG_BITS == 32
609
case INDEX_op_add2_i32:
610
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,
611
case INDEX_op_brcond2_i32:
612
tcg_out_r(s, args[0]);
613
tcg_out_r(s, args[1]);
614
- tcg_out_ri32(s, const_args[2], args[2]);
615
- tcg_out_ri32(s, const_args[3], args[3]);
616
+ tcg_out_r(s, args[2]);
617
+ tcg_out_r(s, args[3]);
618
tcg_out8(s, args[4]); /* condition */
619
tci_out_label(s, arg_label(args[5]));
620
break;
621
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,
622
#endif
623
case INDEX_op_brcond_i32:
624
tcg_out_r(s, args[0]);
625
- tcg_out_ri32(s, const_args[1], args[1]);
626
+ tcg_out_r(s, args[1]);
627
tcg_out8(s, args[2]); /* condition */
628
tci_out_label(s, arg_label(args[3]));
629
break;
630
--
137
--
631
2.25.1
138
2.25.1
632
139
633
140
diff view generated by jsdifflib
1
From: Claudio Fontana <cfontana@suse.de>
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
2
3
This will allow us to centralize the registration of
3
Use uint8_t for (unsigned) byte, and uint16_t for (unsigned)
4
the cpus.c module accelerator operations (in accel/accel-softmmu.c),
4
16-bit word.
5
and trigger it automatically using object hierarchy lookup from the
6
new accel_init_interfaces() initialization step, depending just on
7
which accelerators are available in the code.
8
5
9
Rename all tcg-cpus.c, kvm-cpus.c, etc to tcg-accel-ops.c,
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
10
kvm-accel-ops.c, etc, matching the object type names.
7
Message-Id: <20210518183655.1711377-4-philmd@redhat.com>
11
12
Signed-off-by: Claudio Fontana <cfontana@suse.de>
13
Message-Id: <20210204163931.7358-18-cfontana@suse.de>
14
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
15
---
9
---
16
accel/accel-softmmu.h | 15 ++++++
10
include/exec/memory_ldst.h.inc | 16 ++++++++--------
17
accel/kvm/kvm-cpus.h | 2 -
11
memory_ldst.c.inc | 20 ++++++++++----------
18
...g-cpus-icount.h => tcg-accel-ops-icount.h} | 2 +
12
2 files changed, 18 insertions(+), 18 deletions(-)
19
accel/tcg/tcg-accel-ops-mttcg.h | 19 ++++++++
20
.../tcg/{tcg-cpus-rr.h => tcg-accel-ops-rr.h} | 0
21
accel/tcg/{tcg-cpus.h => tcg-accel-ops.h} | 6 +--
22
include/qemu/accel.h | 2 +
23
include/sysemu/accel-ops.h | 45 ++++++++++++++++++
24
include/sysemu/cpus.h | 26 ++--------
25
.../i386/hax/{hax-cpus.h => hax-accel-ops.h} | 2 -
26
target/i386/hax/hax-windows.h | 2 +-
27
.../i386/hvf/{hvf-cpus.h => hvf-accel-ops.h} | 2 -
28
.../whpx/{whpx-cpus.h => whpx-accel-ops.h} | 2 -
29
accel/accel-common.c | 11 +++++
30
accel/accel-softmmu.c | 44 +++++++++++++++--
31
accel/kvm/{kvm-cpus.c => kvm-accel-ops.c} | 28 ++++++++---
32
accel/kvm/kvm-all.c | 2 -
33
accel/qtest/qtest.c | 23 ++++++---
34
...g-cpus-icount.c => tcg-accel-ops-icount.c} | 21 +++------
35
...tcg-cpus-mttcg.c => tcg-accel-ops-mttcg.c} | 14 ++----
36
.../tcg/{tcg-cpus-rr.c => tcg-accel-ops-rr.c} | 13 ++---
37
accel/tcg/{tcg-cpus.c => tcg-accel-ops.c} | 47 ++++++++++++++++++-
38
accel/tcg/tcg-all.c | 12 -----
39
accel/xen/xen-all.c | 24 ++++++----
40
bsd-user/main.c | 3 +-
41
linux-user/main.c | 1 +
42
softmmu/cpus.c | 12 ++---
43
softmmu/vl.c | 7 ++-
44
.../i386/hax/{hax-cpus.c => hax-accel-ops.c} | 33 +++++++++----
45
target/i386/hax/hax-all.c | 5 +-
46
target/i386/hax/hax-mem.c | 2 +-
47
target/i386/hax/hax-posix.c | 2 +-
48
target/i386/hax/hax-windows.c | 2 +-
49
.../i386/hvf/{hvf-cpus.c => hvf-accel-ops.c} | 29 +++++++++---
50
target/i386/hvf/hvf.c | 3 +-
51
target/i386/hvf/x86hvf.c | 2 +-
52
.../whpx/{whpx-cpus.c => whpx-accel-ops.c} | 33 +++++++++----
53
target/i386/whpx/whpx-all.c | 7 +--
54
MAINTAINERS | 3 +-
55
accel/kvm/meson.build | 2 +-
56
accel/tcg/meson.build | 8 ++--
57
target/i386/hax/meson.build | 2 +-
58
target/i386/hvf/meson.build | 2 +-
59
target/i386/whpx/meson.build | 2 +-
60
44 files changed, 361 insertions(+), 163 deletions(-)
61
create mode 100644 accel/accel-softmmu.h
62
rename accel/tcg/{tcg-cpus-icount.h => tcg-accel-ops-icount.h} (88%)
63
create mode 100644 accel/tcg/tcg-accel-ops-mttcg.h
64
rename accel/tcg/{tcg-cpus-rr.h => tcg-accel-ops-rr.h} (100%)
65
rename accel/tcg/{tcg-cpus.h => tcg-accel-ops.h} (72%)
66
create mode 100644 include/sysemu/accel-ops.h
67
rename target/i386/hax/{hax-cpus.h => hax-accel-ops.h} (95%)
68
rename target/i386/hvf/{hvf-cpus.h => hvf-accel-ops.h} (94%)
69
rename target/i386/whpx/{whpx-cpus.h => whpx-accel-ops.h} (96%)
70
rename accel/kvm/{kvm-cpus.c => kvm-accel-ops.c} (72%)
71
rename accel/tcg/{tcg-cpus-icount.c => tcg-accel-ops-icount.c} (89%)
72
rename accel/tcg/{tcg-cpus-mttcg.c => tcg-accel-ops-mttcg.c} (92%)
73
rename accel/tcg/{tcg-cpus-rr.c => tcg-accel-ops-rr.c} (97%)
74
rename accel/tcg/{tcg-cpus.c => tcg-accel-ops.c} (63%)
75
rename target/i386/hax/{hax-cpus.c => hax-accel-ops.c} (69%)
76
rename target/i386/hvf/{hvf-cpus.c => hvf-accel-ops.c} (84%)
77
rename target/i386/whpx/{whpx-cpus.c => whpx-accel-ops.c} (71%)
78
13
79
diff --git a/accel/accel-softmmu.h b/accel/accel-softmmu.h
14
diff --git a/include/exec/memory_ldst.h.inc b/include/exec/memory_ldst.h.inc
80
new file mode 100644
15
index XXXXXXX..XXXXXXX 100644
81
index XXXXXXX..XXXXXXX
16
--- a/include/exec/memory_ldst.h.inc
82
--- /dev/null
17
+++ b/include/exec/memory_ldst.h.inc
83
+++ b/accel/accel-softmmu.h
84
@@ -XXX,XX +XXX,XX @@
18
@@ -XXX,XX +XXX,XX @@
85
+/*
19
*/
86
+ * QEMU System Emulation accel internal functions
20
87
+ *
21
#ifdef TARGET_ENDIANNESS
88
+ * Copyright 2021 SUSE LLC
22
-extern uint32_t glue(address_space_lduw, SUFFIX)(ARG1_DECL,
89
+ *
23
+extern uint16_t glue(address_space_lduw, SUFFIX)(ARG1_DECL,
90
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
24
hwaddr addr, MemTxAttrs attrs, MemTxResult *result);
91
+ * See the COPYING file in the top-level directory.
25
extern uint32_t glue(address_space_ldl, SUFFIX)(ARG1_DECL,
92
+ */
26
hwaddr addr, MemTxAttrs attrs, MemTxResult *result);
93
+
27
@@ -XXX,XX +XXX,XX @@ extern uint64_t glue(address_space_ldq, SUFFIX)(ARG1_DECL,
94
+#ifndef ACCEL_SOFTMMU_H
28
extern void glue(address_space_stl_notdirty, SUFFIX)(ARG1_DECL,
95
+#define ACCEL_SOFTMMU_H
29
hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result);
96
+
30
extern void glue(address_space_stw, SUFFIX)(ARG1_DECL,
97
+void accel_init_ops_interfaces(AccelClass *ac);
31
- hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result);
98
+
32
+ hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result);
99
+#endif /* ACCEL_SOFTMMU_H */
33
extern void glue(address_space_stl, SUFFIX)(ARG1_DECL,
100
diff --git a/accel/kvm/kvm-cpus.h b/accel/kvm/kvm-cpus.h
34
hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result);
35
extern void glue(address_space_stq, SUFFIX)(ARG1_DECL,
36
hwaddr addr, uint64_t val, MemTxAttrs attrs, MemTxResult *result);
37
#else
38
-extern uint32_t glue(address_space_ldub, SUFFIX)(ARG1_DECL,
39
+extern uint8_t glue(address_space_ldub, SUFFIX)(ARG1_DECL,
40
hwaddr addr, MemTxAttrs attrs, MemTxResult *result);
41
-extern uint32_t glue(address_space_lduw_le, SUFFIX)(ARG1_DECL,
42
+extern uint16_t glue(address_space_lduw_le, SUFFIX)(ARG1_DECL,
43
hwaddr addr, MemTxAttrs attrs, MemTxResult *result);
44
-extern uint32_t glue(address_space_lduw_be, SUFFIX)(ARG1_DECL,
45
+extern uint16_t glue(address_space_lduw_be, SUFFIX)(ARG1_DECL,
46
hwaddr addr, MemTxAttrs attrs, MemTxResult *result);
47
extern uint32_t glue(address_space_ldl_le, SUFFIX)(ARG1_DECL,
48
hwaddr addr, MemTxAttrs attrs, MemTxResult *result);
49
@@ -XXX,XX +XXX,XX @@ extern uint64_t glue(address_space_ldq_le, SUFFIX)(ARG1_DECL,
50
extern uint64_t glue(address_space_ldq_be, SUFFIX)(ARG1_DECL,
51
hwaddr addr, MemTxAttrs attrs, MemTxResult *result);
52
extern void glue(address_space_stb, SUFFIX)(ARG1_DECL,
53
- hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result);
54
+ hwaddr addr, uint8_t val, MemTxAttrs attrs, MemTxResult *result);
55
extern void glue(address_space_stw_le, SUFFIX)(ARG1_DECL,
56
- hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result);
57
+ hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result);
58
extern void glue(address_space_stw_be, SUFFIX)(ARG1_DECL,
59
- hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result);
60
+ hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result);
61
extern void glue(address_space_stl_le, SUFFIX)(ARG1_DECL,
62
hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result);
63
extern void glue(address_space_stl_be, SUFFIX)(ARG1_DECL,
64
diff --git a/memory_ldst.c.inc b/memory_ldst.c.inc
101
index XXXXXXX..XXXXXXX 100644
65
index XXXXXXX..XXXXXXX 100644
102
--- a/accel/kvm/kvm-cpus.h
66
--- a/memory_ldst.c.inc
103
+++ b/accel/kvm/kvm-cpus.h
67
+++ b/memory_ldst.c.inc
104
@@ -XXX,XX +XXX,XX @@
68
@@ -XXX,XX +XXX,XX @@ uint64_t glue(address_space_ldq_be, SUFFIX)(ARG1_DECL,
105
69
DEVICE_BIG_ENDIAN);
106
#include "sysemu/cpus.h"
107
108
-extern const CpusAccel kvm_cpus;
109
-
110
int kvm_init_vcpu(CPUState *cpu, Error **errp);
111
int kvm_cpu_exec(CPUState *cpu);
112
void kvm_destroy_vcpu(CPUState *cpu);
113
diff --git a/accel/tcg/tcg-cpus-icount.h b/accel/tcg/tcg-accel-ops-icount.h
114
similarity index 88%
115
rename from accel/tcg/tcg-cpus-icount.h
116
rename to accel/tcg/tcg-accel-ops-icount.h
117
index XXXXXXX..XXXXXXX 100644
118
--- a/accel/tcg/tcg-cpus-icount.h
119
+++ b/accel/tcg/tcg-accel-ops-icount.h
120
@@ -XXX,XX +XXX,XX @@ void icount_handle_deadline(void);
121
void icount_prepare_for_run(CPUState *cpu);
122
void icount_process_data(CPUState *cpu);
123
124
+void icount_handle_interrupt(CPUState *cpu, int mask);
125
+
126
#endif /* TCG_CPUS_ICOUNT_H */
127
diff --git a/accel/tcg/tcg-accel-ops-mttcg.h b/accel/tcg/tcg-accel-ops-mttcg.h
128
new file mode 100644
129
index XXXXXXX..XXXXXXX
130
--- /dev/null
131
+++ b/accel/tcg/tcg-accel-ops-mttcg.h
132
@@ -XXX,XX +XXX,XX @@
133
+/*
134
+ * QEMU TCG Multi Threaded vCPUs implementation
135
+ *
136
+ * Copyright 2021 SUSE LLC
137
+ *
138
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
139
+ * See the COPYING file in the top-level directory.
140
+ */
141
+
142
+#ifndef TCG_CPUS_MTTCG_H
143
+#define TCG_CPUS_MTTCG_H
144
+
145
+/* kick MTTCG vCPU thread */
146
+void mttcg_kick_vcpu_thread(CPUState *cpu);
147
+
148
+/* start an mttcg vCPU thread */
149
+void mttcg_start_vcpu_thread(CPUState *cpu);
150
+
151
+#endif /* TCG_CPUS_MTTCG_H */
152
diff --git a/accel/tcg/tcg-cpus-rr.h b/accel/tcg/tcg-accel-ops-rr.h
153
similarity index 100%
154
rename from accel/tcg/tcg-cpus-rr.h
155
rename to accel/tcg/tcg-accel-ops-rr.h
156
diff --git a/accel/tcg/tcg-cpus.h b/accel/tcg/tcg-accel-ops.h
157
similarity index 72%
158
rename from accel/tcg/tcg-cpus.h
159
rename to accel/tcg/tcg-accel-ops.h
160
index XXXXXXX..XXXXXXX 100644
161
--- a/accel/tcg/tcg-cpus.h
162
+++ b/accel/tcg/tcg-accel-ops.h
163
@@ -XXX,XX +XXX,XX @@
164
165
#include "sysemu/cpus.h"
166
167
-extern const CpusAccel tcg_cpus_mttcg;
168
-extern const CpusAccel tcg_cpus_icount;
169
-extern const CpusAccel tcg_cpus_rr;
170
-
171
void tcg_cpus_destroy(CPUState *cpu);
172
int tcg_cpus_exec(CPUState *cpu);
173
-void tcg_cpus_handle_interrupt(CPUState *cpu, int mask);
174
+void tcg_handle_interrupt(CPUState *cpu, int mask);
175
176
#endif /* TCG_CPUS_H */
177
diff --git a/include/qemu/accel.h b/include/qemu/accel.h
178
index XXXXXXX..XXXXXXX 100644
179
--- a/include/qemu/accel.h
180
+++ b/include/qemu/accel.h
181
@@ -XXX,XX +XXX,XX @@ typedef struct AccelClass {
182
AccelClass *accel_find(const char *opt_name);
183
AccelState *current_accel(void);
184
185
+void accel_init_interfaces(AccelClass *ac);
186
+
187
#ifndef CONFIG_USER_ONLY
188
int accel_init_machine(AccelState *accel, MachineState *ms);
189
190
diff --git a/include/sysemu/accel-ops.h b/include/sysemu/accel-ops.h
191
new file mode 100644
192
index XXXXXXX..XXXXXXX
193
--- /dev/null
194
+++ b/include/sysemu/accel-ops.h
195
@@ -XXX,XX +XXX,XX @@
196
+/*
197
+ * Accelerator OPS, used for cpus.c module
198
+ *
199
+ * Copyright 2021 SUSE LLC
200
+ *
201
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
202
+ * See the COPYING file in the top-level directory.
203
+ */
204
+
205
+#ifndef ACCEL_OPS_H
206
+#define ACCEL_OPS_H
207
+
208
+#include "qom/object.h"
209
+
210
+#define ACCEL_OPS_SUFFIX "-ops"
211
+#define TYPE_ACCEL_OPS "accel" ACCEL_OPS_SUFFIX
212
+#define ACCEL_OPS_NAME(name) (name "-" TYPE_ACCEL_OPS)
213
+
214
+typedef struct AccelOpsClass AccelOpsClass;
215
+DECLARE_CLASS_CHECKERS(AccelOpsClass, ACCEL_OPS, TYPE_ACCEL_OPS)
216
+
217
+/* cpus.c operations interface */
218
+struct AccelOpsClass {
219
+ /*< private >*/
220
+ ObjectClass parent_class;
221
+ /*< public >*/
222
+
223
+ /* initialization function called when accel is chosen */
224
+ void (*ops_init)(AccelOpsClass *ops);
225
+
226
+ void (*create_vcpu_thread)(CPUState *cpu); /* MANDATORY NON-NULL */
227
+ void (*kick_vcpu_thread)(CPUState *cpu);
228
+
229
+ void (*synchronize_post_reset)(CPUState *cpu);
230
+ void (*synchronize_post_init)(CPUState *cpu);
231
+ void (*synchronize_state)(CPUState *cpu);
232
+ void (*synchronize_pre_loadvm)(CPUState *cpu);
233
+
234
+ void (*handle_interrupt)(CPUState *cpu, int mask);
235
+
236
+ int64_t (*get_virtual_clock)(void);
237
+ int64_t (*get_elapsed_ticks)(void);
238
+};
239
+
240
+#endif /* ACCEL_OPS_H */
241
diff --git a/include/sysemu/cpus.h b/include/sysemu/cpus.h
242
index XXXXXXX..XXXXXXX 100644
243
--- a/include/sysemu/cpus.h
244
+++ b/include/sysemu/cpus.h
245
@@ -XXX,XX +XXX,XX @@
246
#define QEMU_CPUS_H
247
248
#include "qemu/timer.h"
249
+#include "sysemu/accel-ops.h"
250
251
-/* cpus.c */
252
+/* register accel-specific operations */
253
+void cpus_register_accel(const AccelOpsClass *i);
254
255
-/* CPU execution threads */
256
+/* accel/dummy-cpus.c */
257
258
-typedef struct CpusAccel {
259
- void (*create_vcpu_thread)(CPUState *cpu); /* MANDATORY */
260
- void (*kick_vcpu_thread)(CPUState *cpu);
261
-
262
- void (*synchronize_post_reset)(CPUState *cpu);
263
- void (*synchronize_post_init)(CPUState *cpu);
264
- void (*synchronize_state)(CPUState *cpu);
265
- void (*synchronize_pre_loadvm)(CPUState *cpu);
266
-
267
- void (*handle_interrupt)(CPUState *cpu, int mask);
268
-
269
- int64_t (*get_virtual_clock)(void);
270
- int64_t (*get_elapsed_ticks)(void);
271
-} CpusAccel;
272
-
273
-/* register accel-specific cpus interface implementation */
274
-void cpus_register_accel(const CpusAccel *i);
275
-
276
-/* Create a dummy vcpu for CpusAccel->create_vcpu_thread */
277
+/* Create a dummy vcpu for AccelOpsClass->create_vcpu_thread */
278
void dummy_start_vcpu_thread(CPUState *);
279
280
/* interface available for cpus accelerator threads */
281
diff --git a/target/i386/hax/hax-cpus.h b/target/i386/hax/hax-accel-ops.h
282
similarity index 95%
283
rename from target/i386/hax/hax-cpus.h
284
rename to target/i386/hax/hax-accel-ops.h
285
index XXXXXXX..XXXXXXX 100644
286
--- a/target/i386/hax/hax-cpus.h
287
+++ b/target/i386/hax/hax-accel-ops.h
288
@@ -XXX,XX +XXX,XX @@
289
290
#include "sysemu/cpus.h"
291
292
-extern const CpusAccel hax_cpus;
293
-
294
#include "hax-interface.h"
295
#include "hax-i386.h"
296
297
diff --git a/target/i386/hax/hax-windows.h b/target/i386/hax/hax-windows.h
298
index XXXXXXX..XXXXXXX 100644
299
--- a/target/i386/hax/hax-windows.h
300
+++ b/target/i386/hax/hax-windows.h
301
@@ -XXX,XX +XXX,XX @@
302
#include <winioctl.h>
303
#include <windef.h>
304
305
-#include "hax-cpus.h"
306
+#include "hax-accel-ops.h"
307
308
#define HAX_INVALID_FD INVALID_HANDLE_VALUE
309
310
diff --git a/target/i386/hvf/hvf-cpus.h b/target/i386/hvf/hvf-accel-ops.h
311
similarity index 94%
312
rename from target/i386/hvf/hvf-cpus.h
313
rename to target/i386/hvf/hvf-accel-ops.h
314
index XXXXXXX..XXXXXXX 100644
315
--- a/target/i386/hvf/hvf-cpus.h
316
+++ b/target/i386/hvf/hvf-accel-ops.h
317
@@ -XXX,XX +XXX,XX @@
318
319
#include "sysemu/cpus.h"
320
321
-extern const CpusAccel hvf_cpus;
322
-
323
int hvf_init_vcpu(CPUState *);
324
int hvf_vcpu_exec(CPUState *);
325
void hvf_cpu_synchronize_state(CPUState *);
326
diff --git a/target/i386/whpx/whpx-cpus.h b/target/i386/whpx/whpx-accel-ops.h
327
similarity index 96%
328
rename from target/i386/whpx/whpx-cpus.h
329
rename to target/i386/whpx/whpx-accel-ops.h
330
index XXXXXXX..XXXXXXX 100644
331
--- a/target/i386/whpx/whpx-cpus.h
332
+++ b/target/i386/whpx/whpx-accel-ops.h
333
@@ -XXX,XX +XXX,XX @@
334
335
#include "sysemu/cpus.h"
336
337
-extern const CpusAccel whpx_cpus;
338
-
339
int whpx_init_vcpu(CPUState *cpu);
340
int whpx_vcpu_exec(CPUState *cpu);
341
void whpx_destroy_vcpu(CPUState *cpu);
342
diff --git a/accel/accel-common.c b/accel/accel-common.c
343
index XXXXXXX..XXXXXXX 100644
344
--- a/accel/accel-common.c
345
+++ b/accel/accel-common.c
346
@@ -XXX,XX +XXX,XX @@
347
#include "qemu/osdep.h"
348
#include "qemu/accel.h"
349
350
+#ifndef CONFIG_USER_ONLY
351
+#include "accel-softmmu.h"
352
+#endif /* !CONFIG_USER_ONLY */
353
+
354
static const TypeInfo accel_type = {
355
.name = TYPE_ACCEL,
356
.parent = TYPE_OBJECT,
357
@@ -XXX,XX +XXX,XX @@ AccelClass *accel_find(const char *opt_name)
358
return ac;
359
}
70
}
360
71
361
+void accel_init_interfaces(AccelClass *ac)
72
-uint32_t glue(address_space_ldub, SUFFIX)(ARG1_DECL,
362
+{
73
+uint8_t glue(address_space_ldub, SUFFIX)(ARG1_DECL,
363
+#ifndef CONFIG_USER_ONLY
74
hwaddr addr, MemTxAttrs attrs, MemTxResult *result)
364
+ accel_init_ops_interfaces(ac);
365
+#endif /* !CONFIG_USER_ONLY */
366
+}
367
+
368
static void register_accel_types(void)
369
{
75
{
370
type_register_static(&accel_type);
76
uint8_t *ptr;
371
diff --git a/accel/accel-softmmu.c b/accel/accel-softmmu.c
77
@@ -XXX,XX +XXX,XX @@ uint32_t glue(address_space_ldub, SUFFIX)(ARG1_DECL,
372
index XXXXXXX..XXXXXXX 100644
78
}
373
--- a/accel/accel-softmmu.c
79
374
+++ b/accel/accel-softmmu.c
80
/* warning: addr must be aligned */
375
@@ -XXX,XX +XXX,XX @@
81
-static inline uint32_t glue(address_space_lduw_internal, SUFFIX)(ARG1_DECL,
376
#include "qemu/osdep.h"
82
+static inline uint16_t glue(address_space_lduw_internal, SUFFIX)(ARG1_DECL,
377
#include "qemu/accel.h"
83
hwaddr addr, MemTxAttrs attrs, MemTxResult *result,
378
#include "hw/boards.h"
84
enum device_endian endian)
379
-#include "sysemu/arch_init.h"
380
-#include "sysemu/sysemu.h"
381
-#include "qom/object.h"
382
+#include "sysemu/cpus.h"
383
+
384
+#include "accel-softmmu.h"
385
386
int accel_init_machine(AccelState *accel, MachineState *ms)
387
{
85
{
388
@@ -XXX,XX +XXX,XX @@ void accel_setup_post(MachineState *ms)
86
@@ -XXX,XX +XXX,XX @@ static inline uint32_t glue(address_space_lduw_internal, SUFFIX)(ARG1_DECL,
389
acc->setup_post(ms, accel);
87
return val;
390
}
391
}
88
}
392
+
89
393
+/* initialize the arch-independent accel operation interfaces */
90
-uint32_t glue(address_space_lduw, SUFFIX)(ARG1_DECL,
394
+void accel_init_ops_interfaces(AccelClass *ac)
91
+uint16_t glue(address_space_lduw, SUFFIX)(ARG1_DECL,
395
+{
92
hwaddr addr, MemTxAttrs attrs, MemTxResult *result)
396
+ const char *ac_name;
93
{
397
+ char *ops_name;
94
return glue(address_space_lduw_internal, SUFFIX)(ARG1, addr, attrs, result,
398
+ AccelOpsClass *ops;
95
DEVICE_NATIVE_ENDIAN);
399
+
400
+ ac_name = object_class_get_name(OBJECT_CLASS(ac));
401
+ g_assert(ac_name != NULL);
402
+
403
+ ops_name = g_strdup_printf("%s" ACCEL_OPS_SUFFIX, ac_name);
404
+ ops = ACCEL_OPS_CLASS(object_class_by_name(ops_name));
405
+ g_free(ops_name);
406
+
407
+ /*
408
+ * all accelerators need to define ops, providing at least a mandatory
409
+ * non-NULL create_vcpu_thread operation.
410
+ */
411
+ g_assert(ops != NULL);
412
+ if (ops->ops_init) {
413
+ ops->ops_init(ops);
414
+ }
415
+ cpus_register_accel(ops);
416
+}
417
+
418
+static const TypeInfo accel_ops_type_info = {
419
+ .name = TYPE_ACCEL_OPS,
420
+ .parent = TYPE_OBJECT,
421
+ .abstract = true,
422
+ .class_size = sizeof(AccelOpsClass),
423
+};
424
+
425
+static void accel_softmmu_register_types(void)
426
+{
427
+ type_register_static(&accel_ops_type_info);
428
+}
429
+type_init(accel_softmmu_register_types);
430
diff --git a/accel/kvm/kvm-cpus.c b/accel/kvm/kvm-accel-ops.c
431
similarity index 72%
432
rename from accel/kvm/kvm-cpus.c
433
rename to accel/kvm/kvm-accel-ops.c
434
index XXXXXXX..XXXXXXX 100644
435
--- a/accel/kvm/kvm-cpus.c
436
+++ b/accel/kvm/kvm-accel-ops.c
437
@@ -XXX,XX +XXX,XX @@ static void kvm_start_vcpu_thread(CPUState *cpu)
438
cpu, QEMU_THREAD_JOINABLE);
439
}
96
}
440
97
441
-const CpusAccel kvm_cpus = {
98
-uint32_t glue(address_space_lduw_le, SUFFIX)(ARG1_DECL,
442
- .create_vcpu_thread = kvm_start_vcpu_thread,
99
+uint16_t glue(address_space_lduw_le, SUFFIX)(ARG1_DECL,
443
+static void kvm_accel_ops_class_init(ObjectClass *oc, void *data)
100
hwaddr addr, MemTxAttrs attrs, MemTxResult *result)
444
+{
445
+ AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
446
447
- .synchronize_post_reset = kvm_cpu_synchronize_post_reset,
448
- .synchronize_post_init = kvm_cpu_synchronize_post_init,
449
- .synchronize_state = kvm_cpu_synchronize_state,
450
- .synchronize_pre_loadvm = kvm_cpu_synchronize_pre_loadvm,
451
+ ops->create_vcpu_thread = kvm_start_vcpu_thread;
452
+ ops->synchronize_post_reset = kvm_cpu_synchronize_post_reset;
453
+ ops->synchronize_post_init = kvm_cpu_synchronize_post_init;
454
+ ops->synchronize_state = kvm_cpu_synchronize_state;
455
+ ops->synchronize_pre_loadvm = kvm_cpu_synchronize_pre_loadvm;
456
+}
457
+
458
+static const TypeInfo kvm_accel_ops_type = {
459
+ .name = ACCEL_OPS_NAME("kvm"),
460
+
461
+ .parent = TYPE_ACCEL_OPS,
462
+ .class_init = kvm_accel_ops_class_init,
463
+ .abstract = true,
464
};
465
+
466
+static void kvm_accel_ops_register_types(void)
467
+{
468
+ type_register_static(&kvm_accel_ops_type);
469
+}
470
+type_init(kvm_accel_ops_register_types);
471
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
472
index XXXXXXX..XXXXXXX 100644
473
--- a/accel/kvm/kvm-all.c
474
+++ b/accel/kvm/kvm-all.c
475
@@ -XXX,XX +XXX,XX @@ static int kvm_init(MachineState *ms)
476
ret = ram_block_discard_disable(true);
477
assert(!ret);
478
}
479
-
480
- cpus_register_accel(&kvm_cpus);
481
return 0;
482
483
err:
484
diff --git a/accel/qtest/qtest.c b/accel/qtest/qtest.c
485
index XXXXXXX..XXXXXXX 100644
486
--- a/accel/qtest/qtest.c
487
+++ b/accel/qtest/qtest.c
488
@@ -XXX,XX +XXX,XX @@
489
#include "qemu/main-loop.h"
490
#include "hw/core/cpu.h"
491
492
-const CpusAccel qtest_cpus = {
493
- .create_vcpu_thread = dummy_start_vcpu_thread,
494
- .get_virtual_clock = qtest_get_virtual_clock,
495
-};
496
-
497
static int qtest_init_accel(MachineState *ms)
498
{
101
{
499
- cpus_register_accel(&qtest_cpus);
102
return glue(address_space_lduw_internal, SUFFIX)(ARG1, addr, attrs, result,
500
return 0;
103
DEVICE_LITTLE_ENDIAN);
501
}
104
}
502
105
503
@@ -XXX,XX +XXX,XX @@ static const TypeInfo qtest_accel_type = {
106
-uint32_t glue(address_space_lduw_be, SUFFIX)(ARG1_DECL,
504
.class_init = qtest_accel_class_init,
107
+uint16_t glue(address_space_lduw_be, SUFFIX)(ARG1_DECL,
505
};
108
hwaddr addr, MemTxAttrs attrs, MemTxResult *result)
506
507
+static void qtest_accel_ops_class_init(ObjectClass *oc, void *data)
508
+{
509
+ AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
510
+
511
+ ops->create_vcpu_thread = dummy_start_vcpu_thread;
512
+ ops->get_virtual_clock = qtest_get_virtual_clock;
513
+};
514
+
515
+static const TypeInfo qtest_accel_ops_type = {
516
+ .name = ACCEL_OPS_NAME("qtest"),
517
+
518
+ .parent = TYPE_ACCEL_OPS,
519
+ .class_init = qtest_accel_ops_class_init,
520
+ .abstract = true,
521
+};
522
+
523
static void qtest_type_init(void)
524
{
109
{
525
type_register_static(&qtest_accel_type);
110
return glue(address_space_lduw_internal, SUFFIX)(ARG1, addr, attrs, result,
526
+ type_register_static(&qtest_accel_ops_type);
111
@@ -XXX,XX +XXX,XX @@ void glue(address_space_stl_be, SUFFIX)(ARG1_DECL,
527
}
112
}
528
113
529
type_init(qtest_type_init);
114
void glue(address_space_stb, SUFFIX)(ARG1_DECL,
530
diff --git a/accel/tcg/tcg-cpus-icount.c b/accel/tcg/tcg-accel-ops-icount.c
115
- hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result)
531
similarity index 89%
116
+ hwaddr addr, uint8_t val, MemTxAttrs attrs, MemTxResult *result)
532
rename from accel/tcg/tcg-cpus-icount.c
533
rename to accel/tcg/tcg-accel-ops-icount.c
534
index XXXXXXX..XXXXXXX 100644
535
--- a/accel/tcg/tcg-cpus-icount.c
536
+++ b/accel/tcg/tcg-accel-ops-icount.c
537
@@ -XXX,XX +XXX,XX @@
538
#include "exec/exec-all.h"
539
#include "hw/boards.h"
540
541
-#include "tcg-cpus.h"
542
-#include "tcg-cpus-icount.h"
543
-#include "tcg-cpus-rr.h"
544
+#include "tcg-accel-ops.h"
545
+#include "tcg-accel-ops-icount.h"
546
+#include "tcg-accel-ops-rr.h"
547
548
static int64_t icount_get_limit(void)
549
{
117
{
550
@@ -XXX,XX +XXX,XX @@ void icount_prepare_for_run(CPUState *cpu)
118
uint8_t *ptr;
551
/*
119
MemoryRegion *mr;
552
* These should always be cleared by icount_process_data after
120
@@ -XXX,XX +XXX,XX @@ void glue(address_space_stb, SUFFIX)(ARG1_DECL,
553
* each vCPU execution. However u16.high can be raised
121
554
- * asynchronously by cpu_exit/cpu_interrupt/tcg_cpus_handle_interrupt
122
/* warning: addr must be aligned */
555
+ * asynchronously by cpu_exit/cpu_interrupt/tcg_handle_interrupt
123
static inline void glue(address_space_stw_internal, SUFFIX)(ARG1_DECL,
556
*/
124
- hwaddr addr, uint32_t val, MemTxAttrs attrs,
557
g_assert(cpu_neg(cpu)->icount_decr.u16.low == 0);
125
+ hwaddr addr, uint16_t val, MemTxAttrs attrs,
558
g_assert(cpu->icount_extra == 0);
126
MemTxResult *result, enum device_endian endian)
559
@@ -XXX,XX +XXX,XX @@ void icount_process_data(CPUState *cpu)
127
{
560
replay_mutex_unlock();
128
uint8_t *ptr;
129
@@ -XXX,XX +XXX,XX @@ static inline void glue(address_space_stw_internal, SUFFIX)(ARG1_DECL,
561
}
130
}
562
131
563
-static void icount_handle_interrupt(CPUState *cpu, int mask)
132
void glue(address_space_stw, SUFFIX)(ARG1_DECL,
564
+void icount_handle_interrupt(CPUState *cpu, int mask)
133
- hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result)
134
+ hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result)
565
{
135
{
566
int old_mask = cpu->interrupt_request;
136
glue(address_space_stw_internal, SUFFIX)(ARG1, addr, val, attrs, result,
567
137
DEVICE_NATIVE_ENDIAN);
568
- tcg_cpus_handle_interrupt(cpu, mask);
569
+ tcg_handle_interrupt(cpu, mask);
570
if (qemu_cpu_is_self(cpu) &&
571
!cpu->can_do_io
572
&& (mask & ~old_mask) != 0) {
573
cpu_abort(cpu, "Raised interrupt while not in I/O function");
574
}
575
}
138
}
576
-
139
577
-const CpusAccel tcg_cpus_icount = {
140
void glue(address_space_stw_le, SUFFIX)(ARG1_DECL,
578
- .create_vcpu_thread = rr_start_vcpu_thread,
141
- hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result)
579
- .kick_vcpu_thread = rr_kick_vcpu_thread,
142
+ hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result)
580
-
143
{
581
- .handle_interrupt = icount_handle_interrupt,
144
glue(address_space_stw_internal, SUFFIX)(ARG1, addr, val, attrs, result,
582
- .get_virtual_clock = icount_get,
145
DEVICE_LITTLE_ENDIAN);
583
- .get_elapsed_ticks = icount_get,
584
-};
585
diff --git a/accel/tcg/tcg-cpus-mttcg.c b/accel/tcg/tcg-accel-ops-mttcg.c
586
similarity index 92%
587
rename from accel/tcg/tcg-cpus-mttcg.c
588
rename to accel/tcg/tcg-accel-ops-mttcg.c
589
index XXXXXXX..XXXXXXX 100644
590
--- a/accel/tcg/tcg-cpus-mttcg.c
591
+++ b/accel/tcg/tcg-accel-ops-mttcg.c
592
@@ -XXX,XX +XXX,XX @@
593
#include "exec/exec-all.h"
594
#include "hw/boards.h"
595
596
-#include "tcg-cpus.h"
597
+#include "tcg-accel-ops.h"
598
+#include "tcg-accel-ops-mttcg.h"
599
600
/*
601
* In the multi-threaded case each vCPU has its own thread. The TLS
602
@@ -XXX,XX +XXX,XX @@ static void *mttcg_cpu_thread_fn(void *arg)
603
return NULL;
604
}
146
}
605
147
606
-static void mttcg_kick_vcpu_thread(CPUState *cpu)
148
void glue(address_space_stw_be, SUFFIX)(ARG1_DECL,
607
+void mttcg_kick_vcpu_thread(CPUState *cpu)
149
- hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result)
150
+ hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result)
608
{
151
{
609
cpu_exit(cpu);
152
glue(address_space_stw_internal, SUFFIX)(ARG1, addr, val, attrs, result,
610
}
153
DEVICE_BIG_ENDIAN);
611
612
-static void mttcg_start_vcpu_thread(CPUState *cpu)
613
+void mttcg_start_vcpu_thread(CPUState *cpu)
614
{
615
char thread_name[VCPU_THREAD_NAME_SIZE];
616
617
@@ -XXX,XX +XXX,XX @@ static void mttcg_start_vcpu_thread(CPUState *cpu)
618
cpu->hThread = qemu_thread_get_handle(cpu->thread);
619
#endif
620
}
621
-
622
-const CpusAccel tcg_cpus_mttcg = {
623
- .create_vcpu_thread = mttcg_start_vcpu_thread,
624
- .kick_vcpu_thread = mttcg_kick_vcpu_thread,
625
-
626
- .handle_interrupt = tcg_cpus_handle_interrupt,
627
-};
628
diff --git a/accel/tcg/tcg-cpus-rr.c b/accel/tcg/tcg-accel-ops-rr.c
629
similarity index 97%
630
rename from accel/tcg/tcg-cpus-rr.c
631
rename to accel/tcg/tcg-accel-ops-rr.c
632
index XXXXXXX..XXXXXXX 100644
633
--- a/accel/tcg/tcg-cpus-rr.c
634
+++ b/accel/tcg/tcg-accel-ops-rr.c
635
@@ -XXX,XX +XXX,XX @@
636
#include "exec/exec-all.h"
637
#include "hw/boards.h"
638
639
-#include "tcg-cpus.h"
640
-#include "tcg-cpus-rr.h"
641
-#include "tcg-cpus-icount.h"
642
+#include "tcg-accel-ops.h"
643
+#include "tcg-accel-ops-rr.h"
644
+#include "tcg-accel-ops-icount.h"
645
646
/* Kick all RR vCPUs */
647
void rr_kick_vcpu_thread(CPUState *unused)
648
@@ -XXX,XX +XXX,XX @@ void rr_start_vcpu_thread(CPUState *cpu)
649
cpu->created = true;
650
}
651
}
652
-
653
-const CpusAccel tcg_cpus_rr = {
654
- .create_vcpu_thread = rr_start_vcpu_thread,
655
- .kick_vcpu_thread = rr_kick_vcpu_thread,
656
-
657
- .handle_interrupt = tcg_cpus_handle_interrupt,
658
-};
659
diff --git a/accel/tcg/tcg-cpus.c b/accel/tcg/tcg-accel-ops.c
660
similarity index 63%
661
rename from accel/tcg/tcg-cpus.c
662
rename to accel/tcg/tcg-accel-ops.c
663
index XXXXXXX..XXXXXXX 100644
664
--- a/accel/tcg/tcg-cpus.c
665
+++ b/accel/tcg/tcg-accel-ops.c
666
@@ -XXX,XX +XXX,XX @@
667
#include "exec/exec-all.h"
668
#include "hw/boards.h"
669
670
-#include "tcg-cpus.h"
671
+#include "tcg-accel-ops.h"
672
+#include "tcg-accel-ops-mttcg.h"
673
+#include "tcg-accel-ops-rr.h"
674
+#include "tcg-accel-ops-icount.h"
675
676
/* common functionality among all TCG variants */
677
678
@@ -XXX,XX +XXX,XX @@ int tcg_cpus_exec(CPUState *cpu)
679
}
680
681
/* mask must never be zero, except for A20 change call */
682
-void tcg_cpus_handle_interrupt(CPUState *cpu, int mask)
683
+void tcg_handle_interrupt(CPUState *cpu, int mask)
684
{
685
g_assert(qemu_mutex_iothread_locked());
686
687
@@ -XXX,XX +XXX,XX @@ void tcg_cpus_handle_interrupt(CPUState *cpu, int mask)
688
qatomic_set(&cpu_neg(cpu)->icount_decr.u16.high, -1);
689
}
690
}
691
+
692
+static void tcg_accel_ops_init(AccelOpsClass *ops)
693
+{
694
+ if (qemu_tcg_mttcg_enabled()) {
695
+ ops->create_vcpu_thread = mttcg_start_vcpu_thread;
696
+ ops->kick_vcpu_thread = mttcg_kick_vcpu_thread;
697
+ ops->handle_interrupt = tcg_handle_interrupt;
698
+ } else if (icount_enabled()) {
699
+ ops->create_vcpu_thread = rr_start_vcpu_thread;
700
+ ops->kick_vcpu_thread = rr_kick_vcpu_thread;
701
+ ops->handle_interrupt = icount_handle_interrupt;
702
+ ops->get_virtual_clock = icount_get;
703
+ ops->get_elapsed_ticks = icount_get;
704
+ } else {
705
+ ops->create_vcpu_thread = rr_start_vcpu_thread;
706
+ ops->kick_vcpu_thread = rr_kick_vcpu_thread;
707
+ ops->handle_interrupt = tcg_handle_interrupt;
708
+ }
709
+}
710
+
711
+static void tcg_accel_ops_class_init(ObjectClass *oc, void *data)
712
+{
713
+ AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
714
+
715
+ ops->ops_init = tcg_accel_ops_init;
716
+}
717
+
718
+static const TypeInfo tcg_accel_ops_type = {
719
+ .name = ACCEL_OPS_NAME("tcg"),
720
+
721
+ .parent = TYPE_ACCEL_OPS,
722
+ .class_init = tcg_accel_ops_class_init,
723
+ .abstract = true,
724
+};
725
+
726
+static void tcg_accel_ops_register_types(void)
727
+{
728
+ type_register_static(&tcg_accel_ops_type);
729
+}
730
+type_init(tcg_accel_ops_register_types);
731
diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c
732
index XXXXXXX..XXXXXXX 100644
733
--- a/accel/tcg/tcg-all.c
734
+++ b/accel/tcg/tcg-all.c
735
@@ -XXX,XX +XXX,XX @@
736
#include "qemu/accel.h"
737
#include "qapi/qapi-builtin-visit.h"
738
739
-#ifndef CONFIG_USER_ONLY
740
-#include "tcg-cpus.h"
741
-#endif /* CONFIG_USER_ONLY */
742
-
743
struct TCGState {
744
AccelState parent_obj;
745
746
@@ -XXX,XX +XXX,XX @@ static int tcg_init(MachineState *ms)
747
*/
748
#ifndef CONFIG_USER_ONLY
749
tcg_region_init();
750
-
751
- if (mttcg_enabled) {
752
- cpus_register_accel(&tcg_cpus_mttcg);
753
- } else if (icount_enabled()) {
754
- cpus_register_accel(&tcg_cpus_icount);
755
- } else {
756
- cpus_register_accel(&tcg_cpus_rr);
757
- }
758
#endif /* !CONFIG_USER_ONLY */
759
760
return 0;
761
diff --git a/accel/xen/xen-all.c b/accel/xen/xen-all.c
762
index XXXXXXX..XXXXXXX 100644
763
--- a/accel/xen/xen-all.c
764
+++ b/accel/xen/xen-all.c
765
@@ -XXX,XX +XXX,XX @@ static void xen_setup_post(MachineState *ms, AccelState *accel)
766
}
767
}
768
769
-const CpusAccel xen_cpus = {
770
- .create_vcpu_thread = dummy_start_vcpu_thread,
771
-};
772
-
773
static int xen_init(MachineState *ms)
774
{
775
MachineClass *mc = MACHINE_GET_CLASS(ms);
776
@@ -XXX,XX +XXX,XX @@ static int xen_init(MachineState *ms)
777
* opt out of system RAM being allocated by generic code
778
*/
779
mc->default_ram_id = NULL;
780
-
781
- cpus_register_accel(&xen_cpus);
782
-
783
return 0;
784
}
785
786
@@ -XXX,XX +XXX,XX @@ static const TypeInfo xen_accel_type = {
787
.class_init = xen_accel_class_init,
788
};
789
790
+static void xen_accel_ops_class_init(ObjectClass *oc, void *data)
791
+{
792
+ AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
793
+
794
+ ops->create_vcpu_thread = dummy_start_vcpu_thread;
795
+}
796
+
797
+static const TypeInfo xen_accel_ops_type = {
798
+ .name = ACCEL_OPS_NAME("xen"),
799
+
800
+ .parent = TYPE_ACCEL_OPS,
801
+ .class_init = xen_accel_ops_class_init,
802
+ .abstract = true,
803
+};
804
+
805
static void xen_type_init(void)
806
{
807
type_register_static(&xen_accel_type);
808
+ type_register_static(&xen_accel_ops_type);
809
}
810
-
811
type_init(xen_type_init);
812
diff --git a/bsd-user/main.c b/bsd-user/main.c
813
index XXXXXXX..XXXXXXX 100644
814
--- a/bsd-user/main.c
815
+++ b/bsd-user/main.c
816
@@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv)
817
#endif
818
}
819
820
+ cpu_type = parse_cpu_option(cpu_model);
821
/* init tcg before creating CPUs and to get qemu_host_page_size */
822
{
823
AccelClass *ac = ACCEL_GET_CLASS(current_accel());
824
825
ac->init_machine(NULL);
826
+ accel_init_interfaces(ac);
827
}
828
- cpu_type = parse_cpu_option(cpu_model);
829
cpu = cpu_create(cpu_type);
830
env = cpu->env_ptr;
831
#if defined(TARGET_SPARC) || defined(TARGET_PPC)
832
diff --git a/linux-user/main.c b/linux-user/main.c
833
index XXXXXXX..XXXXXXX 100644
834
--- a/linux-user/main.c
835
+++ b/linux-user/main.c
836
@@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv, char **envp)
837
AccelClass *ac = ACCEL_GET_CLASS(current_accel());
838
839
ac->init_machine(NULL);
840
+ accel_init_interfaces(ac);
841
}
842
cpu = cpu_create(cpu_type);
843
env = cpu->env_ptr;
844
diff --git a/softmmu/cpus.c b/softmmu/cpus.c
845
index XXXXXXX..XXXXXXX 100644
846
--- a/softmmu/cpus.c
847
+++ b/softmmu/cpus.c
848
@@ -XXX,XX +XXX,XX @@ void hw_error(const char *fmt, ...)
849
/*
850
* The chosen accelerator is supposed to register this.
851
*/
852
-static const CpusAccel *cpus_accel;
853
+static const AccelOpsClass *cpus_accel;
854
855
void cpu_synchronize_all_states(void)
856
{
857
@@ -XXX,XX +XXX,XX @@ void cpu_remove_sync(CPUState *cpu)
858
qemu_mutex_lock_iothread();
859
}
860
861
-void cpus_register_accel(const CpusAccel *ca)
862
+void cpus_register_accel(const AccelOpsClass *ops)
863
{
864
- assert(ca != NULL);
865
- assert(ca->create_vcpu_thread != NULL); /* mandatory */
866
- cpus_accel = ca;
867
+ assert(ops != NULL);
868
+ assert(ops->create_vcpu_thread != NULL); /* mandatory */
869
+ cpus_accel = ops;
870
}
871
872
void qemu_init_vcpu(CPUState *cpu)
873
@@ -XXX,XX +XXX,XX @@ void qemu_init_vcpu(CPUState *cpu)
874
cpu_address_space_init(cpu, 0, "cpu-memory", cpu->memory);
875
}
876
877
- /* accelerators all implement the CpusAccel interface */
878
+ /* accelerators all implement the AccelOpsClass */
879
g_assert(cpus_accel != NULL && cpus_accel->create_vcpu_thread != NULL);
880
cpus_accel->create_vcpu_thread(cpu);
881
882
diff --git a/softmmu/vl.c b/softmmu/vl.c
883
index XXXXXXX..XXXXXXX 100644
884
--- a/softmmu/vl.c
885
+++ b/softmmu/vl.c
886
@@ -XXX,XX +XXX,XX @@ static bool object_create_early(const char *type, QemuOpts *opts)
887
return false;
888
}
889
890
- /* Allocation of large amounts of memory may delay
891
+ /*
892
+ * Allocation of large amounts of memory may delay
893
* chardev initialization for too long, and trigger timeouts
894
* on software that waits for a monitor socket to be created
895
* (e.g. libvirt).
896
@@ -XXX,XX +XXX,XX @@ void qemu_init(int argc, char **argv, char **envp)
897
*
898
* Machine compat properties: object_set_machine_compat_props().
899
* Accelerator compat props: object_set_accelerator_compat_props(),
900
- * called from configure_accelerator().
901
+ * called from do_configure_accelerator().
902
*/
903
904
machine_class = MACHINE_GET_CLASS(current_machine);
905
@@ -XXX,XX +XXX,XX @@ void qemu_init(int argc, char **argv, char **envp)
906
if (cpu_option) {
907
current_machine->cpu_type = parse_cpu_option(cpu_option);
908
}
909
+ /* NB: for machine none cpu_type could STILL be NULL here! */
910
+ accel_init_interfaces(ACCEL_GET_CLASS(current_machine->accelerator));
911
912
qemu_resolve_machine_memdev();
913
parse_numa_opts(current_machine);
914
diff --git a/target/i386/hax/hax-cpus.c b/target/i386/hax/hax-accel-ops.c
915
similarity index 69%
916
rename from target/i386/hax/hax-cpus.c
917
rename to target/i386/hax/hax-accel-ops.c
918
index XXXXXXX..XXXXXXX 100644
919
--- a/target/i386/hax/hax-cpus.c
920
+++ b/target/i386/hax/hax-accel-ops.c
921
@@ -XXX,XX +XXX,XX @@
922
#include "sysemu/cpus.h"
923
#include "qemu/guest-random.h"
924
925
-#include "hax-cpus.h"
926
+#include "hax-accel-ops.h"
927
928
static void *hax_cpu_thread_fn(void *arg)
929
{
930
@@ -XXX,XX +XXX,XX @@ static void hax_start_vcpu_thread(CPUState *cpu)
931
#endif
932
}
933
934
-const CpusAccel hax_cpus = {
935
- .create_vcpu_thread = hax_start_vcpu_thread,
936
- .kick_vcpu_thread = hax_kick_vcpu_thread,
937
+static void hax_accel_ops_class_init(ObjectClass *oc, void *data)
938
+{
939
+ AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
940
941
- .synchronize_post_reset = hax_cpu_synchronize_post_reset,
942
- .synchronize_post_init = hax_cpu_synchronize_post_init,
943
- .synchronize_state = hax_cpu_synchronize_state,
944
- .synchronize_pre_loadvm = hax_cpu_synchronize_pre_loadvm,
945
+ ops->create_vcpu_thread = hax_start_vcpu_thread;
946
+ ops->kick_vcpu_thread = hax_kick_vcpu_thread;
947
+
948
+ ops->synchronize_post_reset = hax_cpu_synchronize_post_reset;
949
+ ops->synchronize_post_init = hax_cpu_synchronize_post_init;
950
+ ops->synchronize_state = hax_cpu_synchronize_state;
951
+ ops->synchronize_pre_loadvm = hax_cpu_synchronize_pre_loadvm;
952
+}
953
+
954
+static const TypeInfo hax_accel_ops_type = {
955
+ .name = ACCEL_OPS_NAME("hax"),
956
+
957
+ .parent = TYPE_ACCEL_OPS,
958
+ .class_init = hax_accel_ops_class_init,
959
+ .abstract = true,
960
};
961
+
962
+static void hax_accel_ops_register_types(void)
963
+{
964
+ type_register_static(&hax_accel_ops_type);
965
+}
966
+type_init(hax_accel_ops_register_types);
967
diff --git a/target/i386/hax/hax-all.c b/target/i386/hax/hax-all.c
968
index XXXXXXX..XXXXXXX 100644
969
--- a/target/i386/hax/hax-all.c
970
+++ b/target/i386/hax/hax-all.c
971
@@ -XXX,XX +XXX,XX @@
972
#include "sysemu/runstate.h"
973
#include "hw/boards.h"
974
975
-#include "hax-cpus.h"
976
+#include "hax-accel-ops.h"
977
978
#define DEBUG_HAX 0
979
980
@@ -XXX,XX +XXX,XX @@ static int hax_accel_init(MachineState *ms)
981
!ret ? "working" : "not working",
982
!ret ? "fast virt" : "emulation");
983
}
984
- if (ret == 0) {
985
- cpus_register_accel(&hax_cpus);
986
- }
987
return ret;
988
}
989
990
diff --git a/target/i386/hax/hax-mem.c b/target/i386/hax/hax-mem.c
991
index XXXXXXX..XXXXXXX 100644
992
--- a/target/i386/hax/hax-mem.c
993
+++ b/target/i386/hax/hax-mem.c
994
@@ -XXX,XX +XXX,XX @@
995
#include "exec/address-spaces.h"
996
#include "qemu/error-report.h"
997
998
-#include "hax-cpus.h"
999
+#include "hax-accel-ops.h"
1000
#include "qemu/queue.h"
1001
1002
#define DEBUG_HAX_MEM 0
1003
diff --git a/target/i386/hax/hax-posix.c b/target/i386/hax/hax-posix.c
1004
index XXXXXXX..XXXXXXX 100644
1005
--- a/target/i386/hax/hax-posix.c
1006
+++ b/target/i386/hax/hax-posix.c
1007
@@ -XXX,XX +XXX,XX @@
1008
#include <sys/ioctl.h>
1009
1010
#include "sysemu/cpus.h"
1011
-#include "hax-cpus.h"
1012
+#include "hax-accel-ops.h"
1013
1014
hax_fd hax_mod_open(void)
1015
{
1016
diff --git a/target/i386/hax/hax-windows.c b/target/i386/hax/hax-windows.c
1017
index XXXXXXX..XXXXXXX 100644
1018
--- a/target/i386/hax/hax-windows.c
1019
+++ b/target/i386/hax/hax-windows.c
1020
@@ -XXX,XX +XXX,XX @@
1021
1022
#include "qemu/osdep.h"
1023
#include "cpu.h"
1024
-#include "hax-cpus.h"
1025
+#include "hax-accel-ops.h"
1026
1027
/*
1028
* return 0 when success, -1 when driver not loaded,
1029
diff --git a/target/i386/hvf/hvf-cpus.c b/target/i386/hvf/hvf-accel-ops.c
1030
similarity index 84%
1031
rename from target/i386/hvf/hvf-cpus.c
1032
rename to target/i386/hvf/hvf-accel-ops.c
1033
index XXXXXXX..XXXXXXX 100644
1034
--- a/target/i386/hvf/hvf-cpus.c
1035
+++ b/target/i386/hvf/hvf-accel-ops.c
1036
@@ -XXX,XX +XXX,XX @@
1037
#include "target/i386/cpu.h"
1038
#include "qemu/guest-random.h"
1039
1040
-#include "hvf-cpus.h"
1041
+#include "hvf-accel-ops.h"
1042
1043
/*
1044
* The HVF-specific vCPU thread function. This one should only run when the host
1045
@@ -XXX,XX +XXX,XX @@ static void hvf_start_vcpu_thread(CPUState *cpu)
1046
cpu, QEMU_THREAD_JOINABLE);
1047
}
1048
1049
-const CpusAccel hvf_cpus = {
1050
- .create_vcpu_thread = hvf_start_vcpu_thread,
1051
+static void hvf_accel_ops_class_init(ObjectClass *oc, void *data)
1052
+{
1053
+ AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
1054
1055
- .synchronize_post_reset = hvf_cpu_synchronize_post_reset,
1056
- .synchronize_post_init = hvf_cpu_synchronize_post_init,
1057
- .synchronize_state = hvf_cpu_synchronize_state,
1058
- .synchronize_pre_loadvm = hvf_cpu_synchronize_pre_loadvm,
1059
+ ops->create_vcpu_thread = hvf_start_vcpu_thread;
1060
+
1061
+ ops->synchronize_post_reset = hvf_cpu_synchronize_post_reset;
1062
+ ops->synchronize_post_init = hvf_cpu_synchronize_post_init;
1063
+ ops->synchronize_state = hvf_cpu_synchronize_state;
1064
+ ops->synchronize_pre_loadvm = hvf_cpu_synchronize_pre_loadvm;
1065
};
1066
+static const TypeInfo hvf_accel_ops_type = {
1067
+ .name = ACCEL_OPS_NAME("hvf"),
1068
+
1069
+ .parent = TYPE_ACCEL_OPS,
1070
+ .class_init = hvf_accel_ops_class_init,
1071
+ .abstract = true,
1072
+};
1073
+static void hvf_accel_ops_register_types(void)
1074
+{
1075
+ type_register_static(&hvf_accel_ops_type);
1076
+}
1077
+type_init(hvf_accel_ops_register_types);
1078
diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c
1079
index XXXXXXX..XXXXXXX 100644
1080
--- a/target/i386/hvf/hvf.c
1081
+++ b/target/i386/hvf/hvf.c
1082
@@ -XXX,XX +XXX,XX @@
1083
#include "qemu/accel.h"
1084
#include "target/i386/cpu.h"
1085
1086
-#include "hvf-cpus.h"
1087
+#include "hvf-accel-ops.h"
1088
1089
HVFState *hvf_state;
1090
1091
@@ -XXX,XX +XXX,XX @@ static int hvf_accel_init(MachineState *ms)
1092
1093
hvf_state = s;
1094
memory_listener_register(&hvf_memory_listener, &address_space_memory);
1095
- cpus_register_accel(&hvf_cpus);
1096
return 0;
1097
}
1098
1099
diff --git a/target/i386/hvf/x86hvf.c b/target/i386/hvf/x86hvf.c
1100
index XXXXXXX..XXXXXXX 100644
1101
--- a/target/i386/hvf/x86hvf.c
1102
+++ b/target/i386/hvf/x86hvf.c
1103
@@ -XXX,XX +XXX,XX @@
1104
#include <Hypervisor/hv.h>
1105
#include <Hypervisor/hv_vmx.h>
1106
1107
-#include "hvf-cpus.h"
1108
+#include "hvf-accel-ops.h"
1109
1110
void hvf_set_segment(struct CPUState *cpu, struct vmx_segment *vmx_seg,
1111
SegmentCache *qseg, bool is_tr)
1112
diff --git a/target/i386/whpx/whpx-cpus.c b/target/i386/whpx/whpx-accel-ops.c
1113
similarity index 71%
1114
rename from target/i386/whpx/whpx-cpus.c
1115
rename to target/i386/whpx/whpx-accel-ops.c
1116
index XXXXXXX..XXXXXXX 100644
1117
--- a/target/i386/whpx/whpx-cpus.c
1118
+++ b/target/i386/whpx/whpx-accel-ops.c
1119
@@ -XXX,XX +XXX,XX @@
1120
1121
#include "sysemu/whpx.h"
1122
#include "whpx-internal.h"
1123
-#include "whpx-cpus.h"
1124
+#include "whpx-accel-ops.h"
1125
1126
static void *whpx_cpu_thread_fn(void *arg)
1127
{
1128
@@ -XXX,XX +XXX,XX @@ static void whpx_kick_vcpu_thread(CPUState *cpu)
1129
}
1130
}
1131
1132
-const CpusAccel whpx_cpus = {
1133
- .create_vcpu_thread = whpx_start_vcpu_thread,
1134
- .kick_vcpu_thread = whpx_kick_vcpu_thread,
1135
+static void whpx_accel_ops_class_init(ObjectClass *oc, void *data)
1136
+{
1137
+ AccelOpsClass *ops = ACCEL_OPS_CLASS(oc);
1138
1139
- .synchronize_post_reset = whpx_cpu_synchronize_post_reset,
1140
- .synchronize_post_init = whpx_cpu_synchronize_post_init,
1141
- .synchronize_state = whpx_cpu_synchronize_state,
1142
- .synchronize_pre_loadvm = whpx_cpu_synchronize_pre_loadvm,
1143
+ ops->create_vcpu_thread = whpx_start_vcpu_thread;
1144
+ ops->kick_vcpu_thread = whpx_kick_vcpu_thread;
1145
+
1146
+ ops->synchronize_post_reset = whpx_cpu_synchronize_post_reset;
1147
+ ops->synchronize_post_init = whpx_cpu_synchronize_post_init;
1148
+ ops->synchronize_state = whpx_cpu_synchronize_state;
1149
+ ops->synchronize_pre_loadvm = whpx_cpu_synchronize_pre_loadvm;
1150
+}
1151
+
1152
+static const TypeInfo whpx_accel_ops_type = {
1153
+ .name = ACCEL_OPS_NAME("whpx"),
1154
+
1155
+ .parent = TYPE_ACCEL_OPS,
1156
+ .class_init = whpx_accel_ops_class_init,
1157
+ .abstract = true,
1158
};
1159
+
1160
+static void whpx_accel_ops_register_types(void)
1161
+{
1162
+ type_register_static(&whpx_accel_ops_type);
1163
+}
1164
+type_init(whpx_accel_ops_register_types);
1165
diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
1166
index XXXXXXX..XXXXXXX 100644
1167
--- a/target/i386/whpx/whpx-all.c
1168
+++ b/target/i386/whpx/whpx-all.c
1169
@@ -XXX,XX +XXX,XX @@
1170
#include "migration/blocker.h"
1171
#include <winerror.h>
1172
1173
-#include "whpx-cpus.h"
1174
#include "whpx-internal.h"
1175
+#include "whpx-accel-ops.h"
1176
+
1177
+#include <WinHvPlatform.h>
1178
+#include <WinHvEmulation.h>
1179
1180
#define HYPERV_APIC_BUS_FREQUENCY (200000000ULL)
1181
1182
@@ -XXX,XX +XXX,XX @@ static int whpx_accel_init(MachineState *ms)
1183
1184
whpx_memory_init();
1185
1186
- cpus_register_accel(&whpx_cpus);
1187
-
1188
printf("Windows Hypervisor Platform accelerator is operational\n");
1189
return 0;
1190
1191
diff --git a/MAINTAINERS b/MAINTAINERS
1192
index XXXXXXX..XXXXXXX 100644
1193
--- a/MAINTAINERS
1194
+++ b/MAINTAINERS
1195
@@ -XXX,XX +XXX,XX @@ M: Richard Henderson <richard.henderson@linaro.org>
1196
R: Paolo Bonzini <pbonzini@redhat.com>
1197
S: Maintained
1198
F: include/qemu/accel.h
1199
-F: accel/accel.c
1200
+F: include/sysemu/accel-ops.h
1201
+F: accel/accel-*.c
1202
F: accel/Makefile.objs
1203
F: accel/stubs/Makefile.objs
1204
1205
diff --git a/accel/kvm/meson.build b/accel/kvm/meson.build
1206
index XXXXXXX..XXXXXXX 100644
1207
--- a/accel/kvm/meson.build
1208
+++ b/accel/kvm/meson.build
1209
@@ -XXX,XX +XXX,XX @@
1210
kvm_ss = ss.source_set()
1211
kvm_ss.add(files(
1212
'kvm-all.c',
1213
- 'kvm-cpus.c',
1214
+ 'kvm-accel-ops.c',
1215
))
1216
kvm_ss.add(when: 'CONFIG_SEV', if_false: files('sev-stub.c'))
1217
1218
diff --git a/accel/tcg/meson.build b/accel/tcg/meson.build
1219
index XXXXXXX..XXXXXXX 100644
1220
--- a/accel/tcg/meson.build
1221
+++ b/accel/tcg/meson.build
1222
@@ -XXX,XX +XXX,XX @@ specific_ss.add_all(when: 'CONFIG_TCG', if_true: tcg_ss)
1223
1224
specific_ss.add(when: ['CONFIG_SOFTMMU', 'CONFIG_TCG'], if_true: files(
1225
'cputlb.c',
1226
- 'tcg-cpus.c',
1227
- 'tcg-cpus-mttcg.c',
1228
- 'tcg-cpus-icount.c',
1229
- 'tcg-cpus-rr.c'
1230
+ 'tcg-accel-ops.c',
1231
+ 'tcg-accel-ops-mttcg.c',
1232
+ 'tcg-accel-ops-icount.c',
1233
+ 'tcg-accel-ops-rr.c'
1234
))
1235
diff --git a/target/i386/hax/meson.build b/target/i386/hax/meson.build
1236
index XXXXXXX..XXXXXXX 100644
1237
--- a/target/i386/hax/meson.build
1238
+++ b/target/i386/hax/meson.build
1239
@@ -XXX,XX +XXX,XX @@
1240
i386_softmmu_ss.add(when: 'CONFIG_HAX', if_true: files(
1241
'hax-all.c',
1242
'hax-mem.c',
1243
- 'hax-cpus.c',
1244
+ 'hax-accel-ops.c',
1245
))
1246
i386_softmmu_ss.add(when: ['CONFIG_HAX', 'CONFIG_POSIX'], if_true: files('hax-posix.c'))
1247
i386_softmmu_ss.add(when: ['CONFIG_HAX', 'CONFIG_WIN32'], if_true: files('hax-windows.c'))
1248
diff --git a/target/i386/hvf/meson.build b/target/i386/hvf/meson.build
1249
index XXXXXXX..XXXXXXX 100644
1250
--- a/target/i386/hvf/meson.build
1251
+++ b/target/i386/hvf/meson.build
1252
@@ -XXX,XX +XXX,XX @@
1253
i386_softmmu_ss.add(when: [hvf, 'CONFIG_HVF'], if_true: files(
1254
'hvf.c',
1255
- 'hvf-cpus.c',
1256
+ 'hvf-accel-ops.c',
1257
'x86.c',
1258
'x86_cpuid.c',
1259
'x86_decode.c',
1260
diff --git a/target/i386/whpx/meson.build b/target/i386/whpx/meson.build
1261
index XXXXXXX..XXXXXXX 100644
1262
--- a/target/i386/whpx/meson.build
1263
+++ b/target/i386/whpx/meson.build
1264
@@ -XXX,XX +XXX,XX @@
1265
i386_softmmu_ss.add(when: 'CONFIG_WHPX', if_true: files(
1266
'whpx-all.c',
1267
'whpx-apic.c',
1268
- 'whpx-cpus.c',
1269
+ 'whpx-accel-ops.c',
1270
))
1271
--
154
--
1272
2.25.1
155
2.25.1
1273
156
1274
157
diff view generated by jsdifflib
1
From: Claudio Fontana <cfontana@suse.de>
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
2
3
for now only TCG is allowed as an accelerator for riscv,
3
Use uint8_t for (unsigned) byte, and uint16_t for (unsigned)
4
so remove the CONFIG_TCG use.
4
16-bit word.
5
5
6
Signed-off-by: Claudio Fontana <cfontana@suse.de>
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
7
Message-Id: <20210518183655.1711377-5-philmd@redhat.com>
8
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
9
Message-Id: <20210204163931.7358-3-cfontana@suse.de>
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11
---
9
---
12
target/riscv/cpu.c | 3 +--
10
include/exec/memory_ldst_phys.h.inc | 16 ++++++++--------
13
1 file changed, 1 insertion(+), 2 deletions(-)
11
1 file changed, 8 insertions(+), 8 deletions(-)
14
12
15
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
13
diff --git a/include/exec/memory_ldst_phys.h.inc b/include/exec/memory_ldst_phys.h.inc
16
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
17
--- a/target/riscv/cpu.c
15
--- a/include/exec/memory_ldst_phys.h.inc
18
+++ b/target/riscv/cpu.c
16
+++ b/include/exec/memory_ldst_phys.h.inc
19
@@ -XXX,XX +XXX,XX @@ static void riscv_cpu_class_init(ObjectClass *c, void *data)
17
@@ -XXX,XX +XXX,XX @@
20
#endif
18
*/
21
cc->gdb_arch_name = riscv_gdb_arch_name;
19
22
cc->gdb_get_dynamic_xml = riscv_gdb_get_dynamic_xml;
20
#ifdef TARGET_ENDIANNESS
23
-#ifdef CONFIG_TCG
21
-static inline uint32_t glue(lduw_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
24
cc->tcg_ops.initialize = riscv_translate_init;
22
+static inline uint16_t glue(lduw_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
25
cc->tlb_fill = riscv_cpu_tlb_fill;
23
{
26
-#endif
24
return glue(address_space_lduw, SUFFIX)(ARG1, addr,
27
+
25
MEMTXATTRS_UNSPECIFIED, NULL);
28
device_class_set_props(dc, riscv_cpu_properties);
26
@@ -XXX,XX +XXX,XX @@ static inline uint64_t glue(ldq_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
27
MEMTXATTRS_UNSPECIFIED, NULL);
29
}
28
}
30
29
30
-static inline void glue(stw_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
31
+static inline void glue(stw_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint16_t val)
32
{
33
glue(address_space_stw, SUFFIX)(ARG1, addr, val,
34
MEMTXATTRS_UNSPECIFIED, NULL);
35
@@ -XXX,XX +XXX,XX @@ static inline void glue(stq_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint64_t val)
36
MEMTXATTRS_UNSPECIFIED, NULL);
37
}
38
#else
39
-static inline uint32_t glue(ldub_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
40
+static inline uint8_t glue(ldub_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
41
{
42
return glue(address_space_ldub, SUFFIX)(ARG1, addr,
43
MEMTXATTRS_UNSPECIFIED, NULL);
44
}
45
46
-static inline uint32_t glue(lduw_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
47
+static inline uint16_t glue(lduw_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
48
{
49
return glue(address_space_lduw_le, SUFFIX)(ARG1, addr,
50
MEMTXATTRS_UNSPECIFIED, NULL);
51
}
52
53
-static inline uint32_t glue(lduw_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
54
+static inline uint16_t glue(lduw_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
55
{
56
return glue(address_space_lduw_be, SUFFIX)(ARG1, addr,
57
MEMTXATTRS_UNSPECIFIED, NULL);
58
@@ -XXX,XX +XXX,XX @@ static inline uint64_t glue(ldq_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr)
59
MEMTXATTRS_UNSPECIFIED, NULL);
60
}
61
62
-static inline void glue(stb_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
63
+static inline void glue(stb_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint8_t val)
64
{
65
glue(address_space_stb, SUFFIX)(ARG1, addr, val,
66
MEMTXATTRS_UNSPECIFIED, NULL);
67
}
68
69
-static inline void glue(stw_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
70
+static inline void glue(stw_le_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint16_t val)
71
{
72
glue(address_space_stw_le, SUFFIX)(ARG1, addr, val,
73
MEMTXATTRS_UNSPECIFIED, NULL);
74
}
75
76
-static inline void glue(stw_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint32_t val)
77
+static inline void glue(stw_be_phys, SUFFIX)(ARG1_DECL, hwaddr addr, uint16_t val)
78
{
79
glue(address_space_stw_be, SUFFIX)(ARG1, addr, val,
80
MEMTXATTRS_UNSPECIFIED, NULL);
31
--
81
--
32
2.25.1
82
2.25.1
33
83
34
84
diff view generated by jsdifflib
1
This was removed from tcg_target_reg_alloc_order and
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
tcg_target_call_iarg_regs on the assumption that it
3
was the stack. This was incorrectly copied from i386.
4
For tci, the stack is R15.
5
2
6
By adding R4 back to tcg_target_call_iarg_regs, adjust the other
3
Use uint16_t for (unsigned) 16-bit word.
7
entries so that 6 (or 12) entries are still present in the array,
8
and adjust the numbers in the interpreter.
9
4
10
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
Message-Id: <20210518183655.1711377-6-philmd@redhat.com>
11
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12
---
8
---
13
tcg/tci.c | 8 ++++----
9
include/exec/memory_ldst_cached.h.inc | 4 ++--
14
tcg/tci/tcg-target.c.inc | 7 +------
10
1 file changed, 2 insertions(+), 2 deletions(-)
15
2 files changed, 5 insertions(+), 10 deletions(-)
16
11
17
diff --git a/tcg/tci.c b/tcg/tci.c
12
diff --git a/include/exec/memory_ldst_cached.h.inc b/include/exec/memory_ldst_cached.h.inc
18
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
19
--- a/tcg/tci.c
14
--- a/include/exec/memory_ldst_cached.h.inc
20
+++ b/tcg/tci.c
15
+++ b/include/exec/memory_ldst_cached.h.inc
21
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
16
@@ -XXX,XX +XXX,XX @@
22
tci_read_reg(regs, TCG_REG_R1),
17
#define LD_P(size) \
23
tci_read_reg(regs, TCG_REG_R2),
18
glue(glue(ld, size), glue(ENDIANNESS, _p))
24
tci_read_reg(regs, TCG_REG_R3),
19
25
+ tci_read_reg(regs, TCG_REG_R4),
20
-static inline uint32_t ADDRESS_SPACE_LD_CACHED(uw)(MemoryRegionCache *cache,
26
tci_read_reg(regs, TCG_REG_R5),
21
+static inline uint16_t ADDRESS_SPACE_LD_CACHED(uw)(MemoryRegionCache *cache,
27
tci_read_reg(regs, TCG_REG_R6),
22
hwaddr addr, MemTxAttrs attrs, MemTxResult *result)
28
tci_read_reg(regs, TCG_REG_R7),
23
{
29
tci_read_reg(regs, TCG_REG_R8),
24
assert(addr < cache->len && 2 <= cache->len - addr);
30
tci_read_reg(regs, TCG_REG_R9),
25
@@ -XXX,XX +XXX,XX @@ static inline uint64_t ADDRESS_SPACE_LD_CACHED(q)(MemoryRegionCache *cache,
31
tci_read_reg(regs, TCG_REG_R10),
26
glue(glue(st, size), glue(ENDIANNESS, _p))
32
- tci_read_reg(regs, TCG_REG_R11),
27
33
- tci_read_reg(regs, TCG_REG_R12));
28
static inline void ADDRESS_SPACE_ST_CACHED(w)(MemoryRegionCache *cache,
34
+ tci_read_reg(regs, TCG_REG_R11));
29
- hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result)
35
tci_write_reg(regs, TCG_REG_R0, tmp64);
30
+ hwaddr addr, uint16_t val, MemTxAttrs attrs, MemTxResult *result)
36
tci_write_reg(regs, TCG_REG_R1, tmp64 >> 32);
31
{
37
#else
32
assert(addr < cache->len && 2 <= cache->len - addr);
38
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
33
if (likely(cache->ptr)) {
39
tci_read_reg(regs, TCG_REG_R1),
40
tci_read_reg(regs, TCG_REG_R2),
41
tci_read_reg(regs, TCG_REG_R3),
42
- tci_read_reg(regs, TCG_REG_R5),
43
- tci_read_reg(regs, TCG_REG_R6));
44
+ tci_read_reg(regs, TCG_REG_R4),
45
+ tci_read_reg(regs, TCG_REG_R5));
46
tci_write_reg(regs, TCG_REG_R0, tmp64);
47
#endif
48
break;
49
diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc
50
index XXXXXXX..XXXXXXX 100644
51
--- a/tcg/tci/tcg-target.c.inc
52
+++ b/tcg/tci/tcg-target.c.inc
53
@@ -XXX,XX +XXX,XX @@ static const int tcg_target_reg_alloc_order[] = {
54
TCG_REG_R1,
55
TCG_REG_R2,
56
TCG_REG_R3,
57
-#if 0 /* used for TCG_REG_CALL_STACK */
58
TCG_REG_R4,
59
-#endif
60
TCG_REG_R5,
61
TCG_REG_R6,
62
TCG_REG_R7,
63
@@ -XXX,XX +XXX,XX @@ static const int tcg_target_call_iarg_regs[] = {
64
TCG_REG_R1,
65
TCG_REG_R2,
66
TCG_REG_R3,
67
-#if 0 /* used for TCG_REG_CALL_STACK */
68
TCG_REG_R4,
69
-#endif
70
TCG_REG_R5,
71
- TCG_REG_R6,
72
#if TCG_TARGET_REG_BITS == 32
73
/* 32 bit hosts need 2 * MAX_OPC_PARAM_IARGS registers. */
74
+ TCG_REG_R6,
75
TCG_REG_R7,
76
TCG_REG_R8,
77
TCG_REG_R9,
78
TCG_REG_R10,
79
TCG_REG_R11,
80
- TCG_REG_R12,
81
#endif
82
};
83
84
--
34
--
85
2.25.1
35
2.25.1
86
36
87
37
diff view generated by jsdifflib
1
The existing check was incomplete:
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
(1) Only applied to two of the 7 stores, and not to the loads at all.
3
(2) Only checked the upper, but not the lower bound of the stack.
4
2
5
Doing this at compile time means that we don't need to do it
3
Use uint8_t for (unsigned) byte.
6
at runtime as well.
7
4
8
Tested-by: Alex Bennée <alex.bennee@linaro.org>
5
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
9
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
Message-Id: <20210518183655.1711377-7-philmd@redhat.com>
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11
---
8
---
12
tcg/tci.c | 2 --
9
include/exec/memory.h | 2 +-
13
tcg/tci/tcg-target.c.inc | 13 +++++++++++++
10
1 file changed, 1 insertion(+), 1 deletion(-)
14
2 files changed, 13 insertions(+), 2 deletions(-)
15
11
16
diff --git a/tcg/tci.c b/tcg/tci.c
12
diff --git a/include/exec/memory.h b/include/exec/memory.h
17
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
18
--- a/tcg/tci.c
14
--- a/include/exec/memory.h
19
+++ b/tcg/tci.c
15
+++ b/include/exec/memory.h
20
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
16
@@ -XXX,XX +XXX,XX @@ static inline uint8_t address_space_ldub_cached(MemoryRegionCache *cache,
21
t0 = tci_read_r32(regs, &tb_ptr);
22
t1 = tci_read_r(regs, &tb_ptr);
23
t2 = tci_read_s32(&tb_ptr);
24
- tci_assert(t1 != sp_value || (int32_t)t2 < 0);
25
*(uint32_t *)(t1 + t2) = t0;
26
break;
27
28
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
29
t0 = tci_read_r64(regs, &tb_ptr);
30
t1 = tci_read_r(regs, &tb_ptr);
31
t2 = tci_read_s32(&tb_ptr);
32
- tci_assert(t1 != sp_value || (int32_t)t2 < 0);
33
*(uint64_t *)(t1 + t2) = t0;
34
break;
35
36
diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc
37
index XXXXXXX..XXXXXXX 100644
38
--- a/tcg/tci/tcg-target.c.inc
39
+++ b/tcg/tci/tcg-target.c.inc
40
@@ -XXX,XX +XXX,XX @@ static void tci_out_label(TCGContext *s, TCGLabel *label)
41
}
42
}
17
}
43
18
44
+static void stack_bounds_check(TCGReg base, target_long offset)
19
static inline void address_space_stb_cached(MemoryRegionCache *cache,
45
+{
20
- hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result)
46
+ if (base == TCG_REG_CALL_STACK) {
21
+ hwaddr addr, uint8_t val, MemTxAttrs attrs, MemTxResult *result)
47
+ tcg_debug_assert(offset < 0);
48
+ tcg_debug_assert(offset >= -(CPU_TEMP_BUF_NLONGS * sizeof(long)));
49
+ }
50
+}
51
+
52
static void tcg_out_ld(TCGContext *s, TCGType type, TCGReg ret, TCGReg arg1,
53
intptr_t arg2)
54
{
22
{
55
uint8_t *old_code_ptr = s->code_ptr;
23
assert(addr < cache->len);
56
+
24
if (likely(cache->ptr)) {
57
+ stack_bounds_check(arg1, arg2);
58
if (type == TCG_TYPE_I32) {
59
tcg_out_op_t(s, INDEX_op_ld_i32);
60
tcg_out_r(s, ret);
61
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,
62
case INDEX_op_st16_i64:
63
case INDEX_op_st32_i64:
64
case INDEX_op_st_i64:
65
+ stack_bounds_check(args[1], args[2]);
66
tcg_out_r(s, args[0]);
67
tcg_out_r(s, args[1]);
68
tcg_debug_assert(args[2] == (int32_t)args[2]);
69
@@ -XXX,XX +XXX,XX @@ static void tcg_out_st(TCGContext *s, TCGType type, TCGReg arg, TCGReg arg1,
70
intptr_t arg2)
71
{
72
uint8_t *old_code_ptr = s->code_ptr;
73
+
74
+ stack_bounds_check(arg1, arg2);
75
if (type == TCG_TYPE_I32) {
76
tcg_out_op_t(s, INDEX_op_st_i32);
77
tcg_out_r(s, arg);
78
--
25
--
79
2.25.1
26
2.25.1
80
27
81
28
diff view generated by jsdifflib
1
Each thread must have its own pc, even under TCI.
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
Remove the GETPC ifdef, because GETPC is always available for
3
Only 2 headers require "exec/tb-context.h". Instead of having
4
helpers, and thus is always required. Move the assignment
4
all files including "exec/exec-all.h" also including it, directly
5
under INDEX_op_call, because the value is only visible when
5
include it where it is required:
6
we make a call to a helper function.
6
- accel/tcg/cpu-exec.c
7
- accel/tcg/translate-all.c
7
8
8
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
9
For plugins/plugin.h, we were implicitly relying on
10
exec/exec-all.h -> exec/tb-context.h -> qemu/qht.h
11
which is now included directly.
12
13
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
14
Message-Id: <20210524170453.3791436-2-f4bug@amsat.org>
15
[rth: Fix plugins/plugin.h compilation]
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-Id: <20210204014509.882821-6-richard.henderson@linaro.org>
11
---
17
---
12
include/exec/exec-all.h | 2 +-
18
include/exec/exec-all.h | 1 -
13
tcg/tcg-common.c | 4 ----
19
include/tcg/tcg.h | 1 -
14
tcg/tci.c | 7 +++----
20
plugins/plugin.h | 1 +
15
3 files changed, 4 insertions(+), 9 deletions(-)
21
accel/tcg/cpu-exec.c | 1 +
22
accel/tcg/translate-all.c | 1 +
23
5 files changed, 3 insertions(+), 2 deletions(-)
16
24
17
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
25
diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
18
index XXXXXXX..XXXXXXX 100644
26
index XXXXXXX..XXXXXXX 100644
19
--- a/include/exec/exec-all.h
27
--- a/include/exec/exec-all.h
20
+++ b/include/exec/exec-all.h
28
+++ b/include/exec/exec-all.h
21
@@ -XXX,XX +XXX,XX @@ void tb_set_jmp_target(TranslationBlock *tb, int n, uintptr_t addr);
29
@@ -XXX,XX +XXX,XX @@
22
30
#define EXEC_ALL_H
23
/* GETPC is the true target of the return instruction that we'll execute. */
31
24
#if defined(CONFIG_TCG_INTERPRETER)
32
#include "cpu.h"
25
-extern uintptr_t tci_tb_ptr;
33
-#include "exec/tb-context.h"
26
+extern __thread uintptr_t tci_tb_ptr;
34
#ifdef CONFIG_TCG
27
# define GETPC() tci_tb_ptr
35
#include "exec/cpu_ldst.h"
28
#else
36
#endif
29
# define GETPC() \
37
diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h
30
diff --git a/tcg/tcg-common.c b/tcg/tcg-common.c
31
index XXXXXXX..XXXXXXX 100644
38
index XXXXXXX..XXXXXXX 100644
32
--- a/tcg/tcg-common.c
39
--- a/include/tcg/tcg.h
33
+++ b/tcg/tcg-common.c
40
+++ b/include/tcg/tcg.h
34
@@ -XXX,XX +XXX,XX @@
41
@@ -XXX,XX +XXX,XX @@
35
#include "qemu/osdep.h"
42
36
#include "tcg/tcg.h"
43
#include "cpu.h"
37
44
#include "exec/memop.h"
38
-#if defined(CONFIG_TCG_INTERPRETER)
45
-#include "exec/tb-context.h"
39
-uintptr_t tci_tb_ptr;
46
#include "qemu/bitops.h"
40
-#endif
47
#include "qemu/plugin.h"
41
-
48
#include "qemu/queue.h"
42
TCGOpDef tcg_op_defs[] = {
49
diff --git a/plugins/plugin.h b/plugins/plugin.h
43
#define DEF(s, oargs, iargs, cargs, flags) \
44
{ #s, oargs, iargs, cargs, iargs + oargs + cargs, flags },
45
diff --git a/tcg/tci.c b/tcg/tci.c
46
index XXXXXXX..XXXXXXX 100644
50
index XXXXXXX..XXXXXXX 100644
47
--- a/tcg/tci.c
51
--- a/plugins/plugin.h
48
+++ b/tcg/tci.c
52
+++ b/plugins/plugin.h
49
@@ -XXX,XX +XXX,XX @@ typedef uint64_t (*helper_function)(tcg_target_ulong, tcg_target_ulong,
53
@@ -XXX,XX +XXX,XX @@
50
tcg_target_ulong, tcg_target_ulong);
54
#define _PLUGIN_INTERNAL_H_
51
#endif
55
52
56
#include <gmodule.h>
53
+__thread uintptr_t tci_tb_ptr;
57
+#include "qemu/qht.h"
54
+
58
55
static tcg_target_ulong tci_read_reg(const tcg_target_ulong *regs, TCGReg index)
59
#define QEMU_PLUGIN_MIN_VERSION 0
56
{
60
57
tci_assert(index < TCG_TARGET_NB_REGS);
61
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
58
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
62
index XXXXXXX..XXXXXXX 100644
59
#endif
63
--- a/accel/tcg/cpu-exec.c
60
TCGMemOpIdx oi;
64
+++ b/accel/tcg/cpu-exec.c
61
65
@@ -XXX,XX +XXX,XX @@
62
-#if defined(GETPC)
66
#include "qemu/rcu.h"
63
- tci_tb_ptr = (uintptr_t)tb_ptr;
67
#include "exec/tb-hash.h"
64
-#endif
68
#include "exec/tb-lookup.h"
65
-
69
+#include "exec/tb-context.h"
66
/* Skip opcode and size entry. */
70
#include "exec/log.h"
67
tb_ptr += 2;
71
#include "qemu/main-loop.h"
68
72
#if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY)
69
switch (opc) {
73
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
70
case INDEX_op_call:
74
index XXXXXXX..XXXXXXX 100644
71
t0 = tci_read_ri(regs, &tb_ptr);
75
--- a/accel/tcg/translate-all.c
72
+ tci_tb_ptr = (uintptr_t)tb_ptr;
76
+++ b/accel/tcg/translate-all.c
73
#if TCG_TARGET_REG_BITS == 32
77
@@ -XXX,XX +XXX,XX @@
74
tmp64 = ((helper_function)t0)(tci_read_reg(regs, TCG_REG_R0),
78
75
tci_read_reg(regs, TCG_REG_R1),
79
#include "exec/cputlb.h"
80
#include "exec/tb-hash.h"
81
+#include "exec/tb-context.h"
82
#include "exec/translate-all.h"
83
#include "qemu/bitmap.h"
84
#include "qemu/error-report.h"
76
--
85
--
77
2.25.1
86
2.25.1
78
87
79
88
diff view generated by jsdifflib
1
From: Claudio Fontana <cfontana@suse.de>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
Signed-off-by: Claudio Fontana <cfontana@suse.de>
3
Only the TCG accelerator uses the TranslationBlock API.
4
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
4
Move the tb-context.h / tb-hash.h / tb-lookup.h from the
5
global namespace to the TCG one (in accel/tcg).
5
6
6
[claudio: rebased on Richard's splitwx work]
7
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
8
Message-Id: <20210524170453.3791436-3-f4bug@amsat.org>
8
Signed-off-by: Claudio Fontana <cfontana@suse.de>
9
Message-Id: <20210204163931.7358-17-cfontana@suse.de>
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11
---
10
---
12
include/hw/boards.h | 2 +-
11
{include/exec => accel/tcg}/tb-context.h | 0
13
include/{sysemu => qemu}/accel.h | 14 +++++----
12
{include/exec => accel/tcg}/tb-hash.h | 0
14
include/sysemu/hvf.h | 2 +-
13
{include/exec => accel/tcg}/tb-lookup.h | 2 +-
15
include/sysemu/kvm.h | 2 +-
14
accel/tcg/cpu-exec.c | 6 +++---
16
include/sysemu/kvm_int.h | 2 +-
15
accel/tcg/cputlb.c | 2 +-
17
target/i386/hvf/hvf-i386.h | 2 +-
16
accel/tcg/tcg-runtime.c | 2 +-
18
accel/accel-common.c | 50 ++++++++++++++++++++++++++++++
17
accel/tcg/translate-all.c | 4 ++--
19
accel/{accel.c => accel-softmmu.c} | 27 ++--------------
18
MAINTAINERS | 1 -
20
accel/accel-user.c | 24 ++++++++++++++
19
8 files changed, 8 insertions(+), 9 deletions(-)
21
accel/qtest/qtest.c | 2 +-
20
rename {include/exec => accel/tcg}/tb-context.h (100%)
22
accel/tcg/tcg-all.c | 15 +++++++--
21
rename {include/exec => accel/tcg}/tb-hash.h (100%)
23
accel/xen/xen-all.c | 2 +-
22
rename {include/exec => accel/tcg}/tb-lookup.h (98%)
24
bsd-user/main.c | 6 +++-
25
linux-user/main.c | 6 +++-
26
softmmu/memory.c | 2 +-
27
softmmu/qtest.c | 2 +-
28
softmmu/vl.c | 2 +-
29
target/i386/hax/hax-all.c | 2 +-
30
target/i386/hvf/hvf.c | 2 +-
31
target/i386/hvf/x86_task.c | 2 +-
32
target/i386/whpx/whpx-all.c | 2 +-
33
MAINTAINERS | 2 +-
34
accel/meson.build | 4 ++-
35
accel/tcg/meson.build | 2 +-
36
24 files changed, 125 insertions(+), 53 deletions(-)
37
rename include/{sysemu => qemu}/accel.h (95%)
38
create mode 100644 accel/accel-common.c
39
rename accel/{accel.c => accel-softmmu.c} (75%)
40
create mode 100644 accel/accel-user.c
41
23
42
diff --git a/include/hw/boards.h b/include/hw/boards.h
24
diff --git a/include/exec/tb-context.h b/accel/tcg/tb-context.h
25
similarity index 100%
26
rename from include/exec/tb-context.h
27
rename to accel/tcg/tb-context.h
28
diff --git a/include/exec/tb-hash.h b/accel/tcg/tb-hash.h
29
similarity index 100%
30
rename from include/exec/tb-hash.h
31
rename to accel/tcg/tb-hash.h
32
diff --git a/include/exec/tb-lookup.h b/accel/tcg/tb-lookup.h
33
similarity index 98%
34
rename from include/exec/tb-lookup.h
35
rename to accel/tcg/tb-lookup.h
43
index XXXXXXX..XXXXXXX 100644
36
index XXXXXXX..XXXXXXX 100644
44
--- a/include/hw/boards.h
37
--- a/include/exec/tb-lookup.h
45
+++ b/include/hw/boards.h
38
+++ b/accel/tcg/tb-lookup.h
39
@@ -XXX,XX +XXX,XX @@
40
#endif
41
42
#include "exec/exec-all.h"
43
-#include "exec/tb-hash.h"
44
+#include "tb-hash.h"
45
46
/* Might cause an exception, so have a longjmp destination ready */
47
static inline TranslationBlock *tb_lookup(CPUState *cpu, target_ulong pc,
48
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
49
index XXXXXXX..XXXXXXX 100644
50
--- a/accel/tcg/cpu-exec.c
51
+++ b/accel/tcg/cpu-exec.c
52
@@ -XXX,XX +XXX,XX @@
53
#include "qemu/compiler.h"
54
#include "qemu/timer.h"
55
#include "qemu/rcu.h"
56
-#include "exec/tb-hash.h"
57
-#include "exec/tb-lookup.h"
58
-#include "exec/tb-context.h"
59
#include "exec/log.h"
60
#include "qemu/main-loop.h"
61
#if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY)
62
@@ -XXX,XX +XXX,XX @@
63
#include "exec/cpu-all.h"
64
#include "sysemu/cpu-timers.h"
65
#include "sysemu/replay.h"
66
+#include "tb-hash.h"
67
+#include "tb-lookup.h"
68
+#include "tb-context.h"
69
#include "internal.h"
70
71
/* -icount align implementation. */
72
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
73
index XXXXXXX..XXXXXXX 100644
74
--- a/accel/tcg/cputlb.c
75
+++ b/accel/tcg/cputlb.c
46
@@ -XXX,XX +XXX,XX @@
76
@@ -XXX,XX +XXX,XX @@
47
#include "exec/memory.h"
77
#include "exec/memory.h"
48
#include "sysemu/hostmem.h"
78
#include "exec/cpu_ldst.h"
49
#include "sysemu/blockdev.h"
79
#include "exec/cputlb.h"
50
-#include "sysemu/accel.h"
80
-#include "exec/tb-hash.h"
51
+#include "qemu/accel.h"
81
#include "exec/memory-internal.h"
52
#include "qapi/qapi-types-machine.h"
82
#include "exec/ram_addr.h"
53
#include "qemu/module.h"
83
#include "tcg/tcg.h"
54
#include "qom/object.h"
84
@@ -XXX,XX +XXX,XX @@
55
diff --git a/include/sysemu/accel.h b/include/qemu/accel.h
85
#include "exec/translate-all.h"
56
similarity index 95%
86
#include "trace/trace-root.h"
57
rename from include/sysemu/accel.h
87
#include "trace/mem.h"
58
rename to include/qemu/accel.h
88
+#include "tb-hash.h"
89
#include "internal.h"
90
#ifdef CONFIG_PLUGIN
91
#include "qemu/plugin-memory.h"
92
diff --git a/accel/tcg/tcg-runtime.c b/accel/tcg/tcg-runtime.c
59
index XXXXXXX..XXXXXXX 100644
93
index XXXXXXX..XXXXXXX 100644
60
--- a/include/sysemu/accel.h
94
--- a/accel/tcg/tcg-runtime.c
61
+++ b/include/qemu/accel.h
95
+++ b/accel/tcg/tcg-runtime.c
62
@@ -XXX,XX +XXX,XX @@
96
@@ -XXX,XX +XXX,XX @@
63
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
97
#include "disas/disas.h"
64
* THE SOFTWARE.
98
#include "exec/log.h"
65
*/
99
#include "tcg/tcg.h"
66
-#ifndef HW_ACCEL_H
100
-#include "exec/tb-lookup.h"
67
-#define HW_ACCEL_H
101
+#include "tb-lookup.h"
68
+#ifndef QEMU_ACCEL_H
102
69
+#define QEMU_ACCEL_H
103
/* 32-bit helpers */
70
104
71
#include "qom/object.h"
105
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
72
#include "exec/hwaddr.h"
73
@@ -XXX,XX +XXX,XX @@ typedef struct AccelClass {
74
/*< public >*/
75
76
const char *name;
77
-#ifndef CONFIG_USER_ONLY
78
int (*init_machine)(MachineState *ms);
79
+#ifndef CONFIG_USER_ONLY
80
void (*setup_post)(MachineState *ms, AccelState *accel);
81
bool (*has_memory)(MachineState *ms, AddressSpace *as,
82
hwaddr start_addr, hwaddr size);
83
@@ -XXX,XX +XXX,XX @@ typedef struct AccelClass {
84
OBJECT_GET_CLASS(AccelClass, (obj), TYPE_ACCEL)
85
86
AccelClass *accel_find(const char *opt_name);
87
+AccelState *current_accel(void);
88
+
89
+#ifndef CONFIG_USER_ONLY
90
int accel_init_machine(AccelState *accel, MachineState *ms);
91
92
/* Called just before os_setup_post (ie just before drop OS privs) */
93
void accel_setup_post(MachineState *ms);
94
+#endif /* !CONFIG_USER_ONLY */
95
96
-AccelState *current_accel(void);
97
-
98
-#endif
99
+#endif /* QEMU_ACCEL_H */
100
diff --git a/include/sysemu/hvf.h b/include/sysemu/hvf.h
101
index XXXXXXX..XXXXXXX 100644
106
index XXXXXXX..XXXXXXX 100644
102
--- a/include/sysemu/hvf.h
107
--- a/accel/tcg/translate-all.c
103
+++ b/include/sysemu/hvf.h
108
+++ b/accel/tcg/translate-all.c
104
@@ -XXX,XX +XXX,XX @@
109
@@ -XXX,XX +XXX,XX @@
105
#ifndef HVF_H
110
#endif
106
#define HVF_H
111
107
112
#include "exec/cputlb.h"
108
-#include "sysemu/accel.h"
113
-#include "exec/tb-hash.h"
109
+#include "qemu/accel.h"
114
-#include "exec/tb-context.h"
110
#include "qom/object.h"
115
#include "exec/translate-all.h"
111
116
#include "qemu/bitmap.h"
112
#ifdef CONFIG_HVF
117
#include "qemu/error-report.h"
113
diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h
114
index XXXXXXX..XXXXXXX 100644
115
--- a/include/sysemu/kvm.h
116
+++ b/include/sysemu/kvm.h
117
@@ -XXX,XX +XXX,XX @@
118
@@ -XXX,XX +XXX,XX @@
118
#include "qemu/queue.h"
119
#include "sysemu/tcg.h"
119
#include "hw/core/cpu.h"
120
#include "exec/memattrs.h"
121
-#include "sysemu/accel.h"
122
+#include "qemu/accel.h"
123
#include "qom/object.h"
124
125
#ifdef NEED_CPU_H
126
diff --git a/include/sysemu/kvm_int.h b/include/sysemu/kvm_int.h
127
index XXXXXXX..XXXXXXX 100644
128
--- a/include/sysemu/kvm_int.h
129
+++ b/include/sysemu/kvm_int.h
130
@@ -XXX,XX +XXX,XX @@
131
#define QEMU_KVM_INT_H
132
133
#include "exec/memory.h"
134
-#include "sysemu/accel.h"
135
+#include "qemu/accel.h"
136
#include "sysemu/kvm.h"
137
138
typedef struct KVMSlot
139
diff --git a/target/i386/hvf/hvf-i386.h b/target/i386/hvf/hvf-i386.h
140
index XXXXXXX..XXXXXXX 100644
141
--- a/target/i386/hvf/hvf-i386.h
142
+++ b/target/i386/hvf/hvf-i386.h
143
@@ -XXX,XX +XXX,XX @@
144
#ifndef HVF_I386_H
145
#define HVF_I386_H
146
147
-#include "sysemu/accel.h"
148
+#include "qemu/accel.h"
149
#include "sysemu/hvf.h"
150
#include "cpu.h"
151
#include "x86.h"
152
diff --git a/accel/accel-common.c b/accel/accel-common.c
153
new file mode 100644
154
index XXXXXXX..XXXXXXX
155
--- /dev/null
156
+++ b/accel/accel-common.c
157
@@ -XXX,XX +XXX,XX @@
158
+/*
159
+ * QEMU accel class, components common to system emulation and user mode
160
+ *
161
+ * Copyright (c) 2003-2008 Fabrice Bellard
162
+ * Copyright (c) 2014 Red Hat Inc.
163
+ *
164
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
165
+ * of this software and associated documentation files (the "Software"), to deal
166
+ * in the Software without restriction, including without limitation the rights
167
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
168
+ * copies of the Software, and to permit persons to whom the Software is
169
+ * furnished to do so, subject to the following conditions:
170
+ *
171
+ * The above copyright notice and this permission notice shall be included in
172
+ * all copies or substantial portions of the Software.
173
+ *
174
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
175
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
176
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
177
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
178
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
179
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
180
+ * THE SOFTWARE.
181
+ */
182
+
183
+#include "qemu/osdep.h"
184
+#include "qemu/accel.h"
185
+
186
+static const TypeInfo accel_type = {
187
+ .name = TYPE_ACCEL,
188
+ .parent = TYPE_OBJECT,
189
+ .class_size = sizeof(AccelClass),
190
+ .instance_size = sizeof(AccelState),
191
+};
192
+
193
+/* Lookup AccelClass from opt_name. Returns NULL if not found */
194
+AccelClass *accel_find(const char *opt_name)
195
+{
196
+ char *class_name = g_strdup_printf(ACCEL_CLASS_NAME("%s"), opt_name);
197
+ AccelClass *ac = ACCEL_CLASS(object_class_by_name(class_name));
198
+ g_free(class_name);
199
+ return ac;
200
+}
201
+
202
+static void register_accel_types(void)
203
+{
204
+ type_register_static(&accel_type);
205
+}
206
+
207
+type_init(register_accel_types);
208
diff --git a/accel/accel.c b/accel/accel-softmmu.c
209
similarity index 75%
210
rename from accel/accel.c
211
rename to accel/accel-softmmu.c
212
index XXXXXXX..XXXXXXX 100644
213
--- a/accel/accel.c
214
+++ b/accel/accel-softmmu.c
215
@@ -XXX,XX +XXX,XX @@
216
/*
217
- * QEMU System Emulator, accelerator interfaces
218
+ * QEMU accel class, system emulation components
219
*
220
* Copyright (c) 2003-2008 Fabrice Bellard
221
* Copyright (c) 2014 Red Hat Inc.
222
@@ -XXX,XX +XXX,XX @@
223
*/
224
225
#include "qemu/osdep.h"
226
-#include "sysemu/accel.h"
227
+#include "qemu/accel.h"
228
#include "hw/boards.h"
229
#include "sysemu/arch_init.h"
230
#include "sysemu/sysemu.h"
231
#include "qom/object.h"
232
233
-static const TypeInfo accel_type = {
234
- .name = TYPE_ACCEL,
235
- .parent = TYPE_OBJECT,
236
- .class_size = sizeof(AccelClass),
237
- .instance_size = sizeof(AccelState),
238
-};
239
-
240
-/* Lookup AccelClass from opt_name. Returns NULL if not found */
241
-AccelClass *accel_find(const char *opt_name)
242
-{
243
- char *class_name = g_strdup_printf(ACCEL_CLASS_NAME("%s"), opt_name);
244
- AccelClass *ac = ACCEL_CLASS(object_class_by_name(class_name));
245
- g_free(class_name);
246
- return ac;
247
-}
248
-
249
int accel_init_machine(AccelState *accel, MachineState *ms)
250
{
251
AccelClass *acc = ACCEL_GET_CLASS(accel);
252
@@ -XXX,XX +XXX,XX @@ void accel_setup_post(MachineState *ms)
253
acc->setup_post(ms, accel);
254
}
255
}
256
-
257
-static void register_accel_types(void)
258
-{
259
- type_register_static(&accel_type);
260
-}
261
-
262
-type_init(register_accel_types);
263
diff --git a/accel/accel-user.c b/accel/accel-user.c
264
new file mode 100644
265
index XXXXXXX..XXXXXXX
266
--- /dev/null
267
+++ b/accel/accel-user.c
268
@@ -XXX,XX +XXX,XX @@
269
+/*
270
+ * QEMU accel class, user-mode components
271
+ *
272
+ * Copyright 2021 SUSE LLC
273
+ *
274
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
275
+ * See the COPYING file in the top-level directory.
276
+ */
277
+
278
+#include "qemu/osdep.h"
279
+#include "qemu/accel.h"
280
+
281
+AccelState *current_accel(void)
282
+{
283
+ static AccelState *accel;
284
+
285
+ if (!accel) {
286
+ AccelClass *ac = accel_find("tcg");
287
+
288
+ g_assert(ac != NULL);
289
+ accel = ACCEL(object_new_with_class(OBJECT_CLASS(ac)));
290
+ }
291
+ return accel;
292
+}
293
diff --git a/accel/qtest/qtest.c b/accel/qtest/qtest.c
294
index XXXXXXX..XXXXXXX 100644
295
--- a/accel/qtest/qtest.c
296
+++ b/accel/qtest/qtest.c
297
@@ -XXX,XX +XXX,XX @@
298
#include "qemu/module.h"
299
#include "qemu/option.h"
300
#include "qemu/config-file.h"
301
-#include "sysemu/accel.h"
302
+#include "qemu/accel.h"
303
#include "sysemu/qtest.h"
304
#include "sysemu/cpus.h"
305
#include "sysemu/cpu-timers.h"
306
diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c
307
index XXXXXXX..XXXXXXX 100644
308
--- a/accel/tcg/tcg-all.c
309
+++ b/accel/tcg/tcg-all.c
310
@@ -XXX,XX +XXX,XX @@
311
#include "tcg/tcg.h"
312
#include "qapi/error.h"
120
#include "qapi/error.h"
313
#include "qemu/error-report.h"
121
#include "hw/core/tcg-cpu-ops.h"
314
-#include "hw/boards.h"
122
+#include "tb-hash.h"
315
+#include "qemu/accel.h"
123
+#include "tb-context.h"
316
#include "qapi/qapi-builtin-visit.h"
124
#include "internal.h"
317
+
125
318
+#ifndef CONFIG_USER_ONLY
126
/* #define DEBUG_TB_INVALIDATE */
319
#include "tcg-cpus.h"
320
+#endif /* CONFIG_USER_ONLY */
321
322
struct TCGState {
323
AccelState parent_obj;
324
@@ -XXX,XX +XXX,XX @@ static void tcg_accel_instance_init(Object *obj)
325
s->mttcg_enabled = default_mttcg_enabled();
326
327
/* If debugging enabled, default "auto on", otherwise off. */
328
-#ifdef CONFIG_DEBUG_TCG
329
+#if defined(CONFIG_DEBUG_TCG) && !defined(CONFIG_USER_ONLY)
330
s->splitwx_enabled = -1;
331
#else
332
s->splitwx_enabled = 0;
333
@@ -XXX,XX +XXX,XX @@ static int tcg_init(MachineState *ms)
334
mttcg_enabled = s->mttcg_enabled;
335
336
/*
337
- * Initialize TCG regions
338
+ * Initialize TCG regions only for softmmu.
339
+ *
340
+ * This needs to be done later for user mode, because the prologue
341
+ * generation needs to be delayed so that GUEST_BASE is already set.
342
*/
343
+#ifndef CONFIG_USER_ONLY
344
tcg_region_init();
345
346
if (mttcg_enabled) {
347
@@ -XXX,XX +XXX,XX @@ static int tcg_init(MachineState *ms)
348
} else {
349
cpus_register_accel(&tcg_cpus_rr);
350
}
351
+#endif /* !CONFIG_USER_ONLY */
352
+
353
return 0;
354
}
355
356
diff --git a/accel/xen/xen-all.c b/accel/xen/xen-all.c
357
index XXXXXXX..XXXXXXX 100644
358
--- a/accel/xen/xen-all.c
359
+++ b/accel/xen/xen-all.c
360
@@ -XXX,XX +XXX,XX @@
361
#include "hw/xen/xen-legacy-backend.h"
362
#include "hw/xen/xen_pt.h"
363
#include "chardev/char.h"
364
-#include "sysemu/accel.h"
365
+#include "qemu/accel.h"
366
#include "sysemu/cpus.h"
367
#include "sysemu/xen.h"
368
#include "sysemu/runstate.h"
369
diff --git a/bsd-user/main.c b/bsd-user/main.c
370
index XXXXXXX..XXXXXXX 100644
371
--- a/bsd-user/main.c
372
+++ b/bsd-user/main.c
373
@@ -XXX,XX +XXX,XX @@
374
#include "qemu/osdep.h"
375
#include "qemu-common.h"
376
#include "qemu/units.h"
377
+#include "qemu/accel.h"
378
#include "sysemu/tcg.h"
379
#include "qemu-version.h"
380
#include <machine/trap.h>
381
@@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv)
382
}
383
384
/* init tcg before creating CPUs and to get qemu_host_page_size */
385
- tcg_exec_init(0, false);
386
+ {
387
+ AccelClass *ac = ACCEL_GET_CLASS(current_accel());
388
389
+ ac->init_machine(NULL);
390
+ }
391
cpu_type = parse_cpu_option(cpu_model);
392
cpu = cpu_create(cpu_type);
393
env = cpu->env_ptr;
394
diff --git a/linux-user/main.c b/linux-user/main.c
395
index XXXXXXX..XXXXXXX 100644
396
--- a/linux-user/main.c
397
+++ b/linux-user/main.c
398
@@ -XXX,XX +XXX,XX @@
399
#include "qemu/osdep.h"
400
#include "qemu-common.h"
401
#include "qemu/units.h"
402
+#include "qemu/accel.h"
403
#include "sysemu/tcg.h"
404
#include "qemu-version.h"
405
#include <sys/syscall.h>
406
@@ -XXX,XX +XXX,XX @@ int main(int argc, char **argv, char **envp)
407
cpu_type = parse_cpu_option(cpu_model);
408
409
/* init tcg before creating CPUs and to get qemu_host_page_size */
410
- tcg_exec_init(0, false);
411
+ {
412
+ AccelClass *ac = ACCEL_GET_CLASS(current_accel());
413
414
+ ac->init_machine(NULL);
415
+ }
416
cpu = cpu_create(cpu_type);
417
env = cpu->env_ptr;
418
cpu_reset(cpu);
419
diff --git a/softmmu/memory.c b/softmmu/memory.c
420
index XXXXXXX..XXXXXXX 100644
421
--- a/softmmu/memory.c
422
+++ b/softmmu/memory.c
423
@@ -XXX,XX +XXX,XX @@
424
#include "sysemu/kvm.h"
425
#include "sysemu/runstate.h"
426
#include "sysemu/tcg.h"
427
-#include "sysemu/accel.h"
428
+#include "qemu/accel.h"
429
#include "hw/boards.h"
430
#include "migration/vmstate.h"
431
432
diff --git a/softmmu/qtest.c b/softmmu/qtest.c
433
index XXXXXXX..XXXXXXX 100644
434
--- a/softmmu/qtest.c
435
+++ b/softmmu/qtest.c
436
@@ -XXX,XX +XXX,XX @@
437
#include "exec/ioport.h"
438
#include "exec/memory.h"
439
#include "hw/irq.h"
440
-#include "sysemu/accel.h"
441
+#include "qemu/accel.h"
442
#include "sysemu/cpu-timers.h"
443
#include "qemu/config-file.h"
444
#include "qemu/option.h"
445
diff --git a/softmmu/vl.c b/softmmu/vl.c
446
index XXXXXXX..XXXXXXX 100644
447
--- a/softmmu/vl.c
448
+++ b/softmmu/vl.c
449
@@ -XXX,XX +XXX,XX @@
450
451
#include "qemu/error-report.h"
452
#include "qemu/sockets.h"
453
-#include "sysemu/accel.h"
454
+#include "qemu/accel.h"
455
#include "hw/usb.h"
456
#include "hw/isa/isa.h"
457
#include "hw/scsi/scsi.h"
458
diff --git a/target/i386/hax/hax-all.c b/target/i386/hax/hax-all.c
459
index XXXXXXX..XXXXXXX 100644
460
--- a/target/i386/hax/hax-all.c
461
+++ b/target/i386/hax/hax-all.c
462
@@ -XXX,XX +XXX,XX @@
463
#include "exec/address-spaces.h"
464
465
#include "qemu-common.h"
466
-#include "sysemu/accel.h"
467
+#include "qemu/accel.h"
468
#include "sysemu/reset.h"
469
#include "sysemu/runstate.h"
470
#include "hw/boards.h"
471
diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c
472
index XXXXXXX..XXXXXXX 100644
473
--- a/target/i386/hvf/hvf.c
474
+++ b/target/i386/hvf/hvf.c
475
@@ -XXX,XX +XXX,XX @@
476
#include "exec/address-spaces.h"
477
#include "hw/i386/apic_internal.h"
478
#include "qemu/main-loop.h"
479
-#include "sysemu/accel.h"
480
+#include "qemu/accel.h"
481
#include "target/i386/cpu.h"
482
483
#include "hvf-cpus.h"
484
diff --git a/target/i386/hvf/x86_task.c b/target/i386/hvf/x86_task.c
485
index XXXXXXX..XXXXXXX 100644
486
--- a/target/i386/hvf/x86_task.c
487
+++ b/target/i386/hvf/x86_task.c
488
@@ -XXX,XX +XXX,XX @@
489
490
#include "hw/i386/apic_internal.h"
491
#include "qemu/main-loop.h"
492
-#include "sysemu/accel.h"
493
+#include "qemu/accel.h"
494
#include "target/i386/cpu.h"
495
496
// TODO: taskswitch handling
497
diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
498
index XXXXXXX..XXXXXXX 100644
499
--- a/target/i386/whpx/whpx-all.c
500
+++ b/target/i386/whpx/whpx-all.c
501
@@ -XXX,XX +XXX,XX @@
502
#include "exec/address-spaces.h"
503
#include "exec/ioport.h"
504
#include "qemu-common.h"
505
-#include "sysemu/accel.h"
506
+#include "qemu/accel.h"
507
#include "sysemu/whpx.h"
508
#include "sysemu/cpus.h"
509
#include "sysemu/runstate.h"
510
diff --git a/MAINTAINERS b/MAINTAINERS
127
diff --git a/MAINTAINERS b/MAINTAINERS
511
index XXXXXXX..XXXXXXX 100644
128
index XXXXXXX..XXXXXXX 100644
512
--- a/MAINTAINERS
129
--- a/MAINTAINERS
513
+++ b/MAINTAINERS
130
+++ b/MAINTAINERS
514
@@ -XXX,XX +XXX,XX @@ Overall
131
@@ -XXX,XX +XXX,XX @@ F: docs/devel/decodetree.rst
515
M: Richard Henderson <richard.henderson@linaro.org>
132
F: include/exec/cpu*.h
516
R: Paolo Bonzini <pbonzini@redhat.com>
133
F: include/exec/exec-all.h
517
S: Maintained
134
F: include/exec/helper*.h
518
-F: include/sysemu/accel.h
135
-F: include/exec/tb-hash.h
519
+F: include/qemu/accel.h
136
F: include/sysemu/cpus.h
520
F: accel/accel.c
137
F: include/sysemu/tcg.h
521
F: accel/Makefile.objs
138
F: include/hw/core/tcg-cpu-ops.h
522
F: accel/stubs/Makefile.objs
523
diff --git a/accel/meson.build b/accel/meson.build
524
index XXXXXXX..XXXXXXX 100644
525
--- a/accel/meson.build
526
+++ b/accel/meson.build
527
@@ -XXX,XX +XXX,XX @@
528
-softmmu_ss.add(files('accel.c'))
529
+specific_ss.add(files('accel-common.c'))
530
+softmmu_ss.add(files('accel-softmmu.c'))
531
+user_ss.add(files('accel-user.c'))
532
533
subdir('qtest')
534
subdir('kvm')
535
diff --git a/accel/tcg/meson.build b/accel/tcg/meson.build
536
index XXXXXXX..XXXXXXX 100644
537
--- a/accel/tcg/meson.build
538
+++ b/accel/tcg/meson.build
539
@@ -XXX,XX +XXX,XX @@
540
tcg_ss = ss.source_set()
541
tcg_ss.add(files(
542
+ 'tcg-all.c',
543
'cpu-exec-common.c',
544
'cpu-exec.c',
545
'tcg-runtime-gvec.c',
546
@@ -XXX,XX +XXX,XX @@ tcg_ss.add(when: 'CONFIG_PLUGIN', if_true: [files('plugin-gen.c'), libdl])
547
specific_ss.add_all(when: 'CONFIG_TCG', if_true: tcg_ss)
548
549
specific_ss.add(when: ['CONFIG_SOFTMMU', 'CONFIG_TCG'], if_true: files(
550
- 'tcg-all.c',
551
'cputlb.c',
552
'tcg-cpus.c',
553
'tcg-cpus-mttcg.c',
554
--
139
--
555
2.25.1
140
2.25.1
556
141
557
142
diff view generated by jsdifflib
1
As noted in several comments, 8 regs is not enough for 32-bit
1
From: Pavel Dovgalyuk <pavel.dovgalyuk@ispras.ru>
2
to perform calls, as currently implemented. Shortly, we will
3
rearrange the encoding which will make 32 regs impossible.
4
2
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
3
This patch enables reverse debugging with watchpoints.
4
Reverse continue scans the execution to find the breakpoints
5
and watchpoints that should fire. It uses helper function
6
replay_breakpoint() for that. But this function needs to access
7
icount, which can't be correct in the middle of TB.
8
Therefore, in case of watchpoint, we have to retranslate the block
9
to allow this access.
10
11
Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru>
12
Message-Id: <162072430303.827403.7379783546934958566.stgit@pasha-ThinkPad-X280>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
---
14
---
8
tcg/tci/tcg-target.h | 32 +++++---------------------------
15
softmmu/physmem.c | 10 ++++++++++
9
tcg/tci/tcg-target.c.inc | 26 --------------------------
16
1 file changed, 10 insertions(+)
10
2 files changed, 5 insertions(+), 53 deletions(-)
11
17
12
diff --git a/tcg/tci/tcg-target.h b/tcg/tci/tcg-target.h
18
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
13
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
14
--- a/tcg/tci/tcg-target.h
20
--- a/softmmu/physmem.c
15
+++ b/tcg/tci/tcg-target.h
21
+++ b/softmmu/physmem.c
16
@@ -XXX,XX +XXX,XX @@
22
@@ -XXX,XX +XXX,XX @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
17
#define TCG_TARGET_HAS_mulu2_i32 1
23
if (watchpoint_address_matches(wp, addr, len)
18
#endif /* TCG_TARGET_REG_BITS == 64 */
24
&& (wp->flags & flags)) {
19
25
if (replay_running_debug()) {
20
-/* Number of registers available.
26
+ /*
21
- For 32 bit hosts, we need more than 8 registers (call arguments). */
27
+ * replay_breakpoint reads icount.
22
-/* #define TCG_TARGET_NB_REGS 8 */
28
+ * Force recompile to succeed, because icount may
23
+/* Number of registers available. */
29
+ * be read only at the end of the block.
24
#define TCG_TARGET_NB_REGS 16
30
+ */
25
-/* #define TCG_TARGET_NB_REGS 32 */
31
+ if (!cpu->can_do_io) {
26
32
+ /* Force execution of one insn next time. */
27
/* List of registers which are used by TCG. */
33
+ cpu->cflags_next_tb = 1 | CF_LAST_IO | curr_cflags(cpu);
28
typedef enum {
34
+ cpu_loop_exit_restore(cpu, ra);
29
@@ -XXX,XX +XXX,XX @@ typedef enum {
35
+ }
30
TCG_REG_R5,
36
/*
31
TCG_REG_R6,
37
* Don't process the watchpoints when we are
32
TCG_REG_R7,
38
* in a reverse debugging operation.
33
-#if TCG_TARGET_NB_REGS >= 16
34
TCG_REG_R8,
35
TCG_REG_R9,
36
TCG_REG_R10,
37
@@ -XXX,XX +XXX,XX @@ typedef enum {
38
TCG_REG_R13,
39
TCG_REG_R14,
40
TCG_REG_R15,
41
-#if TCG_TARGET_NB_REGS >= 32
42
- TCG_REG_R16,
43
- TCG_REG_R17,
44
- TCG_REG_R18,
45
- TCG_REG_R19,
46
- TCG_REG_R20,
47
- TCG_REG_R21,
48
- TCG_REG_R22,
49
- TCG_REG_R23,
50
- TCG_REG_R24,
51
- TCG_REG_R25,
52
- TCG_REG_R26,
53
- TCG_REG_R27,
54
- TCG_REG_R28,
55
- TCG_REG_R29,
56
- TCG_REG_R30,
57
- TCG_REG_R31,
58
-#endif
59
-#endif
60
+
61
+ TCG_AREG0 = TCG_REG_R14,
62
+ TCG_REG_CALL_STACK = TCG_REG_R15,
63
+
64
/* Special value UINT8_MAX is used by TCI to encode constant values. */
65
TCG_CONST = UINT8_MAX
66
} TCGReg;
67
68
-#define TCG_AREG0 (TCG_TARGET_NB_REGS - 2)
69
-
70
/* Used for function call generation. */
71
-#define TCG_REG_CALL_STACK (TCG_TARGET_NB_REGS - 1)
72
#define TCG_TARGET_CALL_STACK_OFFSET 0
73
#define TCG_TARGET_STACK_ALIGN 16
74
75
diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc
76
index XXXXXXX..XXXXXXX 100644
77
--- a/tcg/tci/tcg-target.c.inc
78
+++ b/tcg/tci/tcg-target.c.inc
79
@@ -XXX,XX +XXX,XX @@ static const int tcg_target_reg_alloc_order[] = {
80
TCG_REG_R5,
81
TCG_REG_R6,
82
TCG_REG_R7,
83
-#if TCG_TARGET_NB_REGS >= 16
84
TCG_REG_R8,
85
TCG_REG_R9,
86
TCG_REG_R10,
87
@@ -XXX,XX +XXX,XX @@ static const int tcg_target_reg_alloc_order[] = {
88
TCG_REG_R13,
89
TCG_REG_R14,
90
TCG_REG_R15,
91
-#endif
92
};
93
94
#if MAX_OPC_PARAM_IARGS != 6
95
@@ -XXX,XX +XXX,XX @@ static const int tcg_target_call_iarg_regs[] = {
96
#if TCG_TARGET_REG_BITS == 32
97
/* 32 bit hosts need 2 * MAX_OPC_PARAM_IARGS registers. */
98
TCG_REG_R7,
99
-#if TCG_TARGET_NB_REGS >= 16
100
TCG_REG_R8,
101
TCG_REG_R9,
102
TCG_REG_R10,
103
TCG_REG_R11,
104
TCG_REG_R12,
105
-#else
106
-# error Too few input registers available
107
-#endif
108
#endif
109
};
110
111
@@ -XXX,XX +XXX,XX @@ static const char *const tcg_target_reg_names[TCG_TARGET_NB_REGS] = {
112
"r05",
113
"r06",
114
"r07",
115
-#if TCG_TARGET_NB_REGS >= 16
116
"r08",
117
"r09",
118
"r10",
119
@@ -XXX,XX +XXX,XX @@ static const char *const tcg_target_reg_names[TCG_TARGET_NB_REGS] = {
120
"r13",
121
"r14",
122
"r15",
123
-#if TCG_TARGET_NB_REGS >= 32
124
- "r16",
125
- "r17",
126
- "r18",
127
- "r19",
128
- "r20",
129
- "r21",
130
- "r22",
131
- "r23",
132
- "r24",
133
- "r25",
134
- "r26",
135
- "r27",
136
- "r28",
137
- "r29",
138
- "r30",
139
- "r31"
140
-#endif
141
-#endif
142
};
143
#endif
144
145
--
39
--
146
2.25.1
40
2.25.1
147
41
148
42
diff view generated by jsdifflib
1
Fixes INDEX_op_rotli_vec for aarch64 host, where the 3rd
1
From: Yasuo Kuwahara <kwhr00@gmail.com>
2
argument is an integer, not a temporary, which now tickles
3
an assert added in e89b28a6350.
4
2
5
Previously, the value computed into v2 would be garbage for
3
The last argument of tcg_out_extr() must be in the range 0-31 if ext==0.
6
rotli_vec, but as the value was unused it caused no harm.
4
Before the fix, when m==0 it becomes 32 and it crashes with an Illegal
5
instruction on Apple Silicon. After the fix, it will be 0. If m is in
6
the range 1-31, it is the same as before.
7
7
8
Signed-off-by: Yasuo Kuwahara <kwhr00@gmail.com>
9
Message-Id: <CAHfJ0vSXnmnTLmT0kR=a8ACRdw_UsLYOhStzUzgVEHoH8U-7sA@mail.gmail.com>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
---
11
---
10
tcg/aarch64/tcg-target.c.inc | 7 ++++---
12
tcg/aarch64/tcg-target.c.inc | 5 ++---
11
1 file changed, 4 insertions(+), 3 deletions(-)
13
1 file changed, 2 insertions(+), 3 deletions(-)
12
14
13
diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc
15
diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc
14
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
15
--- a/tcg/aarch64/tcg-target.c.inc
17
--- a/tcg/aarch64/tcg-target.c.inc
16
+++ b/tcg/aarch64/tcg-target.c.inc
18
+++ b/tcg/aarch64/tcg-target.c.inc
17
@@ -XXX,XX +XXX,XX @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece,
19
@@ -XXX,XX +XXX,XX @@ static inline void tcg_out_rotr(TCGContext *s, TCGType ext,
18
v0 = temp_tcgv_vec(arg_temp(a0));
20
static inline void tcg_out_rotl(TCGContext *s, TCGType ext,
19
v1 = temp_tcgv_vec(arg_temp(va_arg(va, TCGArg)));
21
TCGReg rd, TCGReg rn, unsigned int m)
20
a2 = va_arg(va, TCGArg);
22
{
21
- v2 = temp_tcgv_vec(arg_temp(a2));
23
- int bits = ext ? 64 : 32;
22
+ va_end(va);
24
- int max = bits - 1;
23
25
- tcg_out_extr(s, ext, rd, rn, rn, bits - (m & max));
24
switch (opc) {
26
+ int max = ext ? 63 : 31;
25
case INDEX_op_rotli_vec:
27
+ tcg_out_extr(s, ext, rd, rn, rn, -m & max);
26
@@ -XXX,XX +XXX,XX @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece,
27
case INDEX_op_shrv_vec:
28
case INDEX_op_sarv_vec:
29
/* Right shifts are negative left shifts for AArch64. */
30
+ v2 = temp_tcgv_vec(arg_temp(a2));
31
t1 = tcg_temp_new_vec(type);
32
tcg_gen_neg_vec(vece, t1, v2);
33
opc = (opc == INDEX_op_shrv_vec
34
@@ -XXX,XX +XXX,XX @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece,
35
break;
36
37
case INDEX_op_rotlv_vec:
38
+ v2 = temp_tcgv_vec(arg_temp(a2));
39
t1 = tcg_temp_new_vec(type);
40
c1 = tcg_constant_vec(type, vece, 8 << vece);
41
tcg_gen_sub_vec(vece, t1, v2, c1);
42
@@ -XXX,XX +XXX,XX @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece,
43
break;
44
45
case INDEX_op_rotrv_vec:
46
+ v2 = temp_tcgv_vec(arg_temp(a2));
47
t1 = tcg_temp_new_vec(type);
48
t2 = tcg_temp_new_vec(type);
49
c1 = tcg_constant_vec(type, vece, 8 << vece);
50
@@ -XXX,XX +XXX,XX @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece,
51
default:
52
g_assert_not_reached();
53
}
54
-
55
- va_end(va);
56
}
28
}
57
29
58
static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op)
30
static inline void tcg_out_dep(TCGContext *s, TCGType ext, TCGReg rd,
59
--
31
--
60
2.25.1
32
2.25.1
61
33
62
34
diff view generated by jsdifflib
1
Tested-by: Alex Bennée <alex.bennee@linaro.org>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
2
3
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-Id: <20210517105140.1062037-5-f4bug@amsat.org>
3
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
4
---
7
---
5
tcg/tci.c | 8 --------
8
hw/core/cpu.c | 1 -
6
1 file changed, 8 deletions(-)
9
1 file changed, 1 deletion(-)
7
10
8
diff --git a/tcg/tci.c b/tcg/tci.c
11
diff --git a/hw/core/cpu.c b/hw/core/cpu.c
9
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
10
--- a/tcg/tci.c
13
--- a/hw/core/cpu.c
11
+++ b/tcg/tci.c
14
+++ b/hw/core/cpu.c
12
@@ -XXX,XX +XXX,XX @@
15
@@ -XXX,XX +XXX,XX @@
13
#include "tcg/tcg-op.h"
16
#include "hw/qdev-properties.h"
14
#include "qemu/compiler.h"
17
#include "trace/trace-root.h"
15
18
#include "qemu/plugin.h"
16
-/* Marker for missing code. */
19
-#include "sysemu/hw_accel.h"
17
-#define TODO() \
20
18
- do { \
21
CPUState *cpu_by_arch_id(int64_t id)
19
- fprintf(stderr, "TODO %s:%u: %s()\n", \
22
{
20
- __FILE__, __LINE__, __func__); \
21
- tcg_abort(); \
22
- } while (0)
23
-
24
#if MAX_OPC_PARAM_IARGS != 6
25
# error Fix needed, number of supported input arguments changed!
26
#endif
27
--
23
--
28
2.25.1
24
2.25.1
29
25
30
26
diff view generated by jsdifflib
1
Tested-by: Alex Bennée <alex.bennee@linaro.org>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
2
3
The current cpu.c contains sysemu-specific methods.
4
To avoid building them in user-mode builds, split the
5
current cpu.c as cpu-common.c / cpu-sysemu.c.
6
7
Start by moving cpu_get_crash_info().
8
9
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-Id: <20210517105140.1062037-6-f4bug@amsat.org>
3
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
4
---
13
---
5
tcg/tci.c | 10 +---------
14
hw/core/{cpu.c => cpu-common.c} | 17 -----------------
6
1 file changed, 1 insertion(+), 9 deletions(-)
15
hw/core/cpu-sysemu.c | 34 +++++++++++++++++++++++++++++++++
16
hw/core/meson.build | 3 ++-
17
3 files changed, 36 insertions(+), 18 deletions(-)
18
rename hw/core/{cpu.c => cpu-common.c} (96%)
19
create mode 100644 hw/core/cpu-sysemu.c
7
20
8
diff --git a/tcg/tci.c b/tcg/tci.c
21
diff --git a/hw/core/cpu.c b/hw/core/cpu-common.c
22
similarity index 96%
23
rename from hw/core/cpu.c
24
rename to hw/core/cpu-common.c
9
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
10
--- a/tcg/tci.c
26
--- a/hw/core/cpu.c
11
+++ b/tcg/tci.c
27
+++ b/hw/core/cpu-common.c
12
@@ -XXX,XX +XXX,XX @@ tci_write_reg(tcg_target_ulong *regs, TCGReg index, tcg_target_ulong value)
28
@@ -XXX,XX +XXX,XX @@ static bool cpu_common_virtio_is_big_endian(CPUState *cpu)
13
regs[index] = value;
29
return target_words_bigendian();
14
}
30
}
15
31
16
-#if TCG_TARGET_REG_BITS == 64
32
-/*
17
-static void
33
- * XXX the following #if is always true because this is a common_ss
18
-tci_write_reg16(tcg_target_ulong *regs, TCGReg index, uint16_t value)
34
- * module, so target CONFIG_* is never defined.
35
- */
36
-#if !defined(CONFIG_USER_ONLY)
37
-GuestPanicInformation *cpu_get_crash_info(CPUState *cpu)
19
-{
38
-{
20
- tci_write_reg(regs, index, value);
39
- CPUClass *cc = CPU_GET_CLASS(cpu);
40
- GuestPanicInformation *res = NULL;
41
-
42
- if (cc->get_crash_info) {
43
- res = cc->get_crash_info(cpu);
44
- }
45
- return res;
21
-}
46
-}
22
-#endif
47
-#endif
23
-
48
-
24
static void
49
void cpu_dump_state(CPUState *cpu, FILE *f, int flags)
25
tci_write_reg32(tcg_target_ulong *regs, TCGReg index, uint32_t value)
26
{
50
{
27
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
51
CPUClass *cc = CPU_GET_CLASS(cpu);
28
t0 = *tb_ptr++;
52
diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c
29
t1 = tci_read_r(regs, &tb_ptr);
53
new file mode 100644
30
t2 = tci_read_s32(&tb_ptr);
54
index XXXXXXX..XXXXXXX
31
- tci_write_reg16(regs, t0, *(uint16_t *)(t1 + t2));
55
--- /dev/null
32
+ tci_write_reg(regs, t0, *(uint16_t *)(t1 + t2));
56
+++ b/hw/core/cpu-sysemu.c
33
break;
57
@@ -XXX,XX +XXX,XX @@
34
case INDEX_op_ld16s_i64:
58
+/*
35
TODO();
59
+ * QEMU CPU model (system emulation specific)
60
+ *
61
+ * Copyright (c) 2012-2014 SUSE LINUX Products GmbH
62
+ *
63
+ * This program is free software; you can redistribute it and/or
64
+ * modify it under the terms of the GNU General Public License
65
+ * as published by the Free Software Foundation; either version 2
66
+ * of the License, or (at your option) any later version.
67
+ *
68
+ * This program is distributed in the hope that it will be useful,
69
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
70
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
71
+ * GNU General Public License for more details.
72
+ *
73
+ * You should have received a copy of the GNU General Public License
74
+ * along with this program; if not, see
75
+ * <http://www.gnu.org/licenses/gpl-2.0.html>
76
+ */
77
+
78
+#include "qemu/osdep.h"
79
+#include "qapi/error.h"
80
+#include "hw/core/cpu.h"
81
+
82
+GuestPanicInformation *cpu_get_crash_info(CPUState *cpu)
83
+{
84
+ CPUClass *cc = CPU_GET_CLASS(cpu);
85
+ GuestPanicInformation *res = NULL;
86
+
87
+ if (cc->get_crash_info) {
88
+ res = cc->get_crash_info(cpu);
89
+ }
90
+ return res;
91
+}
92
diff --git a/hw/core/meson.build b/hw/core/meson.build
93
index XXXXXXX..XXXXXXX 100644
94
--- a/hw/core/meson.build
95
+++ b/hw/core/meson.build
96
@@ -XXX,XX +XXX,XX @@ hwcore_files = files(
97
'qdev-clock.c',
98
)
99
100
-common_ss.add(files('cpu.c'))
101
+common_ss.add(files('cpu-common.c'))
102
common_ss.add(when: 'CONFIG_FITLOADER', if_true: files('loader-fit.c'))
103
common_ss.add(when: 'CONFIG_GENERIC_LOADER', if_true: files('generic-loader.c'))
104
common_ss.add(when: ['CONFIG_GUEST_LOADER', fdt], if_true: files('guest-loader.c'))
105
@@ -XXX,XX +XXX,XX @@ common_ss.add(when: 'CONFIG_SPLIT_IRQ', if_true: files('split-irq.c'))
106
common_ss.add(when: 'CONFIG_XILINX_AXI', if_true: files('stream.c'))
107
108
softmmu_ss.add(files(
109
+ 'cpu-sysemu.c',
110
'fw-path-provider.c',
111
'loader.c',
112
'machine-hmp-cmds.c',
36
--
113
--
37
2.25.1
114
2.25.1
38
115
39
116
diff view generated by jsdifflib
1
From: Claudio Fontana <cfontana@suse.de>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
add a new optional interface to CPUClass, which allows accelerators
3
To be able to later extract the cpu_get_phys_page_debug() and
4
to extend the CPUClass with additional accelerator-specific
4
cpu_asidx_from_attrs() handlers from CPUClass, un-inline them
5
initializations.
5
from "hw/core/cpu.h".
6
6
7
This will allow to separate the target cpu code that is specific
7
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
to each accelerator, and register it automatically with object
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
hierarchy lookup depending on accelerator code availability,
9
Message-Id: <20210517105140.1062037-7-f4bug@amsat.org>
10
as part of the accel_init_interfaces() initialization step.
11
12
Signed-off-by: Claudio Fontana <cfontana@suse.de>
13
Message-Id: <20210204163931.7358-19-cfontana@suse.de>
14
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
15
---
11
---
16
include/hw/core/accel-cpu.h | 38 ++++++++++++++++++++++++++++++++
12
include/hw/core/cpu.h | 33 ++++-----------------------------
17
include/hw/core/cpu.h | 4 ++++
13
hw/core/cpu-sysemu.c | 32 ++++++++++++++++++++++++++++++++
18
accel/accel-common.c | 44 +++++++++++++++++++++++++++++++++++++
14
2 files changed, 36 insertions(+), 29 deletions(-)
19
MAINTAINERS | 1 +
20
4 files changed, 87 insertions(+)
21
create mode 100644 include/hw/core/accel-cpu.h
22
15
23
diff --git a/include/hw/core/accel-cpu.h b/include/hw/core/accel-cpu.h
24
new file mode 100644
25
index XXXXXXX..XXXXXXX
26
--- /dev/null
27
+++ b/include/hw/core/accel-cpu.h
28
@@ -XXX,XX +XXX,XX @@
29
+/*
30
+ * Accelerator interface, specializes CPUClass
31
+ * This header is used only by target-specific code.
32
+ *
33
+ * Copyright 2021 SUSE LLC
34
+ *
35
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
36
+ * See the COPYING file in the top-level directory.
37
+ */
38
+
39
+#ifndef ACCEL_CPU_H
40
+#define ACCEL_CPU_H
41
+
42
+/*
43
+ * This header is used to define new accelerator-specific target-specific
44
+ * accelerator cpu subclasses.
45
+ * It uses CPU_RESOLVING_TYPE, so this is clearly target-specific.
46
+ *
47
+ * Do not try to use for any other purpose than the implementation of new
48
+ * subclasses in target/, or the accel implementation itself in accel/
49
+ */
50
+
51
+#define TYPE_ACCEL_CPU "accel-" CPU_RESOLVING_TYPE
52
+#define ACCEL_CPU_NAME(name) (name "-" TYPE_ACCEL_CPU)
53
+typedef struct AccelCPUClass AccelCPUClass;
54
+DECLARE_CLASS_CHECKERS(AccelCPUClass, ACCEL_CPU, TYPE_ACCEL_CPU)
55
+
56
+typedef struct AccelCPUClass {
57
+ /*< private >*/
58
+ ObjectClass parent_class;
59
+ /*< public >*/
60
+
61
+ void (*cpu_class_init)(CPUClass *cc);
62
+ void (*cpu_instance_init)(CPUState *cpu);
63
+ void (*cpu_realizefn)(CPUState *cpu, Error **errp);
64
+} AccelCPUClass;
65
+
66
+#endif /* ACCEL_CPU_H */
67
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
16
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
68
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
69
--- a/include/hw/core/cpu.h
18
--- a/include/hw/core/cpu.h
70
+++ b/include/hw/core/cpu.h
19
+++ b/include/hw/core/cpu.h
71
@@ -XXX,XX +XXX,XX @@ struct TranslationBlock;
20
@@ -XXX,XX +XXX,XX @@ void cpu_dump_statistics(CPUState *cpu, int flags);
72
/* see tcg-cpu-ops.h */
21
*
73
struct TCGCPUOps;
22
* Returns: Corresponding physical page address or -1 if no page found.
74
23
*/
75
+/* see accel-cpu.h */
24
-static inline hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
76
+struct AccelCPUClass;
25
- MemTxAttrs *attrs)
26
-{
27
- CPUClass *cc = CPU_GET_CLASS(cpu);
28
-
29
- if (cc->get_phys_page_attrs_debug) {
30
- return cc->get_phys_page_attrs_debug(cpu, addr, attrs);
31
- }
32
- /* Fallback for CPUs which don't implement the _attrs_ hook */
33
- *attrs = MEMTXATTRS_UNSPECIFIED;
34
- return cc->get_phys_page_debug(cpu, addr);
35
-}
36
+hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
37
+ MemTxAttrs *attrs);
38
39
/**
40
* cpu_get_phys_page_debug:
41
@@ -XXX,XX +XXX,XX @@ static inline hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
42
*
43
* Returns: Corresponding physical page address or -1 if no page found.
44
*/
45
-static inline hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr)
46
-{
47
- MemTxAttrs attrs = {};
48
-
49
- return cpu_get_phys_page_attrs_debug(cpu, addr, &attrs);
50
-}
51
+hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
52
53
/** cpu_asidx_from_attrs:
54
* @cpu: CPU
55
@@ -XXX,XX +XXX,XX @@ static inline hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr)
56
* Returns the address space index specifying the CPU AddressSpace
57
* to use for a memory access with the given transaction attributes.
58
*/
59
-static inline int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs)
60
-{
61
- CPUClass *cc = CPU_GET_CLASS(cpu);
62
- int ret = 0;
63
-
64
- if (cc->asidx_from_attrs) {
65
- ret = cc->asidx_from_attrs(cpu, attrs);
66
- assert(ret < cpu->num_ases && ret >= 0);
67
- }
68
- return ret;
69
-}
70
+int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs);
71
72
#endif /* CONFIG_USER_ONLY */
73
74
diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c
75
index XXXXXXX..XXXXXXX 100644
76
--- a/hw/core/cpu-sysemu.c
77
+++ b/hw/core/cpu-sysemu.c
78
@@ -XXX,XX +XXX,XX @@
79
#include "qapi/error.h"
80
#include "hw/core/cpu.h"
81
82
+hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
83
+ MemTxAttrs *attrs)
84
+{
85
+ CPUClass *cc = CPU_GET_CLASS(cpu);
77
+
86
+
78
/**
87
+ if (cc->get_phys_page_attrs_debug) {
79
* CPUClass:
88
+ return cc->get_phys_page_attrs_debug(cpu, addr, attrs);
80
* @class_by_name: Callback to map -cpu command line model name to an
81
@@ -XXX,XX +XXX,XX @@ struct CPUClass {
82
/* Keep non-pointer data at the end to minimize holes. */
83
int gdb_num_core_regs;
84
bool gdb_stop_before_watchpoint;
85
+ struct AccelCPUClass *accel_cpu;
86
87
/* when TCG is not available, this pointer is NULL */
88
struct TCGCPUOps *tcg_ops;
89
diff --git a/accel/accel-common.c b/accel/accel-common.c
90
index XXXXXXX..XXXXXXX 100644
91
--- a/accel/accel-common.c
92
+++ b/accel/accel-common.c
93
@@ -XXX,XX +XXX,XX @@
94
#include "qemu/osdep.h"
95
#include "qemu/accel.h"
96
97
+#include "cpu.h"
98
+#include "hw/core/accel-cpu.h"
99
+
100
#ifndef CONFIG_USER_ONLY
101
#include "accel-softmmu.h"
102
#endif /* !CONFIG_USER_ONLY */
103
@@ -XXX,XX +XXX,XX @@ AccelClass *accel_find(const char *opt_name)
104
return ac;
105
}
106
107
+static void accel_init_cpu_int_aux(ObjectClass *klass, void *opaque)
108
+{
109
+ CPUClass *cc = CPU_CLASS(klass);
110
+ AccelCPUClass *accel_cpu = opaque;
111
+
112
+ cc->accel_cpu = accel_cpu;
113
+ if (accel_cpu->cpu_class_init) {
114
+ accel_cpu->cpu_class_init(cc);
115
+ }
89
+ }
90
+ /* Fallback for CPUs which don't implement the _attrs_ hook */
91
+ *attrs = MEMTXATTRS_UNSPECIFIED;
92
+ return cc->get_phys_page_debug(cpu, addr);
116
+}
93
+}
117
+
94
+
118
+/* initialize the arch-specific accel CpuClass interfaces */
95
+hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr)
119
+static void accel_init_cpu_interfaces(AccelClass *ac)
120
+{
96
+{
121
+ const char *ac_name; /* AccelClass name */
97
+ MemTxAttrs attrs = {};
122
+ char *acc_name; /* AccelCPUClass name */
123
+ ObjectClass *acc; /* AccelCPUClass */
124
+
98
+
125
+ ac_name = object_class_get_name(OBJECT_CLASS(ac));
99
+ return cpu_get_phys_page_attrs_debug(cpu, addr, &attrs);
126
+ g_assert(ac_name != NULL);
127
+
128
+ acc_name = g_strdup_printf("%s-%s", ac_name, CPU_RESOLVING_TYPE);
129
+ acc = object_class_by_name(acc_name);
130
+ g_free(acc_name);
131
+
132
+ if (acc) {
133
+ object_class_foreach(accel_init_cpu_int_aux,
134
+ CPU_RESOLVING_TYPE, false, acc);
135
+ }
136
+}
100
+}
137
+
101
+
138
void accel_init_interfaces(AccelClass *ac)
102
+int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs)
103
+{
104
+ CPUClass *cc = CPU_GET_CLASS(cpu);
105
+ int ret = 0;
106
+
107
+ if (cc->asidx_from_attrs) {
108
+ ret = cc->asidx_from_attrs(cpu, attrs);
109
+ assert(ret < cpu->num_ases && ret >= 0);
110
+ }
111
+ return ret;
112
+}
113
+
114
GuestPanicInformation *cpu_get_crash_info(CPUState *cpu)
139
{
115
{
140
#ifndef CONFIG_USER_ONLY
116
CPUClass *cc = CPU_GET_CLASS(cpu);
141
accel_init_ops_interfaces(ac);
142
#endif /* !CONFIG_USER_ONLY */
143
+
144
+ accel_init_cpu_interfaces(ac);
145
}
146
147
+static const TypeInfo accel_cpu_type = {
148
+ .name = TYPE_ACCEL_CPU,
149
+ .parent = TYPE_OBJECT,
150
+ .abstract = true,
151
+ .class_size = sizeof(AccelCPUClass),
152
+};
153
+
154
static void register_accel_types(void)
155
{
156
type_register_static(&accel_type);
157
+ type_register_static(&accel_cpu_type);
158
}
159
160
type_init(register_accel_types);
161
diff --git a/MAINTAINERS b/MAINTAINERS
162
index XXXXXXX..XXXXXXX 100644
163
--- a/MAINTAINERS
164
+++ b/MAINTAINERS
165
@@ -XXX,XX +XXX,XX @@ R: Paolo Bonzini <pbonzini@redhat.com>
166
S: Maintained
167
F: include/qemu/accel.h
168
F: include/sysemu/accel-ops.h
169
+F: include/hw/core/accel-cpu.h
170
F: accel/accel-*.c
171
F: accel/Makefile.objs
172
F: accel/stubs/Makefile.objs
173
--
117
--
174
2.25.1
118
2.25.1
175
119
176
120
diff view generated by jsdifflib
1
From: Claudio Fontana <cfontana@suse.de>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
commit 568496c0c0f1 ("cpu: Add callback to check architectural") and
3
Introduce the cpu_virtio_is_big_endian() generic helper to avoid
4
commit 3826121d9298 ("target-arm: Implement checking of fired")
4
calling CPUClass internal virtio_is_big_endian() one.
5
introduced an ARM-specific hack for cpu_check_watchpoint.
6
5
7
Make debug_check_watchpoint optional, and move it to tcg_ops.
6
Similarly to commit bf7663c4bd8 ("cpu: introduce
7
CPUClass::virtio_is_big_endian()"), we keep 'virtio' in the method
8
name to hint this handler shouldn't be called anywhere but from the
9
virtio code.
8
10
9
Signed-off-by: Claudio Fontana <cfontana@suse.de>
11
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
10
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
12
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-Id: <20210204163931.7358-15-cfontana@suse.de>
13
Message-Id: <20210517105140.1062037-8-f4bug@amsat.org>
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
14
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
---
15
---
14
include/hw/core/cpu.h | 9 ++++++---
16
include/hw/core/cpu.h | 9 +++++++++
15
accel/tcg/user-exec.c | 3 ++-
17
hw/core/cpu-common.c | 6 ------
16
hw/core/cpu.c | 9 ---------
18
hw/core/cpu-sysemu.c | 10 ++++++++++
17
softmmu/physmem.c | 4 ++--
19
hw/virtio/virtio.c | 4 +---
18
target/arm/cpu.c | 4 ++--
20
4 files changed, 20 insertions(+), 9 deletions(-)
19
5 files changed, 12 insertions(+), 17 deletions(-)
20
21
21
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
22
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
22
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
23
--- a/include/hw/core/cpu.h
24
--- a/include/hw/core/cpu.h
24
+++ b/include/hw/core/cpu.h
25
+++ b/include/hw/core/cpu.h
25
@@ -XXX,XX +XXX,XX @@ typedef struct TcgCpuOperations {
26
@@ -XXX,XX +XXX,XX @@ hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
26
*/
27
*/
27
vaddr (*adjust_watchpoint_address)(CPUState *cpu, vaddr addr, int len);
28
int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs);
28
29
29
+ /**
30
+/**
30
+ * @debug_check_watchpoint: return true if the architectural
31
+ * cpu_virtio_is_big_endian:
31
+ * watchpoint whose address has matched should really fire, used by ARM
32
+ * @cpu: CPU
32
+ */
33
+ bool (*debug_check_watchpoint)(CPUState *cpu, CPUWatchpoint *wp);
34
+
33
+
35
} TcgCpuOperations;
34
+ * Returns %true if a CPU which supports runtime configurable endianness
35
+ * is currently big-endian.
36
+ */
37
+bool cpu_virtio_is_big_endian(CPUState *cpu);
38
+
39
#endif /* CONFIG_USER_ONLY */
36
40
37
/**
41
/**
38
@@ -XXX,XX +XXX,XX @@ typedef struct TcgCpuOperations {
42
diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c
39
* a memory access with the specified memory transaction attributes.
40
* @gdb_read_register: Callback for letting GDB read a register.
41
* @gdb_write_register: Callback for letting GDB write a register.
42
- * @debug_check_watchpoint: Callback: return true if the architectural
43
- * watchpoint whose address has matched should really fire.
44
* @write_elf64_note: Callback for writing a CPU-specific ELF note to a
45
* 64-bit VM coredump.
46
* @write_elf32_qemunote: Callback for writing a CPU- and QEMU-specific ELF
47
@@ -XXX,XX +XXX,XX @@ struct CPUClass {
48
int (*asidx_from_attrs)(CPUState *cpu, MemTxAttrs attrs);
49
int (*gdb_read_register)(CPUState *cpu, GByteArray *buf, int reg);
50
int (*gdb_write_register)(CPUState *cpu, uint8_t *buf, int reg);
51
- bool (*debug_check_watchpoint)(CPUState *cpu, CPUWatchpoint *wp);
52
53
int (*write_elf64_note)(WriteCoreDumpFunction f, CPUState *cpu,
54
int cpuid, void *opaque);
55
diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
56
index XXXXXXX..XXXXXXX 100644
43
index XXXXXXX..XXXXXXX 100644
57
--- a/accel/tcg/user-exec.c
44
--- a/hw/core/cpu-common.c
58
+++ b/accel/tcg/user-exec.c
45
+++ b/hw/core/cpu-common.c
59
@@ -XXX,XX +XXX,XX @@ static inline int handle_cpu_signal(uintptr_t pc, siginfo_t *info,
60
clear_helper_retaddr();
61
62
cc = CPU_GET_CLASS(cpu);
63
- cc->tcg_ops.tlb_fill(cpu, address, 0, access_type, MMU_USER_IDX, false, pc);
64
+ cc->tcg_ops.tlb_fill(cpu, address, 0, access_type,
65
+ MMU_USER_IDX, false, pc);
66
g_assert_not_reached();
67
}
68
69
diff --git a/hw/core/cpu.c b/hw/core/cpu.c
70
index XXXXXXX..XXXXXXX 100644
71
--- a/hw/core/cpu.c
72
+++ b/hw/core/cpu.c
73
@@ -XXX,XX +XXX,XX @@ static int cpu_common_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg)
46
@@ -XXX,XX +XXX,XX @@ static int cpu_common_gdb_write_register(CPUState *cpu, uint8_t *buf, int reg)
74
return 0;
47
return 0;
75
}
48
}
76
49
77
-static bool cpu_common_debug_check_watchpoint(CPUState *cpu, CPUWatchpoint *wp)
50
-static bool cpu_common_virtio_is_big_endian(CPUState *cpu)
78
-{
51
-{
79
- /* If no extra check is required, QEMU watchpoint match can be considered
52
- return target_words_bigendian();
80
- * as an architectural match.
81
- */
82
- return true;
83
-}
53
-}
84
-
54
-
85
static bool cpu_common_virtio_is_big_endian(CPUState *cpu)
55
void cpu_dump_state(CPUState *cpu, FILE *f, int flags)
86
{
56
{
87
return target_words_bigendian();
57
CPUClass *cc = CPU_GET_CLASS(cpu);
88
@@ -XXX,XX +XXX,XX @@ static void cpu_class_init(ObjectClass *klass, void *data)
58
@@ -XXX,XX +XXX,XX @@ static void cpu_class_init(ObjectClass *klass, void *data)
59
k->write_elf64_note = cpu_common_write_elf64_note;
89
k->gdb_read_register = cpu_common_gdb_read_register;
60
k->gdb_read_register = cpu_common_gdb_read_register;
90
k->gdb_write_register = cpu_common_gdb_write_register;
61
k->gdb_write_register = cpu_common_gdb_write_register;
91
k->virtio_is_big_endian = cpu_common_virtio_is_big_endian;
62
- k->virtio_is_big_endian = cpu_common_virtio_is_big_endian;
92
- k->debug_check_watchpoint = cpu_common_debug_check_watchpoint;
93
set_bit(DEVICE_CATEGORY_CPU, dc->categories);
63
set_bit(DEVICE_CATEGORY_CPU, dc->categories);
94
dc->realize = cpu_common_realizefn;
64
dc->realize = cpu_common_realizefn;
95
dc->unrealize = cpu_common_unrealizefn;
65
dc->unrealize = cpu_common_unrealizefn;
96
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
66
diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c
97
index XXXXXXX..XXXXXXX 100644
67
index XXXXXXX..XXXXXXX 100644
98
--- a/softmmu/physmem.c
68
--- a/hw/core/cpu-sysemu.c
99
+++ b/softmmu/physmem.c
69
+++ b/hw/core/cpu-sysemu.c
100
@@ -XXX,XX +XXX,XX @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
70
@@ -XXX,XX +XXX,XX @@ int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs)
101
wp->hitaddr = MAX(addr, wp->vaddr);
71
return ret;
102
wp->hitattrs = attrs;
72
}
103
if (!cpu->watchpoint_hit) {
73
104
- if (wp->flags & BP_CPU &&
74
+bool cpu_virtio_is_big_endian(CPUState *cpu)
105
- !cc->debug_check_watchpoint(cpu, wp)) {
75
+{
106
+ if (wp->flags & BP_CPU && cc->tcg_ops.debug_check_watchpoint &&
76
+ CPUClass *cc = CPU_GET_CLASS(cpu);
107
+ !cc->tcg_ops.debug_check_watchpoint(cpu, wp)) {
77
+
108
wp->flags &= ~BP_WATCHPOINT_HIT;
78
+ if (cc->virtio_is_big_endian) {
109
continue;
79
+ return cc->virtio_is_big_endian(cpu);
110
}
80
+ }
111
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
81
+ return target_words_bigendian();
82
+}
83
+
84
GuestPanicInformation *cpu_get_crash_info(CPUState *cpu)
85
{
86
CPUClass *cc = CPU_GET_CLASS(cpu);
87
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
112
index XXXXXXX..XXXXXXX 100644
88
index XXXXXXX..XXXXXXX 100644
113
--- a/target/arm/cpu.c
89
--- a/hw/virtio/virtio.c
114
+++ b/target/arm/cpu.c
90
+++ b/hw/virtio/virtio.c
115
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
91
@@ -XXX,XX +XXX,XX @@ static enum virtio_device_endian virtio_default_endian(void)
116
cc->tcg_ops.synchronize_from_tb = arm_cpu_synchronize_from_tb;
92
117
cc->tcg_ops.tlb_fill = arm_cpu_tlb_fill;
93
static enum virtio_device_endian virtio_current_cpu_endian(void)
118
cc->tcg_ops.debug_excp_handler = arm_debug_excp_handler;
94
{
119
- cc->debug_check_watchpoint = arm_debug_check_watchpoint;
95
- CPUClass *cc = CPU_GET_CLASS(current_cpu);
120
#if !defined(CONFIG_USER_ONLY)
96
-
121
+ cc->tcg_ops.do_interrupt = arm_cpu_do_interrupt;
97
- if (cc->virtio_is_big_endian(current_cpu)) {
122
cc->tcg_ops.do_transaction_failed = arm_cpu_do_transaction_failed;
98
+ if (cpu_virtio_is_big_endian(current_cpu)) {
123
cc->tcg_ops.do_unaligned_access = arm_cpu_do_unaligned_access;
99
return VIRTIO_DEVICE_ENDIAN_BIG;
124
cc->tcg_ops.adjust_watchpoint_address = arm_adjust_watchpoint_address;
100
} else {
125
- cc->tcg_ops.do_interrupt = arm_cpu_do_interrupt;
101
return VIRTIO_DEVICE_ENDIAN_LITTLE;
126
+ cc->tcg_ops.debug_check_watchpoint = arm_debug_check_watchpoint;
127
#endif /* CONFIG_TCG && !CONFIG_USER_ONLY */
128
#endif /* CONFIG_TCG */
129
}
130
--
102
--
131
2.25.1
103
2.25.1
132
104
133
105
diff view generated by jsdifflib
1
For a 64-bit TCI, the upper bits of a 32-bit operation are
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
undefined (much like a native ppc64 32-bit operation). It
3
simplifies everything if we don't force-extend the result.
4
2
5
Tested-by: Alex Bennée <alex.bennee@linaro.org>
3
No code directly accesses CPUClass::write_elf*() handlers out
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
4
of hw/core/cpu.c (the rest are assignation in target/ code):
5
6
$ git grep -F -- '->write_elf'
7
hw/core/cpu.c:157: return (*cc->write_elf32_qemunote)(f, cpu, opaque);
8
hw/core/cpu.c:171: return (*cc->write_elf32_note)(f, cpu, cpuid, opaque);
9
hw/core/cpu.c:186: return (*cc->write_elf64_qemunote)(f, cpu, opaque);
10
hw/core/cpu.c:200: return (*cc->write_elf64_note)(f, cpu, cpuid, opaque);
11
hw/core/cpu.c:440: k->write_elf32_qemunote = cpu_common_write_elf32_qemunote;
12
hw/core/cpu.c:441: k->write_elf32_note = cpu_common_write_elf32_note;
13
hw/core/cpu.c:442: k->write_elf64_qemunote = cpu_common_write_elf64_qemunote;
14
hw/core/cpu.c:443: k->write_elf64_note = cpu_common_write_elf64_note;
15
target/arm/cpu.c:2304: cc->write_elf64_note = arm_cpu_write_elf64_note;
16
target/arm/cpu.c:2305: cc->write_elf32_note = arm_cpu_write_elf32_note;
17
target/i386/cpu.c:7425: cc->write_elf64_note = x86_cpu_write_elf64_note;
18
target/i386/cpu.c:7426: cc->write_elf64_qemunote = x86_cpu_write_elf64_qemunote;
19
target/i386/cpu.c:7427: cc->write_elf32_note = x86_cpu_write_elf32_note;
20
target/i386/cpu.c:7428: cc->write_elf32_qemunote = x86_cpu_write_elf32_qemunote;
21
target/ppc/translate_init.c.inc:10891: cc->write_elf64_note = ppc64_cpu_write_elf64_note;
22
target/ppc/translate_init.c.inc:10892: cc->write_elf32_note = ppc32_cpu_write_elf32_note;
23
target/s390x/cpu.c:522: cc->write_elf64_note = s390_cpu_write_elf64_note;
24
25
Check the handler presence in place and remove the common fallback code.
26
27
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
28
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
29
Message-Id: <20210517105140.1062037-9-f4bug@amsat.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
30
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
---
31
---
9
tcg/tci.c | 66 +++++++++++++++++++++++++------------------------------
32
hw/core/cpu-common.c | 63 --------------------------------------------
10
1 file changed, 30 insertions(+), 36 deletions(-)
33
hw/core/cpu-sysemu.c | 44 +++++++++++++++++++++++++++++++
34
2 files changed, 44 insertions(+), 63 deletions(-)
11
35
12
diff --git a/tcg/tci.c b/tcg/tci.c
36
diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c
13
index XXXXXXX..XXXXXXX 100644
37
index XXXXXXX..XXXXXXX 100644
14
--- a/tcg/tci.c
38
--- a/hw/core/cpu-common.c
15
+++ b/tcg/tci.c
39
+++ b/hw/core/cpu-common.c
16
@@ -XXX,XX +XXX,XX @@ tci_write_reg(tcg_target_ulong *regs, TCGReg index, tcg_target_ulong value)
40
@@ -XXX,XX +XXX,XX @@ void cpu_exit(CPUState *cpu)
17
regs[index] = value;
41
qatomic_set(&cpu->icount_decr_ptr->u16.high, -1);
18
}
42
}
19
43
20
-static void
44
-int cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
21
-tci_write_reg32(tcg_target_ulong *regs, TCGReg index, uint32_t value)
45
- void *opaque)
22
-{
46
-{
23
- tci_write_reg(regs, index, value);
47
- CPUClass *cc = CPU_GET_CLASS(cpu);
48
-
49
- return (*cc->write_elf32_qemunote)(f, cpu, opaque);
24
-}
50
-}
25
-
51
-
26
#if TCG_TARGET_REG_BITS == 32
52
-static int cpu_common_write_elf32_qemunote(WriteCoreDumpFunction f,
27
static void tci_write_reg64(tcg_target_ulong *regs, uint32_t high_index,
53
- CPUState *cpu, void *opaque)
28
uint32_t low_index, uint64_t value)
54
-{
29
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
55
- return 0;
30
t1 = tci_read_r32(regs, &tb_ptr);
56
-}
31
t2 = tci_read_ri32(regs, &tb_ptr);
57
-
32
condition = *tb_ptr++;
58
-int cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cpu,
33
- tci_write_reg32(regs, t0, tci_compare32(t1, t2, condition));
59
- int cpuid, void *opaque)
34
+ tci_write_reg(regs, t0, tci_compare32(t1, t2, condition));
60
-{
35
break;
61
- CPUClass *cc = CPU_GET_CLASS(cpu);
36
#if TCG_TARGET_REG_BITS == 32
62
-
37
case INDEX_op_setcond2_i32:
63
- return (*cc->write_elf32_note)(f, cpu, cpuid, opaque);
38
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
64
-}
39
tmp64 = tci_read_r64(regs, &tb_ptr);
65
-
40
v64 = tci_read_ri64(regs, &tb_ptr);
66
-static int cpu_common_write_elf32_note(WriteCoreDumpFunction f,
41
condition = *tb_ptr++;
67
- CPUState *cpu, int cpuid,
42
- tci_write_reg32(regs, t0, tci_compare64(tmp64, v64, condition));
68
- void *opaque)
43
+ tci_write_reg(regs, t0, tci_compare64(tmp64, v64, condition));
69
-{
44
break;
70
- return -1;
45
#elif TCG_TARGET_REG_BITS == 64
71
-}
46
case INDEX_op_setcond_i64:
72
-
47
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
73
-int cpu_write_elf64_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
48
case INDEX_op_mov_i32:
74
- void *opaque)
49
t0 = *tb_ptr++;
75
-{
50
t1 = tci_read_r32(regs, &tb_ptr);
76
- CPUClass *cc = CPU_GET_CLASS(cpu);
51
- tci_write_reg32(regs, t0, t1);
77
-
52
+ tci_write_reg(regs, t0, t1);
78
- return (*cc->write_elf64_qemunote)(f, cpu, opaque);
53
break;
79
-}
54
case INDEX_op_tci_movi_i32:
80
-
55
t0 = *tb_ptr++;
81
-static int cpu_common_write_elf64_qemunote(WriteCoreDumpFunction f,
56
t1 = tci_read_i32(&tb_ptr);
82
- CPUState *cpu, void *opaque)
57
- tci_write_reg32(regs, t0, t1);
83
-{
58
+ tci_write_reg(regs, t0, t1);
84
- return 0;
59
break;
85
-}
60
86
-
61
/* Load/store operations (32 bit). */
87
-int cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cpu,
62
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
88
- int cpuid, void *opaque)
63
t0 = *tb_ptr++;
89
-{
64
t1 = tci_read_r(regs, &tb_ptr);
90
- CPUClass *cc = CPU_GET_CLASS(cpu);
65
t2 = tci_read_s32(&tb_ptr);
91
-
66
- tci_write_reg32(regs, t0, *(uint32_t *)(t1 + t2));
92
- return (*cc->write_elf64_note)(f, cpu, cpuid, opaque);
67
+ tci_write_reg(regs, t0, *(uint32_t *)(t1 + t2));
93
-}
68
break;
94
-
69
case INDEX_op_st8_i32:
95
-static int cpu_common_write_elf64_note(WriteCoreDumpFunction f,
70
t0 = tci_read_r8(regs, &tb_ptr);
96
- CPUState *cpu, int cpuid,
71
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
97
- void *opaque)
72
t0 = *tb_ptr++;
98
-{
73
t1 = tci_read_ri32(regs, &tb_ptr);
99
- return -1;
74
t2 = tci_read_ri32(regs, &tb_ptr);
100
-}
75
- tci_write_reg32(regs, t0, t1 + t2);
101
-
76
+ tci_write_reg(regs, t0, t1 + t2);
102
-
77
break;
103
static int cpu_common_gdb_read_register(CPUState *cpu, GByteArray *buf, int reg)
78
case INDEX_op_sub_i32:
104
{
79
t0 = *tb_ptr++;
105
return 0;
80
t1 = tci_read_ri32(regs, &tb_ptr);
106
@@ -XXX,XX +XXX,XX @@ static void cpu_class_init(ObjectClass *klass, void *data)
81
t2 = tci_read_ri32(regs, &tb_ptr);
107
k->has_work = cpu_common_has_work;
82
- tci_write_reg32(regs, t0, t1 - t2);
108
k->get_paging_enabled = cpu_common_get_paging_enabled;
83
+ tci_write_reg(regs, t0, t1 - t2);
109
k->get_memory_mapping = cpu_common_get_memory_mapping;
84
break;
110
- k->write_elf32_qemunote = cpu_common_write_elf32_qemunote;
85
case INDEX_op_mul_i32:
111
- k->write_elf32_note = cpu_common_write_elf32_note;
86
t0 = *tb_ptr++;
112
- k->write_elf64_qemunote = cpu_common_write_elf64_qemunote;
87
t1 = tci_read_ri32(regs, &tb_ptr);
113
- k->write_elf64_note = cpu_common_write_elf64_note;
88
t2 = tci_read_ri32(regs, &tb_ptr);
114
k->gdb_read_register = cpu_common_gdb_read_register;
89
- tci_write_reg32(regs, t0, t1 * t2);
115
k->gdb_write_register = cpu_common_gdb_write_register;
90
+ tci_write_reg(regs, t0, t1 * t2);
116
set_bit(DEVICE_CATEGORY_CPU, dc->categories);
91
break;
117
diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c
92
#if TCG_TARGET_HAS_div_i32
118
index XXXXXXX..XXXXXXX 100644
93
case INDEX_op_div_i32:
119
--- a/hw/core/cpu-sysemu.c
94
t0 = *tb_ptr++;
120
+++ b/hw/core/cpu-sysemu.c
95
t1 = tci_read_ri32(regs, &tb_ptr);
121
@@ -XXX,XX +XXX,XX @@ int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs)
96
t2 = tci_read_ri32(regs, &tb_ptr);
122
return ret;
97
- tci_write_reg32(regs, t0, (int32_t)t1 / (int32_t)t2);
123
}
98
+ tci_write_reg(regs, t0, (int32_t)t1 / (int32_t)t2);
124
99
break;
125
+int cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
100
case INDEX_op_divu_i32:
126
+ void *opaque)
101
t0 = *tb_ptr++;
127
+{
102
t1 = tci_read_ri32(regs, &tb_ptr);
128
+ CPUClass *cc = CPU_GET_CLASS(cpu);
103
t2 = tci_read_ri32(regs, &tb_ptr);
129
+
104
- tci_write_reg32(regs, t0, t1 / t2);
130
+ if (!cc->write_elf32_qemunote) {
105
+ tci_write_reg(regs, t0, t1 / t2);
131
+ return 0;
106
break;
132
+ }
107
case INDEX_op_rem_i32:
133
+ return (*cc->write_elf32_qemunote)(f, cpu, opaque);
108
t0 = *tb_ptr++;
134
+}
109
t1 = tci_read_ri32(regs, &tb_ptr);
135
+
110
t2 = tci_read_ri32(regs, &tb_ptr);
136
+int cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cpu,
111
- tci_write_reg32(regs, t0, (int32_t)t1 % (int32_t)t2);
137
+ int cpuid, void *opaque)
112
+ tci_write_reg(regs, t0, (int32_t)t1 % (int32_t)t2);
138
+{
113
break;
139
+ CPUClass *cc = CPU_GET_CLASS(cpu);
114
case INDEX_op_remu_i32:
140
+
115
t0 = *tb_ptr++;
141
+ if (!cc->write_elf32_note) {
116
t1 = tci_read_ri32(regs, &tb_ptr);
142
+ return -1;
117
t2 = tci_read_ri32(regs, &tb_ptr);
143
+ }
118
- tci_write_reg32(regs, t0, t1 % t2);
144
+ return (*cc->write_elf32_note)(f, cpu, cpuid, opaque);
119
+ tci_write_reg(regs, t0, t1 % t2);
145
+}
120
break;
146
+
121
#elif TCG_TARGET_HAS_div2_i32
147
+int cpu_write_elf64_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
122
case INDEX_op_div2_i32:
148
+ void *opaque)
123
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
149
+{
124
t0 = *tb_ptr++;
150
+ CPUClass *cc = CPU_GET_CLASS(cpu);
125
t1 = tci_read_ri32(regs, &tb_ptr);
151
+
126
t2 = tci_read_ri32(regs, &tb_ptr);
152
+ if (!cc->write_elf64_qemunote) {
127
- tci_write_reg32(regs, t0, t1 & t2);
153
+ return 0;
128
+ tci_write_reg(regs, t0, t1 & t2);
154
+ }
129
break;
155
+ return (*cc->write_elf64_qemunote)(f, cpu, opaque);
130
case INDEX_op_or_i32:
156
+}
131
t0 = *tb_ptr++;
157
+
132
t1 = tci_read_ri32(regs, &tb_ptr);
158
+int cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cpu,
133
t2 = tci_read_ri32(regs, &tb_ptr);
159
+ int cpuid, void *opaque)
134
- tci_write_reg32(regs, t0, t1 | t2);
160
+{
135
+ tci_write_reg(regs, t0, t1 | t2);
161
+ CPUClass *cc = CPU_GET_CLASS(cpu);
136
break;
162
+
137
case INDEX_op_xor_i32:
163
+ if (!cc->write_elf64_note) {
138
t0 = *tb_ptr++;
164
+ return -1;
139
t1 = tci_read_ri32(regs, &tb_ptr);
165
+ }
140
t2 = tci_read_ri32(regs, &tb_ptr);
166
+ return (*cc->write_elf64_note)(f, cpu, cpuid, opaque);
141
- tci_write_reg32(regs, t0, t1 ^ t2);
167
+}
142
+ tci_write_reg(regs, t0, t1 ^ t2);
168
+
143
break;
169
bool cpu_virtio_is_big_endian(CPUState *cpu)
144
170
{
145
/* Shift/rotate operations (32 bit). */
171
CPUClass *cc = CPU_GET_CLASS(cpu);
146
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
147
t0 = *tb_ptr++;
148
t1 = tci_read_ri32(regs, &tb_ptr);
149
t2 = tci_read_ri32(regs, &tb_ptr);
150
- tci_write_reg32(regs, t0, t1 << (t2 & 31));
151
+ tci_write_reg(regs, t0, t1 << (t2 & 31));
152
break;
153
case INDEX_op_shr_i32:
154
t0 = *tb_ptr++;
155
t1 = tci_read_ri32(regs, &tb_ptr);
156
t2 = tci_read_ri32(regs, &tb_ptr);
157
- tci_write_reg32(regs, t0, t1 >> (t2 & 31));
158
+ tci_write_reg(regs, t0, t1 >> (t2 & 31));
159
break;
160
case INDEX_op_sar_i32:
161
t0 = *tb_ptr++;
162
t1 = tci_read_ri32(regs, &tb_ptr);
163
t2 = tci_read_ri32(regs, &tb_ptr);
164
- tci_write_reg32(regs, t0, ((int32_t)t1 >> (t2 & 31)));
165
+ tci_write_reg(regs, t0, ((int32_t)t1 >> (t2 & 31)));
166
break;
167
#if TCG_TARGET_HAS_rot_i32
168
case INDEX_op_rotl_i32:
169
t0 = *tb_ptr++;
170
t1 = tci_read_ri32(regs, &tb_ptr);
171
t2 = tci_read_ri32(regs, &tb_ptr);
172
- tci_write_reg32(regs, t0, rol32(t1, t2 & 31));
173
+ tci_write_reg(regs, t0, rol32(t1, t2 & 31));
174
break;
175
case INDEX_op_rotr_i32:
176
t0 = *tb_ptr++;
177
t1 = tci_read_ri32(regs, &tb_ptr);
178
t2 = tci_read_ri32(regs, &tb_ptr);
179
- tci_write_reg32(regs, t0, ror32(t1, t2 & 31));
180
+ tci_write_reg(regs, t0, ror32(t1, t2 & 31));
181
break;
182
#endif
183
#if TCG_TARGET_HAS_deposit_i32
184
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
185
tmp16 = *tb_ptr++;
186
tmp8 = *tb_ptr++;
187
tmp32 = (((1 << tmp8) - 1) << tmp16);
188
- tci_write_reg32(regs, t0, (t1 & ~tmp32) | ((t2 << tmp16) & tmp32));
189
+ tci_write_reg(regs, t0, (t1 & ~tmp32) | ((t2 << tmp16) & tmp32));
190
break;
191
#endif
192
case INDEX_op_brcond_i32:
193
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
194
case INDEX_op_ext8s_i32:
195
t0 = *tb_ptr++;
196
t1 = tci_read_r8s(regs, &tb_ptr);
197
- tci_write_reg32(regs, t0, t1);
198
+ tci_write_reg(regs, t0, t1);
199
break;
200
#endif
201
#if TCG_TARGET_HAS_ext16s_i32
202
case INDEX_op_ext16s_i32:
203
t0 = *tb_ptr++;
204
t1 = tci_read_r16s(regs, &tb_ptr);
205
- tci_write_reg32(regs, t0, t1);
206
+ tci_write_reg(regs, t0, t1);
207
break;
208
#endif
209
#if TCG_TARGET_HAS_ext8u_i32
210
case INDEX_op_ext8u_i32:
211
t0 = *tb_ptr++;
212
t1 = tci_read_r8(regs, &tb_ptr);
213
- tci_write_reg32(regs, t0, t1);
214
+ tci_write_reg(regs, t0, t1);
215
break;
216
#endif
217
#if TCG_TARGET_HAS_ext16u_i32
218
case INDEX_op_ext16u_i32:
219
t0 = *tb_ptr++;
220
t1 = tci_read_r16(regs, &tb_ptr);
221
- tci_write_reg32(regs, t0, t1);
222
+ tci_write_reg(regs, t0, t1);
223
break;
224
#endif
225
#if TCG_TARGET_HAS_bswap16_i32
226
case INDEX_op_bswap16_i32:
227
t0 = *tb_ptr++;
228
t1 = tci_read_r16(regs, &tb_ptr);
229
- tci_write_reg32(regs, t0, bswap16(t1));
230
+ tci_write_reg(regs, t0, bswap16(t1));
231
break;
232
#endif
233
#if TCG_TARGET_HAS_bswap32_i32
234
case INDEX_op_bswap32_i32:
235
t0 = *tb_ptr++;
236
t1 = tci_read_r32(regs, &tb_ptr);
237
- tci_write_reg32(regs, t0, bswap32(t1));
238
+ tci_write_reg(regs, t0, bswap32(t1));
239
break;
240
#endif
241
#if TCG_TARGET_HAS_not_i32
242
case INDEX_op_not_i32:
243
t0 = *tb_ptr++;
244
t1 = tci_read_r32(regs, &tb_ptr);
245
- tci_write_reg32(regs, t0, ~t1);
246
+ tci_write_reg(regs, t0, ~t1);
247
break;
248
#endif
249
#if TCG_TARGET_HAS_neg_i32
250
case INDEX_op_neg_i32:
251
t0 = *tb_ptr++;
252
t1 = tci_read_r32(regs, &tb_ptr);
253
- tci_write_reg32(regs, t0, -t1);
254
+ tci_write_reg(regs, t0, -t1);
255
break;
256
#endif
257
#if TCG_TARGET_REG_BITS == 64
258
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
259
t0 = *tb_ptr++;
260
t1 = tci_read_r(regs, &tb_ptr);
261
t2 = tci_read_s32(&tb_ptr);
262
- tci_write_reg32(regs, t0, *(uint32_t *)(t1 + t2));
263
+ tci_write_reg(regs, t0, *(uint32_t *)(t1 + t2));
264
break;
265
case INDEX_op_ld32s_i64:
266
t0 = *tb_ptr++;
267
--
172
--
268
2.25.1
173
2.25.1
269
174
270
175
diff view generated by jsdifflib
1
Tested-by: Alex Bennée <alex.bennee@linaro.org>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
2
3
No code uses CPUClass::get_paging_enabled() outside of hw/core/cpu.c:
4
5
$ git grep -F -- '->get_paging_enabled'
6
hw/core/cpu.c:74: return cc->get_paging_enabled(cpu);
7
hw/core/cpu.c:438: k->get_paging_enabled = cpu_common_get_paging_enabled;
8
target/i386/cpu.c:7418: cc->get_paging_enabled = x86_cpu_get_paging_enabled;
9
10
Check the handler presence in place and remove the common fallback code.
11
12
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Message-Id: <20210517105140.1062037-10-f4bug@amsat.org>
3
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
15
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
4
---
16
---
5
tcg/tci.c | 9 ++-------
17
hw/core/cpu-common.c | 13 -------------
6
1 file changed, 2 insertions(+), 7 deletions(-)
18
hw/core/cpu-sysemu.c | 11 +++++++++++
19
2 files changed, 11 insertions(+), 13 deletions(-)
7
20
8
diff --git a/tcg/tci.c b/tcg/tci.c
21
diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c
9
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
10
--- a/tcg/tci.c
23
--- a/hw/core/cpu-common.c
11
+++ b/tcg/tci.c
24
+++ b/hw/core/cpu-common.c
12
@@ -XXX,XX +XXX,XX @@ tci_write_reg(tcg_target_ulong *regs, TCGReg index, tcg_target_ulong value)
25
@@ -XXX,XX +XXX,XX @@ CPUState *cpu_create(const char *typename)
13
regs[index] = value;
26
return cpu;
14
}
27
}
15
28
16
-static void tci_write_reg8(tcg_target_ulong *regs, TCGReg index, uint8_t value)
29
-bool cpu_paging_enabled(const CPUState *cpu)
17
-{
30
-{
18
- tci_write_reg(regs, index, value);
31
- CPUClass *cc = CPU_GET_CLASS(cpu);
32
-
33
- return cc->get_paging_enabled(cpu);
19
-}
34
-}
20
-
35
-
21
#if TCG_TARGET_REG_BITS == 64
36
-static bool cpu_common_get_paging_enabled(const CPUState *cpu)
22
static void
37
-{
23
tci_write_reg16(tcg_target_ulong *regs, TCGReg index, uint16_t value)
38
- return false;
24
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
39
-}
25
t0 = *tb_ptr++;
40
-
26
t1 = tci_read_r(regs, &tb_ptr);
41
void cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list,
27
t2 = tci_read_s32(&tb_ptr);
42
Error **errp)
28
- tci_write_reg8(regs, t0, *(uint8_t *)(t1 + t2));
43
{
29
+ tci_write_reg(regs, t0, *(uint8_t *)(t1 + t2));
44
@@ -XXX,XX +XXX,XX @@ static void cpu_class_init(ObjectClass *klass, void *data)
30
break;
45
k->parse_features = cpu_common_parse_features;
31
case INDEX_op_ld8s_i32:
46
k->get_arch_id = cpu_common_get_arch_id;
32
TODO();
47
k->has_work = cpu_common_has_work;
33
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
48
- k->get_paging_enabled = cpu_common_get_paging_enabled;
34
t0 = *tb_ptr++;
49
k->get_memory_mapping = cpu_common_get_memory_mapping;
35
t1 = tci_read_r(regs, &tb_ptr);
50
k->gdb_read_register = cpu_common_gdb_read_register;
36
t2 = tci_read_s32(&tb_ptr);
51
k->gdb_write_register = cpu_common_gdb_write_register;
37
- tci_write_reg8(regs, t0, *(uint8_t *)(t1 + t2));
52
diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c
38
+ tci_write_reg(regs, t0, *(uint8_t *)(t1 + t2));
53
index XXXXXXX..XXXXXXX 100644
39
break;
54
--- a/hw/core/cpu-sysemu.c
40
case INDEX_op_ld8s_i64:
55
+++ b/hw/core/cpu-sysemu.c
41
t0 = *tb_ptr++;
56
@@ -XXX,XX +XXX,XX @@
57
#include "qapi/error.h"
58
#include "hw/core/cpu.h"
59
60
+bool cpu_paging_enabled(const CPUState *cpu)
61
+{
62
+ CPUClass *cc = CPU_GET_CLASS(cpu);
63
+
64
+ if (cc->get_paging_enabled) {
65
+ return cc->get_paging_enabled(cpu);
66
+ }
67
+
68
+ return false;
69
+}
70
+
71
hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
72
MemTxAttrs *attrs)
73
{
42
--
74
--
43
2.25.1
75
2.25.1
44
76
45
77
diff view generated by jsdifflib
1
From: Claudio Fontana <cfontana@suse.de>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
cpu_check_watchpoint, watchpoint_address_matches are TCG-only.
3
No code uses CPUClass::get_memory_mapping() outside of hw/core/cpu.c:
4
4
5
Signed-off-by: Claudio Fontana <cfontana@suse.de>
5
$ git grep -F -- '->get_memory_mapping'
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
hw/core/cpu.c:87: cc->get_memory_mapping(cpu, list, errp);
7
Message-Id: <20210204163931.7358-13-cfontana@suse.de>
7
hw/core/cpu.c:439: k->get_memory_mapping = cpu_common_get_memory_mapping;
8
target/i386/cpu.c:7422: cc->get_memory_mapping = x86_cpu_get_memory_mapping;
9
10
Check the handler presence in place and remove the common fallback code.
11
12
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Message-Id: <20210517105140.1062037-11-f4bug@amsat.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
15
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
---
16
---
10
softmmu/physmem.c | 141 +++++++++++++++++++++++-----------------------
17
hw/core/cpu-common.c | 16 ----------------
11
1 file changed, 72 insertions(+), 69 deletions(-)
18
hw/core/cpu-sysemu.c | 13 +++++++++++++
19
2 files changed, 13 insertions(+), 16 deletions(-)
12
20
13
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
21
diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c
14
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
15
--- a/softmmu/physmem.c
23
--- a/hw/core/cpu-common.c
16
+++ b/softmmu/physmem.c
24
+++ b/hw/core/cpu-common.c
17
@@ -XXX,XX +XXX,XX @@ void cpu_watchpoint_remove_all(CPUState *cpu, int mask)
25
@@ -XXX,XX +XXX,XX @@ CPUState *cpu_create(const char *typename)
18
}
26
return cpu;
19
}
27
}
20
28
21
+#ifdef CONFIG_TCG
29
-void cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list,
22
/* Return true if this watchpoint address matches the specified
30
- Error **errp)
23
* access (ie the address range covered by the watchpoint overlaps
31
-{
24
* partially or completely with the address range covered by the
32
- CPUClass *cc = CPU_GET_CLASS(cpu);
25
@@ -XXX,XX +XXX,XX @@ int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len)
33
-
26
return ret;
34
- cc->get_memory_mapping(cpu, list, errp);
35
-}
36
-
37
-static void cpu_common_get_memory_mapping(CPUState *cpu,
38
- MemoryMappingList *list,
39
- Error **errp)
40
-{
41
- error_setg(errp, "Obtaining memory mappings is unsupported on this CPU.");
42
-}
43
-
44
/* Resetting the IRQ comes from across the code base so we take the
45
* BQL here if we need to. cpu_interrupt assumes it is held.*/
46
void cpu_reset_interrupt(CPUState *cpu, int mask)
47
@@ -XXX,XX +XXX,XX @@ static void cpu_class_init(ObjectClass *klass, void *data)
48
k->parse_features = cpu_common_parse_features;
49
k->get_arch_id = cpu_common_get_arch_id;
50
k->has_work = cpu_common_has_work;
51
- k->get_memory_mapping = cpu_common_get_memory_mapping;
52
k->gdb_read_register = cpu_common_gdb_read_register;
53
k->gdb_write_register = cpu_common_gdb_write_register;
54
set_bit(DEVICE_CATEGORY_CPU, dc->categories);
55
diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c
56
index XXXXXXX..XXXXXXX 100644
57
--- a/hw/core/cpu-sysemu.c
58
+++ b/hw/core/cpu-sysemu.c
59
@@ -XXX,XX +XXX,XX @@ bool cpu_paging_enabled(const CPUState *cpu)
60
return false;
27
}
61
}
28
62
29
+/* Generate a debug exception if a watchpoint has been hit. */
63
+void cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list,
30
+void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
64
+ Error **errp)
31
+ MemTxAttrs attrs, int flags, uintptr_t ra)
32
+{
65
+{
33
+ CPUClass *cc = CPU_GET_CLASS(cpu);
66
+ CPUClass *cc = CPU_GET_CLASS(cpu);
34
+ CPUWatchpoint *wp;
35
+
67
+
36
+ assert(tcg_enabled());
68
+ if (cc->get_memory_mapping) {
37
+ if (cpu->watchpoint_hit) {
69
+ cc->get_memory_mapping(cpu, list, errp);
38
+ /*
39
+ * We re-entered the check after replacing the TB.
40
+ * Now raise the debug interrupt so that it will
41
+ * trigger after the current instruction.
42
+ */
43
+ qemu_mutex_lock_iothread();
44
+ cpu_interrupt(cpu, CPU_INTERRUPT_DEBUG);
45
+ qemu_mutex_unlock_iothread();
46
+ return;
70
+ return;
47
+ }
71
+ }
48
+
72
+
49
+ addr = cc->adjust_watchpoint_address(cpu, addr, len);
73
+ error_setg(errp, "Obtaining memory mappings is unsupported on this CPU.");
50
+ QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) {
51
+ if (watchpoint_address_matches(wp, addr, len)
52
+ && (wp->flags & flags)) {
53
+ if (replay_running_debug()) {
54
+ /*
55
+ * Don't process the watchpoints when we are
56
+ * in a reverse debugging operation.
57
+ */
58
+ replay_breakpoint();
59
+ return;
60
+ }
61
+ if (flags == BP_MEM_READ) {
62
+ wp->flags |= BP_WATCHPOINT_HIT_READ;
63
+ } else {
64
+ wp->flags |= BP_WATCHPOINT_HIT_WRITE;
65
+ }
66
+ wp->hitaddr = MAX(addr, wp->vaddr);
67
+ wp->hitattrs = attrs;
68
+ if (!cpu->watchpoint_hit) {
69
+ if (wp->flags & BP_CPU &&
70
+ !cc->debug_check_watchpoint(cpu, wp)) {
71
+ wp->flags &= ~BP_WATCHPOINT_HIT;
72
+ continue;
73
+ }
74
+ cpu->watchpoint_hit = wp;
75
+
76
+ mmap_lock();
77
+ tb_check_watchpoint(cpu, ra);
78
+ if (wp->flags & BP_STOP_BEFORE_ACCESS) {
79
+ cpu->exception_index = EXCP_DEBUG;
80
+ mmap_unlock();
81
+ cpu_loop_exit_restore(cpu, ra);
82
+ } else {
83
+ /* Force execution of one insn next time. */
84
+ cpu->cflags_next_tb = 1 | curr_cflags();
85
+ mmap_unlock();
86
+ if (ra) {
87
+ cpu_restore_state(cpu, ra, true);
88
+ }
89
+ cpu_loop_exit_noexc(cpu);
90
+ }
91
+ }
92
+ } else {
93
+ wp->flags &= ~BP_WATCHPOINT_HIT;
94
+ }
95
+ }
96
+}
74
+}
97
+
75
+
98
+#endif /* CONFIG_TCG */
76
hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
99
+
77
MemTxAttrs *attrs)
100
/* Called from RCU critical section */
101
static RAMBlock *qemu_get_ram_block(ram_addr_t addr)
102
{
78
{
103
@@ -XXX,XX +XXX,XX @@ ram_addr_t qemu_ram_addr_from_host(void *ptr)
104
return block->offset + offset;
105
}
106
107
-/* Generate a debug exception if a watchpoint has been hit. */
108
-void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
109
- MemTxAttrs attrs, int flags, uintptr_t ra)
110
-{
111
- CPUClass *cc = CPU_GET_CLASS(cpu);
112
- CPUWatchpoint *wp;
113
-
114
- assert(tcg_enabled());
115
- if (cpu->watchpoint_hit) {
116
- /*
117
- * We re-entered the check after replacing the TB.
118
- * Now raise the debug interrupt so that it will
119
- * trigger after the current instruction.
120
- */
121
- qemu_mutex_lock_iothread();
122
- cpu_interrupt(cpu, CPU_INTERRUPT_DEBUG);
123
- qemu_mutex_unlock_iothread();
124
- return;
125
- }
126
-
127
- addr = cc->adjust_watchpoint_address(cpu, addr, len);
128
- QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) {
129
- if (watchpoint_address_matches(wp, addr, len)
130
- && (wp->flags & flags)) {
131
- if (replay_running_debug()) {
132
- /*
133
- * Don't process the watchpoints when we are
134
- * in a reverse debugging operation.
135
- */
136
- replay_breakpoint();
137
- return;
138
- }
139
- if (flags == BP_MEM_READ) {
140
- wp->flags |= BP_WATCHPOINT_HIT_READ;
141
- } else {
142
- wp->flags |= BP_WATCHPOINT_HIT_WRITE;
143
- }
144
- wp->hitaddr = MAX(addr, wp->vaddr);
145
- wp->hitattrs = attrs;
146
- if (!cpu->watchpoint_hit) {
147
- if (wp->flags & BP_CPU &&
148
- !cc->debug_check_watchpoint(cpu, wp)) {
149
- wp->flags &= ~BP_WATCHPOINT_HIT;
150
- continue;
151
- }
152
- cpu->watchpoint_hit = wp;
153
-
154
- mmap_lock();
155
- tb_check_watchpoint(cpu, ra);
156
- if (wp->flags & BP_STOP_BEFORE_ACCESS) {
157
- cpu->exception_index = EXCP_DEBUG;
158
- mmap_unlock();
159
- cpu_loop_exit_restore(cpu, ra);
160
- } else {
161
- /* Force execution of one insn next time. */
162
- cpu->cflags_next_tb = 1 | curr_cflags();
163
- mmap_unlock();
164
- if (ra) {
165
- cpu_restore_state(cpu, ra, true);
166
- }
167
- cpu_loop_exit_noexc(cpu);
168
- }
169
- }
170
- } else {
171
- wp->flags &= ~BP_WATCHPOINT_HIT;
172
- }
173
- }
174
-}
175
-
176
static MemTxResult flatview_read(FlatView *fv, hwaddr addr,
177
MemTxAttrs attrs, void *buf, hwaddr len);
178
static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,
179
--
79
--
180
2.25.1
80
2.25.1
181
81
182
82
diff view generated by jsdifflib
1
From: Claudio Fontana <cfontana@suse.de>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
move away TCG-only code, make it compile only on TCG.
3
Migration is specific to system emulation.
4
4
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Restrict current DeviceClass::vmsd to sysemu using #ifdef'ry,
6
and assert in cpu_exec_realizefn() that dc->vmsd not set under
7
user emulation.
8
9
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
[claudio: moved the prototypes from hw/core/cpu.h to exec/cpu-all.h]
11
Message-Id: <20210517105140.1062037-12-f4bug@amsat.org>
8
Signed-off-by: Claudio Fontana <cfontana@suse.de>
9
Message-Id: <20210204163931.7358-4-cfontana@suse.de>
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11
---
13
---
12
include/exec/cpu-all.h | 11 +++++--
14
cpu.c | 2 ++
13
include/hw/core/cpu.h | 2 ++
15
target/sh4/cpu.c | 5 +++--
14
accel/tcg/cpu-exec.c | 28 +++++++++++++++++
16
target/xtensa/cpu.c | 4 +++-
15
cpu.c | 70 ++++++++++++++++++++----------------------
17
3 files changed, 8 insertions(+), 3 deletions(-)
16
hw/core/cpu.c | 6 +++-
17
5 files changed, 77 insertions(+), 40 deletions(-)
18
18
19
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
20
index XXXXXXX..XXXXXXX 100644
21
--- a/include/exec/cpu-all.h
22
+++ b/include/exec/cpu-all.h
23
@@ -XXX,XX +XXX,XX @@ static inline bool tlb_hit(target_ulong tlb_addr, target_ulong addr)
24
}
25
26
#ifdef CONFIG_TCG
27
+/* accel/tcg/cpu-exec.c */
28
void dump_drift_info(void);
29
+/* accel/tcg/translate-all.c */
30
void dump_exec_info(void);
31
void dump_opcount_info(void);
32
#endif /* CONFIG_TCG */
33
34
#endif /* !CONFIG_USER_ONLY */
35
36
+#ifdef CONFIG_TCG
37
+/* accel/tcg/cpu-exec.c */
38
+int cpu_exec(CPUState *cpu);
39
+void tcg_exec_realizefn(CPUState *cpu, Error **errp);
40
+void tcg_exec_unrealizefn(CPUState *cpu);
41
+#endif /* CONFIG_TCG */
42
+
43
/* Returns: 0 on success, -1 on error */
44
int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
45
void *ptr, target_ulong len, bool is_write);
46
47
-int cpu_exec(CPUState *cpu);
48
-
49
/**
50
* cpu_set_cpustate_pointers(cpu)
51
* @cpu: The cpu object
52
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
53
index XXXXXXX..XXXXXXX 100644
54
--- a/include/hw/core/cpu.h
55
+++ b/include/hw/core/cpu.h
56
@@ -XXX,XX +XXX,XX @@ AddressSpace *cpu_get_address_space(CPUState *cpu, int asidx);
57
58
void QEMU_NORETURN cpu_abort(CPUState *cpu, const char *fmt, ...)
59
GCC_FMT_ATTR(2, 3);
60
+
61
+/* $(top_srcdir)/cpu.c */
62
void cpu_exec_initfn(CPUState *cpu);
63
void cpu_exec_realizefn(CPUState *cpu, Error **errp);
64
void cpu_exec_unrealizefn(CPUState *cpu);
65
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
66
index XXXXXXX..XXXXXXX 100644
67
--- a/accel/tcg/cpu-exec.c
68
+++ b/accel/tcg/cpu-exec.c
69
@@ -XXX,XX +XXX,XX @@ int cpu_exec(CPUState *cpu)
70
return ret;
71
}
72
73
+void tcg_exec_realizefn(CPUState *cpu, Error **errp)
74
+{
75
+ static bool tcg_target_initialized;
76
+ CPUClass *cc = CPU_GET_CLASS(cpu);
77
+
78
+ if (!tcg_target_initialized) {
79
+ cc->tcg_ops.initialize();
80
+ tcg_target_initialized = true;
81
+ }
82
+ tlb_init(cpu);
83
+ qemu_plugin_vcpu_init_hook(cpu);
84
+
85
+#ifndef CONFIG_USER_ONLY
86
+ tcg_iommu_init_notifier_list(cpu);
87
+#endif /* !CONFIG_USER_ONLY */
88
+}
89
+
90
+/* undo the initializations in reverse order */
91
+void tcg_exec_unrealizefn(CPUState *cpu)
92
+{
93
+#ifndef CONFIG_USER_ONLY
94
+ tcg_iommu_free_notifier_list(cpu);
95
+#endif /* !CONFIG_USER_ONLY */
96
+
97
+ qemu_plugin_vcpu_exit_hook(cpu);
98
+ tlb_destroy(cpu);
99
+}
100
+
101
#ifndef CONFIG_USER_ONLY
102
103
void dump_drift_info(void)
104
diff --git a/cpu.c b/cpu.c
19
diff --git a/cpu.c b/cpu.c
105
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
106
--- a/cpu.c
21
--- a/cpu.c
107
+++ b/cpu.c
22
+++ b/cpu.c
108
@@ -XXX,XX +XXX,XX @@ const VMStateDescription vmstate_cpu_common = {
23
@@ -XXX,XX +XXX,XX @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp)
24
#endif /* CONFIG_TCG */
25
26
#ifdef CONFIG_USER_ONLY
27
+ assert(qdev_get_vmsd(DEVICE(cpu)) == NULL ||
28
+ qdev_get_vmsd(DEVICE(cpu))->unmigratable);
29
assert(cc->vmsd == NULL);
30
#else
31
if (qdev_get_vmsd(DEVICE(cpu)) == NULL) {
32
diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c
33
index XXXXXXX..XXXXXXX 100644
34
--- a/target/sh4/cpu.c
35
+++ b/target/sh4/cpu.c
36
@@ -XXX,XX +XXX,XX @@ static void superh_cpu_initfn(Object *obj)
37
env->movcal_backup_tail = &(env->movcal_backup);
38
}
39
40
+#ifndef CONFIG_USER_ONLY
41
static const VMStateDescription vmstate_sh_cpu = {
42
.name = "cpu",
43
.unmigratable = 1,
109
};
44
};
45
+#endif
46
47
#include "hw/core/tcg-cpu-ops.h"
48
49
@@ -XXX,XX +XXX,XX @@ static void superh_cpu_class_init(ObjectClass *oc, void *data)
50
cc->gdb_write_register = superh_cpu_gdb_write_register;
51
#ifndef CONFIG_USER_ONLY
52
cc->get_phys_page_debug = superh_cpu_get_phys_page_debug;
53
+ dc->vmsd = &vmstate_sh_cpu;
110
#endif
54
#endif
111
55
cc->disas_set_info = superh_cpu_disas_set_info;
112
-void cpu_exec_unrealizefn(CPUState *cpu)
56
113
+void cpu_exec_realizefn(CPUState *cpu, Error **errp)
57
cc->gdb_num_core_regs = 59;
114
{
58
-
115
CPUClass *cc = CPU_GET_CLASS(cpu);
59
- dc->vmsd = &vmstate_sh_cpu;
116
60
cc->tcg_ops = &superh_tcg_ops;
117
- tlb_destroy(cpu);
118
- cpu_list_remove(cpu);
119
+ cpu_list_add(cpu);
120
+
121
+#ifdef CONFIG_TCG
122
+ /* NB: errp parameter is unused currently */
123
+ if (tcg_enabled()) {
124
+ tcg_exec_realizefn(cpu, errp);
125
+ }
126
+#endif /* CONFIG_TCG */
127
+
128
+#ifdef CONFIG_USER_ONLY
129
+ assert(cc->vmsd == NULL);
130
+#else
131
+ if (qdev_get_vmsd(DEVICE(cpu)) == NULL) {
132
+ vmstate_register(NULL, cpu->cpu_index, &vmstate_cpu_common, cpu);
133
+ }
134
+ if (cc->vmsd != NULL) {
135
+ vmstate_register(NULL, cpu->cpu_index, cc->vmsd, cpu);
136
+ }
137
+#endif /* CONFIG_USER_ONLY */
138
+}
139
+
140
+void cpu_exec_unrealizefn(CPUState *cpu)
141
+{
142
+ CPUClass *cc = CPU_GET_CLASS(cpu);
143
144
#ifdef CONFIG_USER_ONLY
145
assert(cc->vmsd == NULL);
146
@@ -XXX,XX +XXX,XX @@ void cpu_exec_unrealizefn(CPUState *cpu)
147
if (qdev_get_vmsd(DEVICE(cpu)) == NULL) {
148
vmstate_unregister(NULL, &vmstate_cpu_common, cpu);
149
}
150
- tcg_iommu_free_notifier_list(cpu);
151
#endif
152
+#ifdef CONFIG_TCG
153
+ /* NB: errp parameter is unused currently */
154
+ if (tcg_enabled()) {
155
+ tcg_exec_unrealizefn(cpu);
156
+ }
157
+#endif /* CONFIG_TCG */
158
+
159
+ cpu_list_remove(cpu);
160
}
61
}
161
62
162
void cpu_exec_initfn(CPUState *cpu)
63
diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c
163
@@ -XXX,XX +XXX,XX @@ void cpu_exec_initfn(CPUState *cpu)
64
index XXXXXXX..XXXXXXX 100644
65
--- a/target/xtensa/cpu.c
66
+++ b/target/xtensa/cpu.c
67
@@ -XXX,XX +XXX,XX @@ static void xtensa_cpu_initfn(Object *obj)
164
#endif
68
#endif
165
}
69
}
166
70
167
-void cpu_exec_realizefn(CPUState *cpu, Error **errp)
71
+#ifndef CONFIG_USER_ONLY
168
-{
72
static const VMStateDescription vmstate_xtensa_cpu = {
169
- CPUClass *cc = CPU_GET_CLASS(cpu);
73
.name = "cpu",
170
-#ifdef CONFIG_TCG
74
.unmigratable = 1,
171
- static bool tcg_target_initialized;
75
};
172
-#endif /* CONFIG_TCG */
76
+#endif
173
-
77
174
- cpu_list_add(cpu);
78
#include "hw/core/tcg-cpu-ops.h"
175
-
79
176
-#ifdef CONFIG_TCG
80
@@ -XXX,XX +XXX,XX @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data)
177
- if (tcg_enabled() && !tcg_target_initialized) {
81
cc->gdb_stop_before_watchpoint = true;
178
- tcg_target_initialized = true;
82
#ifndef CONFIG_USER_ONLY
179
- cc->tcg_ops.initialize();
83
cc->get_phys_page_debug = xtensa_cpu_get_phys_page_debug;
180
- }
84
+ dc->vmsd = &vmstate_xtensa_cpu;
181
-#endif /* CONFIG_TCG */
85
#endif
182
- tlb_init(cpu);
86
cc->disas_set_info = xtensa_cpu_disas_set_info;
183
-
87
- dc->vmsd = &vmstate_xtensa_cpu;
184
- qemu_plugin_vcpu_init_hook(cpu);
88
cc->tcg_ops = &xtensa_tcg_ops;
185
-
186
-#ifdef CONFIG_USER_ONLY
187
- assert(cc->vmsd == NULL);
188
-#else /* !CONFIG_USER_ONLY */
189
- if (qdev_get_vmsd(DEVICE(cpu)) == NULL) {
190
- vmstate_register(NULL, cpu->cpu_index, &vmstate_cpu_common, cpu);
191
- }
192
- if (cc->vmsd != NULL) {
193
- vmstate_register(NULL, cpu->cpu_index, cc->vmsd, cpu);
194
- }
195
-
196
- tcg_iommu_init_notifier_list(cpu);
197
-#endif
198
-}
199
-
200
const char *parse_cpu_option(const char *cpu_option)
201
{
202
ObjectClass *oc;
203
diff --git a/hw/core/cpu.c b/hw/core/cpu.c
204
index XXXXXXX..XXXXXXX 100644
205
--- a/hw/core/cpu.c
206
+++ b/hw/core/cpu.c
207
@@ -XXX,XX +XXX,XX @@ static bool cpu_common_virtio_is_big_endian(CPUState *cpu)
208
return target_words_bigendian();
209
}
89
}
210
211
+/*
212
+ * XXX the following #if is always true because this is a common_ss
213
+ * module, so target CONFIG_* is never defined.
214
+ */
215
#if !defined(CONFIG_USER_ONLY)
216
GuestPanicInformation *cpu_get_crash_info(CPUState *cpu)
217
{
218
@@ -XXX,XX +XXX,XX @@ static void cpu_common_realizefn(DeviceState *dev, Error **errp)
219
static void cpu_common_unrealizefn(DeviceState *dev)
220
{
221
CPUState *cpu = CPU(dev);
222
+
223
/* NOTE: latest generic point before the cpu is fully unrealized */
224
trace_fini_vcpu(cpu);
225
- qemu_plugin_vcpu_exit_hook(cpu);
226
cpu_exec_unrealizefn(cpu);
227
}
228
90
229
--
91
--
230
2.25.1
92
2.25.1
231
93
232
94
diff view generated by jsdifflib
1
From: Eduardo Habkost <ehabkost@redhat.com>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3
Quoting Peter Maydell [*]:
4
[claudio: wrapped target code in CONFIG_TCG]
4
5
Signed-off-by: Claudio Fontana <cfontana@suse.de>
5
There are two ways to handle migration for
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
a CPU object:
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
8
(1) like any other device, so it has a dc->vmsd that covers
9
migration for the whole object. As usual for objects that are a
10
subclass of a parent that has state, the first entry in the
11
VMStateDescription field list is VMSTATE_CPU(), which migrates
12
the cpu_common fields, followed by whatever the CPU's own migration
13
fields are.
14
15
(2) a backwards-compatible mechanism for CPUs that were
16
originally migrated using manual "write fields to the migration
17
stream structures". The on-the-wire migration format
18
for those is based on the 'env' pointer (which isn't a QOM object),
19
and the cpu_common part of the migration data is elsewhere.
20
21
cpu_exec_realizefn() handles both possibilities:
22
23
* for type 1, dc->vmsd is set and cc->vmsd is not,
24
so cpu_exec_realizefn() does nothing, and the standard
25
"register dc->vmsd for a device" code does everything needed
26
27
* for type 2, dc->vmsd is NULL and so we register the
28
vmstate_cpu_common directly to handle the cpu-common fields,
29
and the cc->vmsd to handle the per-CPU stuff
30
31
You can't change a CPU from one type to the other without breaking
32
migration compatibility, which is why some guest architectures
33
are stuck on the cc->vmsd form. New targets should use dc->vmsd.
34
35
To avoid new targets to start using type (2), rename cc->vmsd as
36
cc->legacy_vmsd. The correct field to implement is dc->vmsd (the
37
DeviceClass one).
38
39
See also commit b170fce3dd0 ("cpu: Register VMStateDescription
40
through CPUState") for historic background.
41
42
[*] https://www.mail-archive.com/qemu-devel@nongnu.org/msg800849.html
43
44
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
45
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-Id: <20210204163931.7358-6-cfontana@suse.de>
46
Cc: Peter Maydell <peter.maydell@linaro.org>
47
Message-Id: <20210517105140.1062037-13-f4bug@amsat.org>
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
48
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11
---
49
---
12
include/hw/core/cpu.h | 12 ++++++------
50
include/hw/core/cpu.h | 5 +++--
13
accel/tcg/cpu-exec.c | 12 ++++++------
51
cpu.c | 12 ++++++------
14
target/alpha/cpu.c | 2 +-
52
target/arm/cpu.c | 2 +-
15
target/arm/cpu.c | 2 +-
53
target/avr/cpu.c | 2 +-
16
target/arm/cpu64.c | 5 ++++-
54
target/i386/cpu.c | 2 +-
17
target/arm/cpu_tcg.c | 7 ++++++-
55
target/mips/cpu.c | 2 +-
18
target/avr/cpu.c | 2 +-
56
target/ppc/cpu_init.c | 2 +-
19
target/cris/cpu.c | 2 +-
57
target/riscv/cpu.c | 3 +--
20
target/hppa/cpu.c | 2 +-
58
target/s390x/cpu.c | 2 +-
21
target/i386/tcg/tcg-cpu.c | 6 +++---
59
target/sparc/cpu.c | 2 +-
22
target/lm32/cpu.c | 2 +-
60
10 files changed, 17 insertions(+), 17 deletions(-)
23
target/m68k/cpu.c | 2 +-
24
target/microblaze/cpu.c | 2 +-
25
target/mips/cpu.c | 2 +-
26
target/nios2/cpu.c | 2 +-
27
target/openrisc/cpu.c | 2 +-
28
target/riscv/cpu.c | 2 +-
29
target/rx/cpu.c | 2 +-
30
target/s390x/cpu.c | 2 +-
31
target/sh4/cpu.c | 2 +-
32
target/sparc/cpu.c | 2 +-
33
target/tilegx/cpu.c | 2 +-
34
target/unicore32/cpu.c | 2 +-
35
target/xtensa/cpu.c | 2 +-
36
target/ppc/translate_init.c.inc | 16 ++++++++++------
37
25 files changed, 54 insertions(+), 42 deletions(-)
38
61
39
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
62
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
40
index XXXXXXX..XXXXXXX 100644
63
index XXXXXXX..XXXXXXX 100644
41
--- a/include/hw/core/cpu.h
64
--- a/include/hw/core/cpu.h
42
+++ b/include/hw/core/cpu.h
65
+++ b/include/hw/core/cpu.h
43
@@ -XXX,XX +XXX,XX @@ typedef struct TcgCpuOperations {
66
@@ -XXX,XX +XXX,XX @@ struct AccelCPUClass;
44
*/
67
* 32-bit VM coredump.
45
void (*synchronize_from_tb)(CPUState *cpu,
68
* @write_elf32_qemunote: Callback for writing a CPU- and QEMU-specific ELF
46
const struct TranslationBlock *tb);
69
* note to a 32-bit VM coredump.
47
+ /** @cpu_exec_enter: Callback for cpu_exec preparation */
70
- * @vmsd: State description for migration.
48
+ void (*cpu_exec_enter)(CPUState *cpu);
71
+ * @legacy_vmsd: Legacy state description for migration.
49
+ /** @cpu_exec_exit: Callback for cpu_exec cleanup */
72
+ * Do not use in new targets, use #DeviceClass::vmsd instead.
50
+ void (*cpu_exec_exit)(CPUState *cpu);
73
* @gdb_num_core_regs: Number of core registers accessible to GDB.
51
+ /** @cpu_exec_interrupt: Callback for processing interrupts in cpu_exec */
74
* @gdb_core_xml_file: File name for core registers GDB XML description.
52
+ bool (*cpu_exec_interrupt)(CPUState *cpu, int interrupt_request);
75
* @gdb_stop_before_watchpoint: Indicates whether GDB expects the CPU to stop
53
54
} TcgCpuOperations;
55
56
@@ -XXX,XX +XXX,XX @@ typedef struct TcgCpuOperations {
57
* @gdb_get_dynamic_xml: Callback to return dynamically generated XML for the
58
* gdb stub. Returns a pointer to the XML contents for the specified XML file
59
* or NULL if the CPU doesn't have a dynamically generated content for it.
60
- * @cpu_exec_enter: Callback for cpu_exec preparation.
61
- * @cpu_exec_exit: Callback for cpu_exec cleanup.
62
- * @cpu_exec_interrupt: Callback for processing interrupts in cpu_exec.
63
* @disas_set_info: Setup architecture specific components of disassembly info
64
* @adjust_watchpoint_address: Perform a target-specific adjustment to an
65
* address before attempting to match it against watchpoints.
66
@@ -XXX,XX +XXX,XX @@ struct CPUClass {
76
@@ -XXX,XX +XXX,XX @@ struct CPUClass {
77
int (*write_elf32_qemunote)(WriteCoreDumpFunction f, CPUState *cpu,
78
void *opaque);
79
80
- const VMStateDescription *vmsd;
81
+ const VMStateDescription *legacy_vmsd;
67
const char *gdb_core_xml_file;
82
const char *gdb_core_xml_file;
68
gchar * (*gdb_arch_name)(CPUState *cpu);
83
gchar * (*gdb_arch_name)(CPUState *cpu);
69
const char * (*gdb_get_dynamic_xml)(CPUState *cpu, const char *xmlname);
84
const char * (*gdb_get_dynamic_xml)(CPUState *cpu, const char *xmlname);
70
- void (*cpu_exec_enter)(CPUState *cpu);
85
diff --git a/cpu.c b/cpu.c
71
- void (*cpu_exec_exit)(CPUState *cpu);
86
index XXXXXXX..XXXXXXX 100644
72
- bool (*cpu_exec_interrupt)(CPUState *cpu, int interrupt_request);
87
--- a/cpu.c
73
88
+++ b/cpu.c
74
void (*disas_set_info)(CPUState *cpu, disassemble_info *info);
89
@@ -XXX,XX +XXX,XX @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp)
75
vaddr (*adjust_watchpoint_address)(CPUState *cpu, vaddr addr, int len);
90
#ifdef CONFIG_USER_ONLY
76
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
91
assert(qdev_get_vmsd(DEVICE(cpu)) == NULL ||
77
index XXXXXXX..XXXXXXX 100644
92
qdev_get_vmsd(DEVICE(cpu))->unmigratable);
78
--- a/accel/tcg/cpu-exec.c
93
- assert(cc->vmsd == NULL);
79
+++ b/accel/tcg/cpu-exec.c
94
+ assert(cc->legacy_vmsd == NULL);
80
@@ -XXX,XX +XXX,XX @@ static void cpu_exec_enter(CPUState *cpu)
95
#else
81
{
96
if (qdev_get_vmsd(DEVICE(cpu)) == NULL) {
97
vmstate_register(NULL, cpu->cpu_index, &vmstate_cpu_common, cpu);
98
}
99
- if (cc->vmsd != NULL) {
100
- vmstate_register(NULL, cpu->cpu_index, cc->vmsd, cpu);
101
+ if (cc->legacy_vmsd != NULL) {
102
+ vmstate_register(NULL, cpu->cpu_index, cc->legacy_vmsd, cpu);
103
}
104
#endif /* CONFIG_USER_ONLY */
105
}
106
@@ -XXX,XX +XXX,XX @@ void cpu_exec_unrealizefn(CPUState *cpu)
82
CPUClass *cc = CPU_GET_CLASS(cpu);
107
CPUClass *cc = CPU_GET_CLASS(cpu);
83
108
84
- if (cc->cpu_exec_enter) {
109
#ifdef CONFIG_USER_ONLY
85
- cc->cpu_exec_enter(cpu);
110
- assert(cc->vmsd == NULL);
86
+ if (cc->tcg_ops.cpu_exec_enter) {
111
+ assert(cc->legacy_vmsd == NULL);
87
+ cc->tcg_ops.cpu_exec_enter(cpu);
112
#else
113
- if (cc->vmsd != NULL) {
114
- vmstate_unregister(NULL, cc->vmsd, cpu);
115
+ if (cc->legacy_vmsd != NULL) {
116
+ vmstate_unregister(NULL, cc->legacy_vmsd, cpu);
88
}
117
}
89
}
118
if (qdev_get_vmsd(DEVICE(cpu)) == NULL) {
90
119
vmstate_unregister(NULL, &vmstate_cpu_common, cpu);
91
@@ -XXX,XX +XXX,XX @@ static void cpu_exec_exit(CPUState *cpu)
92
{
93
CPUClass *cc = CPU_GET_CLASS(cpu);
94
95
- if (cc->cpu_exec_exit) {
96
- cc->cpu_exec_exit(cpu);
97
+ if (cc->tcg_ops.cpu_exec_exit) {
98
+ cc->tcg_ops.cpu_exec_exit(cpu);
99
}
100
}
101
102
@@ -XXX,XX +XXX,XX @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
103
True when it is, and we should restart on a new TB,
104
and via longjmp via cpu_loop_exit. */
105
else {
106
- if (cc->cpu_exec_interrupt &&
107
- cc->cpu_exec_interrupt(cpu, interrupt_request)) {
108
+ if (cc->tcg_ops.cpu_exec_interrupt &&
109
+ cc->tcg_ops.cpu_exec_interrupt(cpu, interrupt_request)) {
110
if (need_replay_interrupt(interrupt_request)) {
111
replay_interrupt();
112
}
113
diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c
114
index XXXXXXX..XXXXXXX 100644
115
--- a/target/alpha/cpu.c
116
+++ b/target/alpha/cpu.c
117
@@ -XXX,XX +XXX,XX @@ static void alpha_cpu_class_init(ObjectClass *oc, void *data)
118
cc->class_by_name = alpha_cpu_class_by_name;
119
cc->has_work = alpha_cpu_has_work;
120
cc->do_interrupt = alpha_cpu_do_interrupt;
121
- cc->cpu_exec_interrupt = alpha_cpu_exec_interrupt;
122
+ cc->tcg_ops.cpu_exec_interrupt = alpha_cpu_exec_interrupt;
123
cc->dump_state = alpha_cpu_dump_state;
124
cc->set_pc = alpha_cpu_set_pc;
125
cc->gdb_read_register = alpha_cpu_gdb_read_register;
126
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
120
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
127
index XXXXXXX..XXXXXXX 100644
121
index XXXXXXX..XXXXXXX 100644
128
--- a/target/arm/cpu.c
122
--- a/target/arm/cpu.c
129
+++ b/target/arm/cpu.c
123
+++ b/target/arm/cpu.c
130
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
124
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
131
125
#ifndef CONFIG_USER_ONLY
132
cc->class_by_name = arm_cpu_class_by_name;
126
cc->get_phys_page_attrs_debug = arm_cpu_get_phys_page_attrs_debug;
133
cc->has_work = arm_cpu_has_work;
127
cc->asidx_from_attrs = arm_asidx_from_attrs;
134
- cc->cpu_exec_interrupt = arm_cpu_exec_interrupt;
128
- cc->vmsd = &vmstate_arm_cpu;
135
cc->dump_state = arm_cpu_dump_state;
129
+ cc->legacy_vmsd = &vmstate_arm_cpu;
136
cc->set_pc = arm_cpu_set_pc;
130
cc->virtio_is_big_endian = arm_cpu_virtio_is_big_endian;
137
cc->gdb_read_register = arm_cpu_gdb_read_register;
131
cc->write_elf64_note = arm_cpu_write_elf64_note;
138
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
132
cc->write_elf32_note = arm_cpu_write_elf32_note;
139
cc->disas_set_info = arm_disas_set_info;
140
#ifdef CONFIG_TCG
141
cc->tcg_ops.initialize = arm_translate_init;
142
+ cc->tcg_ops.cpu_exec_interrupt = arm_cpu_exec_interrupt;
143
cc->tcg_ops.synchronize_from_tb = arm_cpu_synchronize_from_tb;
144
cc->tlb_fill = arm_cpu_tlb_fill;
145
cc->debug_excp_handler = arm_debug_excp_handler;
146
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
147
index XXXXXXX..XXXXXXX 100644
148
--- a/target/arm/cpu64.c
149
+++ b/target/arm/cpu64.c
150
@@ -XXX,XX +XXX,XX @@ static void aarch64_cpu_class_init(ObjectClass *oc, void *data)
151
{
152
CPUClass *cc = CPU_CLASS(oc);
153
154
- cc->cpu_exec_interrupt = arm_cpu_exec_interrupt;
155
+#ifdef CONFIG_TCG
156
+ cc->tcg_ops.cpu_exec_interrupt = arm_cpu_exec_interrupt;
157
+#endif /* CONFIG_TCG */
158
+
159
cc->gdb_read_register = aarch64_cpu_gdb_read_register;
160
cc->gdb_write_register = aarch64_cpu_gdb_write_register;
161
cc->gdb_num_core_regs = 34;
162
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
163
index XXXXXXX..XXXXXXX 100644
164
--- a/target/arm/cpu_tcg.c
165
+++ b/target/arm/cpu_tcg.c
166
@@ -XXX,XX +XXX,XX @@
167
/* CPU models. These are not needed for the AArch64 linux-user build. */
168
#if !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64)
169
170
+#ifdef CONFIG_TCG
171
static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
172
{
173
CPUClass *cc = CPU_GET_CLASS(cs);
174
@@ -XXX,XX +XXX,XX @@ static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
175
}
176
return ret;
177
}
178
+#endif /* CONFIG_TCG */
179
180
static void arm926_initfn(Object *obj)
181
{
182
@@ -XXX,XX +XXX,XX @@ static void arm_v7m_class_init(ObjectClass *oc, void *data)
183
cc->do_interrupt = arm_v7m_cpu_do_interrupt;
184
#endif
185
186
- cc->cpu_exec_interrupt = arm_v7m_cpu_exec_interrupt;
187
+#ifdef CONFIG_TCG
188
+ cc->tcg_ops.cpu_exec_interrupt = arm_v7m_cpu_exec_interrupt;
189
+#endif /* CONFIG_TCG */
190
+
191
cc->gdb_core_xml_file = "arm-m-profile.xml";
192
}
193
194
diff --git a/target/avr/cpu.c b/target/avr/cpu.c
133
diff --git a/target/avr/cpu.c b/target/avr/cpu.c
195
index XXXXXXX..XXXXXXX 100644
134
index XXXXXXX..XXXXXXX 100644
196
--- a/target/avr/cpu.c
135
--- a/target/avr/cpu.c
197
+++ b/target/avr/cpu.c
136
+++ b/target/avr/cpu.c
198
@@ -XXX,XX +XXX,XX @@ static void avr_cpu_class_init(ObjectClass *oc, void *data)
137
@@ -XXX,XX +XXX,XX @@ static void avr_cpu_class_init(ObjectClass *oc, void *data)
199
200
cc->has_work = avr_cpu_has_work;
201
cc->do_interrupt = avr_cpu_do_interrupt;
202
- cc->cpu_exec_interrupt = avr_cpu_exec_interrupt;
203
+ cc->tcg_ops.cpu_exec_interrupt = avr_cpu_exec_interrupt;
204
cc->dump_state = avr_cpu_dump_state;
205
cc->set_pc = avr_cpu_set_pc;
138
cc->set_pc = avr_cpu_set_pc;
206
cc->memory_rw_debug = avr_cpu_memory_rw_debug;
139
cc->memory_rw_debug = avr_cpu_memory_rw_debug;
207
diff --git a/target/cris/cpu.c b/target/cris/cpu.c
140
cc->get_phys_page_debug = avr_cpu_get_phys_page_debug;
208
index XXXXXXX..XXXXXXX 100644
141
- cc->vmsd = &vms_avr_cpu;
209
--- a/target/cris/cpu.c
142
+ cc->legacy_vmsd = &vms_avr_cpu;
210
+++ b/target/cris/cpu.c
143
cc->disas_set_info = avr_cpu_disas_set_info;
211
@@ -XXX,XX +XXX,XX @@ static void cris_cpu_class_init(ObjectClass *oc, void *data)
144
cc->gdb_read_register = avr_cpu_gdb_read_register;
212
cc->class_by_name = cris_cpu_class_by_name;
145
cc->gdb_write_register = avr_cpu_gdb_write_register;
213
cc->has_work = cris_cpu_has_work;
146
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
214
cc->do_interrupt = cris_cpu_do_interrupt;
147
index XXXXXXX..XXXXXXX 100644
215
- cc->cpu_exec_interrupt = cris_cpu_exec_interrupt;
148
--- a/target/i386/cpu.c
216
+ cc->tcg_ops.cpu_exec_interrupt = cris_cpu_exec_interrupt;
149
+++ b/target/i386/cpu.c
217
cc->dump_state = cris_cpu_dump_state;
150
@@ -XXX,XX +XXX,XX @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
218
cc->set_pc = cris_cpu_set_pc;
151
cc->write_elf64_qemunote = x86_cpu_write_elf64_qemunote;
219
cc->gdb_read_register = cris_cpu_gdb_read_register;
152
cc->write_elf32_note = x86_cpu_write_elf32_note;
220
diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
153
cc->write_elf32_qemunote = x86_cpu_write_elf32_qemunote;
221
index XXXXXXX..XXXXXXX 100644
154
- cc->vmsd = &vmstate_x86_cpu;
222
--- a/target/hppa/cpu.c
155
+ cc->legacy_vmsd = &vmstate_x86_cpu;
223
+++ b/target/hppa/cpu.c
156
#endif /* !CONFIG_USER_ONLY */
224
@@ -XXX,XX +XXX,XX @@ static void hppa_cpu_class_init(ObjectClass *oc, void *data)
157
225
cc->class_by_name = hppa_cpu_class_by_name;
158
cc->gdb_arch_name = x86_gdb_arch_name;
226
cc->has_work = hppa_cpu_has_work;
227
cc->do_interrupt = hppa_cpu_do_interrupt;
228
- cc->cpu_exec_interrupt = hppa_cpu_exec_interrupt;
229
+ cc->tcg_ops.cpu_exec_interrupt = hppa_cpu_exec_interrupt;
230
cc->dump_state = hppa_cpu_dump_state;
231
cc->set_pc = hppa_cpu_set_pc;
232
cc->tcg_ops.synchronize_from_tb = hppa_cpu_synchronize_from_tb;
233
diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c
234
index XXXXXXX..XXXXXXX 100644
235
--- a/target/i386/tcg/tcg-cpu.c
236
+++ b/target/i386/tcg/tcg-cpu.c
237
@@ -XXX,XX +XXX,XX @@ static void x86_cpu_synchronize_from_tb(CPUState *cs,
238
void tcg_cpu_common_class_init(CPUClass *cc)
239
{
240
cc->do_interrupt = x86_cpu_do_interrupt;
241
- cc->cpu_exec_interrupt = x86_cpu_exec_interrupt;
242
+ cc->tcg_ops.cpu_exec_interrupt = x86_cpu_exec_interrupt;
243
cc->tcg_ops.synchronize_from_tb = x86_cpu_synchronize_from_tb;
244
- cc->cpu_exec_enter = x86_cpu_exec_enter;
245
- cc->cpu_exec_exit = x86_cpu_exec_exit;
246
+ cc->tcg_ops.cpu_exec_enter = x86_cpu_exec_enter;
247
+ cc->tcg_ops.cpu_exec_exit = x86_cpu_exec_exit;
248
cc->tcg_ops.initialize = tcg_x86_init;
249
cc->tlb_fill = x86_cpu_tlb_fill;
250
#ifndef CONFIG_USER_ONLY
251
diff --git a/target/lm32/cpu.c b/target/lm32/cpu.c
252
index XXXXXXX..XXXXXXX 100644
253
--- a/target/lm32/cpu.c
254
+++ b/target/lm32/cpu.c
255
@@ -XXX,XX +XXX,XX @@ static void lm32_cpu_class_init(ObjectClass *oc, void *data)
256
cc->class_by_name = lm32_cpu_class_by_name;
257
cc->has_work = lm32_cpu_has_work;
258
cc->do_interrupt = lm32_cpu_do_interrupt;
259
- cc->cpu_exec_interrupt = lm32_cpu_exec_interrupt;
260
+ cc->tcg_ops.cpu_exec_interrupt = lm32_cpu_exec_interrupt;
261
cc->dump_state = lm32_cpu_dump_state;
262
cc->set_pc = lm32_cpu_set_pc;
263
cc->gdb_read_register = lm32_cpu_gdb_read_register;
264
diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c
265
index XXXXXXX..XXXXXXX 100644
266
--- a/target/m68k/cpu.c
267
+++ b/target/m68k/cpu.c
268
@@ -XXX,XX +XXX,XX @@ static void m68k_cpu_class_init(ObjectClass *c, void *data)
269
cc->class_by_name = m68k_cpu_class_by_name;
270
cc->has_work = m68k_cpu_has_work;
271
cc->do_interrupt = m68k_cpu_do_interrupt;
272
- cc->cpu_exec_interrupt = m68k_cpu_exec_interrupt;
273
+ cc->tcg_ops.cpu_exec_interrupt = m68k_cpu_exec_interrupt;
274
cc->dump_state = m68k_cpu_dump_state;
275
cc->set_pc = m68k_cpu_set_pc;
276
cc->gdb_read_register = m68k_cpu_gdb_read_register;
277
diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c
278
index XXXXXXX..XXXXXXX 100644
279
--- a/target/microblaze/cpu.c
280
+++ b/target/microblaze/cpu.c
281
@@ -XXX,XX +XXX,XX @@ static void mb_cpu_class_init(ObjectClass *oc, void *data)
282
cc->has_work = mb_cpu_has_work;
283
cc->do_interrupt = mb_cpu_do_interrupt;
284
cc->do_unaligned_access = mb_cpu_do_unaligned_access;
285
- cc->cpu_exec_interrupt = mb_cpu_exec_interrupt;
286
+ cc->tcg_ops.cpu_exec_interrupt = mb_cpu_exec_interrupt;
287
cc->dump_state = mb_cpu_dump_state;
288
cc->set_pc = mb_cpu_set_pc;
289
cc->tcg_ops.synchronize_from_tb = mb_cpu_synchronize_from_tb;
290
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
159
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
291
index XXXXXXX..XXXXXXX 100644
160
index XXXXXXX..XXXXXXX 100644
292
--- a/target/mips/cpu.c
161
--- a/target/mips/cpu.c
293
+++ b/target/mips/cpu.c
162
+++ b/target/mips/cpu.c
294
@@ -XXX,XX +XXX,XX @@ static void mips_cpu_class_init(ObjectClass *c, void *data)
163
@@ -XXX,XX +XXX,XX @@ static void mips_cpu_class_init(ObjectClass *c, void *data)
295
cc->class_by_name = mips_cpu_class_by_name;
164
cc->gdb_write_register = mips_cpu_gdb_write_register;
296
cc->has_work = mips_cpu_has_work;
165
#ifndef CONFIG_USER_ONLY
297
cc->do_interrupt = mips_cpu_do_interrupt;
166
cc->get_phys_page_debug = mips_cpu_get_phys_page_debug;
298
- cc->cpu_exec_interrupt = mips_cpu_exec_interrupt;
167
- cc->vmsd = &vmstate_mips_cpu;
299
cc->dump_state = mips_cpu_dump_state;
168
+ cc->legacy_vmsd = &vmstate_mips_cpu;
300
cc->set_pc = mips_cpu_set_pc;
169
#endif
301
cc->gdb_read_register = mips_cpu_gdb_read_register;
302
@@ -XXX,XX +XXX,XX @@ static void mips_cpu_class_init(ObjectClass *c, void *data)
303
cc->disas_set_info = mips_cpu_disas_set_info;
170
cc->disas_set_info = mips_cpu_disas_set_info;
304
#ifdef CONFIG_TCG
171
cc->gdb_num_core_regs = 73;
305
cc->tcg_ops.initialize = mips_tcg_init;
172
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
306
+ cc->tcg_ops.cpu_exec_interrupt = mips_cpu_exec_interrupt;
173
index XXXXXXX..XXXXXXX 100644
307
cc->tcg_ops.synchronize_from_tb = mips_cpu_synchronize_from_tb;
174
--- a/target/ppc/cpu_init.c
308
cc->tlb_fill = mips_cpu_tlb_fill;
175
+++ b/target/ppc/cpu_init.c
309
#endif
176
@@ -XXX,XX +XXX,XX @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
310
diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c
177
cc->gdb_write_register = ppc_cpu_gdb_write_register;
311
index XXXXXXX..XXXXXXX 100644
178
#ifndef CONFIG_USER_ONLY
312
--- a/target/nios2/cpu.c
179
cc->get_phys_page_debug = ppc_cpu_get_phys_page_debug;
313
+++ b/target/nios2/cpu.c
180
- cc->vmsd = &vmstate_ppc_cpu;
314
@@ -XXX,XX +XXX,XX @@ static void nios2_cpu_class_init(ObjectClass *oc, void *data)
181
+ cc->legacy_vmsd = &vmstate_ppc_cpu;
315
cc->class_by_name = nios2_cpu_class_by_name;
182
#endif
316
cc->has_work = nios2_cpu_has_work;
183
#if defined(CONFIG_SOFTMMU)
317
cc->do_interrupt = nios2_cpu_do_interrupt;
184
cc->write_elf64_note = ppc64_cpu_write_elf64_note;
318
- cc->cpu_exec_interrupt = nios2_cpu_exec_interrupt;
319
+ cc->tcg_ops.cpu_exec_interrupt = nios2_cpu_exec_interrupt;
320
cc->dump_state = nios2_cpu_dump_state;
321
cc->set_pc = nios2_cpu_set_pc;
322
cc->disas_set_info = nios2_cpu_disas_set_info;
323
diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c
324
index XXXXXXX..XXXXXXX 100644
325
--- a/target/openrisc/cpu.c
326
+++ b/target/openrisc/cpu.c
327
@@ -XXX,XX +XXX,XX @@ static void openrisc_cpu_class_init(ObjectClass *oc, void *data)
328
cc->class_by_name = openrisc_cpu_class_by_name;
329
cc->has_work = openrisc_cpu_has_work;
330
cc->do_interrupt = openrisc_cpu_do_interrupt;
331
- cc->cpu_exec_interrupt = openrisc_cpu_exec_interrupt;
332
+ cc->tcg_ops.cpu_exec_interrupt = openrisc_cpu_exec_interrupt;
333
cc->dump_state = openrisc_cpu_dump_state;
334
cc->set_pc = openrisc_cpu_set_pc;
335
cc->gdb_read_register = openrisc_cpu_gdb_read_register;
336
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
185
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
337
index XXXXXXX..XXXXXXX 100644
186
index XXXXXXX..XXXXXXX 100644
338
--- a/target/riscv/cpu.c
187
--- a/target/riscv/cpu.c
339
+++ b/target/riscv/cpu.c
188
+++ b/target/riscv/cpu.c
340
@@ -XXX,XX +XXX,XX @@ static void riscv_cpu_class_init(ObjectClass *c, void *data)
189
@@ -XXX,XX +XXX,XX @@ static void riscv_cpu_class_init(ObjectClass *c, void *data)
341
cc->class_by_name = riscv_cpu_class_by_name;
190
cc->disas_set_info = riscv_cpu_disas_set_info;
342
cc->has_work = riscv_cpu_has_work;
191
#ifndef CONFIG_USER_ONLY
343
cc->do_interrupt = riscv_cpu_do_interrupt;
192
cc->get_phys_page_debug = riscv_cpu_get_phys_page_debug;
344
- cc->cpu_exec_interrupt = riscv_cpu_exec_interrupt;
193
- /* For now, mark unmigratable: */
345
+ cc->tcg_ops.cpu_exec_interrupt = riscv_cpu_exec_interrupt;
194
- cc->vmsd = &vmstate_riscv_cpu;
346
cc->dump_state = riscv_cpu_dump_state;
195
+ cc->legacy_vmsd = &vmstate_riscv_cpu;
347
cc->set_pc = riscv_cpu_set_pc;
196
cc->write_elf64_note = riscv_cpu_write_elf64_note;
348
cc->tcg_ops.synchronize_from_tb = riscv_cpu_synchronize_from_tb;
197
cc->write_elf32_note = riscv_cpu_write_elf32_note;
349
diff --git a/target/rx/cpu.c b/target/rx/cpu.c
198
#endif
350
index XXXXXXX..XXXXXXX 100644
351
--- a/target/rx/cpu.c
352
+++ b/target/rx/cpu.c
353
@@ -XXX,XX +XXX,XX @@ static void rx_cpu_class_init(ObjectClass *klass, void *data)
354
cc->class_by_name = rx_cpu_class_by_name;
355
cc->has_work = rx_cpu_has_work;
356
cc->do_interrupt = rx_cpu_do_interrupt;
357
- cc->cpu_exec_interrupt = rx_cpu_exec_interrupt;
358
+ cc->tcg_ops.cpu_exec_interrupt = rx_cpu_exec_interrupt;
359
cc->dump_state = rx_cpu_dump_state;
360
cc->set_pc = rx_cpu_set_pc;
361
cc->tcg_ops.synchronize_from_tb = rx_cpu_synchronize_from_tb;
362
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
199
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
363
index XXXXXXX..XXXXXXX 100644
200
index XXXXXXX..XXXXXXX 100644
364
--- a/target/s390x/cpu.c
201
--- a/target/s390x/cpu.c
365
+++ b/target/s390x/cpu.c
202
+++ b/target/s390x/cpu.c
366
@@ -XXX,XX +XXX,XX @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)
203
@@ -XXX,XX +XXX,XX @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)
204
cc->gdb_write_register = s390_cpu_gdb_write_register;
205
#ifndef CONFIG_USER_ONLY
206
cc->get_phys_page_debug = s390_cpu_get_phys_page_debug;
207
- cc->vmsd = &vmstate_s390_cpu;
208
+ cc->legacy_vmsd = &vmstate_s390_cpu;
367
cc->get_crash_info = s390_cpu_get_crash_info;
209
cc->get_crash_info = s390_cpu_get_crash_info;
368
cc->write_elf64_note = s390_cpu_write_elf64_note;
210
cc->write_elf64_note = s390_cpu_write_elf64_note;
369
#ifdef CONFIG_TCG
211
#endif
370
- cc->cpu_exec_interrupt = s390_cpu_exec_interrupt;
371
+ cc->tcg_ops.cpu_exec_interrupt = s390_cpu_exec_interrupt;
372
cc->debug_excp_handler = s390x_cpu_debug_excp_handler;
373
cc->do_unaligned_access = s390x_cpu_do_unaligned_access;
374
#endif
375
diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c
376
index XXXXXXX..XXXXXXX 100644
377
--- a/target/sh4/cpu.c
378
+++ b/target/sh4/cpu.c
379
@@ -XXX,XX +XXX,XX @@ static void superh_cpu_class_init(ObjectClass *oc, void *data)
380
cc->class_by_name = superh_cpu_class_by_name;
381
cc->has_work = superh_cpu_has_work;
382
cc->do_interrupt = superh_cpu_do_interrupt;
383
- cc->cpu_exec_interrupt = superh_cpu_exec_interrupt;
384
+ cc->tcg_ops.cpu_exec_interrupt = superh_cpu_exec_interrupt;
385
cc->dump_state = superh_cpu_dump_state;
386
cc->set_pc = superh_cpu_set_pc;
387
cc->tcg_ops.synchronize_from_tb = superh_cpu_synchronize_from_tb;
388
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
212
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
389
index XXXXXXX..XXXXXXX 100644
213
index XXXXXXX..XXXXXXX 100644
390
--- a/target/sparc/cpu.c
214
--- a/target/sparc/cpu.c
391
+++ b/target/sparc/cpu.c
215
+++ b/target/sparc/cpu.c
392
@@ -XXX,XX +XXX,XX @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data)
216
@@ -XXX,XX +XXX,XX @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data)
393
cc->parse_features = sparc_cpu_parse_features;
217
cc->gdb_write_register = sparc_cpu_gdb_write_register;
394
cc->has_work = sparc_cpu_has_work;
218
#ifndef CONFIG_USER_ONLY
395
cc->do_interrupt = sparc_cpu_do_interrupt;
219
cc->get_phys_page_debug = sparc_cpu_get_phys_page_debug;
396
- cc->cpu_exec_interrupt = sparc_cpu_exec_interrupt;
220
- cc->vmsd = &vmstate_sparc_cpu;
397
+ cc->tcg_ops.cpu_exec_interrupt = sparc_cpu_exec_interrupt;
221
+ cc->legacy_vmsd = &vmstate_sparc_cpu;
398
cc->dump_state = sparc_cpu_dump_state;
222
#endif
399
#if !defined(TARGET_SPARC64) && !defined(CONFIG_USER_ONLY)
223
cc->disas_set_info = cpu_sparc_disas_set_info;
400
cc->memory_rw_debug = sparc_cpu_memory_rw_debug;
401
diff --git a/target/tilegx/cpu.c b/target/tilegx/cpu.c
402
index XXXXXXX..XXXXXXX 100644
403
--- a/target/tilegx/cpu.c
404
+++ b/target/tilegx/cpu.c
405
@@ -XXX,XX +XXX,XX @@ static void tilegx_cpu_class_init(ObjectClass *oc, void *data)
406
cc->class_by_name = tilegx_cpu_class_by_name;
407
cc->has_work = tilegx_cpu_has_work;
408
cc->do_interrupt = tilegx_cpu_do_interrupt;
409
- cc->cpu_exec_interrupt = tilegx_cpu_exec_interrupt;
410
+ cc->tcg_ops.cpu_exec_interrupt = tilegx_cpu_exec_interrupt;
411
cc->dump_state = tilegx_cpu_dump_state;
412
cc->set_pc = tilegx_cpu_set_pc;
413
cc->tlb_fill = tilegx_cpu_tlb_fill;
414
diff --git a/target/unicore32/cpu.c b/target/unicore32/cpu.c
415
index XXXXXXX..XXXXXXX 100644
416
--- a/target/unicore32/cpu.c
417
+++ b/target/unicore32/cpu.c
418
@@ -XXX,XX +XXX,XX @@ static void uc32_cpu_class_init(ObjectClass *oc, void *data)
419
cc->class_by_name = uc32_cpu_class_by_name;
420
cc->has_work = uc32_cpu_has_work;
421
cc->do_interrupt = uc32_cpu_do_interrupt;
422
- cc->cpu_exec_interrupt = uc32_cpu_exec_interrupt;
423
+ cc->tcg_ops.cpu_exec_interrupt = uc32_cpu_exec_interrupt;
424
cc->dump_state = uc32_cpu_dump_state;
425
cc->set_pc = uc32_cpu_set_pc;
426
cc->tlb_fill = uc32_cpu_tlb_fill;
427
diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c
428
index XXXXXXX..XXXXXXX 100644
429
--- a/target/xtensa/cpu.c
430
+++ b/target/xtensa/cpu.c
431
@@ -XXX,XX +XXX,XX @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data)
432
cc->class_by_name = xtensa_cpu_class_by_name;
433
cc->has_work = xtensa_cpu_has_work;
434
cc->do_interrupt = xtensa_cpu_do_interrupt;
435
- cc->cpu_exec_interrupt = xtensa_cpu_exec_interrupt;
436
+ cc->tcg_ops.cpu_exec_interrupt = xtensa_cpu_exec_interrupt;
437
cc->dump_state = xtensa_cpu_dump_state;
438
cc->set_pc = xtensa_cpu_set_pc;
439
cc->gdb_read_register = xtensa_cpu_gdb_read_register;
440
diff --git a/target/ppc/translate_init.c.inc b/target/ppc/translate_init.c.inc
441
index XXXXXXX..XXXXXXX 100644
442
--- a/target/ppc/translate_init.c.inc
443
+++ b/target/ppc/translate_init.c.inc
444
@@ -XXX,XX +XXX,XX @@ static void ppc_cpu_reset(DeviceState *dev)
445
}
446
447
#ifndef CONFIG_USER_ONLY
448
+
449
static bool ppc_cpu_is_big_endian(CPUState *cs)
450
{
451
PowerPCCPU *cpu = POWERPC_CPU(cs);
452
@@ -XXX,XX +XXX,XX @@ static bool ppc_cpu_is_big_endian(CPUState *cs)
453
return !msr_le;
454
}
455
456
+#ifdef CONFIG_TCG
457
static void ppc_cpu_exec_enter(CPUState *cs)
458
{
459
PowerPCCPU *cpu = POWERPC_CPU(cs);
460
@@ -XXX,XX +XXX,XX @@ static void ppc_cpu_exec_exit(CPUState *cs)
461
vhc->cpu_exec_exit(cpu->vhyp, cpu);
462
}
463
}
464
-#endif
465
+#endif /* CONFIG_TCG */
466
+
467
+#endif /* !CONFIG_USER_ONLY */
468
469
static void ppc_cpu_instance_init(Object *obj)
470
{
471
@@ -XXX,XX +XXX,XX @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
472
cc->class_by_name = ppc_cpu_class_by_name;
473
cc->has_work = ppc_cpu_has_work;
474
cc->do_interrupt = ppc_cpu_do_interrupt;
475
- cc->cpu_exec_interrupt = ppc_cpu_exec_interrupt;
476
cc->dump_state = ppc_cpu_dump_state;
477
cc->dump_statistics = ppc_cpu_dump_statistics;
478
cc->set_pc = ppc_cpu_set_pc;
479
@@ -XXX,XX +XXX,XX @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
480
#endif
481
#ifdef CONFIG_TCG
482
cc->tcg_ops.initialize = ppc_translate_init;
483
+ cc->tcg_ops.cpu_exec_interrupt = ppc_cpu_exec_interrupt;
484
cc->tlb_fill = ppc_cpu_tlb_fill;
485
-#endif
486
#ifndef CONFIG_USER_ONLY
487
- cc->cpu_exec_enter = ppc_cpu_exec_enter;
488
- cc->cpu_exec_exit = ppc_cpu_exec_exit;
489
-#endif
490
+ cc->tcg_ops.cpu_exec_enter = ppc_cpu_exec_enter;
491
+ cc->tcg_ops.cpu_exec_exit = ppc_cpu_exec_exit;
492
+#endif /* !CONFIG_USER_ONLY */
493
+#endif /* CONFIG_TCG */
494
495
cc->disas_set_info = ppc_disas_set_info;
496
224
497
--
225
--
498
2.25.1
226
2.25.1
499
227
500
228
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
The code is currently comparing c2 to the type promotion of
3
See rationale in previous commit. Targets should use the vmsd field
4
uint32_t and int32_t. That is, the conversion rules are as:
4
of DeviceClass, not CPUClass. As migration is not important on the
5
AVR target, break the migration compatibility and set the DeviceClass
6
vmsd field. To feel safer, increment the vmstate version.
5
7
6
(common_type) c2 == (common_type) (uint32_t)
7
(is_unsigned
8
? (uint32_t)c2
9
: (uint32_t)(int32_t)c2)
10
11
In the signed case we lose the desired sign extensions because
12
of the argument promotion rules of the ternary operator.
13
14
Solve the problem by doing the round-trip parsing through the
15
intermediate type and back to the desired common type (all at
16
one expression).
17
18
Fixes: a534bb15f30 ("tcg/s390: Use constant pool for cmpi")
19
Tested-by: Richard W.M. Jones <rjones@redhat.com>
20
Reviewed-by: David Hildenbrand <david@redhat.com>
21
Reported-by: Miroslav Rezanina <mrezanin@redhat.com>
22
Reported-by: Richard W.M. Jones <rjones@redhat.com>
23
Suggested-by: David Hildenbrand <david@redhat.com>
24
Suggested-by: Eric Blake <eblake@redhat.com>
25
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
26
Message-Id: <20210204182902.1742826-1-f4bug@amsat.org>
9
Message-Id: <20210517105140.1062037-14-f4bug@amsat.org>
27
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
28
---
11
---
29
tcg/s390/tcg-target.c.inc | 2 +-
12
target/avr/cpu.c | 2 +-
30
1 file changed, 1 insertion(+), 1 deletion(-)
13
target/avr/machine.c | 4 ++--
14
2 files changed, 3 insertions(+), 3 deletions(-)
31
15
32
diff --git a/tcg/s390/tcg-target.c.inc b/tcg/s390/tcg-target.c.inc
16
diff --git a/target/avr/cpu.c b/target/avr/cpu.c
33
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
34
--- a/tcg/s390/tcg-target.c.inc
18
--- a/target/avr/cpu.c
35
+++ b/tcg/s390/tcg-target.c.inc
19
+++ b/target/avr/cpu.c
36
@@ -XXX,XX +XXX,XX @@ static int tgen_cmp(TCGContext *s, TCGType type, TCGCond c, TCGReg r1,
20
@@ -XXX,XX +XXX,XX @@ static void avr_cpu_class_init(ObjectClass *oc, void *data)
37
op = (is_unsigned ? RIL_CLFI : RIL_CFI);
21
cc->set_pc = avr_cpu_set_pc;
38
tcg_out_insn_RIL(s, op, r1, c2);
22
cc->memory_rw_debug = avr_cpu_memory_rw_debug;
39
goto exit;
23
cc->get_phys_page_debug = avr_cpu_get_phys_page_debug;
40
- } else if (c2 == (is_unsigned ? (uint32_t)c2 : (int32_t)c2)) {
24
- cc->legacy_vmsd = &vms_avr_cpu;
41
+ } else if (c2 == (is_unsigned ? (TCGArg)(uint32_t)c2 : (TCGArg)(int32_t)c2)) {
25
+ dc->vmsd = &vms_avr_cpu;
42
op = (is_unsigned ? RIL_CLGFI : RIL_CGFI);
26
cc->disas_set_info = avr_cpu_disas_set_info;
43
tcg_out_insn_RIL(s, op, r1, c2);
27
cc->gdb_read_register = avr_cpu_gdb_read_register;
44
goto exit;
28
cc->gdb_write_register = avr_cpu_gdb_write_register;
29
diff --git a/target/avr/machine.c b/target/avr/machine.c
30
index XXXXXXX..XXXXXXX 100644
31
--- a/target/avr/machine.c
32
+++ b/target/avr/machine.c
33
@@ -XXX,XX +XXX,XX @@ static const VMStateInfo vms_eind = {
34
35
const VMStateDescription vms_avr_cpu = {
36
.name = "cpu",
37
- .version_id = 0,
38
- .minimum_version_id = 0,
39
+ .version_id = 1,
40
+ .minimum_version_id = 1,
41
.fields = (VMStateField[]) {
42
VMSTATE_UINT32(env.pc_w, AVRCPU),
43
VMSTATE_UINT32(env.sp, AVRCPU),
45
--
44
--
46
2.25.1
45
2.25.1
47
46
48
47
diff view generated by jsdifflib
1
From: Claudio Fontana <cfontana@suse.de>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
we cannot in principle make the TCG Operations field definitions
3
Introduce a structure to hold handler specific to sysemu.
4
conditional on CONFIG_TCG in code that is included by both common_ss
5
and specific_ss modules.
6
4
7
Therefore, what we can do safely to restrict the TCG fields to TCG-only
5
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
builds, is to move all tcg cpu operations into a separate header file,
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
which is only included by TCG, target-specific code.
7
Message-Id: <20210517105140.1062037-15-f4bug@amsat.org>
10
8
[rth: Squash "restrict hw/core/sysemu-cpu-ops.h" patch]
11
This leaves just a NULL pointer in the cpu.h for the non-TCG builds.
12
13
This also tidies up the code in all targets a bit, having all TCG cpu
14
operations neatly contained by a dedicated data struct.
15
16
Signed-off-by: Claudio Fontana <cfontana@suse.de>
17
Message-Id: <20210204163931.7358-16-cfontana@suse.de>
18
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
19
---
10
---
20
include/hw/core/cpu.h | 103 ++------------------------------
11
include/hw/core/cpu.h | 6 ++++++
21
include/hw/core/tcg-cpu-ops.h | 97 ++++++++++++++++++++++++++++++
12
include/hw/core/sysemu-cpu-ops.h | 21 +++++++++++++++++++++
22
target/arm/internals.h | 6 ++
13
cpu.c | 1 +
23
accel/tcg/cpu-exec.c | 27 +++++----
14
target/alpha/cpu.c | 8 ++++++++
24
accel/tcg/cputlb.c | 35 +++++++++--
15
target/arm/cpu.c | 8 ++++++++
25
accel/tcg/user-exec.c | 9 +--
16
target/avr/cpu.c | 6 ++++++
26
hw/mips/jazz.c | 7 ++-
17
target/cris/cpu.c | 8 ++++++++
27
softmmu/physmem.c | 13 ++--
18
target/hppa/cpu.c | 8 ++++++++
28
target/alpha/cpu.c | 21 +++++--
19
target/i386/cpu.c | 8 ++++++++
29
target/arm/cpu.c | 41 ++++++++-----
20
target/m68k/cpu.c | 8 ++++++++
30
target/arm/cpu64.c | 7 +--
21
target/microblaze/cpu.c | 8 ++++++++
31
target/arm/cpu_tcg.c | 28 +++++++--
22
target/mips/cpu.c | 8 ++++++++
32
target/avr/cpu.c | 19 ++++--
23
target/nios2/cpu.c | 8 ++++++++
33
target/avr/helper.c | 5 +-
24
target/openrisc/cpu.c | 8 ++++++++
34
target/cris/cpu.c | 43 ++++++++-----
25
target/ppc/cpu_init.c | 8 ++++++++
35
target/cris/helper.c | 5 +-
26
target/riscv/cpu.c | 8 ++++++++
36
target/hppa/cpu.c | 22 ++++---
27
target/rx/cpu.c | 10 ++++++++++
37
target/i386/tcg/tcg-cpu.c | 26 ++++----
28
target/s390x/cpu.c | 8 ++++++++
38
target/lm32/cpu.c | 19 ++++--
29
target/sh4/cpu.c | 6 ++++++
39
target/m68k/cpu.c | 19 ++++--
30
target/sparc/cpu.c | 8 ++++++++
40
target/microblaze/cpu.c | 25 +++++---
31
target/tricore/cpu.c | 6 ++++++
41
target/mips/cpu.c | 36 +++++++----
32
target/xtensa/cpu.c | 6 ++++++
42
target/moxie/cpu.c | 15 ++++-
33
22 files changed, 174 insertions(+)
43
target/nios2/cpu.c | 18 ++++--
34
create mode 100644 include/hw/core/sysemu-cpu-ops.h
44
target/openrisc/cpu.c | 17 ++++--
45
target/riscv/cpu.c | 23 ++++---
46
target/rx/cpu.c | 20 +++++--
47
target/s390x/cpu.c | 33 ++++++----
48
target/sh4/cpu.c | 21 +++++--
49
target/sparc/cpu.c | 25 +++++---
50
target/tilegx/cpu.c | 17 ++++--
51
target/tricore/cpu.c | 12 +++-
52
target/unicore32/cpu.c | 17 ++++--
53
target/xtensa/cpu.c | 23 ++++---
54
target/ppc/translate_init.c.inc | 33 ++++++----
55
MAINTAINERS | 1 +
56
36 files changed, 582 insertions(+), 306 deletions(-)
57
create mode 100644 include/hw/core/tcg-cpu-ops.h
58
35
59
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
36
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
60
index XXXXXXX..XXXXXXX 100644
37
index XXXXXXX..XXXXXXX 100644
61
--- a/include/hw/core/cpu.h
38
--- a/include/hw/core/cpu.h
62
+++ b/include/hw/core/cpu.h
39
+++ b/include/hw/core/cpu.h
63
@@ -XXX,XX +XXX,XX @@ typedef struct CPUWatchpoint CPUWatchpoint;
40
@@ -XXX,XX +XXX,XX @@ struct TCGCPUOps;
64
41
/* see accel-cpu.h */
65
struct TranslationBlock;
42
struct AccelCPUClass;
66
43
67
-/**
44
+/* see sysemu-cpu-ops.h */
68
- * struct TcgCpuOperations: TCG operations specific to a CPU class
45
+struct SysemuCPUOps;
69
- */
46
+
70
-typedef struct TcgCpuOperations {
71
- /**
72
- * @initialize: Initalize TCG state
73
- *
74
- * Called when the first CPU is realized.
75
- */
76
- void (*initialize)(void);
77
- /**
78
- * @synchronize_from_tb: Synchronize state from a TCG #TranslationBlock
79
- *
80
- * This is called when we abandon execution of a TB before starting it,
81
- * and must set all parts of the CPU state which the previous TB in the
82
- * chain may not have updated.
83
- * By default, when this is NULL, a call is made to @set_pc(tb->pc).
84
- *
85
- * If more state needs to be restored, the target must implement a
86
- * function to restore all the state, and register it here.
87
- */
88
- void (*synchronize_from_tb)(CPUState *cpu,
89
- const struct TranslationBlock *tb);
90
- /** @cpu_exec_enter: Callback for cpu_exec preparation */
91
- void (*cpu_exec_enter)(CPUState *cpu);
92
- /** @cpu_exec_exit: Callback for cpu_exec cleanup */
93
- void (*cpu_exec_exit)(CPUState *cpu);
94
- /** @cpu_exec_interrupt: Callback for processing interrupts in cpu_exec */
95
- bool (*cpu_exec_interrupt)(CPUState *cpu, int interrupt_request);
96
- /** @do_interrupt: Callback for interrupt handling. */
97
- void (*do_interrupt)(CPUState *cpu);
98
- /**
99
- * @tlb_fill: Handle a softmmu tlb miss or user-only address fault
100
- *
101
- * For system mode, if the access is valid, call tlb_set_page
102
- * and return true; if the access is invalid, and probe is
103
- * true, return false; otherwise raise an exception and do
104
- * not return. For user-only mode, always raise an exception
105
- * and do not return.
106
- */
107
- bool (*tlb_fill)(CPUState *cpu, vaddr address, int size,
108
- MMUAccessType access_type, int mmu_idx,
109
- bool probe, uintptr_t retaddr);
110
- /** @debug_excp_handler: Callback for handling debug exceptions */
111
- void (*debug_excp_handler)(CPUState *cpu);
112
-
113
- /**
114
- * @do_transaction_failed: Callback for handling failed memory transactions
115
- * (ie bus faults or external aborts; not MMU faults)
116
- */
117
- void (*do_transaction_failed)(CPUState *cpu, hwaddr physaddr, vaddr addr,
118
- unsigned size, MMUAccessType access_type,
119
- int mmu_idx, MemTxAttrs attrs,
120
- MemTxResult response, uintptr_t retaddr);
121
- /**
122
- * @do_unaligned_access: Callback for unaligned access handling
123
- */
124
- void (*do_unaligned_access)(CPUState *cpu, vaddr addr,
125
- MMUAccessType access_type,
126
- int mmu_idx, uintptr_t retaddr);
127
- /**
128
- * @adjust_watchpoint_address: hack for cpu_check_watchpoint used by ARM
129
- */
130
- vaddr (*adjust_watchpoint_address)(CPUState *cpu, vaddr addr, int len);
131
-
132
- /**
133
- * @debug_check_watchpoint: return true if the architectural
134
- * watchpoint whose address has matched should really fire, used by ARM
135
- */
136
- bool (*debug_check_watchpoint)(CPUState *cpu, CPUWatchpoint *wp);
137
-
138
-} TcgCpuOperations;
139
+/* see tcg-cpu-ops.h */
140
+struct TCGCPUOps;
141
142
/**
47
/**
143
* CPUClass:
48
* CPUClass:
49
* @class_by_name: Callback to map -cpu command line model name to an
144
@@ -XXX,XX +XXX,XX @@ struct CPUClass {
50
@@ -XXX,XX +XXX,XX @@ struct CPUClass {
145
int gdb_num_core_regs;
146
bool gdb_stop_before_watchpoint;
51
bool gdb_stop_before_watchpoint;
147
52
struct AccelCPUClass *accel_cpu;
148
- TcgCpuOperations tcg_ops;
53
149
+ /* when TCG is not available, this pointer is NULL */
54
+ /* when system emulation is not available, this pointer is NULL */
150
+ struct TCGCPUOps *tcg_ops;
55
+ const struct SysemuCPUOps *sysemu_ops;
151
};
56
+
152
57
/* when TCG is not available, this pointer is NULL */
153
/*
58
struct TCGCPUOps *tcg_ops;
154
@@ -XXX,XX +XXX,XX @@ CPUState *cpu_by_arch_id(int64_t id);
59
155
60
diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h
156
void cpu_interrupt(CPUState *cpu, int mask);
157
158
-static inline void cpu_unaligned_access(CPUState *cpu, vaddr addr,
159
- MMUAccessType access_type,
160
- int mmu_idx, uintptr_t retaddr)
161
-{
162
- CPUClass *cc = CPU_GET_CLASS(cpu);
163
-
164
- cc->tcg_ops.do_unaligned_access(cpu, addr, access_type, mmu_idx, retaddr);
165
-}
166
-
167
-static inline void cpu_transaction_failed(CPUState *cpu, hwaddr physaddr,
168
- vaddr addr, unsigned size,
169
- MMUAccessType access_type,
170
- int mmu_idx, MemTxAttrs attrs,
171
- MemTxResult response,
172
- uintptr_t retaddr)
173
-{
174
- CPUClass *cc = CPU_GET_CLASS(cpu);
175
-
176
- if (!cpu->ignore_memory_transaction_failures &&
177
- cc->tcg_ops.do_transaction_failed) {
178
- cc->tcg_ops.do_transaction_failed(cpu, physaddr, addr, size,
179
- access_type, mmu_idx, attrs,
180
- response, retaddr);
181
- }
182
-}
183
-
184
/**
185
* cpu_set_pc:
186
* @cpu: The CPU to set the program counter for.
187
diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h
188
new file mode 100644
61
new file mode 100644
189
index XXXXXXX..XXXXXXX
62
index XXXXXXX..XXXXXXX
190
--- /dev/null
63
--- /dev/null
191
+++ b/include/hw/core/tcg-cpu-ops.h
64
+++ b/include/hw/core/sysemu-cpu-ops.h
192
@@ -XXX,XX +XXX,XX @@
65
@@ -XXX,XX +XXX,XX @@
193
+/*
66
+/*
194
+ * TCG CPU-specific operations
67
+ * CPU operations specific to system emulation
195
+ *
68
+ *
196
+ * Copyright 2021 SUSE LLC
69
+ * Copyright (c) 2012 SUSE LINUX Products GmbH
197
+ *
70
+ *
198
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
71
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
199
+ * See the COPYING file in the top-level directory.
72
+ * See the COPYING file in the top-level directory.
200
+ */
73
+ */
201
+
74
+
202
+#ifndef TCG_CPU_OPS_H
75
+#ifndef SYSEMU_CPU_OPS_H
203
+#define TCG_CPU_OPS_H
76
+#define SYSEMU_CPU_OPS_H
204
+
77
+
205
+#include "hw/core/cpu.h"
78
+#include "hw/core/cpu.h"
206
+
79
+
207
+struct TCGCPUOps {
80
+/*
208
+ /**
81
+ * struct SysemuCPUOps: System operations specific to a CPU class
209
+ * @initialize: Initalize TCG state
82
+ */
210
+ *
83
+typedef struct SysemuCPUOps {
211
+ * Called when the first CPU is realized.
84
+} SysemuCPUOps;
212
+ */
85
+
213
+ void (*initialize)(void);
86
+#endif /* SYSEMU_CPU_OPS_H */
214
+ /**
87
diff --git a/cpu.c b/cpu.c
215
+ * @synchronize_from_tb: Synchronize state from a TCG #TranslationBlock
88
index XXXXXXX..XXXXXXX 100644
216
+ *
89
--- a/cpu.c
217
+ * This is called when we abandon execution of a TB before starting it,
90
+++ b/cpu.c
218
+ * and must set all parts of the CPU state which the previous TB in the
219
+ * chain may not have updated.
220
+ * By default, when this is NULL, a call is made to @set_pc(tb->pc).
221
+ *
222
+ * If more state needs to be restored, the target must implement a
223
+ * function to restore all the state, and register it here.
224
+ */
225
+ void (*synchronize_from_tb)(CPUState *cpu,
226
+ const struct TranslationBlock *tb);
227
+ /** @cpu_exec_enter: Callback for cpu_exec preparation */
228
+ void (*cpu_exec_enter)(CPUState *cpu);
229
+ /** @cpu_exec_exit: Callback for cpu_exec cleanup */
230
+ void (*cpu_exec_exit)(CPUState *cpu);
231
+ /** @cpu_exec_interrupt: Callback for processing interrupts in cpu_exec */
232
+ bool (*cpu_exec_interrupt)(CPUState *cpu, int interrupt_request);
233
+ /**
234
+ * @do_interrupt: Callback for interrupt handling.
235
+ *
236
+ * note that this is in general SOFTMMU only, but it actually isn't
237
+ * because of an x86 hack (accel/tcg/cpu-exec.c), so we cannot put it
238
+ * in the SOFTMMU section in general.
239
+ */
240
+ void (*do_interrupt)(CPUState *cpu);
241
+ /**
242
+ * @tlb_fill: Handle a softmmu tlb miss or user-only address fault
243
+ *
244
+ * For system mode, if the access is valid, call tlb_set_page
245
+ * and return true; if the access is invalid, and probe is
246
+ * true, return false; otherwise raise an exception and do
247
+ * not return. For user-only mode, always raise an exception
248
+ * and do not return.
249
+ */
250
+ bool (*tlb_fill)(CPUState *cpu, vaddr address, int size,
251
+ MMUAccessType access_type, int mmu_idx,
252
+ bool probe, uintptr_t retaddr);
253
+ /** @debug_excp_handler: Callback for handling debug exceptions */
254
+ void (*debug_excp_handler)(CPUState *cpu);
255
+
256
+#ifdef NEED_CPU_H
257
+#ifdef CONFIG_SOFTMMU
258
+ /**
259
+ * @do_transaction_failed: Callback for handling failed memory transactions
260
+ * (ie bus faults or external aborts; not MMU faults)
261
+ */
262
+ void (*do_transaction_failed)(CPUState *cpu, hwaddr physaddr, vaddr addr,
263
+ unsigned size, MMUAccessType access_type,
264
+ int mmu_idx, MemTxAttrs attrs,
265
+ MemTxResult response, uintptr_t retaddr);
266
+ /**
267
+ * @do_unaligned_access: Callback for unaligned access handling
268
+ */
269
+ void (*do_unaligned_access)(CPUState *cpu, vaddr addr,
270
+ MMUAccessType access_type,
271
+ int mmu_idx, uintptr_t retaddr);
272
+
273
+ /**
274
+ * @adjust_watchpoint_address: hack for cpu_check_watchpoint used by ARM
275
+ */
276
+ vaddr (*adjust_watchpoint_address)(CPUState *cpu, vaddr addr, int len);
277
+
278
+ /**
279
+ * @debug_check_watchpoint: return true if the architectural
280
+ * watchpoint whose address has matched should really fire, used by ARM
281
+ */
282
+ bool (*debug_check_watchpoint)(CPUState *cpu, CPUWatchpoint *wp);
283
+
284
+#endif /* CONFIG_SOFTMMU */
285
+#endif /* NEED_CPU_H */
286
+
287
+};
288
+
289
+#endif /* TCG_CPU_OPS_H */
290
diff --git a/target/arm/internals.h b/target/arm/internals.h
291
index XXXXXXX..XXXXXXX 100644
292
--- a/target/arm/internals.h
293
+++ b/target/arm/internals.h
294
@@ -XXX,XX +XXX,XX @@ static inline int r14_bank_number(int mode)
295
void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu);
296
void arm_translate_init(void);
297
298
+#ifdef CONFIG_TCG
299
+void arm_cpu_synchronize_from_tb(CPUState *cs,
300
+ const struct TranslationBlock *tb);
301
+#endif /* CONFIG_TCG */
302
+
303
+
304
enum arm_fprounding {
305
FPROUNDING_TIEEVEN,
306
FPROUNDING_POSINF,
307
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
308
index XXXXXXX..XXXXXXX 100644
309
--- a/accel/tcg/cpu-exec.c
310
+++ b/accel/tcg/cpu-exec.c
311
@@ -XXX,XX +XXX,XX @@
91
@@ -XXX,XX +XXX,XX @@
312
#include "qemu-common.h"
92
#ifdef CONFIG_USER_ONLY
313
#include "qemu/qemu-print.h"
93
#include "qemu.h"
314
#include "cpu.h"
94
#else
315
+#include "hw/core/tcg-cpu-ops.h"
95
+#include "hw/core/sysemu-cpu-ops.h"
316
#include "trace.h"
317
#include "disas/disas.h"
318
#include "exec/exec-all.h"
319
@@ -XXX,XX +XXX,XX @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit)
320
TARGET_FMT_lx "] %s\n",
321
last_tb->tc.ptr, last_tb->pc,
322
lookup_symbol(last_tb->pc));
323
- if (cc->tcg_ops.synchronize_from_tb) {
324
- cc->tcg_ops.synchronize_from_tb(cpu, last_tb);
325
+ if (cc->tcg_ops->synchronize_from_tb) {
326
+ cc->tcg_ops->synchronize_from_tb(cpu, last_tb);
327
} else {
328
assert(cc->set_pc);
329
cc->set_pc(cpu, last_tb->pc);
330
@@ -XXX,XX +XXX,XX @@ static void cpu_exec_enter(CPUState *cpu)
331
{
332
CPUClass *cc = CPU_GET_CLASS(cpu);
333
334
- if (cc->tcg_ops.cpu_exec_enter) {
335
- cc->tcg_ops.cpu_exec_enter(cpu);
336
+ if (cc->tcg_ops->cpu_exec_enter) {
337
+ cc->tcg_ops->cpu_exec_enter(cpu);
338
}
339
}
340
341
@@ -XXX,XX +XXX,XX @@ static void cpu_exec_exit(CPUState *cpu)
342
{
343
CPUClass *cc = CPU_GET_CLASS(cpu);
344
345
- if (cc->tcg_ops.cpu_exec_exit) {
346
- cc->tcg_ops.cpu_exec_exit(cpu);
347
+ if (cc->tcg_ops->cpu_exec_exit) {
348
+ cc->tcg_ops->cpu_exec_exit(cpu);
349
}
350
}
351
352
@@ -XXX,XX +XXX,XX @@ static inline void cpu_handle_debug_exception(CPUState *cpu)
353
}
354
}
355
356
- if (cc->tcg_ops.debug_excp_handler) {
357
- cc->tcg_ops.debug_excp_handler(cpu);
358
+ if (cc->tcg_ops->debug_excp_handler) {
359
+ cc->tcg_ops->debug_excp_handler(cpu);
360
}
361
}
362
363
@@ -XXX,XX +XXX,XX @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret)
364
loop */
365
#if defined(TARGET_I386)
366
CPUClass *cc = CPU_GET_CLASS(cpu);
367
- cc->tcg_ops.do_interrupt(cpu);
368
+ cc->tcg_ops->do_interrupt(cpu);
369
#endif
370
*ret = cpu->exception_index;
371
cpu->exception_index = -1;
372
@@ -XXX,XX +XXX,XX @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret)
373
if (replay_exception()) {
374
CPUClass *cc = CPU_GET_CLASS(cpu);
375
qemu_mutex_lock_iothread();
376
- cc->tcg_ops.do_interrupt(cpu);
377
+ cc->tcg_ops->do_interrupt(cpu);
378
qemu_mutex_unlock_iothread();
379
cpu->exception_index = -1;
380
381
@@ -XXX,XX +XXX,XX @@ static inline bool cpu_handle_interrupt(CPUState *cpu,
382
True when it is, and we should restart on a new TB,
383
and via longjmp via cpu_loop_exit. */
384
else {
385
- if (cc->tcg_ops.cpu_exec_interrupt &&
386
- cc->tcg_ops.cpu_exec_interrupt(cpu, interrupt_request)) {
387
+ if (cc->tcg_ops->cpu_exec_interrupt &&
388
+ cc->tcg_ops->cpu_exec_interrupt(cpu, interrupt_request)) {
389
if (need_replay_interrupt(interrupt_request)) {
390
replay_interrupt();
391
}
392
@@ -XXX,XX +XXX,XX @@ void tcg_exec_realizefn(CPUState *cpu, Error **errp)
393
CPUClass *cc = CPU_GET_CLASS(cpu);
394
395
if (!tcg_target_initialized) {
396
- cc->tcg_ops.initialize();
397
+ cc->tcg_ops->initialize();
398
tcg_target_initialized = true;
399
}
400
tlb_init(cpu);
401
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
402
index XXXXXXX..XXXXXXX 100644
403
--- a/accel/tcg/cputlb.c
404
+++ b/accel/tcg/cputlb.c
405
@@ -XXX,XX +XXX,XX @@
406
#include "qemu/osdep.h"
407
#include "qemu/main-loop.h"
408
#include "cpu.h"
409
+#include "hw/core/tcg-cpu-ops.h"
410
#include "exec/exec-all.h"
411
#include "exec/memory.h"
412
#include "exec/address-spaces.h"
96
#include "exec/address-spaces.h"
413
@@ -XXX,XX +XXX,XX @@ static void tlb_fill(CPUState *cpu, target_ulong addr, int size,
97
#endif
414
* This is not a probe, so only valid return is success; failure
98
#include "sysemu/tcg.h"
415
* should result in exception + longjmp to the cpu loop.
416
*/
417
- ok = cc->tcg_ops.tlb_fill(cpu, addr, size,
418
- access_type, mmu_idx, false, retaddr);
419
+ ok = cc->tcg_ops->tlb_fill(cpu, addr, size,
420
+ access_type, mmu_idx, false, retaddr);
421
assert(ok);
422
}
423
424
+static inline void cpu_unaligned_access(CPUState *cpu, vaddr addr,
425
+ MMUAccessType access_type,
426
+ int mmu_idx, uintptr_t retaddr)
427
+{
428
+ CPUClass *cc = CPU_GET_CLASS(cpu);
429
+
430
+ cc->tcg_ops->do_unaligned_access(cpu, addr, access_type, mmu_idx, retaddr);
431
+}
432
+
433
+static inline void cpu_transaction_failed(CPUState *cpu, hwaddr physaddr,
434
+ vaddr addr, unsigned size,
435
+ MMUAccessType access_type,
436
+ int mmu_idx, MemTxAttrs attrs,
437
+ MemTxResult response,
438
+ uintptr_t retaddr)
439
+{
440
+ CPUClass *cc = CPU_GET_CLASS(cpu);
441
+
442
+ if (!cpu->ignore_memory_transaction_failures &&
443
+ cc->tcg_ops->do_transaction_failed) {
444
+ cc->tcg_ops->do_transaction_failed(cpu, physaddr, addr, size,
445
+ access_type, mmu_idx, attrs,
446
+ response, retaddr);
447
+ }
448
+}
449
+
450
static uint64_t io_readx(CPUArchState *env, CPUIOTLBEntry *iotlbentry,
451
int mmu_idx, target_ulong addr, uintptr_t retaddr,
452
MMUAccessType access_type, MemOp op)
453
@@ -XXX,XX +XXX,XX @@ static int probe_access_internal(CPUArchState *env, target_ulong addr,
454
CPUState *cs = env_cpu(env);
455
CPUClass *cc = CPU_GET_CLASS(cs);
456
457
- if (!cc->tcg_ops.tlb_fill(cs, addr, fault_size, access_type,
458
- mmu_idx, nonfault, retaddr)) {
459
+ if (!cc->tcg_ops->tlb_fill(cs, addr, fault_size, access_type,
460
+ mmu_idx, nonfault, retaddr)) {
461
/* Non-faulting page table read failed. */
462
*phost = NULL;
463
return TLB_INVALID_MASK;
464
diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
465
index XXXXXXX..XXXXXXX 100644
466
--- a/accel/tcg/user-exec.c
467
+++ b/accel/tcg/user-exec.c
468
@@ -XXX,XX +XXX,XX @@
469
*/
470
#include "qemu/osdep.h"
471
#include "cpu.h"
472
+#include "hw/core/tcg-cpu-ops.h"
473
#include "disas/disas.h"
474
#include "exec/exec-all.h"
475
#include "tcg/tcg.h"
476
@@ -XXX,XX +XXX,XX @@ static inline int handle_cpu_signal(uintptr_t pc, siginfo_t *info,
477
clear_helper_retaddr();
478
479
cc = CPU_GET_CLASS(cpu);
480
- cc->tcg_ops.tlb_fill(cpu, address, 0, access_type,
481
- MMU_USER_IDX, false, pc);
482
+ cc->tcg_ops->tlb_fill(cpu, address, 0, access_type,
483
+ MMU_USER_IDX, false, pc);
484
g_assert_not_reached();
485
}
486
487
@@ -XXX,XX +XXX,XX @@ static int probe_access_internal(CPUArchState *env, target_ulong addr,
488
} else {
489
CPUState *cpu = env_cpu(env);
490
CPUClass *cc = CPU_GET_CLASS(cpu);
491
- cc->tcg_ops.tlb_fill(cpu, addr, fault_size, access_type,
492
- MMU_USER_IDX, false, ra);
493
+ cc->tcg_ops->tlb_fill(cpu, addr, fault_size, access_type,
494
+ MMU_USER_IDX, false, ra);
495
g_assert_not_reached();
496
}
497
}
498
diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c
499
index XXXXXXX..XXXXXXX 100644
500
--- a/hw/mips/jazz.c
501
+++ b/hw/mips/jazz.c
502
@@ -XXX,XX +XXX,XX @@
503
#include "qapi/error.h"
504
#include "qemu/error-report.h"
505
#include "qemu/help_option.h"
506
+#ifdef CONFIG_TCG
507
+#include "hw/core/tcg-cpu-ops.h"
508
+#endif /* CONFIG_TCG */
509
510
enum jazz_model_e {
511
JAZZ_MAGNUM,
512
@@ -XXX,XX +XXX,XX @@ static void mips_jazz_init(MachineState *machine,
513
*/
514
cc = CPU_GET_CLASS(cpu);
515
#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
516
- real_do_transaction_failed = cc->tcg_ops.do_transaction_failed;
517
- cc->tcg_ops.do_transaction_failed = mips_jazz_do_transaction_failed;
518
+ real_do_transaction_failed = cc->tcg_ops->do_transaction_failed;
519
+ cc->tcg_ops->do_transaction_failed = mips_jazz_do_transaction_failed;
520
#endif /* CONFIG_TCG && !CONFIG_USER_ONLY */
521
522
/* allocate RAM */
523
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
524
index XXXXXXX..XXXXXXX 100644
525
--- a/softmmu/physmem.c
526
+++ b/softmmu/physmem.c
527
@@ -XXX,XX +XXX,XX @@
528
#include "qemu/cutils.h"
529
#include "qemu/cacheflush.h"
530
#include "cpu.h"
531
+
532
+#ifdef CONFIG_TCG
533
+#include "hw/core/tcg-cpu-ops.h"
534
+#endif /* CONFIG_TCG */
535
+
536
#include "exec/exec-all.h"
537
#include "exec/target_page.h"
538
#include "hw/qdev-core.h"
539
@@ -XXX,XX +XXX,XX @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
540
return;
541
}
542
543
- if (cc->tcg_ops.adjust_watchpoint_address) {
544
+ if (cc->tcg_ops->adjust_watchpoint_address) {
545
/* this is currently used only by ARM BE32 */
546
- addr = cc->tcg_ops.adjust_watchpoint_address(cpu, addr, len);
547
+ addr = cc->tcg_ops->adjust_watchpoint_address(cpu, addr, len);
548
}
549
QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) {
550
if (watchpoint_address_matches(wp, addr, len)
551
@@ -XXX,XX +XXX,XX @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
552
wp->hitaddr = MAX(addr, wp->vaddr);
553
wp->hitattrs = attrs;
554
if (!cpu->watchpoint_hit) {
555
- if (wp->flags & BP_CPU && cc->tcg_ops.debug_check_watchpoint &&
556
- !cc->tcg_ops.debug_check_watchpoint(cpu, wp)) {
557
+ if (wp->flags & BP_CPU && cc->tcg_ops->debug_check_watchpoint &&
558
+ !cc->tcg_ops->debug_check_watchpoint(cpu, wp)) {
559
wp->flags &= ~BP_WATCHPOINT_HIT;
560
continue;
561
}
562
diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c
99
diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c
563
index XXXXXXX..XXXXXXX 100644
100
index XXXXXXX..XXXXXXX 100644
564
--- a/target/alpha/cpu.c
101
--- a/target/alpha/cpu.c
565
+++ b/target/alpha/cpu.c
102
+++ b/target/alpha/cpu.c
566
@@ -XXX,XX +XXX,XX @@ static void alpha_cpu_initfn(Object *obj)
103
@@ -XXX,XX +XXX,XX @@ static void alpha_cpu_initfn(Object *obj)
567
#endif
104
#endif
568
}
105
}
569
106
570
+#include "hw/core/tcg-cpu-ops.h"
107
+#ifndef CONFIG_USER_ONLY
571
+
108
+#include "hw/core/sysemu-cpu-ops.h"
572
+static struct TCGCPUOps alpha_tcg_ops = {
109
+
573
+ .initialize = alpha_translate_init,
110
+static const struct SysemuCPUOps alpha_sysemu_ops = {
574
+ .cpu_exec_interrupt = alpha_cpu_exec_interrupt,
111
+};
575
+ .tlb_fill = alpha_cpu_tlb_fill,
112
+#endif
576
+
113
+
577
+#ifndef CONFIG_USER_ONLY
114
#include "hw/core/tcg-cpu-ops.h"
578
+ .do_interrupt = alpha_cpu_do_interrupt,
115
579
+ .do_transaction_failed = alpha_cpu_do_transaction_failed,
116
static struct TCGCPUOps alpha_tcg_ops = {
580
+ .do_unaligned_access = alpha_cpu_do_unaligned_access,
581
+#endif /* !CONFIG_USER_ONLY */
582
+};
583
+
584
static void alpha_cpu_class_init(ObjectClass *oc, void *data)
585
{
586
DeviceClass *dc = DEVICE_CLASS(oc);
587
@@ -XXX,XX +XXX,XX @@ static void alpha_cpu_class_init(ObjectClass *oc, void *data)
117
@@ -XXX,XX +XXX,XX @@ static void alpha_cpu_class_init(ObjectClass *oc, void *data)
588
118
#ifndef CONFIG_USER_ONLY
589
cc->class_by_name = alpha_cpu_class_by_name;
590
cc->has_work = alpha_cpu_has_work;
591
- cc->tcg_ops.do_interrupt = alpha_cpu_do_interrupt;
592
- cc->tcg_ops.cpu_exec_interrupt = alpha_cpu_exec_interrupt;
593
cc->dump_state = alpha_cpu_dump_state;
594
cc->set_pc = alpha_cpu_set_pc;
595
cc->gdb_read_register = alpha_cpu_gdb_read_register;
596
cc->gdb_write_register = alpha_cpu_gdb_write_register;
597
- cc->tcg_ops.tlb_fill = alpha_cpu_tlb_fill;
598
#ifndef CONFIG_USER_ONLY
599
- cc->tcg_ops.do_transaction_failed = alpha_cpu_do_transaction_failed;
600
- cc->tcg_ops.do_unaligned_access = alpha_cpu_do_unaligned_access;
601
cc->get_phys_page_debug = alpha_cpu_get_phys_page_debug;
119
cc->get_phys_page_debug = alpha_cpu_get_phys_page_debug;
602
dc->vmsd = &vmstate_alpha_cpu;
120
dc->vmsd = &vmstate_alpha_cpu;
121
+ cc->sysemu_ops = &alpha_sysemu_ops;
603
#endif
122
#endif
604
cc->disas_set_info = alpha_cpu_disas_set_info;
123
cc->disas_set_info = alpha_cpu_disas_set_info;
605
- cc->tcg_ops.initialize = alpha_translate_init;
606
607
+ cc->tcg_ops = &alpha_tcg_ops;
608
cc->gdb_num_core_regs = 67;
609
}
610
124
611
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
125
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
612
index XXXXXXX..XXXXXXX 100644
126
index XXXXXXX..XXXXXXX 100644
613
--- a/target/arm/cpu.c
127
--- a/target/arm/cpu.c
614
+++ b/target/arm/cpu.c
128
+++ b/target/arm/cpu.c
615
@@ -XXX,XX +XXX,XX @@
616
#include "qapi/error.h"
617
#include "qapi/visitor.h"
618
#include "cpu.h"
619
+#ifdef CONFIG_TCG
620
+#include "hw/core/tcg-cpu-ops.h"
621
+#endif /* CONFIG_TCG */
622
#include "internals.h"
623
#include "exec/exec-all.h"
624
#include "hw/qdev-properties.h"
625
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_set_pc(CPUState *cs, vaddr value)
626
}
627
628
#ifdef CONFIG_TCG
629
-static void arm_cpu_synchronize_from_tb(CPUState *cs,
630
- const TranslationBlock *tb)
631
+void arm_cpu_synchronize_from_tb(CPUState *cs,
632
+ const TranslationBlock *tb)
633
{
634
ARMCPU *cpu = ARM_CPU(cs);
635
CPUARMState *env = &cpu->env;
636
@@ -XXX,XX +XXX,XX @@ bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
637
found:
638
cs->exception_index = excp_idx;
639
env->exception.target_el = target_el;
640
- cc->tcg_ops.do_interrupt(cs);
641
+ cc->tcg_ops->do_interrupt(cs);
642
return true;
643
}
644
645
@@ -XXX,XX +XXX,XX @@ static gchar *arm_gdb_arch_name(CPUState *cs)
129
@@ -XXX,XX +XXX,XX @@ static gchar *arm_gdb_arch_name(CPUState *cs)
646
return g_strdup("arm");
130
return g_strdup("arm");
647
}
131
}
648
132
649
+#ifdef CONFIG_TCG
133
+#ifndef CONFIG_USER_ONLY
650
+static struct TCGCPUOps arm_tcg_ops = {
134
+#include "hw/core/sysemu-cpu-ops.h"
651
+ .initialize = arm_translate_init,
135
+
652
+ .synchronize_from_tb = arm_cpu_synchronize_from_tb,
136
+static const struct SysemuCPUOps arm_sysemu_ops = {
653
+ .cpu_exec_interrupt = arm_cpu_exec_interrupt,
137
+};
654
+ .tlb_fill = arm_cpu_tlb_fill,
138
+#endif
655
+ .debug_excp_handler = arm_debug_excp_handler,
139
+
656
+
140
#ifdef CONFIG_TCG
657
+#if !defined(CONFIG_USER_ONLY)
141
static struct TCGCPUOps arm_tcg_ops = {
658
+ .do_interrupt = arm_cpu_do_interrupt,
142
.initialize = arm_translate_init,
659
+ .do_transaction_failed = arm_cpu_do_transaction_failed,
660
+ .do_unaligned_access = arm_cpu_do_unaligned_access,
661
+ .adjust_watchpoint_address = arm_adjust_watchpoint_address,
662
+ .debug_check_watchpoint = arm_debug_check_watchpoint,
663
+#endif /* !CONFIG_USER_ONLY */
664
+};
665
+#endif /* CONFIG_TCG */
666
+
667
static void arm_cpu_class_init(ObjectClass *oc, void *data)
668
{
669
ARMCPUClass *acc = ARM_CPU_CLASS(oc);
670
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
143
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
671
cc->gdb_get_dynamic_xml = arm_gdb_get_dynamic_xml;
144
cc->virtio_is_big_endian = arm_cpu_virtio_is_big_endian;
672
cc->gdb_stop_before_watchpoint = true;
145
cc->write_elf64_note = arm_cpu_write_elf64_note;
673
cc->disas_set_info = arm_disas_set_info;
146
cc->write_elf32_note = arm_cpu_write_elf32_note;
674
+
147
+ cc->sysemu_ops = &arm_sysemu_ops;
675
#ifdef CONFIG_TCG
148
#endif
676
- cc->tcg_ops.initialize = arm_translate_init;
149
cc->gdb_num_core_regs = 26;
677
- cc->tcg_ops.cpu_exec_interrupt = arm_cpu_exec_interrupt;
150
cc->gdb_core_xml_file = "arm-core.xml";
678
- cc->tcg_ops.synchronize_from_tb = arm_cpu_synchronize_from_tb;
679
- cc->tcg_ops.tlb_fill = arm_cpu_tlb_fill;
680
- cc->tcg_ops.debug_excp_handler = arm_debug_excp_handler;
681
-#if !defined(CONFIG_USER_ONLY)
682
- cc->tcg_ops.do_interrupt = arm_cpu_do_interrupt;
683
- cc->tcg_ops.do_transaction_failed = arm_cpu_do_transaction_failed;
684
- cc->tcg_ops.do_unaligned_access = arm_cpu_do_unaligned_access;
685
- cc->tcg_ops.adjust_watchpoint_address = arm_adjust_watchpoint_address;
686
- cc->tcg_ops.debug_check_watchpoint = arm_debug_check_watchpoint;
687
-#endif /* CONFIG_TCG && !CONFIG_USER_ONLY */
688
+ cc->tcg_ops = &arm_tcg_ops;
689
#endif /* CONFIG_TCG */
690
}
691
692
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
693
index XXXXXXX..XXXXXXX 100644
694
--- a/target/arm/cpu64.c
695
+++ b/target/arm/cpu64.c
696
@@ -XXX,XX +XXX,XX @@
697
#include "qemu/osdep.h"
698
#include "qapi/error.h"
699
#include "cpu.h"
700
+#ifdef CONFIG_TCG
701
+#include "hw/core/tcg-cpu-ops.h"
702
+#endif /* CONFIG_TCG */
703
#include "qemu/module.h"
704
#if !defined(CONFIG_USER_ONLY)
705
#include "hw/loader.h"
706
@@ -XXX,XX +XXX,XX @@ static void aarch64_cpu_class_init(ObjectClass *oc, void *data)
707
{
708
CPUClass *cc = CPU_CLASS(oc);
709
710
-#ifdef CONFIG_TCG
711
- cc->tcg_ops.cpu_exec_interrupt = arm_cpu_exec_interrupt;
712
-#endif /* CONFIG_TCG */
713
-
714
cc->gdb_read_register = aarch64_cpu_gdb_read_register;
715
cc->gdb_write_register = aarch64_cpu_gdb_write_register;
716
cc->gdb_num_core_regs = 34;
717
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
718
index XXXXXXX..XXXXXXX 100644
719
--- a/target/arm/cpu_tcg.c
720
+++ b/target/arm/cpu_tcg.c
721
@@ -XXX,XX +XXX,XX @@
722
723
#include "qemu/osdep.h"
724
#include "cpu.h"
725
+#ifdef CONFIG_TCG
726
+#include "hw/core/tcg-cpu-ops.h"
727
+#endif /* CONFIG_TCG */
728
#include "internals.h"
729
730
/* CPU models. These are not needed for the AArch64 linux-user build. */
731
@@ -XXX,XX +XXX,XX @@ static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
732
if (interrupt_request & CPU_INTERRUPT_HARD
733
&& (armv7m_nvic_can_take_pending_exception(env->nvic))) {
734
cs->exception_index = EXCP_IRQ;
735
- cc->tcg_ops.do_interrupt(cs);
736
+ cc->tcg_ops->do_interrupt(cs);
737
ret = true;
738
}
739
return ret;
740
@@ -XXX,XX +XXX,XX @@ static void pxa270c5_initfn(Object *obj)
741
cpu->reset_sctlr = 0x00000078;
742
}
743
744
+#ifdef CONFIG_TCG
745
+static struct TCGCPUOps arm_v7m_tcg_ops = {
746
+ .initialize = arm_translate_init,
747
+ .synchronize_from_tb = arm_cpu_synchronize_from_tb,
748
+ .cpu_exec_interrupt = arm_v7m_cpu_exec_interrupt,
749
+ .tlb_fill = arm_cpu_tlb_fill,
750
+ .debug_excp_handler = arm_debug_excp_handler,
751
+
752
+#if !defined(CONFIG_USER_ONLY)
753
+ .do_interrupt = arm_v7m_cpu_do_interrupt,
754
+ .do_transaction_failed = arm_cpu_do_transaction_failed,
755
+ .do_unaligned_access = arm_cpu_do_unaligned_access,
756
+ .adjust_watchpoint_address = arm_adjust_watchpoint_address,
757
+ .debug_check_watchpoint = arm_debug_check_watchpoint,
758
+#endif /* !CONFIG_USER_ONLY */
759
+};
760
+#endif /* CONFIG_TCG */
761
+
762
static void arm_v7m_class_init(ObjectClass *oc, void *data)
763
{
764
ARMCPUClass *acc = ARM_CPU_CLASS(oc);
765
@@ -XXX,XX +XXX,XX @@ static void arm_v7m_class_init(ObjectClass *oc, void *data)
766
767
acc->info = data;
768
#ifdef CONFIG_TCG
769
- cc->tcg_ops.cpu_exec_interrupt = arm_v7m_cpu_exec_interrupt;
770
-#ifndef CONFIG_USER_ONLY
771
- cc->tcg_ops.do_interrupt = arm_v7m_cpu_do_interrupt;
772
-#endif
773
+ cc->tcg_ops = &arm_v7m_tcg_ops;
774
#endif /* CONFIG_TCG */
775
776
cc->gdb_core_xml_file = "arm-m-profile.xml";
777
diff --git a/target/avr/cpu.c b/target/avr/cpu.c
151
diff --git a/target/avr/cpu.c b/target/avr/cpu.c
778
index XXXXXXX..XXXXXXX 100644
152
index XXXXXXX..XXXXXXX 100644
779
--- a/target/avr/cpu.c
153
--- a/target/avr/cpu.c
780
+++ b/target/avr/cpu.c
154
+++ b/target/avr/cpu.c
781
@@ -XXX,XX +XXX,XX @@ static void avr_cpu_dump_state(CPUState *cs, FILE *f, int flags)
155
@@ -XXX,XX +XXX,XX @@ static void avr_cpu_dump_state(CPUState *cs, FILE *f, int flags)
782
qemu_fprintf(f, "\n");
156
qemu_fprintf(f, "\n");
783
}
157
}
784
158
785
+#include "hw/core/tcg-cpu-ops.h"
159
+#include "hw/core/sysemu-cpu-ops.h"
786
+
160
+
787
+static struct TCGCPUOps avr_tcg_ops = {
161
+static const struct SysemuCPUOps avr_sysemu_ops = {
788
+ .initialize = avr_cpu_tcg_init,
162
+};
789
+ .synchronize_from_tb = avr_cpu_synchronize_from_tb,
163
+
790
+ .cpu_exec_interrupt = avr_cpu_exec_interrupt,
164
#include "hw/core/tcg-cpu-ops.h"
791
+ .tlb_fill = avr_cpu_tlb_fill,
165
792
+
166
static struct TCGCPUOps avr_tcg_ops = {
793
+#ifndef CONFIG_USER_ONLY
794
+ .do_interrupt = avr_cpu_do_interrupt,
795
+#endif /* !CONFIG_USER_ONLY */
796
+};
797
+
798
static void avr_cpu_class_init(ObjectClass *oc, void *data)
799
{
800
DeviceClass *dc = DEVICE_CLASS(oc);
801
@@ -XXX,XX +XXX,XX @@ static void avr_cpu_class_init(ObjectClass *oc, void *data)
167
@@ -XXX,XX +XXX,XX @@ static void avr_cpu_class_init(ObjectClass *oc, void *data)
802
cc->class_by_name = avr_cpu_class_by_name;
803
804
cc->has_work = avr_cpu_has_work;
805
- cc->tcg_ops.do_interrupt = avr_cpu_do_interrupt;
806
- cc->tcg_ops.cpu_exec_interrupt = avr_cpu_exec_interrupt;
807
cc->dump_state = avr_cpu_dump_state;
808
cc->set_pc = avr_cpu_set_pc;
809
cc->memory_rw_debug = avr_cpu_memory_rw_debug;
168
cc->memory_rw_debug = avr_cpu_memory_rw_debug;
810
cc->get_phys_page_debug = avr_cpu_get_phys_page_debug;
169
cc->get_phys_page_debug = avr_cpu_get_phys_page_debug;
811
- cc->tcg_ops.tlb_fill = avr_cpu_tlb_fill;
170
dc->vmsd = &vms_avr_cpu;
812
cc->vmsd = &vms_avr_cpu;
171
+ cc->sysemu_ops = &avr_sysemu_ops;
813
cc->disas_set_info = avr_cpu_disas_set_info;
172
cc->disas_set_info = avr_cpu_disas_set_info;
814
- cc->tcg_ops.initialize = avr_cpu_tcg_init;
815
- cc->tcg_ops.synchronize_from_tb = avr_cpu_synchronize_from_tb;
816
cc->gdb_read_register = avr_cpu_gdb_read_register;
173
cc->gdb_read_register = avr_cpu_gdb_read_register;
817
cc->gdb_write_register = avr_cpu_gdb_write_register;
174
cc->gdb_write_register = avr_cpu_gdb_write_register;
818
cc->gdb_num_core_regs = 35;
819
cc->gdb_core_xml_file = "avr-cpu.xml";
820
+ cc->tcg_ops = &avr_tcg_ops;
821
}
822
823
/*
824
diff --git a/target/avr/helper.c b/target/avr/helper.c
825
index XXXXXXX..XXXXXXX 100644
826
--- a/target/avr/helper.c
827
+++ b/target/avr/helper.c
828
@@ -XXX,XX +XXX,XX @@
829
830
#include "qemu/osdep.h"
831
#include "cpu.h"
832
+#include "hw/core/tcg-cpu-ops.h"
833
#include "exec/exec-all.h"
834
#include "exec/address-spaces.h"
835
#include "exec/helper-proto.h"
836
@@ -XXX,XX +XXX,XX @@ bool avr_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
837
if (interrupt_request & CPU_INTERRUPT_RESET) {
838
if (cpu_interrupts_enabled(env)) {
839
cs->exception_index = EXCP_RESET;
840
- cc->tcg_ops.do_interrupt(cs);
841
+ cc->tcg_ops->do_interrupt(cs);
842
843
cs->interrupt_request &= ~CPU_INTERRUPT_RESET;
844
845
@@ -XXX,XX +XXX,XX @@ bool avr_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
846
if (cpu_interrupts_enabled(env) && env->intsrc != 0) {
847
int index = ctz32(env->intsrc);
848
cs->exception_index = EXCP_INT(index);
849
- cc->tcg_ops.do_interrupt(cs);
850
+ cc->tcg_ops->do_interrupt(cs);
851
852
env->intsrc &= env->intsrc - 1; /* clear the interrupt */
853
cs->interrupt_request &= ~CPU_INTERRUPT_HARD;
854
diff --git a/target/cris/cpu.c b/target/cris/cpu.c
175
diff --git a/target/cris/cpu.c b/target/cris/cpu.c
855
index XXXXXXX..XXXXXXX 100644
176
index XXXXXXX..XXXXXXX 100644
856
--- a/target/cris/cpu.c
177
--- a/target/cris/cpu.c
857
+++ b/target/cris/cpu.c
178
+++ b/target/cris/cpu.c
858
@@ -XXX,XX +XXX,XX @@ static void cris_cpu_initfn(Object *obj)
179
@@ -XXX,XX +XXX,XX @@ static void cris_cpu_initfn(Object *obj)
859
#endif
180
#endif
860
}
181
}
861
182
862
+#include "hw/core/tcg-cpu-ops.h"
183
+#ifndef CONFIG_USER_ONLY
863
+
184
+#include "hw/core/sysemu-cpu-ops.h"
864
+static struct TCGCPUOps crisv10_tcg_ops = {
185
+
865
+ .initialize = cris_initialize_crisv10_tcg,
186
+static const struct SysemuCPUOps cris_sysemu_ops = {
866
+ .cpu_exec_interrupt = cris_cpu_exec_interrupt,
187
+};
867
+ .tlb_fill = cris_cpu_tlb_fill,
188
+#endif
868
+
189
+
869
+#ifndef CONFIG_USER_ONLY
190
#include "hw/core/tcg-cpu-ops.h"
870
+ .do_interrupt = crisv10_cpu_do_interrupt,
191
871
+#endif /* !CONFIG_USER_ONLY */
192
static struct TCGCPUOps crisv10_tcg_ops = {
872
+};
873
+
874
+static struct TCGCPUOps crisv32_tcg_ops = {
875
+ .initialize = cris_initialize_tcg,
876
+ .cpu_exec_interrupt = cris_cpu_exec_interrupt,
877
+ .tlb_fill = cris_cpu_tlb_fill,
878
+
879
+#ifndef CONFIG_USER_ONLY
880
+ .do_interrupt = cris_cpu_do_interrupt,
881
+#endif /* !CONFIG_USER_ONLY */
882
+};
883
+
884
static void crisv8_cpu_class_init(ObjectClass *oc, void *data)
885
{
886
CPUClass *cc = CPU_CLASS(oc);
887
CRISCPUClass *ccc = CRIS_CPU_CLASS(oc);
888
889
ccc->vr = 8;
890
- cc->tcg_ops.do_interrupt = crisv10_cpu_do_interrupt;
891
cc->gdb_read_register = crisv10_cpu_gdb_read_register;
892
- cc->tcg_ops.initialize = cris_initialize_crisv10_tcg;
893
+ cc->tcg_ops = &crisv10_tcg_ops;
894
}
895
896
static void crisv9_cpu_class_init(ObjectClass *oc, void *data)
897
@@ -XXX,XX +XXX,XX @@ static void crisv9_cpu_class_init(ObjectClass *oc, void *data)
898
CRISCPUClass *ccc = CRIS_CPU_CLASS(oc);
899
900
ccc->vr = 9;
901
- cc->tcg_ops.do_interrupt = crisv10_cpu_do_interrupt;
902
cc->gdb_read_register = crisv10_cpu_gdb_read_register;
903
- cc->tcg_ops.initialize = cris_initialize_crisv10_tcg;
904
+ cc->tcg_ops = &crisv10_tcg_ops;
905
}
906
907
static void crisv10_cpu_class_init(ObjectClass *oc, void *data)
908
@@ -XXX,XX +XXX,XX @@ static void crisv10_cpu_class_init(ObjectClass *oc, void *data)
909
CRISCPUClass *ccc = CRIS_CPU_CLASS(oc);
910
911
ccc->vr = 10;
912
- cc->tcg_ops.do_interrupt = crisv10_cpu_do_interrupt;
913
cc->gdb_read_register = crisv10_cpu_gdb_read_register;
914
- cc->tcg_ops.initialize = cris_initialize_crisv10_tcg;
915
+ cc->tcg_ops = &crisv10_tcg_ops;
916
}
917
918
static void crisv11_cpu_class_init(ObjectClass *oc, void *data)
919
@@ -XXX,XX +XXX,XX @@ static void crisv11_cpu_class_init(ObjectClass *oc, void *data)
920
CRISCPUClass *ccc = CRIS_CPU_CLASS(oc);
921
922
ccc->vr = 11;
923
- cc->tcg_ops.do_interrupt = crisv10_cpu_do_interrupt;
924
cc->gdb_read_register = crisv10_cpu_gdb_read_register;
925
- cc->tcg_ops.initialize = cris_initialize_crisv10_tcg;
926
+ cc->tcg_ops = &crisv10_tcg_ops;
927
}
928
929
static void crisv17_cpu_class_init(ObjectClass *oc, void *data)
930
@@ -XXX,XX +XXX,XX @@ static void crisv17_cpu_class_init(ObjectClass *oc, void *data)
931
CRISCPUClass *ccc = CRIS_CPU_CLASS(oc);
932
933
ccc->vr = 17;
934
- cc->tcg_ops.do_interrupt = crisv10_cpu_do_interrupt;
935
cc->gdb_read_register = crisv10_cpu_gdb_read_register;
936
- cc->tcg_ops.initialize = cris_initialize_crisv10_tcg;
937
+ cc->tcg_ops = &crisv10_tcg_ops;
938
}
939
940
static void crisv32_cpu_class_init(ObjectClass *oc, void *data)
941
{
942
+ CPUClass *cc = CPU_CLASS(oc);
943
CRISCPUClass *ccc = CRIS_CPU_CLASS(oc);
944
945
ccc->vr = 32;
946
+ cc->tcg_ops = &crisv32_tcg_ops;
947
}
948
949
static void cris_cpu_class_init(ObjectClass *oc, void *data)
950
@@ -XXX,XX +XXX,XX @@ static void cris_cpu_class_init(ObjectClass *oc, void *data)
193
@@ -XXX,XX +XXX,XX @@ static void cris_cpu_class_init(ObjectClass *oc, void *data)
951
952
cc->class_by_name = cris_cpu_class_by_name;
953
cc->has_work = cris_cpu_has_work;
954
- cc->tcg_ops.do_interrupt = cris_cpu_do_interrupt;
955
- cc->tcg_ops.cpu_exec_interrupt = cris_cpu_exec_interrupt;
956
cc->dump_state = cris_cpu_dump_state;
957
cc->set_pc = cris_cpu_set_pc;
958
cc->gdb_read_register = cris_cpu_gdb_read_register;
959
cc->gdb_write_register = cris_cpu_gdb_write_register;
960
- cc->tcg_ops.tlb_fill = cris_cpu_tlb_fill;
961
#ifndef CONFIG_USER_ONLY
194
#ifndef CONFIG_USER_ONLY
962
cc->get_phys_page_debug = cris_cpu_get_phys_page_debug;
195
cc->get_phys_page_debug = cris_cpu_get_phys_page_debug;
963
dc->vmsd = &vmstate_cris_cpu;
196
dc->vmsd = &vmstate_cris_cpu;
964
@@ -XXX,XX +XXX,XX @@ static void cris_cpu_class_init(ObjectClass *oc, void *data)
197
+ cc->sysemu_ops = &cris_sysemu_ops;
965
cc->gdb_stop_before_watchpoint = true;
198
#endif
966
199
967
cc->disas_set_info = cris_disas_set_info;
200
cc->gdb_num_core_regs = 49;
968
- cc->tcg_ops.initialize = cris_initialize_tcg;
969
}
970
971
#define DEFINE_CRIS_CPU_TYPE(cpu_model, initfn) \
972
diff --git a/target/cris/helper.c b/target/cris/helper.c
973
index XXXXXXX..XXXXXXX 100644
974
--- a/target/cris/helper.c
975
+++ b/target/cris/helper.c
976
@@ -XXX,XX +XXX,XX @@
977
978
#include "qemu/osdep.h"
979
#include "cpu.h"
980
+#include "hw/core/tcg-cpu-ops.h"
981
#include "mmu.h"
982
#include "qemu/host-utils.h"
983
#include "exec/exec-all.h"
984
@@ -XXX,XX +XXX,XX @@ bool cris_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
985
&& (env->pregs[PR_CCS] & I_FLAG)
986
&& !env->locked_irq) {
987
cs->exception_index = EXCP_IRQ;
988
- cc->tcg_ops.do_interrupt(cs);
989
+ cc->tcg_ops->do_interrupt(cs);
990
ret = true;
991
}
992
if (interrupt_request & CPU_INTERRUPT_NMI) {
993
@@ -XXX,XX +XXX,XX @@ bool cris_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
994
}
995
if ((env->pregs[PR_CCS] & m_flag_archval)) {
996
cs->exception_index = EXCP_NMI;
997
- cc->tcg_ops.do_interrupt(cs);
998
+ cc->tcg_ops->do_interrupt(cs);
999
ret = true;
1000
}
1001
}
1002
diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
201
diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
1003
index XXXXXXX..XXXXXXX 100644
202
index XXXXXXX..XXXXXXX 100644
1004
--- a/target/hppa/cpu.c
203
--- a/target/hppa/cpu.c
1005
+++ b/target/hppa/cpu.c
204
+++ b/target/hppa/cpu.c
1006
@@ -XXX,XX +XXX,XX @@ static ObjectClass *hppa_cpu_class_by_name(const char *cpu_model)
205
@@ -XXX,XX +XXX,XX @@ static ObjectClass *hppa_cpu_class_by_name(const char *cpu_model)
1007
return object_class_by_name(TYPE_HPPA_CPU);
206
return object_class_by_name(TYPE_HPPA_CPU);
1008
}
207
}
1009
208
1010
+#include "hw/core/tcg-cpu-ops.h"
209
+#ifndef CONFIG_USER_ONLY
1011
+
210
+#include "hw/core/sysemu-cpu-ops.h"
1012
+static struct TCGCPUOps hppa_tcg_ops = {
211
+
1013
+ .initialize = hppa_translate_init,
212
+static const struct SysemuCPUOps hppa_sysemu_ops = {
1014
+ .synchronize_from_tb = hppa_cpu_synchronize_from_tb,
213
+};
1015
+ .cpu_exec_interrupt = hppa_cpu_exec_interrupt,
214
+#endif
1016
+ .tlb_fill = hppa_cpu_tlb_fill,
215
+
1017
+
216
#include "hw/core/tcg-cpu-ops.h"
1018
+#ifndef CONFIG_USER_ONLY
217
1019
+ .do_interrupt = hppa_cpu_do_interrupt,
218
static struct TCGCPUOps hppa_tcg_ops = {
1020
+ .do_unaligned_access = hppa_cpu_do_unaligned_access,
219
@@ -XXX,XX +XXX,XX @@ static void hppa_cpu_class_init(ObjectClass *oc, void *data)
1021
+#endif /* !CONFIG_USER_ONLY */
220
#ifndef CONFIG_USER_ONLY
1022
+};
221
cc->get_phys_page_debug = hppa_cpu_get_phys_page_debug;
1023
+
222
dc->vmsd = &vmstate_hppa_cpu;
1024
static void hppa_cpu_class_init(ObjectClass *oc, void *data)
223
+ cc->sysemu_ops = &hppa_sysemu_ops;
224
#endif
225
cc->disas_set_info = hppa_cpu_disas_set_info;
226
cc->gdb_num_core_regs = 128;
227
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
228
index XXXXXXX..XXXXXXX 100644
229
--- a/target/i386/cpu.c
230
+++ b/target/i386/cpu.c
231
@@ -XXX,XX +XXX,XX @@ static Property x86_cpu_properties[] = {
232
DEFINE_PROP_END_OF_LIST()
233
};
234
235
+#ifndef CONFIG_USER_ONLY
236
+#include "hw/core/sysemu-cpu-ops.h"
237
+
238
+static const struct SysemuCPUOps i386_sysemu_ops = {
239
+};
240
+#endif
241
+
242
static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
1025
{
243
{
1026
DeviceClass *dc = DEVICE_CLASS(oc);
244
X86CPUClass *xcc = X86_CPU_CLASS(oc);
1027
@@ -XXX,XX +XXX,XX @@ static void hppa_cpu_class_init(ObjectClass *oc, void *data)
245
@@ -XXX,XX +XXX,XX @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
1028
246
cc->write_elf32_note = x86_cpu_write_elf32_note;
1029
cc->class_by_name = hppa_cpu_class_by_name;
247
cc->write_elf32_qemunote = x86_cpu_write_elf32_qemunote;
1030
cc->has_work = hppa_cpu_has_work;
248
cc->legacy_vmsd = &vmstate_x86_cpu;
1031
- cc->tcg_ops.do_interrupt = hppa_cpu_do_interrupt;
249
+ cc->sysemu_ops = &i386_sysemu_ops;
1032
- cc->tcg_ops.cpu_exec_interrupt = hppa_cpu_exec_interrupt;
250
#endif /* !CONFIG_USER_ONLY */
1033
cc->dump_state = hppa_cpu_dump_state;
251
1034
cc->set_pc = hppa_cpu_set_pc;
252
cc->gdb_arch_name = x86_gdb_arch_name;
1035
- cc->tcg_ops.synchronize_from_tb = hppa_cpu_synchronize_from_tb;
1036
cc->gdb_read_register = hppa_cpu_gdb_read_register;
1037
cc->gdb_write_register = hppa_cpu_gdb_write_register;
1038
- cc->tcg_ops.tlb_fill = hppa_cpu_tlb_fill;
1039
#ifndef CONFIG_USER_ONLY
1040
cc->get_phys_page_debug = hppa_cpu_get_phys_page_debug;
1041
- cc->tcg_ops.do_unaligned_access = hppa_cpu_do_unaligned_access;
1042
dc->vmsd = &vmstate_hppa_cpu;
1043
#endif
1044
cc->disas_set_info = hppa_cpu_disas_set_info;
1045
- cc->tcg_ops.initialize = hppa_translate_init;
1046
-
1047
cc->gdb_num_core_regs = 128;
1048
+ cc->tcg_ops = &hppa_tcg_ops;
1049
}
1050
1051
static const TypeInfo hppa_cpu_type_info = {
1052
diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c
1053
index XXXXXXX..XXXXXXX 100644
1054
--- a/target/i386/tcg/tcg-cpu.c
1055
+++ b/target/i386/tcg/tcg-cpu.c
1056
@@ -XXX,XX +XXX,XX @@ static void x86_cpu_synchronize_from_tb(CPUState *cs,
1057
cpu->env.eip = tb->pc - tb->cs_base;
1058
}
1059
1060
+#include "hw/core/tcg-cpu-ops.h"
1061
+
1062
+static struct TCGCPUOps x86_tcg_ops = {
1063
+ .initialize = tcg_x86_init,
1064
+ .synchronize_from_tb = x86_cpu_synchronize_from_tb,
1065
+ .cpu_exec_enter = x86_cpu_exec_enter,
1066
+ .cpu_exec_exit = x86_cpu_exec_exit,
1067
+ .cpu_exec_interrupt = x86_cpu_exec_interrupt,
1068
+ .do_interrupt = x86_cpu_do_interrupt,
1069
+ .tlb_fill = x86_cpu_tlb_fill,
1070
+#ifndef CONFIG_USER_ONLY
1071
+ .debug_excp_handler = breakpoint_handler,
1072
+#endif /* !CONFIG_USER_ONLY */
1073
+};
1074
+
1075
void tcg_cpu_common_class_init(CPUClass *cc)
1076
{
1077
- cc->tcg_ops.do_interrupt = x86_cpu_do_interrupt;
1078
- cc->tcg_ops.cpu_exec_interrupt = x86_cpu_exec_interrupt;
1079
- cc->tcg_ops.synchronize_from_tb = x86_cpu_synchronize_from_tb;
1080
- cc->tcg_ops.cpu_exec_enter = x86_cpu_exec_enter;
1081
- cc->tcg_ops.cpu_exec_exit = x86_cpu_exec_exit;
1082
- cc->tcg_ops.initialize = tcg_x86_init;
1083
- cc->tcg_ops.tlb_fill = x86_cpu_tlb_fill;
1084
-#ifndef CONFIG_USER_ONLY
1085
- cc->tcg_ops.debug_excp_handler = breakpoint_handler;
1086
-#endif
1087
+ cc->tcg_ops = &x86_tcg_ops;
1088
}
1089
diff --git a/target/lm32/cpu.c b/target/lm32/cpu.c
1090
index XXXXXXX..XXXXXXX 100644
1091
--- a/target/lm32/cpu.c
1092
+++ b/target/lm32/cpu.c
1093
@@ -XXX,XX +XXX,XX @@ static ObjectClass *lm32_cpu_class_by_name(const char *cpu_model)
1094
return oc;
1095
}
1096
1097
+#include "hw/core/tcg-cpu-ops.h"
1098
+
1099
+static struct TCGCPUOps lm32_tcg_ops = {
1100
+ .initialize = lm32_translate_init,
1101
+ .cpu_exec_interrupt = lm32_cpu_exec_interrupt,
1102
+ .tlb_fill = lm32_cpu_tlb_fill,
1103
+ .debug_excp_handler = lm32_debug_excp_handler,
1104
+
1105
+#ifndef CONFIG_USER_ONLY
1106
+ .do_interrupt = lm32_cpu_do_interrupt,
1107
+#endif /* !CONFIG_USER_ONLY */
1108
+};
1109
+
1110
static void lm32_cpu_class_init(ObjectClass *oc, void *data)
1111
{
1112
LM32CPUClass *lcc = LM32_CPU_CLASS(oc);
1113
@@ -XXX,XX +XXX,XX @@ static void lm32_cpu_class_init(ObjectClass *oc, void *data)
1114
1115
cc->class_by_name = lm32_cpu_class_by_name;
1116
cc->has_work = lm32_cpu_has_work;
1117
- cc->tcg_ops.do_interrupt = lm32_cpu_do_interrupt;
1118
- cc->tcg_ops.cpu_exec_interrupt = lm32_cpu_exec_interrupt;
1119
cc->dump_state = lm32_cpu_dump_state;
1120
cc->set_pc = lm32_cpu_set_pc;
1121
cc->gdb_read_register = lm32_cpu_gdb_read_register;
1122
cc->gdb_write_register = lm32_cpu_gdb_write_register;
1123
- cc->tcg_ops.tlb_fill = lm32_cpu_tlb_fill;
1124
#ifndef CONFIG_USER_ONLY
1125
cc->get_phys_page_debug = lm32_cpu_get_phys_page_debug;
1126
cc->vmsd = &vmstate_lm32_cpu;
1127
#endif
1128
cc->gdb_num_core_regs = 32 + 7;
1129
cc->gdb_stop_before_watchpoint = true;
1130
- cc->tcg_ops.debug_excp_handler = lm32_debug_excp_handler;
1131
cc->disas_set_info = lm32_cpu_disas_set_info;
1132
- cc->tcg_ops.initialize = lm32_translate_init;
1133
+ cc->tcg_ops = &lm32_tcg_ops;
1134
}
1135
1136
#define DEFINE_LM32_CPU_TYPE(cpu_model, initfn) \
1137
diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c
253
diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c
1138
index XXXXXXX..XXXXXXX 100644
254
index XXXXXXX..XXXXXXX 100644
1139
--- a/target/m68k/cpu.c
255
--- a/target/m68k/cpu.c
1140
+++ b/target/m68k/cpu.c
256
+++ b/target/m68k/cpu.c
1141
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m68k_cpu = {
257
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m68k_cpu = {
1142
};
258
};
1143
#endif
259
#endif
1144
260
1145
+#include "hw/core/tcg-cpu-ops.h"
261
+#ifndef CONFIG_USER_ONLY
1146
+
262
+#include "hw/core/sysemu-cpu-ops.h"
1147
+static struct TCGCPUOps m68k_tcg_ops = {
263
+
1148
+ .initialize = m68k_tcg_init,
264
+static const struct SysemuCPUOps m68k_sysemu_ops = {
1149
+ .cpu_exec_interrupt = m68k_cpu_exec_interrupt,
265
+};
1150
+ .tlb_fill = m68k_cpu_tlb_fill,
266
+#endif
1151
+
267
+
1152
+#ifndef CONFIG_USER_ONLY
268
#include "hw/core/tcg-cpu-ops.h"
1153
+ .do_interrupt = m68k_cpu_do_interrupt,
269
1154
+ .do_transaction_failed = m68k_cpu_transaction_failed,
270
static struct TCGCPUOps m68k_tcg_ops = {
1155
+#endif /* !CONFIG_USER_ONLY */
1156
+};
1157
+
1158
static void m68k_cpu_class_init(ObjectClass *c, void *data)
1159
{
1160
M68kCPUClass *mcc = M68K_CPU_CLASS(c);
1161
@@ -XXX,XX +XXX,XX @@ static void m68k_cpu_class_init(ObjectClass *c, void *data)
271
@@ -XXX,XX +XXX,XX @@ static void m68k_cpu_class_init(ObjectClass *c, void *data)
1162
1163
cc->class_by_name = m68k_cpu_class_by_name;
1164
cc->has_work = m68k_cpu_has_work;
1165
- cc->tcg_ops.do_interrupt = m68k_cpu_do_interrupt;
1166
- cc->tcg_ops.cpu_exec_interrupt = m68k_cpu_exec_interrupt;
1167
cc->dump_state = m68k_cpu_dump_state;
1168
cc->set_pc = m68k_cpu_set_pc;
1169
cc->gdb_read_register = m68k_cpu_gdb_read_register;
1170
cc->gdb_write_register = m68k_cpu_gdb_write_register;
1171
- cc->tcg_ops.tlb_fill = m68k_cpu_tlb_fill;
1172
#if defined(CONFIG_SOFTMMU)
272
#if defined(CONFIG_SOFTMMU)
1173
- cc->tcg_ops.do_transaction_failed = m68k_cpu_transaction_failed;
1174
cc->get_phys_page_debug = m68k_cpu_get_phys_page_debug;
273
cc->get_phys_page_debug = m68k_cpu_get_phys_page_debug;
1175
dc->vmsd = &vmstate_m68k_cpu;
274
dc->vmsd = &vmstate_m68k_cpu;
275
+ cc->sysemu_ops = &m68k_sysemu_ops;
1176
#endif
276
#endif
1177
cc->disas_set_info = m68k_cpu_disas_set_info;
277
cc->disas_set_info = m68k_cpu_disas_set_info;
1178
- cc->tcg_ops.initialize = m68k_tcg_init;
278
1179
1180
cc->gdb_num_core_regs = 18;
1181
+ cc->tcg_ops = &m68k_tcg_ops;
1182
}
1183
1184
static void m68k_cpu_class_init_cf_core(ObjectClass *c, void *data)
1185
diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c
279
diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c
1186
index XXXXXXX..XXXXXXX 100644
280
index XXXXXXX..XXXXXXX 100644
1187
--- a/target/microblaze/cpu.c
281
--- a/target/microblaze/cpu.c
1188
+++ b/target/microblaze/cpu.c
282
+++ b/target/microblaze/cpu.c
1189
@@ -XXX,XX +XXX,XX @@ static ObjectClass *mb_cpu_class_by_name(const char *cpu_model)
283
@@ -XXX,XX +XXX,XX @@ static ObjectClass *mb_cpu_class_by_name(const char *cpu_model)
1190
return object_class_by_name(TYPE_MICROBLAZE_CPU);
284
return object_class_by_name(TYPE_MICROBLAZE_CPU);
1191
}
285
}
1192
286
1193
+#include "hw/core/tcg-cpu-ops.h"
287
+#ifndef CONFIG_USER_ONLY
1194
+
288
+#include "hw/core/sysemu-cpu-ops.h"
1195
+static struct TCGCPUOps mb_tcg_ops = {
289
+
1196
+ .initialize = mb_tcg_init,
290
+static const struct SysemuCPUOps mb_sysemu_ops = {
1197
+ .synchronize_from_tb = mb_cpu_synchronize_from_tb,
291
+};
1198
+ .cpu_exec_interrupt = mb_cpu_exec_interrupt,
292
+#endif
1199
+ .tlb_fill = mb_cpu_tlb_fill,
293
+
1200
+
294
#include "hw/core/tcg-cpu-ops.h"
1201
+#ifndef CONFIG_USER_ONLY
295
1202
+ .do_interrupt = mb_cpu_do_interrupt,
296
static struct TCGCPUOps mb_tcg_ops = {
1203
+ .do_transaction_failed = mb_cpu_transaction_failed,
1204
+ .do_unaligned_access = mb_cpu_do_unaligned_access,
1205
+#endif /* !CONFIG_USER_ONLY */
1206
+};
1207
+
1208
static void mb_cpu_class_init(ObjectClass *oc, void *data)
1209
{
1210
DeviceClass *dc = DEVICE_CLASS(oc);
1211
@@ -XXX,XX +XXX,XX @@ static void mb_cpu_class_init(ObjectClass *oc, void *data)
297
@@ -XXX,XX +XXX,XX @@ static void mb_cpu_class_init(ObjectClass *oc, void *data)
1212
298
#ifndef CONFIG_USER_ONLY
1213
cc->class_by_name = mb_cpu_class_by_name;
1214
cc->has_work = mb_cpu_has_work;
1215
- cc->tcg_ops.do_interrupt = mb_cpu_do_interrupt;
1216
- cc->tcg_ops.cpu_exec_interrupt = mb_cpu_exec_interrupt;
1217
+
1218
cc->dump_state = mb_cpu_dump_state;
1219
cc->set_pc = mb_cpu_set_pc;
1220
- cc->tcg_ops.synchronize_from_tb = mb_cpu_synchronize_from_tb;
1221
cc->gdb_read_register = mb_cpu_gdb_read_register;
1222
cc->gdb_write_register = mb_cpu_gdb_write_register;
1223
- cc->tcg_ops.tlb_fill = mb_cpu_tlb_fill;
1224
+
1225
#ifndef CONFIG_USER_ONLY
1226
- cc->tcg_ops.do_transaction_failed = mb_cpu_transaction_failed;
1227
- cc->tcg_ops.do_unaligned_access = mb_cpu_do_unaligned_access;
1228
cc->get_phys_page_attrs_debug = mb_cpu_get_phys_page_attrs_debug;
299
cc->get_phys_page_attrs_debug = mb_cpu_get_phys_page_attrs_debug;
1229
dc->vmsd = &vmstate_mb_cpu;
300
dc->vmsd = &vmstate_mb_cpu;
1230
#endif
301
+ cc->sysemu_ops = &mb_sysemu_ops;
1231
@@ -XXX,XX +XXX,XX @@ static void mb_cpu_class_init(ObjectClass *oc, void *data)
302
#endif
303
device_class_set_props(dc, mb_properties);
1232
cc->gdb_num_core_regs = 32 + 27;
304
cc->gdb_num_core_regs = 32 + 27;
1233
1234
cc->disas_set_info = mb_disas_set_info;
1235
- cc->tcg_ops.initialize = mb_tcg_init;
1236
+ cc->tcg_ops = &mb_tcg_ops;
1237
}
1238
1239
static const TypeInfo mb_cpu_type_info = {
1240
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
305
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
1241
index XXXXXXX..XXXXXXX 100644
306
index XXXXXXX..XXXXXXX 100644
1242
--- a/target/mips/cpu.c
307
--- a/target/mips/cpu.c
1243
+++ b/target/mips/cpu.c
308
+++ b/target/mips/cpu.c
1244
@@ -XXX,XX +XXX,XX @@ static Property mips_cpu_properties[] = {
309
@@ -XXX,XX +XXX,XX @@ static Property mips_cpu_properties[] = {
1245
DEFINE_PROP_END_OF_LIST()
310
DEFINE_PROP_END_OF_LIST()
1246
};
311
};
1247
312
1248
+#ifdef CONFIG_TCG
313
+#ifndef CONFIG_USER_ONLY
1249
+#include "hw/core/tcg-cpu-ops.h"
314
+#include "hw/core/sysemu-cpu-ops.h"
1250
+/*
315
+
1251
+ * NB: cannot be const, as some elements are changed for specific
316
+static const struct SysemuCPUOps mips_sysemu_ops = {
1252
+ * mips hardware (see hw/mips/jazz.c).
317
+};
1253
+ */
318
+#endif
1254
+static struct TCGCPUOps mips_tcg_ops = {
319
+
1255
+ .initialize = mips_tcg_init,
320
#ifdef CONFIG_TCG
1256
+ .synchronize_from_tb = mips_cpu_synchronize_from_tb,
321
#include "hw/core/tcg-cpu-ops.h"
1257
+ .cpu_exec_interrupt = mips_cpu_exec_interrupt,
322
/*
1258
+ .tlb_fill = mips_cpu_tlb_fill,
1259
+
1260
+#if !defined(CONFIG_USER_ONLY)
1261
+ .do_interrupt = mips_cpu_do_interrupt,
1262
+ .do_transaction_failed = mips_cpu_do_transaction_failed,
1263
+ .do_unaligned_access = mips_cpu_do_unaligned_access,
1264
+#endif /* !CONFIG_USER_ONLY */
1265
+};
1266
+#endif /* CONFIG_TCG */
1267
+
1268
static void mips_cpu_class_init(ObjectClass *c, void *data)
1269
{
1270
MIPSCPUClass *mcc = MIPS_CPU_CLASS(c);
1271
@@ -XXX,XX +XXX,XX @@ static void mips_cpu_class_init(ObjectClass *c, void *data)
323
@@ -XXX,XX +XXX,XX @@ static void mips_cpu_class_init(ObjectClass *c, void *data)
1272
cc->vmsd = &vmstate_mips_cpu;
324
#ifndef CONFIG_USER_ONLY
325
cc->get_phys_page_debug = mips_cpu_get_phys_page_debug;
326
cc->legacy_vmsd = &vmstate_mips_cpu;
327
+ cc->sysemu_ops = &mips_sysemu_ops;
1273
#endif
328
#endif
1274
cc->disas_set_info = mips_cpu_disas_set_info;
329
cc->disas_set_info = mips_cpu_disas_set_info;
1275
-#ifdef CONFIG_TCG
1276
- cc->tcg_ops.initialize = mips_tcg_init;
1277
- cc->tcg_ops.do_interrupt = mips_cpu_do_interrupt;
1278
- cc->tcg_ops.cpu_exec_interrupt = mips_cpu_exec_interrupt;
1279
- cc->tcg_ops.synchronize_from_tb = mips_cpu_synchronize_from_tb;
1280
- cc->tcg_ops.tlb_fill = mips_cpu_tlb_fill;
1281
-#ifndef CONFIG_USER_ONLY
1282
- cc->tcg_ops.do_transaction_failed = mips_cpu_do_transaction_failed;
1283
- cc->tcg_ops.do_unaligned_access = mips_cpu_do_unaligned_access;
1284
-
1285
-#endif /* CONFIG_USER_ONLY */
1286
-#endif /* CONFIG_TCG */
1287
-
1288
cc->gdb_num_core_regs = 73;
330
cc->gdb_num_core_regs = 73;
1289
cc->gdb_stop_before_watchpoint = true;
1290
+#ifdef CONFIG_TCG
1291
+ cc->tcg_ops = &mips_tcg_ops;
1292
+#endif /* CONFIG_TCG */
1293
}
1294
1295
static const TypeInfo mips_cpu_type_info = {
1296
diff --git a/target/moxie/cpu.c b/target/moxie/cpu.c
1297
index XXXXXXX..XXXXXXX 100644
1298
--- a/target/moxie/cpu.c
1299
+++ b/target/moxie/cpu.c
1300
@@ -XXX,XX +XXX,XX @@ static ObjectClass *moxie_cpu_class_by_name(const char *cpu_model)
1301
return oc;
1302
}
1303
1304
+#include "hw/core/tcg-cpu-ops.h"
1305
+
1306
+static struct TCGCPUOps moxie_tcg_ops = {
1307
+ .initialize = moxie_translate_init,
1308
+ .tlb_fill = moxie_cpu_tlb_fill,
1309
+
1310
+#ifndef CONFIG_USER_ONLY
1311
+ .do_interrupt = moxie_cpu_do_interrupt,
1312
+#endif /* !CONFIG_USER_ONLY */
1313
+};
1314
+
1315
static void moxie_cpu_class_init(ObjectClass *oc, void *data)
1316
{
1317
DeviceClass *dc = DEVICE_CLASS(oc);
1318
@@ -XXX,XX +XXX,XX @@ static void moxie_cpu_class_init(ObjectClass *oc, void *data)
1319
cc->class_by_name = moxie_cpu_class_by_name;
1320
1321
cc->has_work = moxie_cpu_has_work;
1322
- cc->tcg_ops.do_interrupt = moxie_cpu_do_interrupt;
1323
cc->dump_state = moxie_cpu_dump_state;
1324
cc->set_pc = moxie_cpu_set_pc;
1325
- cc->tcg_ops.tlb_fill = moxie_cpu_tlb_fill;
1326
#ifndef CONFIG_USER_ONLY
1327
cc->get_phys_page_debug = moxie_cpu_get_phys_page_debug;
1328
cc->vmsd = &vmstate_moxie_cpu;
1329
#endif
1330
cc->disas_set_info = moxie_cpu_disas_set_info;
1331
- cc->tcg_ops.initialize = moxie_translate_init;
1332
+ cc->tcg_ops = &moxie_tcg_ops;
1333
}
1334
1335
static void moxielite_initfn(Object *obj)
1336
diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c
331
diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c
1337
index XXXXXXX..XXXXXXX 100644
332
index XXXXXXX..XXXXXXX 100644
1338
--- a/target/nios2/cpu.c
333
--- a/target/nios2/cpu.c
1339
+++ b/target/nios2/cpu.c
334
+++ b/target/nios2/cpu.c
1340
@@ -XXX,XX +XXX,XX @@ static Property nios2_properties[] = {
335
@@ -XXX,XX +XXX,XX @@ static Property nios2_properties[] = {
1341
DEFINE_PROP_END_OF_LIST(),
336
DEFINE_PROP_END_OF_LIST(),
1342
};
337
};
1343
338
1344
+#include "hw/core/tcg-cpu-ops.h"
339
+#ifndef CONFIG_USER_ONLY
1345
+
340
+#include "hw/core/sysemu-cpu-ops.h"
1346
+static struct TCGCPUOps nios2_tcg_ops = {
341
+
1347
+ .initialize = nios2_tcg_init,
342
+static const struct SysemuCPUOps nios2_sysemu_ops = {
1348
+ .cpu_exec_interrupt = nios2_cpu_exec_interrupt,
343
+};
1349
+ .tlb_fill = nios2_cpu_tlb_fill,
344
+#endif
1350
+
345
+
1351
+#ifndef CONFIG_USER_ONLY
346
#include "hw/core/tcg-cpu-ops.h"
1352
+ .do_interrupt = nios2_cpu_do_interrupt,
347
1353
+ .do_unaligned_access = nios2_cpu_do_unaligned_access,
348
static struct TCGCPUOps nios2_tcg_ops = {
1354
+#endif /* !CONFIG_USER_ONLY */
1355
+};
1356
1357
static void nios2_cpu_class_init(ObjectClass *oc, void *data)
1358
{
1359
@@ -XXX,XX +XXX,XX @@ static void nios2_cpu_class_init(ObjectClass *oc, void *data)
349
@@ -XXX,XX +XXX,XX @@ static void nios2_cpu_class_init(ObjectClass *oc, void *data)
1360
1361
cc->class_by_name = nios2_cpu_class_by_name;
1362
cc->has_work = nios2_cpu_has_work;
1363
- cc->tcg_ops.do_interrupt = nios2_cpu_do_interrupt;
1364
- cc->tcg_ops.cpu_exec_interrupt = nios2_cpu_exec_interrupt;
1365
cc->dump_state = nios2_cpu_dump_state;
1366
cc->set_pc = nios2_cpu_set_pc;
1367
cc->disas_set_info = nios2_cpu_disas_set_info;
350
cc->disas_set_info = nios2_cpu_disas_set_info;
1368
- cc->tcg_ops.tlb_fill = nios2_cpu_tlb_fill;
351
#ifndef CONFIG_USER_ONLY
1369
#ifndef CONFIG_USER_ONLY
1370
- cc->tcg_ops.do_unaligned_access = nios2_cpu_do_unaligned_access;
1371
cc->get_phys_page_debug = nios2_cpu_get_phys_page_debug;
352
cc->get_phys_page_debug = nios2_cpu_get_phys_page_debug;
353
+ cc->sysemu_ops = &nios2_sysemu_ops;
1372
#endif
354
#endif
1373
cc->gdb_read_register = nios2_cpu_gdb_read_register;
355
cc->gdb_read_register = nios2_cpu_gdb_read_register;
1374
cc->gdb_write_register = nios2_cpu_gdb_write_register;
356
cc->gdb_write_register = nios2_cpu_gdb_write_register;
1375
cc->gdb_num_core_regs = 49;
1376
- cc->tcg_ops.initialize = nios2_tcg_init;
1377
+ cc->tcg_ops = &nios2_tcg_ops;
1378
}
1379
1380
static const TypeInfo nios2_cpu_type_info = {
1381
diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c
357
diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c
1382
index XXXXXXX..XXXXXXX 100644
358
index XXXXXXX..XXXXXXX 100644
1383
--- a/target/openrisc/cpu.c
359
--- a/target/openrisc/cpu.c
1384
+++ b/target/openrisc/cpu.c
360
+++ b/target/openrisc/cpu.c
1385
@@ -XXX,XX +XXX,XX @@ static void openrisc_any_initfn(Object *obj)
361
@@ -XXX,XX +XXX,XX @@ static void openrisc_any_initfn(Object *obj)
1386
| (IMMUCFGR_NTS & (ctz32(TLB_SIZE) << 2));
362
| (IMMUCFGR_NTS & (ctz32(TLB_SIZE) << 2));
1387
}
363
}
1388
364
1389
+#include "hw/core/tcg-cpu-ops.h"
365
+#ifndef CONFIG_USER_ONLY
1390
+
366
+#include "hw/core/sysemu-cpu-ops.h"
1391
+static struct TCGCPUOps openrisc_tcg_ops = {
367
+
1392
+ .initialize = openrisc_translate_init,
368
+static const struct SysemuCPUOps openrisc_sysemu_ops = {
1393
+ .cpu_exec_interrupt = openrisc_cpu_exec_interrupt,
369
+};
1394
+ .tlb_fill = openrisc_cpu_tlb_fill,
370
+#endif
1395
+
371
+
1396
+#ifndef CONFIG_USER_ONLY
372
#include "hw/core/tcg-cpu-ops.h"
1397
+ .do_interrupt = openrisc_cpu_do_interrupt,
373
1398
+#endif /* !CONFIG_USER_ONLY */
374
static struct TCGCPUOps openrisc_tcg_ops = {
1399
+};
1400
+
1401
static void openrisc_cpu_class_init(ObjectClass *oc, void *data)
1402
{
1403
OpenRISCCPUClass *occ = OPENRISC_CPU_CLASS(oc);
1404
@@ -XXX,XX +XXX,XX @@ static void openrisc_cpu_class_init(ObjectClass *oc, void *data)
375
@@ -XXX,XX +XXX,XX @@ static void openrisc_cpu_class_init(ObjectClass *oc, void *data)
1405
1406
cc->class_by_name = openrisc_cpu_class_by_name;
1407
cc->has_work = openrisc_cpu_has_work;
1408
- cc->tcg_ops.do_interrupt = openrisc_cpu_do_interrupt;
1409
- cc->tcg_ops.cpu_exec_interrupt = openrisc_cpu_exec_interrupt;
1410
cc->dump_state = openrisc_cpu_dump_state;
1411
cc->set_pc = openrisc_cpu_set_pc;
1412
cc->gdb_read_register = openrisc_cpu_gdb_read_register;
1413
cc->gdb_write_register = openrisc_cpu_gdb_write_register;
1414
- cc->tcg_ops.tlb_fill = openrisc_cpu_tlb_fill;
1415
#ifndef CONFIG_USER_ONLY
376
#ifndef CONFIG_USER_ONLY
1416
cc->get_phys_page_debug = openrisc_cpu_get_phys_page_debug;
377
cc->get_phys_page_debug = openrisc_cpu_get_phys_page_debug;
1417
dc->vmsd = &vmstate_openrisc_cpu;
378
dc->vmsd = &vmstate_openrisc_cpu;
379
+ cc->sysemu_ops = &openrisc_sysemu_ops;
1418
#endif
380
#endif
1419
cc->gdb_num_core_regs = 32 + 3;
381
cc->gdb_num_core_regs = 32 + 3;
1420
- cc->tcg_ops.initialize = openrisc_translate_init;
1421
cc->disas_set_info = openrisc_disas_set_info;
382
cc->disas_set_info = openrisc_disas_set_info;
1422
+ cc->tcg_ops = &openrisc_tcg_ops;
383
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
1423
}
384
index XXXXXXX..XXXXXXX 100644
1424
385
--- a/target/ppc/cpu_init.c
1425
/* Sort alphabetically by type name, except for "any". */
386
+++ b/target/ppc/cpu_init.c
387
@@ -XXX,XX +XXX,XX @@ static Property ppc_cpu_properties[] = {
388
DEFINE_PROP_END_OF_LIST(),
389
};
390
391
+#ifndef CONFIG_USER_ONLY
392
+#include "hw/core/sysemu-cpu-ops.h"
393
+
394
+static const struct SysemuCPUOps ppc_sysemu_ops = {
395
+};
396
+#endif
397
+
398
#ifdef CONFIG_TCG
399
#include "hw/core/tcg-cpu-ops.h"
400
401
@@ -XXX,XX +XXX,XX @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
402
#ifndef CONFIG_USER_ONLY
403
cc->get_phys_page_debug = ppc_cpu_get_phys_page_debug;
404
cc->legacy_vmsd = &vmstate_ppc_cpu;
405
+ cc->sysemu_ops = &ppc_sysemu_ops;
406
#endif
407
#if defined(CONFIG_SOFTMMU)
408
cc->write_elf64_note = ppc64_cpu_write_elf64_note;
1426
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
409
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
1427
index XXXXXXX..XXXXXXX 100644
410
index XXXXXXX..XXXXXXX 100644
1428
--- a/target/riscv/cpu.c
411
--- a/target/riscv/cpu.c
1429
+++ b/target/riscv/cpu.c
412
+++ b/target/riscv/cpu.c
1430
@@ -XXX,XX +XXX,XX @@ static const char *riscv_gdb_get_dynamic_xml(CPUState *cs, const char *xmlname)
413
@@ -XXX,XX +XXX,XX @@ static const char *riscv_gdb_get_dynamic_xml(CPUState *cs, const char *xmlname)
1431
return NULL;
414
return NULL;
1432
}
415
}
1433
416
1434
+#include "hw/core/tcg-cpu-ops.h"
417
+#ifndef CONFIG_USER_ONLY
1435
+
418
+#include "hw/core/sysemu-cpu-ops.h"
1436
+static struct TCGCPUOps riscv_tcg_ops = {
419
+
1437
+ .initialize = riscv_translate_init,
420
+static const struct SysemuCPUOps riscv_sysemu_ops = {
1438
+ .synchronize_from_tb = riscv_cpu_synchronize_from_tb,
421
+};
1439
+ .cpu_exec_interrupt = riscv_cpu_exec_interrupt,
422
+#endif
1440
+ .tlb_fill = riscv_cpu_tlb_fill,
423
+
1441
+
424
#include "hw/core/tcg-cpu-ops.h"
1442
+#ifndef CONFIG_USER_ONLY
425
1443
+ .do_interrupt = riscv_cpu_do_interrupt,
426
static struct TCGCPUOps riscv_tcg_ops = {
1444
+ .do_transaction_failed = riscv_cpu_do_transaction_failed,
1445
+ .do_unaligned_access = riscv_cpu_do_unaligned_access,
1446
+#endif /* !CONFIG_USER_ONLY */
1447
+};
1448
+
1449
static void riscv_cpu_class_init(ObjectClass *c, void *data)
1450
{
1451
RISCVCPUClass *mcc = RISCV_CPU_CLASS(c);
1452
@@ -XXX,XX +XXX,XX @@ static void riscv_cpu_class_init(ObjectClass *c, void *data)
427
@@ -XXX,XX +XXX,XX @@ static void riscv_cpu_class_init(ObjectClass *c, void *data)
1453
428
#ifndef CONFIG_USER_ONLY
1454
cc->class_by_name = riscv_cpu_class_by_name;
1455
cc->has_work = riscv_cpu_has_work;
1456
- cc->tcg_ops.do_interrupt = riscv_cpu_do_interrupt;
1457
- cc->tcg_ops.cpu_exec_interrupt = riscv_cpu_exec_interrupt;
1458
cc->dump_state = riscv_cpu_dump_state;
1459
cc->set_pc = riscv_cpu_set_pc;
1460
- cc->tcg_ops.synchronize_from_tb = riscv_cpu_synchronize_from_tb;
1461
cc->gdb_read_register = riscv_cpu_gdb_read_register;
1462
cc->gdb_write_register = riscv_cpu_gdb_write_register;
1463
cc->gdb_num_core_regs = 33;
1464
@@ -XXX,XX +XXX,XX @@ static void riscv_cpu_class_init(ObjectClass *c, void *data)
1465
cc->gdb_stop_before_watchpoint = true;
1466
cc->disas_set_info = riscv_cpu_disas_set_info;
1467
#ifndef CONFIG_USER_ONLY
1468
- cc->tcg_ops.do_transaction_failed = riscv_cpu_do_transaction_failed;
1469
- cc->tcg_ops.do_unaligned_access = riscv_cpu_do_unaligned_access;
1470
cc->get_phys_page_debug = riscv_cpu_get_phys_page_debug;
429
cc->get_phys_page_debug = riscv_cpu_get_phys_page_debug;
1471
/* For now, mark unmigratable: */
430
cc->legacy_vmsd = &vmstate_riscv_cpu;
1472
cc->vmsd = &vmstate_riscv_cpu;
431
+ cc->sysemu_ops = &riscv_sysemu_ops;
1473
#endif
432
cc->write_elf64_note = riscv_cpu_write_elf64_note;
1474
cc->gdb_arch_name = riscv_gdb_arch_name;
433
cc->write_elf32_note = riscv_cpu_write_elf32_note;
1475
cc->gdb_get_dynamic_xml = riscv_gdb_get_dynamic_xml;
434
#endif
1476
- cc->tcg_ops.initialize = riscv_translate_init;
1477
- cc->tcg_ops.tlb_fill = riscv_cpu_tlb_fill;
1478
+ cc->tcg_ops = &riscv_tcg_ops;
1479
1480
device_class_set_props(dc, riscv_cpu_properties);
1481
}
1482
diff --git a/target/rx/cpu.c b/target/rx/cpu.c
435
diff --git a/target/rx/cpu.c b/target/rx/cpu.c
1483
index XXXXXXX..XXXXXXX 100644
436
index XXXXXXX..XXXXXXX 100644
1484
--- a/target/rx/cpu.c
437
--- a/target/rx/cpu.c
1485
+++ b/target/rx/cpu.c
438
+++ b/target/rx/cpu.c
1486
@@ -XXX,XX +XXX,XX @@ static void rx_cpu_init(Object *obj)
439
@@ -XXX,XX +XXX,XX @@ static void rx_cpu_init(Object *obj)
1487
qdev_init_gpio_in(DEVICE(cpu), rx_cpu_set_irq, 2);
440
qdev_init_gpio_in(DEVICE(cpu), rx_cpu_set_irq, 2);
1488
}
441
}
1489
442
1490
+#include "hw/core/tcg-cpu-ops.h"
443
+#ifndef CONFIG_USER_ONLY
1491
+
444
+#include "hw/core/sysemu-cpu-ops.h"
1492
+static struct TCGCPUOps rx_tcg_ops = {
445
+
1493
+ .initialize = rx_translate_init,
446
+static const struct SysemuCPUOps rx_sysemu_ops = {
1494
+ .synchronize_from_tb = rx_cpu_synchronize_from_tb,
447
+};
1495
+ .cpu_exec_interrupt = rx_cpu_exec_interrupt,
448
+#endif
1496
+ .tlb_fill = rx_cpu_tlb_fill,
449
+
1497
+
450
#include "hw/core/tcg-cpu-ops.h"
1498
+#ifndef CONFIG_USER_ONLY
451
1499
+ .do_interrupt = rx_cpu_do_interrupt,
452
static struct TCGCPUOps rx_tcg_ops = {
1500
+#endif /* !CONFIG_USER_ONLY */
1501
+};
1502
+
1503
static void rx_cpu_class_init(ObjectClass *klass, void *data)
1504
{
1505
DeviceClass *dc = DEVICE_CLASS(klass);
1506
@@ -XXX,XX +XXX,XX @@ static void rx_cpu_class_init(ObjectClass *klass, void *data)
453
@@ -XXX,XX +XXX,XX @@ static void rx_cpu_class_init(ObjectClass *klass, void *data)
1507
1508
cc->class_by_name = rx_cpu_class_by_name;
1509
cc->has_work = rx_cpu_has_work;
1510
- cc->tcg_ops.do_interrupt = rx_cpu_do_interrupt;
1511
- cc->tcg_ops.cpu_exec_interrupt = rx_cpu_exec_interrupt;
1512
cc->dump_state = rx_cpu_dump_state;
454
cc->dump_state = rx_cpu_dump_state;
1513
cc->set_pc = rx_cpu_set_pc;
455
cc->set_pc = rx_cpu_set_pc;
1514
- cc->tcg_ops.synchronize_from_tb = rx_cpu_synchronize_from_tb;
456
1515
+
457
+#ifndef CONFIG_USER_ONLY
458
+ cc->sysemu_ops = &rx_sysemu_ops;
459
+#endif
1516
cc->gdb_read_register = rx_cpu_gdb_read_register;
460
cc->gdb_read_register = rx_cpu_gdb_read_register;
1517
cc->gdb_write_register = rx_cpu_gdb_write_register;
461
cc->gdb_write_register = rx_cpu_gdb_write_register;
1518
cc->get_phys_page_debug = rx_cpu_get_phys_page_debug;
462
cc->get_phys_page_debug = rx_cpu_get_phys_page_debug;
1519
cc->disas_set_info = rx_cpu_disas_set_info;
1520
- cc->tcg_ops.initialize = rx_translate_init;
1521
- cc->tcg_ops.tlb_fill = rx_cpu_tlb_fill;
1522
1523
cc->gdb_num_core_regs = 26;
1524
cc->gdb_core_xml_file = "rx-core.xml";
1525
+ cc->tcg_ops = &rx_tcg_ops;
1526
}
1527
1528
static const TypeInfo rx_cpu_info = {
1529
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
463
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
1530
index XXXXXXX..XXXXXXX 100644
464
index XXXXXXX..XXXXXXX 100644
1531
--- a/target/s390x/cpu.c
465
--- a/target/s390x/cpu.c
1532
+++ b/target/s390x/cpu.c
466
+++ b/target/s390x/cpu.c
1533
@@ -XXX,XX +XXX,XX @@ static void s390_cpu_reset_full(DeviceState *dev)
467
@@ -XXX,XX +XXX,XX @@ static void s390_cpu_reset_full(DeviceState *dev)
1534
return s390_cpu_reset(s, S390_CPU_RESET_CLEAR);
468
return s390_cpu_reset(s, S390_CPU_RESET_CLEAR);
1535
}
469
}
1536
470
1537
+#ifdef CONFIG_TCG
471
+#ifndef CONFIG_USER_ONLY
1538
+#include "hw/core/tcg-cpu-ops.h"
472
+#include "hw/core/sysemu-cpu-ops.h"
1539
+
473
+
1540
+static struct TCGCPUOps s390_tcg_ops = {
474
+static const struct SysemuCPUOps s390_sysemu_ops = {
1541
+ .initialize = s390x_translate_init,
475
+};
1542
+ .tlb_fill = s390_cpu_tlb_fill,
476
+#endif
1543
+
477
+
1544
+#if !defined(CONFIG_USER_ONLY)
478
#ifdef CONFIG_TCG
1545
+ .cpu_exec_interrupt = s390_cpu_exec_interrupt,
479
#include "hw/core/tcg-cpu-ops.h"
1546
+ .do_interrupt = s390_cpu_do_interrupt,
480
1547
+ .debug_excp_handler = s390x_cpu_debug_excp_handler,
1548
+ .do_unaligned_access = s390x_cpu_do_unaligned_access,
1549
+#endif /* !CONFIG_USER_ONLY */
1550
+};
1551
+#endif /* CONFIG_TCG */
1552
+
1553
static void s390_cpu_class_init(ObjectClass *oc, void *data)
1554
{
1555
S390CPUClass *scc = S390_CPU_CLASS(oc);
1556
@@ -XXX,XX +XXX,XX @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)
481
@@ -XXX,XX +XXX,XX @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)
1557
scc->reset = s390_cpu_reset;
482
cc->legacy_vmsd = &vmstate_s390_cpu;
1558
cc->class_by_name = s390_cpu_class_by_name,
1559
cc->has_work = s390_cpu_has_work;
1560
-#ifdef CONFIG_TCG
1561
- cc->tcg_ops.do_interrupt = s390_cpu_do_interrupt;
1562
-#endif
1563
cc->dump_state = s390_cpu_dump_state;
1564
cc->set_pc = s390_cpu_set_pc;
1565
cc->gdb_read_register = s390_cpu_gdb_read_register;
1566
@@ -XXX,XX +XXX,XX @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)
1567
cc->vmsd = &vmstate_s390_cpu;
1568
cc->get_crash_info = s390_cpu_get_crash_info;
483
cc->get_crash_info = s390_cpu_get_crash_info;
1569
cc->write_elf64_note = s390_cpu_write_elf64_note;
484
cc->write_elf64_note = s390_cpu_write_elf64_note;
1570
-#ifdef CONFIG_TCG
485
+ cc->sysemu_ops = &s390_sysemu_ops;
1571
- cc->tcg_ops.cpu_exec_interrupt = s390_cpu_exec_interrupt;
1572
- cc->tcg_ops.debug_excp_handler = s390x_cpu_debug_excp_handler;
1573
- cc->tcg_ops.do_unaligned_access = s390x_cpu_do_unaligned_access;
1574
-#endif
1575
#endif
486
#endif
1576
cc->disas_set_info = s390_cpu_disas_set_info;
487
cc->disas_set_info = s390_cpu_disas_set_info;
1577
-#ifdef CONFIG_TCG
1578
- cc->tcg_ops.initialize = s390x_translate_init;
1579
- cc->tcg_ops.tlb_fill = s390_cpu_tlb_fill;
1580
-#endif
1581
-
1582
cc->gdb_num_core_regs = S390_NUM_CORE_REGS;
488
cc->gdb_num_core_regs = S390_NUM_CORE_REGS;
1583
cc->gdb_core_xml_file = "s390x-core64.xml";
1584
cc->gdb_arch_name = s390_gdb_arch_name;
1585
1586
s390_cpu_model_class_register_props(oc);
1587
+
1588
+#ifdef CONFIG_TCG
1589
+ cc->tcg_ops = &s390_tcg_ops;
1590
+#endif /* CONFIG_TCG */
1591
}
1592
1593
static const TypeInfo s390_cpu_type_info = {
1594
diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c
489
diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c
1595
index XXXXXXX..XXXXXXX 100644
490
index XXXXXXX..XXXXXXX 100644
1596
--- a/target/sh4/cpu.c
491
--- a/target/sh4/cpu.c
1597
+++ b/target/sh4/cpu.c
492
+++ b/target/sh4/cpu.c
1598
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_sh_cpu = {
493
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_sh_cpu = {
494
.name = "cpu",
1599
.unmigratable = 1,
495
.unmigratable = 1,
1600
};
496
};
1601
497
+
1602
+#include "hw/core/tcg-cpu-ops.h"
498
+#include "hw/core/sysemu-cpu-ops.h"
1603
+
499
+
1604
+static struct TCGCPUOps superh_tcg_ops = {
500
+static const struct SysemuCPUOps sh4_sysemu_ops = {
1605
+ .initialize = sh4_translate_init,
501
+};
1606
+ .synchronize_from_tb = superh_cpu_synchronize_from_tb,
502
#endif
1607
+ .cpu_exec_interrupt = superh_cpu_exec_interrupt,
503
1608
+ .tlb_fill = superh_cpu_tlb_fill,
504
#include "hw/core/tcg-cpu-ops.h"
1609
+
1610
+#ifndef CONFIG_USER_ONLY
1611
+ .do_interrupt = superh_cpu_do_interrupt,
1612
+ .do_unaligned_access = superh_cpu_do_unaligned_access,
1613
+#endif /* !CONFIG_USER_ONLY */
1614
+};
1615
+
1616
static void superh_cpu_class_init(ObjectClass *oc, void *data)
1617
{
1618
DeviceClass *dc = DEVICE_CLASS(oc);
1619
@@ -XXX,XX +XXX,XX @@ static void superh_cpu_class_init(ObjectClass *oc, void *data)
505
@@ -XXX,XX +XXX,XX @@ static void superh_cpu_class_init(ObjectClass *oc, void *data)
1620
1621
cc->class_by_name = superh_cpu_class_by_name;
1622
cc->has_work = superh_cpu_has_work;
1623
- cc->tcg_ops.do_interrupt = superh_cpu_do_interrupt;
1624
- cc->tcg_ops.cpu_exec_interrupt = superh_cpu_exec_interrupt;
1625
cc->dump_state = superh_cpu_dump_state;
1626
cc->set_pc = superh_cpu_set_pc;
1627
- cc->tcg_ops.synchronize_from_tb = superh_cpu_synchronize_from_tb;
1628
cc->gdb_read_register = superh_cpu_gdb_read_register;
1629
cc->gdb_write_register = superh_cpu_gdb_write_register;
506
cc->gdb_write_register = superh_cpu_gdb_write_register;
1630
- cc->tcg_ops.tlb_fill = superh_cpu_tlb_fill;
507
#ifndef CONFIG_USER_ONLY
1631
#ifndef CONFIG_USER_ONLY
1632
- cc->tcg_ops.do_unaligned_access = superh_cpu_do_unaligned_access;
1633
cc->get_phys_page_debug = superh_cpu_get_phys_page_debug;
508
cc->get_phys_page_debug = superh_cpu_get_phys_page_debug;
509
+ cc->sysemu_ops = &sh4_sysemu_ops;
510
dc->vmsd = &vmstate_sh_cpu;
1634
#endif
511
#endif
1635
cc->disas_set_info = superh_cpu_disas_set_info;
512
cc->disas_set_info = superh_cpu_disas_set_info;
1636
- cc->tcg_ops.initialize = sh4_translate_init;
1637
1638
cc->gdb_num_core_regs = 59;
1639
1640
dc->vmsd = &vmstate_sh_cpu;
1641
+ cc->tcg_ops = &superh_tcg_ops;
1642
}
1643
1644
#define DEFINE_SUPERH_CPU_TYPE(type_name, cinit, initfn) \
1645
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
513
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
1646
index XXXXXXX..XXXXXXX 100644
514
index XXXXXXX..XXXXXXX 100644
1647
--- a/target/sparc/cpu.c
515
--- a/target/sparc/cpu.c
1648
+++ b/target/sparc/cpu.c
516
+++ b/target/sparc/cpu.c
1649
@@ -XXX,XX +XXX,XX @@ static Property sparc_cpu_properties[] = {
517
@@ -XXX,XX +XXX,XX @@ static Property sparc_cpu_properties[] = {
1650
DEFINE_PROP_END_OF_LIST()
518
DEFINE_PROP_END_OF_LIST()
1651
};
519
};
1652
520
1653
+#ifdef CONFIG_TCG
521
+#ifndef CONFIG_USER_ONLY
1654
+#include "hw/core/tcg-cpu-ops.h"
522
+#include "hw/core/sysemu-cpu-ops.h"
1655
+
523
+
1656
+static struct TCGCPUOps sparc_tcg_ops = {
524
+static const struct SysemuCPUOps sparc_sysemu_ops = {
1657
+ .initialize = sparc_tcg_init,
525
+};
1658
+ .synchronize_from_tb = sparc_cpu_synchronize_from_tb,
526
+#endif
1659
+ .cpu_exec_interrupt = sparc_cpu_exec_interrupt,
527
+
1660
+ .tlb_fill = sparc_cpu_tlb_fill,
528
#ifdef CONFIG_TCG
1661
+
529
#include "hw/core/tcg-cpu-ops.h"
1662
+#ifndef CONFIG_USER_ONLY
530
1663
+ .do_interrupt = sparc_cpu_do_interrupt,
1664
+ .do_transaction_failed = sparc_cpu_do_transaction_failed,
1665
+ .do_unaligned_access = sparc_cpu_do_unaligned_access,
1666
+#endif /* !CONFIG_USER_ONLY */
1667
+};
1668
+#endif /* CONFIG_TCG */
1669
+
1670
static void sparc_cpu_class_init(ObjectClass *oc, void *data)
1671
{
1672
SPARCCPUClass *scc = SPARC_CPU_CLASS(oc);
1673
@@ -XXX,XX +XXX,XX @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data)
531
@@ -XXX,XX +XXX,XX @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data)
1674
cc->class_by_name = sparc_cpu_class_by_name;
532
#ifndef CONFIG_USER_ONLY
1675
cc->parse_features = sparc_cpu_parse_features;
1676
cc->has_work = sparc_cpu_has_work;
1677
- cc->tcg_ops.do_interrupt = sparc_cpu_do_interrupt;
1678
- cc->tcg_ops.cpu_exec_interrupt = sparc_cpu_exec_interrupt;
1679
cc->dump_state = sparc_cpu_dump_state;
1680
#if !defined(TARGET_SPARC64) && !defined(CONFIG_USER_ONLY)
1681
cc->memory_rw_debug = sparc_cpu_memory_rw_debug;
1682
#endif
1683
cc->set_pc = sparc_cpu_set_pc;
1684
- cc->tcg_ops.synchronize_from_tb = sparc_cpu_synchronize_from_tb;
1685
cc->gdb_read_register = sparc_cpu_gdb_read_register;
1686
cc->gdb_write_register = sparc_cpu_gdb_write_register;
1687
- cc->tcg_ops.tlb_fill = sparc_cpu_tlb_fill;
1688
#ifndef CONFIG_USER_ONLY
1689
- cc->tcg_ops.do_transaction_failed = sparc_cpu_do_transaction_failed;
1690
- cc->tcg_ops.do_unaligned_access = sparc_cpu_do_unaligned_access;
1691
cc->get_phys_page_debug = sparc_cpu_get_phys_page_debug;
533
cc->get_phys_page_debug = sparc_cpu_get_phys_page_debug;
1692
cc->vmsd = &vmstate_sparc_cpu;
534
cc->legacy_vmsd = &vmstate_sparc_cpu;
535
+ cc->sysemu_ops = &sparc_sysemu_ops;
1693
#endif
536
#endif
1694
cc->disas_set_info = cpu_sparc_disas_set_info;
537
cc->disas_set_info = cpu_sparc_disas_set_info;
1695
- cc->tcg_ops.initialize = sparc_tcg_init;
538
1696
1697
#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
1698
cc->gdb_num_core_regs = 86;
1699
#else
1700
cc->gdb_num_core_regs = 72;
1701
#endif
1702
+ cc->tcg_ops = &sparc_tcg_ops;
1703
}
1704
1705
static const TypeInfo sparc_cpu_type_info = {
1706
diff --git a/target/tilegx/cpu.c b/target/tilegx/cpu.c
1707
index XXXXXXX..XXXXXXX 100644
1708
--- a/target/tilegx/cpu.c
1709
+++ b/target/tilegx/cpu.c
1710
@@ -XXX,XX +XXX,XX @@ static bool tilegx_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
1711
return false;
1712
}
1713
1714
+#include "hw/core/tcg-cpu-ops.h"
1715
+
1716
+static struct TCGCPUOps tilegx_tcg_ops = {
1717
+ .initialize = tilegx_tcg_init,
1718
+ .cpu_exec_interrupt = tilegx_cpu_exec_interrupt,
1719
+ .tlb_fill = tilegx_cpu_tlb_fill,
1720
+
1721
+#ifndef CONFIG_USER_ONLY
1722
+ .do_interrupt = tilegx_cpu_do_interrupt,
1723
+#endif /* !CONFIG_USER_ONLY */
1724
+};
1725
+
1726
static void tilegx_cpu_class_init(ObjectClass *oc, void *data)
1727
{
1728
DeviceClass *dc = DEVICE_CLASS(oc);
1729
@@ -XXX,XX +XXX,XX @@ static void tilegx_cpu_class_init(ObjectClass *oc, void *data)
1730
1731
cc->class_by_name = tilegx_cpu_class_by_name;
1732
cc->has_work = tilegx_cpu_has_work;
1733
- cc->tcg_ops.do_interrupt = tilegx_cpu_do_interrupt;
1734
- cc->tcg_ops.cpu_exec_interrupt = tilegx_cpu_exec_interrupt;
1735
cc->dump_state = tilegx_cpu_dump_state;
1736
cc->set_pc = tilegx_cpu_set_pc;
1737
- cc->tcg_ops.tlb_fill = tilegx_cpu_tlb_fill;
1738
cc->gdb_num_core_regs = 0;
1739
- cc->tcg_ops.initialize = tilegx_tcg_init;
1740
+ cc->tcg_ops = &tilegx_tcg_ops;
1741
}
1742
1743
static const TypeInfo tilegx_cpu_type_info = {
1744
diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c
539
diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c
1745
index XXXXXXX..XXXXXXX 100644
540
index XXXXXXX..XXXXXXX 100644
1746
--- a/target/tricore/cpu.c
541
--- a/target/tricore/cpu.c
1747
+++ b/target/tricore/cpu.c
542
+++ b/target/tricore/cpu.c
1748
@@ -XXX,XX +XXX,XX @@ static void tc27x_initfn(Object *obj)
543
@@ -XXX,XX +XXX,XX @@ static void tc27x_initfn(Object *obj)
1749
set_feature(&cpu->env, TRICORE_FEATURE_161);
544
set_feature(&cpu->env, TRICORE_FEATURE_161);
1750
}
545
}
1751
546
1752
+#include "hw/core/tcg-cpu-ops.h"
547
+#include "hw/core/sysemu-cpu-ops.h"
1753
+
548
+
1754
+static struct TCGCPUOps tricore_tcg_ops = {
549
+static const struct SysemuCPUOps tricore_sysemu_ops = {
1755
+ .initialize = tricore_tcg_init,
550
+};
1756
+ .synchronize_from_tb = tricore_cpu_synchronize_from_tb,
551
+
1757
+ .tlb_fill = tricore_cpu_tlb_fill,
552
#include "hw/core/tcg-cpu-ops.h"
1758
+};
553
1759
+
554
static struct TCGCPUOps tricore_tcg_ops = {
1760
static void tricore_cpu_class_init(ObjectClass *c, void *data)
1761
{
1762
TriCoreCPUClass *mcc = TRICORE_CPU_CLASS(c);
1763
@@ -XXX,XX +XXX,XX @@ static void tricore_cpu_class_init(ObjectClass *c, void *data)
555
@@ -XXX,XX +XXX,XX @@ static void tricore_cpu_class_init(ObjectClass *c, void *data)
1764
1765
cc->dump_state = tricore_cpu_dump_state;
556
cc->dump_state = tricore_cpu_dump_state;
1766
cc->set_pc = tricore_cpu_set_pc;
557
cc->set_pc = tricore_cpu_set_pc;
1767
- cc->tcg_ops.synchronize_from_tb = tricore_cpu_synchronize_from_tb;
1768
cc->get_phys_page_debug = tricore_cpu_get_phys_page_debug;
558
cc->get_phys_page_debug = tricore_cpu_get_phys_page_debug;
1769
- cc->tcg_ops.initialize = tricore_tcg_init;
559
+ cc->sysemu_ops = &tricore_sysemu_ops;
1770
- cc->tcg_ops.tlb_fill = tricore_cpu_tlb_fill;
560
cc->tcg_ops = &tricore_tcg_ops;
1771
+ cc->tcg_ops = &tricore_tcg_ops;
561
}
1772
}
562
1773
1774
#define DEFINE_TRICORE_CPU_TYPE(cpu_model, initfn) \
1775
diff --git a/target/unicore32/cpu.c b/target/unicore32/cpu.c
1776
index XXXXXXX..XXXXXXX 100644
1777
--- a/target/unicore32/cpu.c
1778
+++ b/target/unicore32/cpu.c
1779
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_uc32_cpu = {
1780
.unmigratable = 1,
1781
};
1782
1783
+#include "hw/core/tcg-cpu-ops.h"
1784
+
1785
+static struct TCGCPUOps uc32_tcg_ops = {
1786
+ .initialize = uc32_translate_init,
1787
+ .cpu_exec_interrupt = uc32_cpu_exec_interrupt,
1788
+ .tlb_fill = uc32_cpu_tlb_fill,
1789
+
1790
+#ifndef CONFIG_USER_ONLY
1791
+ .do_interrupt = uc32_cpu_do_interrupt,
1792
+#endif /* !CONFIG_USER_ONLY */
1793
+};
1794
+
1795
static void uc32_cpu_class_init(ObjectClass *oc, void *data)
1796
{
1797
DeviceClass *dc = DEVICE_CLASS(oc);
1798
@@ -XXX,XX +XXX,XX @@ static void uc32_cpu_class_init(ObjectClass *oc, void *data)
1799
1800
cc->class_by_name = uc32_cpu_class_by_name;
1801
cc->has_work = uc32_cpu_has_work;
1802
- cc->tcg_ops.do_interrupt = uc32_cpu_do_interrupt;
1803
- cc->tcg_ops.cpu_exec_interrupt = uc32_cpu_exec_interrupt;
1804
cc->dump_state = uc32_cpu_dump_state;
1805
cc->set_pc = uc32_cpu_set_pc;
1806
- cc->tcg_ops.tlb_fill = uc32_cpu_tlb_fill;
1807
cc->get_phys_page_debug = uc32_cpu_get_phys_page_debug;
1808
- cc->tcg_ops.initialize = uc32_translate_init;
1809
dc->vmsd = &vmstate_uc32_cpu;
1810
+ cc->tcg_ops = &uc32_tcg_ops;
1811
}
1812
1813
#define DEFINE_UNICORE32_CPU_TYPE(cpu_model, initfn) \
1814
diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c
563
diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c
1815
index XXXXXXX..XXXXXXX 100644
564
index XXXXXXX..XXXXXXX 100644
1816
--- a/target/xtensa/cpu.c
565
--- a/target/xtensa/cpu.c
1817
+++ b/target/xtensa/cpu.c
566
+++ b/target/xtensa/cpu.c
1818
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_xtensa_cpu = {
567
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_xtensa_cpu = {
568
.name = "cpu",
1819
.unmigratable = 1,
569
.unmigratable = 1,
1820
};
570
};
1821
571
+
1822
+#include "hw/core/tcg-cpu-ops.h"
572
+#include "hw/core/sysemu-cpu-ops.h"
1823
+
573
+
1824
+static struct TCGCPUOps xtensa_tcg_ops = {
574
+static const struct SysemuCPUOps xtensa_sysemu_ops = {
1825
+ .initialize = xtensa_translate_init,
575
+};
1826
+ .cpu_exec_interrupt = xtensa_cpu_exec_interrupt,
576
#endif
1827
+ .tlb_fill = xtensa_cpu_tlb_fill,
577
1828
+ .debug_excp_handler = xtensa_breakpoint_handler,
578
#include "hw/core/tcg-cpu-ops.h"
1829
+
1830
+#ifndef CONFIG_USER_ONLY
1831
+ .do_interrupt = xtensa_cpu_do_interrupt,
1832
+ .do_transaction_failed = xtensa_cpu_do_transaction_failed,
1833
+ .do_unaligned_access = xtensa_cpu_do_unaligned_access,
1834
+#endif /* !CONFIG_USER_ONLY */
1835
+};
1836
+
1837
static void xtensa_cpu_class_init(ObjectClass *oc, void *data)
1838
{
1839
DeviceClass *dc = DEVICE_CLASS(oc);
1840
@@ -XXX,XX +XXX,XX @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data)
579
@@ -XXX,XX +XXX,XX @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data)
1841
1842
cc->class_by_name = xtensa_cpu_class_by_name;
1843
cc->has_work = xtensa_cpu_has_work;
1844
- cc->tcg_ops.do_interrupt = xtensa_cpu_do_interrupt;
1845
- cc->tcg_ops.cpu_exec_interrupt = xtensa_cpu_exec_interrupt;
1846
cc->dump_state = xtensa_cpu_dump_state;
1847
cc->set_pc = xtensa_cpu_set_pc;
1848
cc->gdb_read_register = xtensa_cpu_gdb_read_register;
1849
cc->gdb_write_register = xtensa_cpu_gdb_write_register;
580
cc->gdb_write_register = xtensa_cpu_gdb_write_register;
1850
cc->gdb_stop_before_watchpoint = true;
581
cc->gdb_stop_before_watchpoint = true;
1851
- cc->tcg_ops.tlb_fill = xtensa_cpu_tlb_fill;
582
#ifndef CONFIG_USER_ONLY
1852
#ifndef CONFIG_USER_ONLY
583
+ cc->sysemu_ops = &xtensa_sysemu_ops;
1853
- cc->tcg_ops.do_unaligned_access = xtensa_cpu_do_unaligned_access;
1854
cc->get_phys_page_debug = xtensa_cpu_get_phys_page_debug;
584
cc->get_phys_page_debug = xtensa_cpu_get_phys_page_debug;
1855
- cc->tcg_ops.do_transaction_failed = xtensa_cpu_do_transaction_failed;
1856
#endif
1857
- cc->tcg_ops.debug_excp_handler = xtensa_breakpoint_handler;
1858
cc->disas_set_info = xtensa_cpu_disas_set_info;
1859
- cc->tcg_ops.initialize = xtensa_translate_init;
1860
dc->vmsd = &vmstate_xtensa_cpu;
585
dc->vmsd = &vmstate_xtensa_cpu;
1861
+ cc->tcg_ops = &xtensa_tcg_ops;
586
#endif
1862
}
1863
1864
static const TypeInfo xtensa_cpu_type_info = {
1865
diff --git a/target/ppc/translate_init.c.inc b/target/ppc/translate_init.c.inc
1866
index XXXXXXX..XXXXXXX 100644
1867
--- a/target/ppc/translate_init.c.inc
1868
+++ b/target/ppc/translate_init.c.inc
1869
@@ -XXX,XX +XXX,XX @@ static Property ppc_cpu_properties[] = {
1870
DEFINE_PROP_END_OF_LIST(),
1871
};
1872
1873
+#ifdef CONFIG_TCG
1874
+#include "hw/core/tcg-cpu-ops.h"
1875
+
1876
+static struct TCGCPUOps ppc_tcg_ops = {
1877
+ .initialize = ppc_translate_init,
1878
+ .cpu_exec_interrupt = ppc_cpu_exec_interrupt,
1879
+ .tlb_fill = ppc_cpu_tlb_fill,
1880
+
1881
+#ifndef CONFIG_USER_ONLY
1882
+ .do_interrupt = ppc_cpu_do_interrupt,
1883
+ .cpu_exec_enter = ppc_cpu_exec_enter,
1884
+ .cpu_exec_exit = ppc_cpu_exec_exit,
1885
+ .do_unaligned_access = ppc_cpu_do_unaligned_access,
1886
+#endif /* !CONFIG_USER_ONLY */
1887
+};
1888
+#endif /* CONFIG_TCG */
1889
+
1890
static void ppc_cpu_class_init(ObjectClass *oc, void *data)
1891
{
1892
PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
1893
@@ -XXX,XX +XXX,XX @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
1894
#ifndef CONFIG_USER_ONLY
1895
cc->virtio_is_big_endian = ppc_cpu_is_big_endian;
1896
#endif
1897
-#ifdef CONFIG_TCG
1898
- cc->tcg_ops.initialize = ppc_translate_init;
1899
- cc->tcg_ops.cpu_exec_interrupt = ppc_cpu_exec_interrupt;
1900
- cc->tcg_ops.do_interrupt = ppc_cpu_do_interrupt;
1901
- cc->tcg_ops.tlb_fill = ppc_cpu_tlb_fill;
1902
-#ifndef CONFIG_USER_ONLY
1903
- cc->tcg_ops.cpu_exec_enter = ppc_cpu_exec_enter;
1904
- cc->tcg_ops.cpu_exec_exit = ppc_cpu_exec_exit;
1905
- cc->tcg_ops.do_unaligned_access = ppc_cpu_do_unaligned_access;
1906
-#endif /* !CONFIG_USER_ONLY */
1907
-#endif /* CONFIG_TCG */
1908
-
1909
cc->disas_set_info = ppc_disas_set_info;
1910
1911
dc->fw_name = "PowerPC,UNKNOWN";
1912
+
1913
+#ifdef CONFIG_TCG
1914
+ cc->tcg_ops = &ppc_tcg_ops;
1915
+#endif /* CONFIG_TCG */
1916
}
1917
1918
static const TypeInfo ppc_cpu_type_info = {
1919
diff --git a/MAINTAINERS b/MAINTAINERS
1920
index XXXXXXX..XXXXXXX 100644
1921
--- a/MAINTAINERS
1922
+++ b/MAINTAINERS
1923
@@ -XXX,XX +XXX,XX @@ F: include/exec/helper*.h
1924
F: include/exec/tb-hash.h
1925
F: include/sysemu/cpus.h
1926
F: include/sysemu/tcg.h
1927
+F: include/hw/core/tcg-cpu-ops.h
1928
1929
FPU emulation
1930
M: Aurelien Jarno <aurelien@aurel32.net>
1931
--
587
--
1932
2.25.1
588
2.25.1
1933
589
1934
590
diff view generated by jsdifflib
1
From: Eduardo Habkost <ehabkost@redhat.com>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
The TCG-specific CPU methods will be moved to a separate struct,
3
Migration is specific to system emulation.
4
to make it easier to move accel-specific code outside generic CPU
4
5
code in the future. Start by moving tcg_initialize().
5
- Move the CPUClass::vmsd field to SysemuCPUOps,
6
6
- restrict VMSTATE_CPU() macro to sysemu,
7
The new CPUClass.tcg_opts field may eventually become a pointer,
7
- vmstate_dummy is now unused, remove it.
8
but keep it an embedded struct for now, to make code conversion
8
9
easier.
9
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
10
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
11
Message-Id: <20210517105140.1062037-16-f4bug@amsat.org>
12
[claudio: move TCGCpuOperations inside include/hw/core/cpu.h]
13
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
14
Message-Id: <20210204163931.7358-2-cfontana@suse.de>
15
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16
---
13
---
17
include/hw/core/cpu.h | 16 +++++++++++++++-
14
include/hw/core/cpu.h | 8 ++------
18
cpu.c | 6 +++++-
15
include/hw/core/sysemu-cpu-ops.h | 6 ++++++
19
target/alpha/cpu.c | 2 +-
16
include/migration/vmstate.h | 2 --
20
target/arm/cpu.c | 2 +-
17
cpu.c | 15 +++++++--------
21
target/avr/cpu.c | 2 +-
18
stubs/vmstate.c | 2 --
22
target/cris/cpu.c | 12 ++++++------
19
target/arm/cpu.c | 2 +-
23
target/hppa/cpu.c | 2 +-
20
target/i386/cpu.c | 2 +-
24
target/i386/tcg/tcg-cpu.c | 2 +-
21
target/mips/cpu.c | 2 +-
25
target/lm32/cpu.c | 2 +-
22
target/ppc/cpu_init.c | 2 +-
26
target/m68k/cpu.c | 2 +-
23
target/riscv/cpu.c | 2 +-
27
target/microblaze/cpu.c | 2 +-
24
target/s390x/cpu.c | 2 +-
28
target/mips/cpu.c | 2 +-
25
target/sparc/cpu.c | 2 +-
29
target/moxie/cpu.c | 2 +-
26
12 files changed, 22 insertions(+), 25 deletions(-)
30
target/nios2/cpu.c | 2 +-
31
target/openrisc/cpu.c | 2 +-
32
target/riscv/cpu.c | 2 +-
33
target/rx/cpu.c | 2 +-
34
target/s390x/cpu.c | 2 +-
35
target/sh4/cpu.c | 2 +-
36
target/sparc/cpu.c | 2 +-
37
target/tilegx/cpu.c | 2 +-
38
target/tricore/cpu.c | 2 +-
39
target/unicore32/cpu.c | 2 +-
40
target/xtensa/cpu.c | 2 +-
41
target/ppc/translate_init.c.inc | 2 +-
42
25 files changed, 48 insertions(+), 30 deletions(-)
43
27
44
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
28
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
45
index XXXXXXX..XXXXXXX 100644
29
index XXXXXXX..XXXXXXX 100644
46
--- a/include/hw/core/cpu.h
30
--- a/include/hw/core/cpu.h
47
+++ b/include/hw/core/cpu.h
31
+++ b/include/hw/core/cpu.h
48
@@ -XXX,XX +XXX,XX @@ typedef struct CPUWatchpoint CPUWatchpoint;
32
@@ -XXX,XX +XXX,XX @@ struct SysemuCPUOps;
49
33
* 32-bit VM coredump.
50
struct TranslationBlock;
34
* @write_elf32_qemunote: Callback for writing a CPU- and QEMU-specific ELF
51
35
* note to a 32-bit VM coredump.
52
+/**
36
- * @legacy_vmsd: Legacy state description for migration.
53
+ * struct TcgCpuOperations: TCG operations specific to a CPU class
37
- * Do not use in new targets, use #DeviceClass::vmsd instead.
54
+ */
38
* @gdb_num_core_regs: Number of core registers accessible to GDB.
55
+typedef struct TcgCpuOperations {
39
* @gdb_core_xml_file: File name for core registers GDB XML description.
40
* @gdb_stop_before_watchpoint: Indicates whether GDB expects the CPU to stop
41
@@ -XXX,XX +XXX,XX @@ struct CPUClass {
42
int (*write_elf32_qemunote)(WriteCoreDumpFunction f, CPUState *cpu,
43
void *opaque);
44
45
- const VMStateDescription *legacy_vmsd;
46
const char *gdb_core_xml_file;
47
gchar * (*gdb_arch_name)(CPUState *cpu);
48
const char * (*gdb_get_dynamic_xml)(CPUState *cpu, const char *xmlname);
49
@@ -XXX,XX +XXX,XX @@ bool target_words_bigendian(void);
50
#ifdef NEED_CPU_H
51
52
#ifdef CONFIG_SOFTMMU
53
+
54
extern const VMStateDescription vmstate_cpu_common;
55
-#else
56
-#define vmstate_cpu_common vmstate_dummy
57
-#endif
58
59
#define VMSTATE_CPU() { \
60
.name = "parent_obj", \
61
@@ -XXX,XX +XXX,XX @@ extern const VMStateDescription vmstate_cpu_common;
62
.flags = VMS_STRUCT, \
63
.offset = 0, \
64
}
65
+#endif /* CONFIG_SOFTMMU */
66
67
#endif /* NEED_CPU_H */
68
69
diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h
70
index XXXXXXX..XXXXXXX 100644
71
--- a/include/hw/core/sysemu-cpu-ops.h
72
+++ b/include/hw/core/sysemu-cpu-ops.h
73
@@ -XXX,XX +XXX,XX @@
74
* struct SysemuCPUOps: System operations specific to a CPU class
75
*/
76
typedef struct SysemuCPUOps {
56
+ /**
77
+ /**
57
+ * @initialize: Initalize TCG state
78
+ * @legacy_vmsd: Legacy state for migration.
58
+ *
79
+ * Do not use in new targets, use #DeviceClass::vmsd instead.
59
+ * Called when the first CPU is realized.
60
+ */
80
+ */
61
+ void (*initialize)(void);
81
+ const VMStateDescription *legacy_vmsd;
62
+
82
+
63
+} TcgCpuOperations;
83
} SysemuCPUOps;
64
+
84
65
/**
85
#endif /* SYSEMU_CPU_OPS_H */
66
* CPUClass:
86
diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
67
* @class_by_name: Callback to map -cpu command line model name to an
87
index XXXXXXX..XXXXXXX 100644
68
@@ -XXX,XX +XXX,XX @@ struct CPUClass {
88
--- a/include/migration/vmstate.h
69
89
+++ b/include/migration/vmstate.h
70
void (*disas_set_info)(CPUState *cpu, disassemble_info *info);
90
@@ -XXX,XX +XXX,XX @@ struct VMStateDescription {
71
vaddr (*adjust_watchpoint_address)(CPUState *cpu, vaddr addr, int len);
91
const VMStateDescription **subsections;
72
- void (*tcg_initialize)(void);
92
};
73
93
74
const char *deprecation_note;
94
-extern const VMStateDescription vmstate_dummy;
75
/* Keep non-pointer data at the end to minimize holes. */
95
-
76
int gdb_num_core_regs;
96
extern const VMStateInfo vmstate_info_bool;
77
bool gdb_stop_before_watchpoint;
97
78
+
98
extern const VMStateInfo vmstate_info_int8;
79
+ TcgCpuOperations tcg_ops;
80
};
81
82
/*
83
diff --git a/cpu.c b/cpu.c
99
diff --git a/cpu.c b/cpu.c
84
index XXXXXXX..XXXXXXX 100644
100
index XXXXXXX..XXXXXXX 100644
85
--- a/cpu.c
101
--- a/cpu.c
86
+++ b/cpu.c
102
+++ b/cpu.c
87
@@ -XXX,XX +XXX,XX @@ void cpu_exec_initfn(CPUState *cpu)
103
@@ -XXX,XX +XXX,XX @@ const VMStateDescription vmstate_cpu_common = {
104
88
void cpu_exec_realizefn(CPUState *cpu, Error **errp)
105
void cpu_exec_realizefn(CPUState *cpu, Error **errp)
89
{
106
{
107
+#ifndef CONFIG_USER_ONLY
90
CPUClass *cc = CPU_GET_CLASS(cpu);
108
CPUClass *cc = CPU_GET_CLASS(cpu);
91
+#ifdef CONFIG_TCG
109
+#endif
92
static bool tcg_target_initialized;
93
+#endif /* CONFIG_TCG */
94
110
95
cpu_list_add(cpu);
111
cpu_list_add(cpu);
96
112
if (!accel_cpu_realizefn(cpu, errp)) {
97
+#ifdef CONFIG_TCG
113
@@ -XXX,XX +XXX,XX @@ void cpu_exec_realizefn(CPUState *cpu, Error **errp)
98
if (tcg_enabled() && !tcg_target_initialized) {
114
#ifdef CONFIG_USER_ONLY
99
tcg_target_initialized = true;
115
assert(qdev_get_vmsd(DEVICE(cpu)) == NULL ||
100
- cc->tcg_initialize();
116
qdev_get_vmsd(DEVICE(cpu))->unmigratable);
101
+ cc->tcg_ops.initialize();
117
- assert(cc->legacy_vmsd == NULL);
118
#else
119
if (qdev_get_vmsd(DEVICE(cpu)) == NULL) {
120
vmstate_register(NULL, cpu->cpu_index, &vmstate_cpu_common, cpu);
102
}
121
}
103
+#endif /* CONFIG_TCG */
122
- if (cc->legacy_vmsd != NULL) {
104
tlb_init(cpu);
123
- vmstate_register(NULL, cpu->cpu_index, cc->legacy_vmsd, cpu);
105
124
+ if (cc->sysemu_ops->legacy_vmsd != NULL) {
106
qemu_plugin_vcpu_init_hook(cpu);
125
+ vmstate_register(NULL, cpu->cpu_index, cc->sysemu_ops->legacy_vmsd, cpu);
107
diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c
126
}
108
index XXXXXXX..XXXXXXX 100644
127
#endif /* CONFIG_USER_ONLY */
109
--- a/target/alpha/cpu.c
110
+++ b/target/alpha/cpu.c
111
@@ -XXX,XX +XXX,XX @@ static void alpha_cpu_class_init(ObjectClass *oc, void *data)
112
dc->vmsd = &vmstate_alpha_cpu;
113
#endif
114
cc->disas_set_info = alpha_cpu_disas_set_info;
115
- cc->tcg_initialize = alpha_translate_init;
116
+ cc->tcg_ops.initialize = alpha_translate_init;
117
118
cc->gdb_num_core_regs = 67;
119
}
128
}
129
130
void cpu_exec_unrealizefn(CPUState *cpu)
131
{
132
+#ifndef CONFIG_USER_ONLY
133
CPUClass *cc = CPU_GET_CLASS(cpu);
134
135
-#ifdef CONFIG_USER_ONLY
136
- assert(cc->legacy_vmsd == NULL);
137
-#else
138
- if (cc->legacy_vmsd != NULL) {
139
- vmstate_unregister(NULL, cc->legacy_vmsd, cpu);
140
+ if (cc->sysemu_ops->legacy_vmsd != NULL) {
141
+ vmstate_unregister(NULL, cc->sysemu_ops->legacy_vmsd, cpu);
142
}
143
if (qdev_get_vmsd(DEVICE(cpu)) == NULL) {
144
vmstate_unregister(NULL, &vmstate_cpu_common, cpu);
145
diff --git a/stubs/vmstate.c b/stubs/vmstate.c
146
index XXXXXXX..XXXXXXX 100644
147
--- a/stubs/vmstate.c
148
+++ b/stubs/vmstate.c
149
@@ -XXX,XX +XXX,XX @@
150
#include "qemu/osdep.h"
151
#include "migration/vmstate.h"
152
153
-const VMStateDescription vmstate_dummy = {};
154
-
155
int vmstate_register_with_alias_id(VMStateIf *obj,
156
uint32_t instance_id,
157
const VMStateDescription *vmsd,
120
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
158
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
121
index XXXXXXX..XXXXXXX 100644
159
index XXXXXXX..XXXXXXX 100644
122
--- a/target/arm/cpu.c
160
--- a/target/arm/cpu.c
123
+++ b/target/arm/cpu.c
161
+++ b/target/arm/cpu.c
162
@@ -XXX,XX +XXX,XX @@ static gchar *arm_gdb_arch_name(CPUState *cs)
163
#include "hw/core/sysemu-cpu-ops.h"
164
165
static const struct SysemuCPUOps arm_sysemu_ops = {
166
+ .legacy_vmsd = &vmstate_arm_cpu,
167
};
168
#endif
169
124
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
170
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
125
cc->gdb_stop_before_watchpoint = true;
171
#ifndef CONFIG_USER_ONLY
126
cc->disas_set_info = arm_disas_set_info;
172
cc->get_phys_page_attrs_debug = arm_cpu_get_phys_page_attrs_debug;
127
#ifdef CONFIG_TCG
173
cc->asidx_from_attrs = arm_asidx_from_attrs;
128
- cc->tcg_initialize = arm_translate_init;
174
- cc->legacy_vmsd = &vmstate_arm_cpu;
129
+ cc->tcg_ops.initialize = arm_translate_init;
175
cc->virtio_is_big_endian = arm_cpu_virtio_is_big_endian;
130
cc->tlb_fill = arm_cpu_tlb_fill;
176
cc->write_elf64_note = arm_cpu_write_elf64_note;
131
cc->debug_excp_handler = arm_debug_excp_handler;
177
cc->write_elf32_note = arm_cpu_write_elf32_note;
132
cc->debug_check_watchpoint = arm_debug_check_watchpoint;
178
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
133
diff --git a/target/avr/cpu.c b/target/avr/cpu.c
179
index XXXXXXX..XXXXXXX 100644
134
index XXXXXXX..XXXXXXX 100644
180
--- a/target/i386/cpu.c
135
--- a/target/avr/cpu.c
181
+++ b/target/i386/cpu.c
136
+++ b/target/avr/cpu.c
182
@@ -XXX,XX +XXX,XX @@ static Property x86_cpu_properties[] = {
137
@@ -XXX,XX +XXX,XX @@ static void avr_cpu_class_init(ObjectClass *oc, void *data)
183
#include "hw/core/sysemu-cpu-ops.h"
138
cc->tlb_fill = avr_cpu_tlb_fill;
184
139
cc->vmsd = &vms_avr_cpu;
185
static const struct SysemuCPUOps i386_sysemu_ops = {
140
cc->disas_set_info = avr_cpu_disas_set_info;
186
+ .legacy_vmsd = &vmstate_x86_cpu,
141
- cc->tcg_initialize = avr_cpu_tcg_init;
187
};
142
+ cc->tcg_ops.initialize = avr_cpu_tcg_init;
188
#endif
143
cc->synchronize_from_tb = avr_cpu_synchronize_from_tb;
189
144
cc->gdb_read_register = avr_cpu_gdb_read_register;
190
@@ -XXX,XX +XXX,XX @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
145
cc->gdb_write_register = avr_cpu_gdb_write_register;
191
cc->write_elf64_qemunote = x86_cpu_write_elf64_qemunote;
146
diff --git a/target/cris/cpu.c b/target/cris/cpu.c
192
cc->write_elf32_note = x86_cpu_write_elf32_note;
147
index XXXXXXX..XXXXXXX 100644
193
cc->write_elf32_qemunote = x86_cpu_write_elf32_qemunote;
148
--- a/target/cris/cpu.c
194
- cc->legacy_vmsd = &vmstate_x86_cpu;
149
+++ b/target/cris/cpu.c
195
cc->sysemu_ops = &i386_sysemu_ops;
150
@@ -XXX,XX +XXX,XX @@ static void crisv8_cpu_class_init(ObjectClass *oc, void *data)
196
#endif /* !CONFIG_USER_ONLY */
151
ccc->vr = 8;
197
152
cc->do_interrupt = crisv10_cpu_do_interrupt;
153
cc->gdb_read_register = crisv10_cpu_gdb_read_register;
154
- cc->tcg_initialize = cris_initialize_crisv10_tcg;
155
+ cc->tcg_ops.initialize = cris_initialize_crisv10_tcg;
156
}
157
158
static void crisv9_cpu_class_init(ObjectClass *oc, void *data)
159
@@ -XXX,XX +XXX,XX @@ static void crisv9_cpu_class_init(ObjectClass *oc, void *data)
160
ccc->vr = 9;
161
cc->do_interrupt = crisv10_cpu_do_interrupt;
162
cc->gdb_read_register = crisv10_cpu_gdb_read_register;
163
- cc->tcg_initialize = cris_initialize_crisv10_tcg;
164
+ cc->tcg_ops.initialize = cris_initialize_crisv10_tcg;
165
}
166
167
static void crisv10_cpu_class_init(ObjectClass *oc, void *data)
168
@@ -XXX,XX +XXX,XX @@ static void crisv10_cpu_class_init(ObjectClass *oc, void *data)
169
ccc->vr = 10;
170
cc->do_interrupt = crisv10_cpu_do_interrupt;
171
cc->gdb_read_register = crisv10_cpu_gdb_read_register;
172
- cc->tcg_initialize = cris_initialize_crisv10_tcg;
173
+ cc->tcg_ops.initialize = cris_initialize_crisv10_tcg;
174
}
175
176
static void crisv11_cpu_class_init(ObjectClass *oc, void *data)
177
@@ -XXX,XX +XXX,XX @@ static void crisv11_cpu_class_init(ObjectClass *oc, void *data)
178
ccc->vr = 11;
179
cc->do_interrupt = crisv10_cpu_do_interrupt;
180
cc->gdb_read_register = crisv10_cpu_gdb_read_register;
181
- cc->tcg_initialize = cris_initialize_crisv10_tcg;
182
+ cc->tcg_ops.initialize = cris_initialize_crisv10_tcg;
183
}
184
185
static void crisv17_cpu_class_init(ObjectClass *oc, void *data)
186
@@ -XXX,XX +XXX,XX @@ static void crisv17_cpu_class_init(ObjectClass *oc, void *data)
187
ccc->vr = 17;
188
cc->do_interrupt = crisv10_cpu_do_interrupt;
189
cc->gdb_read_register = crisv10_cpu_gdb_read_register;
190
- cc->tcg_initialize = cris_initialize_crisv10_tcg;
191
+ cc->tcg_ops.initialize = cris_initialize_crisv10_tcg;
192
}
193
194
static void crisv32_cpu_class_init(ObjectClass *oc, void *data)
195
@@ -XXX,XX +XXX,XX @@ static void cris_cpu_class_init(ObjectClass *oc, void *data)
196
cc->gdb_stop_before_watchpoint = true;
197
198
cc->disas_set_info = cris_disas_set_info;
199
- cc->tcg_initialize = cris_initialize_tcg;
200
+ cc->tcg_ops.initialize = cris_initialize_tcg;
201
}
202
203
#define DEFINE_CRIS_CPU_TYPE(cpu_model, initfn) \
204
diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
205
index XXXXXXX..XXXXXXX 100644
206
--- a/target/hppa/cpu.c
207
+++ b/target/hppa/cpu.c
208
@@ -XXX,XX +XXX,XX @@ static void hppa_cpu_class_init(ObjectClass *oc, void *data)
209
#endif
210
cc->do_unaligned_access = hppa_cpu_do_unaligned_access;
211
cc->disas_set_info = hppa_cpu_disas_set_info;
212
- cc->tcg_initialize = hppa_translate_init;
213
+ cc->tcg_ops.initialize = hppa_translate_init;
214
215
cc->gdb_num_core_regs = 128;
216
}
217
diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c
218
index XXXXXXX..XXXXXXX 100644
219
--- a/target/i386/tcg/tcg-cpu.c
220
+++ b/target/i386/tcg/tcg-cpu.c
221
@@ -XXX,XX +XXX,XX @@ void tcg_cpu_common_class_init(CPUClass *cc)
222
cc->synchronize_from_tb = x86_cpu_synchronize_from_tb;
223
cc->cpu_exec_enter = x86_cpu_exec_enter;
224
cc->cpu_exec_exit = x86_cpu_exec_exit;
225
- cc->tcg_initialize = tcg_x86_init;
226
+ cc->tcg_ops.initialize = tcg_x86_init;
227
cc->tlb_fill = x86_cpu_tlb_fill;
228
#ifndef CONFIG_USER_ONLY
229
cc->debug_excp_handler = breakpoint_handler;
230
diff --git a/target/lm32/cpu.c b/target/lm32/cpu.c
231
index XXXXXXX..XXXXXXX 100644
232
--- a/target/lm32/cpu.c
233
+++ b/target/lm32/cpu.c
234
@@ -XXX,XX +XXX,XX @@ static void lm32_cpu_class_init(ObjectClass *oc, void *data)
235
cc->gdb_stop_before_watchpoint = true;
236
cc->debug_excp_handler = lm32_debug_excp_handler;
237
cc->disas_set_info = lm32_cpu_disas_set_info;
238
- cc->tcg_initialize = lm32_translate_init;
239
+ cc->tcg_ops.initialize = lm32_translate_init;
240
}
241
242
#define DEFINE_LM32_CPU_TYPE(cpu_model, initfn) \
243
diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c
244
index XXXXXXX..XXXXXXX 100644
245
--- a/target/m68k/cpu.c
246
+++ b/target/m68k/cpu.c
247
@@ -XXX,XX +XXX,XX @@ static void m68k_cpu_class_init(ObjectClass *c, void *data)
248
dc->vmsd = &vmstate_m68k_cpu;
249
#endif
250
cc->disas_set_info = m68k_cpu_disas_set_info;
251
- cc->tcg_initialize = m68k_tcg_init;
252
+ cc->tcg_ops.initialize = m68k_tcg_init;
253
254
cc->gdb_num_core_regs = 18;
255
}
256
diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c
257
index XXXXXXX..XXXXXXX 100644
258
--- a/target/microblaze/cpu.c
259
+++ b/target/microblaze/cpu.c
260
@@ -XXX,XX +XXX,XX @@ static void mb_cpu_class_init(ObjectClass *oc, void *data)
261
cc->gdb_num_core_regs = 32 + 27;
262
263
cc->disas_set_info = mb_disas_set_info;
264
- cc->tcg_initialize = mb_tcg_init;
265
+ cc->tcg_ops.initialize = mb_tcg_init;
266
}
267
268
static const TypeInfo mb_cpu_type_info = {
269
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
198
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
270
index XXXXXXX..XXXXXXX 100644
199
index XXXXXXX..XXXXXXX 100644
271
--- a/target/mips/cpu.c
200
--- a/target/mips/cpu.c
272
+++ b/target/mips/cpu.c
201
+++ b/target/mips/cpu.c
202
@@ -XXX,XX +XXX,XX @@ static Property mips_cpu_properties[] = {
203
#include "hw/core/sysemu-cpu-ops.h"
204
205
static const struct SysemuCPUOps mips_sysemu_ops = {
206
+ .legacy_vmsd = &vmstate_mips_cpu,
207
};
208
#endif
209
273
@@ -XXX,XX +XXX,XX @@ static void mips_cpu_class_init(ObjectClass *c, void *data)
210
@@ -XXX,XX +XXX,XX @@ static void mips_cpu_class_init(ObjectClass *c, void *data)
211
cc->gdb_write_register = mips_cpu_gdb_write_register;
212
#ifndef CONFIG_USER_ONLY
213
cc->get_phys_page_debug = mips_cpu_get_phys_page_debug;
214
- cc->legacy_vmsd = &vmstate_mips_cpu;
215
cc->sysemu_ops = &mips_sysemu_ops;
274
#endif
216
#endif
275
cc->disas_set_info = mips_cpu_disas_set_info;
217
cc->disas_set_info = mips_cpu_disas_set_info;
276
#ifdef CONFIG_TCG
218
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
277
- cc->tcg_initialize = mips_tcg_init;
219
index XXXXXXX..XXXXXXX 100644
278
+ cc->tcg_ops.initialize = mips_tcg_init;
220
--- a/target/ppc/cpu_init.c
279
cc->tlb_fill = mips_cpu_tlb_fill;
221
+++ b/target/ppc/cpu_init.c
280
#endif
222
@@ -XXX,XX +XXX,XX @@ static Property ppc_cpu_properties[] = {
281
223
#include "hw/core/sysemu-cpu-ops.h"
282
diff --git a/target/moxie/cpu.c b/target/moxie/cpu.c
224
283
index XXXXXXX..XXXXXXX 100644
225
static const struct SysemuCPUOps ppc_sysemu_ops = {
284
--- a/target/moxie/cpu.c
226
+ .legacy_vmsd = &vmstate_ppc_cpu,
285
+++ b/target/moxie/cpu.c
227
};
286
@@ -XXX,XX +XXX,XX @@ static void moxie_cpu_class_init(ObjectClass *oc, void *data)
228
#endif
287
cc->vmsd = &vmstate_moxie_cpu;
229
288
#endif
230
@@ -XXX,XX +XXX,XX @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
289
cc->disas_set_info = moxie_cpu_disas_set_info;
231
cc->gdb_write_register = ppc_cpu_gdb_write_register;
290
- cc->tcg_initialize = moxie_translate_init;
232
#ifndef CONFIG_USER_ONLY
291
+ cc->tcg_ops.initialize = moxie_translate_init;
233
cc->get_phys_page_debug = ppc_cpu_get_phys_page_debug;
292
}
234
- cc->legacy_vmsd = &vmstate_ppc_cpu;
293
235
cc->sysemu_ops = &ppc_sysemu_ops;
294
static void moxielite_initfn(Object *obj)
236
#endif
295
diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c
237
#if defined(CONFIG_SOFTMMU)
296
index XXXXXXX..XXXXXXX 100644
297
--- a/target/nios2/cpu.c
298
+++ b/target/nios2/cpu.c
299
@@ -XXX,XX +XXX,XX @@ static void nios2_cpu_class_init(ObjectClass *oc, void *data)
300
cc->gdb_read_register = nios2_cpu_gdb_read_register;
301
cc->gdb_write_register = nios2_cpu_gdb_write_register;
302
cc->gdb_num_core_regs = 49;
303
- cc->tcg_initialize = nios2_tcg_init;
304
+ cc->tcg_ops.initialize = nios2_tcg_init;
305
}
306
307
static const TypeInfo nios2_cpu_type_info = {
308
diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c
309
index XXXXXXX..XXXXXXX 100644
310
--- a/target/openrisc/cpu.c
311
+++ b/target/openrisc/cpu.c
312
@@ -XXX,XX +XXX,XX @@ static void openrisc_cpu_class_init(ObjectClass *oc, void *data)
313
dc->vmsd = &vmstate_openrisc_cpu;
314
#endif
315
cc->gdb_num_core_regs = 32 + 3;
316
- cc->tcg_initialize = openrisc_translate_init;
317
+ cc->tcg_ops.initialize = openrisc_translate_init;
318
cc->disas_set_info = openrisc_disas_set_info;
319
}
320
321
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
238
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
322
index XXXXXXX..XXXXXXX 100644
239
index XXXXXXX..XXXXXXX 100644
323
--- a/target/riscv/cpu.c
240
--- a/target/riscv/cpu.c
324
+++ b/target/riscv/cpu.c
241
+++ b/target/riscv/cpu.c
242
@@ -XXX,XX +XXX,XX @@ static const char *riscv_gdb_get_dynamic_xml(CPUState *cs, const char *xmlname)
243
#include "hw/core/sysemu-cpu-ops.h"
244
245
static const struct SysemuCPUOps riscv_sysemu_ops = {
246
+ .legacy_vmsd = &vmstate_riscv_cpu,
247
};
248
#endif
249
325
@@ -XXX,XX +XXX,XX @@ static void riscv_cpu_class_init(ObjectClass *c, void *data)
250
@@ -XXX,XX +XXX,XX @@ static void riscv_cpu_class_init(ObjectClass *c, void *data)
326
cc->gdb_arch_name = riscv_gdb_arch_name;
251
cc->disas_set_info = riscv_cpu_disas_set_info;
327
cc->gdb_get_dynamic_xml = riscv_gdb_get_dynamic_xml;
252
#ifndef CONFIG_USER_ONLY
328
#ifdef CONFIG_TCG
253
cc->get_phys_page_debug = riscv_cpu_get_phys_page_debug;
329
- cc->tcg_initialize = riscv_translate_init;
254
- cc->legacy_vmsd = &vmstate_riscv_cpu;
330
+ cc->tcg_ops.initialize = riscv_translate_init;
255
cc->sysemu_ops = &riscv_sysemu_ops;
331
cc->tlb_fill = riscv_cpu_tlb_fill;
256
cc->write_elf64_note = riscv_cpu_write_elf64_note;
332
#endif
257
cc->write_elf32_note = riscv_cpu_write_elf32_note;
333
device_class_set_props(dc, riscv_cpu_properties);
334
diff --git a/target/rx/cpu.c b/target/rx/cpu.c
335
index XXXXXXX..XXXXXXX 100644
336
--- a/target/rx/cpu.c
337
+++ b/target/rx/cpu.c
338
@@ -XXX,XX +XXX,XX @@ static void rx_cpu_class_init(ObjectClass *klass, void *data)
339
cc->gdb_write_register = rx_cpu_gdb_write_register;
340
cc->get_phys_page_debug = rx_cpu_get_phys_page_debug;
341
cc->disas_set_info = rx_cpu_disas_set_info;
342
- cc->tcg_initialize = rx_translate_init;
343
+ cc->tcg_ops.initialize = rx_translate_init;
344
cc->tlb_fill = rx_cpu_tlb_fill;
345
346
cc->gdb_num_core_regs = 26;
347
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
258
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
348
index XXXXXXX..XXXXXXX 100644
259
index XXXXXXX..XXXXXXX 100644
349
--- a/target/s390x/cpu.c
260
--- a/target/s390x/cpu.c
350
+++ b/target/s390x/cpu.c
261
+++ b/target/s390x/cpu.c
262
@@ -XXX,XX +XXX,XX @@ static void s390_cpu_reset_full(DeviceState *dev)
263
#include "hw/core/sysemu-cpu-ops.h"
264
265
static const struct SysemuCPUOps s390_sysemu_ops = {
266
+ .legacy_vmsd = &vmstate_s390_cpu,
267
};
268
#endif
269
351
@@ -XXX,XX +XXX,XX @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)
270
@@ -XXX,XX +XXX,XX @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)
352
#endif
271
cc->gdb_write_register = s390_cpu_gdb_write_register;
353
cc->disas_set_info = s390_cpu_disas_set_info;
272
#ifndef CONFIG_USER_ONLY
354
#ifdef CONFIG_TCG
273
cc->get_phys_page_debug = s390_cpu_get_phys_page_debug;
355
- cc->tcg_initialize = s390x_translate_init;
274
- cc->legacy_vmsd = &vmstate_s390_cpu;
356
+ cc->tcg_ops.initialize = s390x_translate_init;
275
cc->get_crash_info = s390_cpu_get_crash_info;
357
cc->tlb_fill = s390_cpu_tlb_fill;
276
cc->write_elf64_note = s390_cpu_write_elf64_note;
358
#endif
277
cc->sysemu_ops = &s390_sysemu_ops;
359
360
diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c
361
index XXXXXXX..XXXXXXX 100644
362
--- a/target/sh4/cpu.c
363
+++ b/target/sh4/cpu.c
364
@@ -XXX,XX +XXX,XX @@ static void superh_cpu_class_init(ObjectClass *oc, void *data)
365
cc->get_phys_page_debug = superh_cpu_get_phys_page_debug;
366
#endif
367
cc->disas_set_info = superh_cpu_disas_set_info;
368
- cc->tcg_initialize = sh4_translate_init;
369
+ cc->tcg_ops.initialize = sh4_translate_init;
370
371
cc->gdb_num_core_regs = 59;
372
373
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
278
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
374
index XXXXXXX..XXXXXXX 100644
279
index XXXXXXX..XXXXXXX 100644
375
--- a/target/sparc/cpu.c
280
--- a/target/sparc/cpu.c
376
+++ b/target/sparc/cpu.c
281
+++ b/target/sparc/cpu.c
282
@@ -XXX,XX +XXX,XX @@ static Property sparc_cpu_properties[] = {
283
#include "hw/core/sysemu-cpu-ops.h"
284
285
static const struct SysemuCPUOps sparc_sysemu_ops = {
286
+ .legacy_vmsd = &vmstate_sparc_cpu,
287
};
288
#endif
289
377
@@ -XXX,XX +XXX,XX @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data)
290
@@ -XXX,XX +XXX,XX @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data)
378
cc->vmsd = &vmstate_sparc_cpu;
291
cc->gdb_write_register = sparc_cpu_gdb_write_register;
292
#ifndef CONFIG_USER_ONLY
293
cc->get_phys_page_debug = sparc_cpu_get_phys_page_debug;
294
- cc->legacy_vmsd = &vmstate_sparc_cpu;
295
cc->sysemu_ops = &sparc_sysemu_ops;
379
#endif
296
#endif
380
cc->disas_set_info = cpu_sparc_disas_set_info;
297
cc->disas_set_info = cpu_sparc_disas_set_info;
381
- cc->tcg_initialize = sparc_tcg_init;
382
+ cc->tcg_ops.initialize = sparc_tcg_init;
383
384
#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
385
cc->gdb_num_core_regs = 86;
386
diff --git a/target/tilegx/cpu.c b/target/tilegx/cpu.c
387
index XXXXXXX..XXXXXXX 100644
388
--- a/target/tilegx/cpu.c
389
+++ b/target/tilegx/cpu.c
390
@@ -XXX,XX +XXX,XX @@ static void tilegx_cpu_class_init(ObjectClass *oc, void *data)
391
cc->set_pc = tilegx_cpu_set_pc;
392
cc->tlb_fill = tilegx_cpu_tlb_fill;
393
cc->gdb_num_core_regs = 0;
394
- cc->tcg_initialize = tilegx_tcg_init;
395
+ cc->tcg_ops.initialize = tilegx_tcg_init;
396
}
397
398
static const TypeInfo tilegx_cpu_type_info = {
399
diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c
400
index XXXXXXX..XXXXXXX 100644
401
--- a/target/tricore/cpu.c
402
+++ b/target/tricore/cpu.c
403
@@ -XXX,XX +XXX,XX @@ static void tricore_cpu_class_init(ObjectClass *c, void *data)
404
cc->set_pc = tricore_cpu_set_pc;
405
cc->synchronize_from_tb = tricore_cpu_synchronize_from_tb;
406
cc->get_phys_page_debug = tricore_cpu_get_phys_page_debug;
407
- cc->tcg_initialize = tricore_tcg_init;
408
+ cc->tcg_ops.initialize = tricore_tcg_init;
409
cc->tlb_fill = tricore_cpu_tlb_fill;
410
}
411
412
diff --git a/target/unicore32/cpu.c b/target/unicore32/cpu.c
413
index XXXXXXX..XXXXXXX 100644
414
--- a/target/unicore32/cpu.c
415
+++ b/target/unicore32/cpu.c
416
@@ -XXX,XX +XXX,XX @@ static void uc32_cpu_class_init(ObjectClass *oc, void *data)
417
cc->set_pc = uc32_cpu_set_pc;
418
cc->tlb_fill = uc32_cpu_tlb_fill;
419
cc->get_phys_page_debug = uc32_cpu_get_phys_page_debug;
420
- cc->tcg_initialize = uc32_translate_init;
421
+ cc->tcg_ops.initialize = uc32_translate_init;
422
dc->vmsd = &vmstate_uc32_cpu;
423
}
424
425
diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c
426
index XXXXXXX..XXXXXXX 100644
427
--- a/target/xtensa/cpu.c
428
+++ b/target/xtensa/cpu.c
429
@@ -XXX,XX +XXX,XX @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data)
430
#endif
431
cc->debug_excp_handler = xtensa_breakpoint_handler;
432
cc->disas_set_info = xtensa_cpu_disas_set_info;
433
- cc->tcg_initialize = xtensa_translate_init;
434
+ cc->tcg_ops.initialize = xtensa_translate_init;
435
dc->vmsd = &vmstate_xtensa_cpu;
436
}
437
438
diff --git a/target/ppc/translate_init.c.inc b/target/ppc/translate_init.c.inc
439
index XXXXXXX..XXXXXXX 100644
440
--- a/target/ppc/translate_init.c.inc
441
+++ b/target/ppc/translate_init.c.inc
442
@@ -XXX,XX +XXX,XX @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
443
cc->virtio_is_big_endian = ppc_cpu_is_big_endian;
444
#endif
445
#ifdef CONFIG_TCG
446
- cc->tcg_initialize = ppc_translate_init;
447
+ cc->tcg_ops.initialize = ppc_translate_init;
448
cc->tlb_fill = ppc_cpu_tlb_fill;
449
#endif
450
#ifndef CONFIG_USER_ONLY
451
--
298
--
452
2.25.1
299
2.25.1
453
300
454
301
diff view generated by jsdifflib
1
From: Claudio Fontana <cfontana@suse.de>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
make it consistently SOFTMMU-only.
3
VirtIO devices are only meaningful with system emulation.
4
4
5
Signed-off-by: Claudio Fontana <cfontana@suse.de>
5
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
7
Message-Id: <20210517105140.1062037-17-f4bug@amsat.org>
10
[claudio: make the field presence in cpu.h unconditional, removing the ifdefs]
11
Message-Id: <20210204163931.7358-12-cfontana@suse.de>
12
13
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
14
---
9
---
15
include/hw/core/cpu.h | 13 +++++++------
10
include/hw/core/cpu.h | 5 -----
16
target/alpha/cpu.c | 2 +-
11
include/hw/core/sysemu-cpu-ops.h | 9 +++++++++
17
target/arm/cpu.c | 2 +-
12
hw/core/cpu-sysemu.c | 5 +++--
18
target/hppa/cpu.c | 4 +++-
13
target/arm/cpu.c | 2 +-
19
target/microblaze/cpu.c | 2 +-
14
target/ppc/cpu_init.c | 4 +---
20
target/mips/cpu.c | 3 ++-
15
5 files changed, 14 insertions(+), 11 deletions(-)
21
target/nios2/cpu.c | 2 +-
22
target/riscv/cpu.c | 2 +-
23
target/s390x/cpu.c | 2 +-
24
target/s390x/excp_helper.c | 2 +-
25
target/sh4/cpu.c | 2 +-
26
target/sparc/cpu.c | 2 +-
27
target/xtensa/cpu.c | 2 +-
28
target/ppc/translate_init.c.inc | 2 +-
29
14 files changed, 23 insertions(+), 19 deletions(-)
30
16
31
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
17
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
32
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
33
--- a/include/hw/core/cpu.h
19
--- a/include/hw/core/cpu.h
34
+++ b/include/hw/core/cpu.h
20
+++ b/include/hw/core/cpu.h
35
@@ -XXX,XX +XXX,XX @@ typedef struct TcgCpuOperations {
21
@@ -XXX,XX +XXX,XX @@ struct SysemuCPUOps;
36
unsigned size, MMUAccessType access_type,
37
int mmu_idx, MemTxAttrs attrs,
38
MemTxResult response, uintptr_t retaddr);
39
+ /**
40
+ * @do_unaligned_access: Callback for unaligned access handling
41
+ */
42
+ void (*do_unaligned_access)(CPUState *cpu, vaddr addr,
43
+ MMUAccessType access_type,
44
+ int mmu_idx, uintptr_t retaddr);
45
} TcgCpuOperations;
46
47
/**
48
@@ -XXX,XX +XXX,XX @@ typedef struct TcgCpuOperations {
49
* @parse_features: Callback to parse command line arguments.
22
* @parse_features: Callback to parse command line arguments.
50
* @reset_dump_flags: #CPUDumpFlags to use for reset logging.
23
* @reset_dump_flags: #CPUDumpFlags to use for reset logging.
51
* @has_work: Callback for checking if there is work to do.
24
* @has_work: Callback for checking if there is work to do.
52
- * @do_unaligned_access: Callback for unaligned access handling, if
25
- * @virtio_is_big_endian: Callback to return %true if a CPU which supports
53
- * the target defines #TARGET_ALIGNED_ONLY.
26
- * runtime configurable endianness is currently big-endian. Non-configurable
54
* @virtio_is_big_endian: Callback to return %true if a CPU which supports
27
- * CPUs can use the default implementation of this method. This method should
55
* runtime configurable endianness is currently big-endian. Non-configurable
28
- * not be used by any callers other than the pre-1.0 virtio devices.
56
* CPUs can use the default implementation of this method. This method should
29
* @memory_rw_debug: Callback for GDB memory access.
30
* @dump_state: Callback for dumping state.
31
* @dump_statistics: Callback for dumping statistics.
57
@@ -XXX,XX +XXX,XX @@ struct CPUClass {
32
@@ -XXX,XX +XXX,XX @@ struct CPUClass {
58
33
59
int reset_dump_flags;
34
int reset_dump_flags;
60
bool (*has_work)(CPUState *cpu);
35
bool (*has_work)(CPUState *cpu);
61
- void (*do_unaligned_access)(CPUState *cpu, vaddr addr,
36
- bool (*virtio_is_big_endian)(CPUState *cpu);
62
- MMUAccessType access_type,
63
- int mmu_idx, uintptr_t retaddr);
64
bool (*virtio_is_big_endian)(CPUState *cpu);
65
int (*memory_rw_debug)(CPUState *cpu, vaddr addr,
37
int (*memory_rw_debug)(CPUState *cpu, vaddr addr,
66
uint8_t *buf, int len, bool is_write);
38
uint8_t *buf, int len, bool is_write);
67
@@ -XXX,XX +XXX,XX @@ static inline void cpu_unaligned_access(CPUState *cpu, vaddr addr,
39
void (*dump_state)(CPUState *cpu, FILE *, int flags);
40
diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h
41
index XXXXXXX..XXXXXXX 100644
42
--- a/include/hw/core/sysemu-cpu-ops.h
43
+++ b/include/hw/core/sysemu-cpu-ops.h
44
@@ -XXX,XX +XXX,XX @@
45
* struct SysemuCPUOps: System operations specific to a CPU class
46
*/
47
typedef struct SysemuCPUOps {
48
+ /**
49
+ * @virtio_is_big_endian: Callback to return %true if a CPU which supports
50
+ * runtime configurable endianness is currently big-endian.
51
+ * Non-configurable CPUs can use the default implementation of this method.
52
+ * This method should not be used by any callers other than the pre-1.0
53
+ * virtio devices.
54
+ */
55
+ bool (*virtio_is_big_endian)(CPUState *cpu);
56
+
57
/**
58
* @legacy_vmsd: Legacy state for migration.
59
* Do not use in new targets, use #DeviceClass::vmsd instead.
60
diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c
61
index XXXXXXX..XXXXXXX 100644
62
--- a/hw/core/cpu-sysemu.c
63
+++ b/hw/core/cpu-sysemu.c
64
@@ -XXX,XX +XXX,XX @@
65
#include "qemu/osdep.h"
66
#include "qapi/error.h"
67
#include "hw/core/cpu.h"
68
+#include "hw/core/sysemu-cpu-ops.h"
69
70
bool cpu_paging_enabled(const CPUState *cpu)
71
{
72
@@ -XXX,XX +XXX,XX @@ bool cpu_virtio_is_big_endian(CPUState *cpu)
68
{
73
{
69
CPUClass *cc = CPU_GET_CLASS(cpu);
74
CPUClass *cc = CPU_GET_CLASS(cpu);
70
75
71
- cc->do_unaligned_access(cpu, addr, access_type, mmu_idx, retaddr);
76
- if (cc->virtio_is_big_endian) {
72
+ cc->tcg_ops.do_unaligned_access(cpu, addr, access_type, mmu_idx, retaddr);
77
- return cc->virtio_is_big_endian(cpu);
78
+ if (cc->sysemu_ops->virtio_is_big_endian) {
79
+ return cc->sysemu_ops->virtio_is_big_endian(cpu);
80
}
81
return target_words_bigendian();
73
}
82
}
74
75
static inline void cpu_transaction_failed(CPUState *cpu, hwaddr physaddr,
76
diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c
77
index XXXXXXX..XXXXXXX 100644
78
--- a/target/alpha/cpu.c
79
+++ b/target/alpha/cpu.c
80
@@ -XXX,XX +XXX,XX @@ static void alpha_cpu_class_init(ObjectClass *oc, void *data)
81
cc->tcg_ops.tlb_fill = alpha_cpu_tlb_fill;
82
#ifndef CONFIG_USER_ONLY
83
cc->tcg_ops.do_transaction_failed = alpha_cpu_do_transaction_failed;
84
- cc->do_unaligned_access = alpha_cpu_do_unaligned_access;
85
+ cc->tcg_ops.do_unaligned_access = alpha_cpu_do_unaligned_access;
86
cc->get_phys_page_debug = alpha_cpu_get_phys_page_debug;
87
dc->vmsd = &vmstate_alpha_cpu;
88
#endif
89
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
83
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
90
index XXXXXXX..XXXXXXX 100644
84
index XXXXXXX..XXXXXXX 100644
91
--- a/target/arm/cpu.c
85
--- a/target/arm/cpu.c
92
+++ b/target/arm/cpu.c
86
+++ b/target/arm/cpu.c
87
@@ -XXX,XX +XXX,XX @@ static gchar *arm_gdb_arch_name(CPUState *cs)
88
#include "hw/core/sysemu-cpu-ops.h"
89
90
static const struct SysemuCPUOps arm_sysemu_ops = {
91
+ .virtio_is_big_endian = arm_cpu_virtio_is_big_endian,
92
.legacy_vmsd = &vmstate_arm_cpu,
93
};
94
#endif
93
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
95
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
94
cc->tcg_ops.tlb_fill = arm_cpu_tlb_fill;
96
#ifndef CONFIG_USER_ONLY
95
cc->tcg_ops.debug_excp_handler = arm_debug_excp_handler;
97
cc->get_phys_page_attrs_debug = arm_cpu_get_phys_page_attrs_debug;
96
cc->debug_check_watchpoint = arm_debug_check_watchpoint;
98
cc->asidx_from_attrs = arm_asidx_from_attrs;
97
- cc->do_unaligned_access = arm_cpu_do_unaligned_access;
99
- cc->virtio_is_big_endian = arm_cpu_virtio_is_big_endian;
98
#if !defined(CONFIG_USER_ONLY)
100
cc->write_elf64_note = arm_cpu_write_elf64_note;
99
cc->tcg_ops.do_transaction_failed = arm_cpu_do_transaction_failed;
101
cc->write_elf32_note = arm_cpu_write_elf32_note;
100
+ cc->tcg_ops.do_unaligned_access = arm_cpu_do_unaligned_access;
102
cc->sysemu_ops = &arm_sysemu_ops;
101
cc->adjust_watchpoint_address = arm_adjust_watchpoint_address;
103
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
102
cc->tcg_ops.do_interrupt = arm_cpu_do_interrupt;
103
#endif /* CONFIG_TCG && !CONFIG_USER_ONLY */
104
diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
105
index XXXXXXX..XXXXXXX 100644
104
index XXXXXXX..XXXXXXX 100644
106
--- a/target/hppa/cpu.c
105
--- a/target/ppc/cpu_init.c
107
+++ b/target/hppa/cpu.c
106
+++ b/target/ppc/cpu_init.c
108
@@ -XXX,XX +XXX,XX @@ static void hppa_cpu_disas_set_info(CPUState *cs, disassemble_info *info)
107
@@ -XXX,XX +XXX,XX @@ static Property ppc_cpu_properties[] = {
109
info->print_insn = print_insn_hppa;
108
#include "hw/core/sysemu-cpu-ops.h"
110
}
109
111
110
static const struct SysemuCPUOps ppc_sysemu_ops = {
112
+#ifndef CONFIG_USER_ONLY
111
+ .virtio_is_big_endian = ppc_cpu_is_big_endian,
113
static void hppa_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
112
.legacy_vmsd = &vmstate_ppc_cpu,
114
MMUAccessType access_type,
113
};
115
int mmu_idx, uintptr_t retaddr)
116
@@ -XXX,XX +XXX,XX @@ static void hppa_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
117
118
cpu_loop_exit_restore(cs, retaddr);
119
}
120
+#endif /* CONFIG_USER_ONLY */
121
122
static void hppa_cpu_realizefn(DeviceState *dev, Error **errp)
123
{
124
@@ -XXX,XX +XXX,XX @@ static void hppa_cpu_class_init(ObjectClass *oc, void *data)
125
cc->tcg_ops.tlb_fill = hppa_cpu_tlb_fill;
126
#ifndef CONFIG_USER_ONLY
127
cc->get_phys_page_debug = hppa_cpu_get_phys_page_debug;
128
+ cc->tcg_ops.do_unaligned_access = hppa_cpu_do_unaligned_access;
129
dc->vmsd = &vmstate_hppa_cpu;
130
#endif
114
#endif
131
- cc->do_unaligned_access = hppa_cpu_do_unaligned_access;
115
@@ -XXX,XX +XXX,XX @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
132
cc->disas_set_info = hppa_cpu_disas_set_info;
116
cc->gdb_core_xml_file = "power64-core.xml";
133
cc->tcg_ops.initialize = hppa_translate_init;
117
#else
134
118
cc->gdb_core_xml_file = "power-core.xml";
135
diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c
119
-#endif
136
index XXXXXXX..XXXXXXX 100644
120
-#ifndef CONFIG_USER_ONLY
137
--- a/target/microblaze/cpu.c
121
- cc->virtio_is_big_endian = ppc_cpu_is_big_endian;
138
+++ b/target/microblaze/cpu.c
139
@@ -XXX,XX +XXX,XX @@ static void mb_cpu_class_init(ObjectClass *oc, void *data)
140
cc->class_by_name = mb_cpu_class_by_name;
141
cc->has_work = mb_cpu_has_work;
142
cc->tcg_ops.do_interrupt = mb_cpu_do_interrupt;
143
- cc->do_unaligned_access = mb_cpu_do_unaligned_access;
144
cc->tcg_ops.cpu_exec_interrupt = mb_cpu_exec_interrupt;
145
cc->dump_state = mb_cpu_dump_state;
146
cc->set_pc = mb_cpu_set_pc;
147
@@ -XXX,XX +XXX,XX @@ static void mb_cpu_class_init(ObjectClass *oc, void *data)
148
cc->tcg_ops.tlb_fill = mb_cpu_tlb_fill;
149
#ifndef CONFIG_USER_ONLY
150
cc->tcg_ops.do_transaction_failed = mb_cpu_transaction_failed;
151
+ cc->tcg_ops.do_unaligned_access = mb_cpu_do_unaligned_access;
152
cc->get_phys_page_attrs_debug = mb_cpu_get_phys_page_attrs_debug;
153
dc->vmsd = &vmstate_mb_cpu;
154
#endif
122
#endif
155
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
123
cc->disas_set_info = ppc_disas_set_info;
156
index XXXXXXX..XXXXXXX 100644
157
--- a/target/mips/cpu.c
158
+++ b/target/mips/cpu.c
159
@@ -XXX,XX +XXX,XX @@ static void mips_cpu_class_init(ObjectClass *c, void *data)
160
cc->gdb_read_register = mips_cpu_gdb_read_register;
161
cc->gdb_write_register = mips_cpu_gdb_write_register;
162
#ifndef CONFIG_USER_ONLY
163
- cc->do_unaligned_access = mips_cpu_do_unaligned_access;
164
cc->get_phys_page_debug = mips_cpu_get_phys_page_debug;
165
cc->vmsd = &vmstate_mips_cpu;
166
#endif
167
@@ -XXX,XX +XXX,XX @@ static void mips_cpu_class_init(ObjectClass *c, void *data)
168
cc->tcg_ops.tlb_fill = mips_cpu_tlb_fill;
169
#ifndef CONFIG_USER_ONLY
170
cc->tcg_ops.do_transaction_failed = mips_cpu_do_transaction_failed;
171
+ cc->tcg_ops.do_unaligned_access = mips_cpu_do_unaligned_access;
172
+
173
#endif /* CONFIG_USER_ONLY */
174
#endif /* CONFIG_TCG */
175
176
diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c
177
index XXXXXXX..XXXXXXX 100644
178
--- a/target/nios2/cpu.c
179
+++ b/target/nios2/cpu.c
180
@@ -XXX,XX +XXX,XX @@ static void nios2_cpu_class_init(ObjectClass *oc, void *data)
181
cc->disas_set_info = nios2_cpu_disas_set_info;
182
cc->tcg_ops.tlb_fill = nios2_cpu_tlb_fill;
183
#ifndef CONFIG_USER_ONLY
184
- cc->do_unaligned_access = nios2_cpu_do_unaligned_access;
185
+ cc->tcg_ops.do_unaligned_access = nios2_cpu_do_unaligned_access;
186
cc->get_phys_page_debug = nios2_cpu_get_phys_page_debug;
187
#endif
188
cc->gdb_read_register = nios2_cpu_gdb_read_register;
189
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
190
index XXXXXXX..XXXXXXX 100644
191
--- a/target/riscv/cpu.c
192
+++ b/target/riscv/cpu.c
193
@@ -XXX,XX +XXX,XX @@ static void riscv_cpu_class_init(ObjectClass *c, void *data)
194
cc->disas_set_info = riscv_cpu_disas_set_info;
195
#ifndef CONFIG_USER_ONLY
196
cc->tcg_ops.do_transaction_failed = riscv_cpu_do_transaction_failed;
197
- cc->do_unaligned_access = riscv_cpu_do_unaligned_access;
198
+ cc->tcg_ops.do_unaligned_access = riscv_cpu_do_unaligned_access;
199
cc->get_phys_page_debug = riscv_cpu_get_phys_page_debug;
200
/* For now, mark unmigratable: */
201
cc->vmsd = &vmstate_riscv_cpu;
202
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
203
index XXXXXXX..XXXXXXX 100644
204
--- a/target/s390x/cpu.c
205
+++ b/target/s390x/cpu.c
206
@@ -XXX,XX +XXX,XX @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)
207
#ifdef CONFIG_TCG
208
cc->tcg_ops.cpu_exec_interrupt = s390_cpu_exec_interrupt;
209
cc->tcg_ops.debug_excp_handler = s390x_cpu_debug_excp_handler;
210
- cc->do_unaligned_access = s390x_cpu_do_unaligned_access;
211
+ cc->tcg_ops.do_unaligned_access = s390x_cpu_do_unaligned_access;
212
#endif
213
#endif
214
cc->disas_set_info = s390_cpu_disas_set_info;
215
diff --git a/target/s390x/excp_helper.c b/target/s390x/excp_helper.c
216
index XXXXXXX..XXXXXXX 100644
217
--- a/target/s390x/excp_helper.c
218
+++ b/target/s390x/excp_helper.c
219
@@ -XXX,XX +XXX,XX @@ void HELPER(monitor_call)(CPUS390XState *env, uint64_t monitor_code,
220
}
221
}
222
223
-#endif /* CONFIG_USER_ONLY */
224
+#endif /* !CONFIG_USER_ONLY */
225
diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c
226
index XXXXXXX..XXXXXXX 100644
227
--- a/target/sh4/cpu.c
228
+++ b/target/sh4/cpu.c
229
@@ -XXX,XX +XXX,XX @@ static void superh_cpu_class_init(ObjectClass *oc, void *data)
230
cc->gdb_write_register = superh_cpu_gdb_write_register;
231
cc->tcg_ops.tlb_fill = superh_cpu_tlb_fill;
232
#ifndef CONFIG_USER_ONLY
233
- cc->do_unaligned_access = superh_cpu_do_unaligned_access;
234
+ cc->tcg_ops.do_unaligned_access = superh_cpu_do_unaligned_access;
235
cc->get_phys_page_debug = superh_cpu_get_phys_page_debug;
236
#endif
237
cc->disas_set_info = superh_cpu_disas_set_info;
238
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
239
index XXXXXXX..XXXXXXX 100644
240
--- a/target/sparc/cpu.c
241
+++ b/target/sparc/cpu.c
242
@@ -XXX,XX +XXX,XX @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data)
243
cc->tcg_ops.tlb_fill = sparc_cpu_tlb_fill;
244
#ifndef CONFIG_USER_ONLY
245
cc->tcg_ops.do_transaction_failed = sparc_cpu_do_transaction_failed;
246
- cc->do_unaligned_access = sparc_cpu_do_unaligned_access;
247
+ cc->tcg_ops.do_unaligned_access = sparc_cpu_do_unaligned_access;
248
cc->get_phys_page_debug = sparc_cpu_get_phys_page_debug;
249
cc->vmsd = &vmstate_sparc_cpu;
250
#endif
251
diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c
252
index XXXXXXX..XXXXXXX 100644
253
--- a/target/xtensa/cpu.c
254
+++ b/target/xtensa/cpu.c
255
@@ -XXX,XX +XXX,XX @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data)
256
cc->gdb_stop_before_watchpoint = true;
257
cc->tcg_ops.tlb_fill = xtensa_cpu_tlb_fill;
258
#ifndef CONFIG_USER_ONLY
259
- cc->do_unaligned_access = xtensa_cpu_do_unaligned_access;
260
+ cc->tcg_ops.do_unaligned_access = xtensa_cpu_do_unaligned_access;
261
cc->get_phys_page_debug = xtensa_cpu_get_phys_page_debug;
262
cc->tcg_ops.do_transaction_failed = xtensa_cpu_do_transaction_failed;
263
#endif
264
diff --git a/target/ppc/translate_init.c.inc b/target/ppc/translate_init.c.inc
265
index XXXXXXX..XXXXXXX 100644
266
--- a/target/ppc/translate_init.c.inc
267
+++ b/target/ppc/translate_init.c.inc
268
@@ -XXX,XX +XXX,XX @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
269
cc->set_pc = ppc_cpu_set_pc;
270
cc->gdb_read_register = ppc_cpu_gdb_read_register;
271
cc->gdb_write_register = ppc_cpu_gdb_write_register;
272
- cc->do_unaligned_access = ppc_cpu_do_unaligned_access;
273
#ifndef CONFIG_USER_ONLY
274
cc->get_phys_page_debug = ppc_cpu_get_phys_page_debug;
275
cc->vmsd = &vmstate_ppc_cpu;
276
@@ -XXX,XX +XXX,XX @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
277
#ifndef CONFIG_USER_ONLY
278
cc->tcg_ops.cpu_exec_enter = ppc_cpu_exec_enter;
279
cc->tcg_ops.cpu_exec_exit = ppc_cpu_exec_exit;
280
+ cc->tcg_ops.do_unaligned_access = ppc_cpu_do_unaligned_access;
281
#endif /* !CONFIG_USER_ONLY */
282
#endif /* CONFIG_TCG */
283
124
284
--
125
--
285
2.25.1
126
2.25.1
286
127
287
128
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
"exec/cpu-defs.h" contains generic CPU definitions for the
3
cpu_get_crash_info() is called on GUEST_PANICKED events,
4
TCG frontends (mostly related to TLB). TCG backends definitions
4
which only occur in system emulation.
5
aren't relevant here.
6
7
See tcg/README description:
8
9
4) Backend
10
11
tcg-target.h contains the target specific definitions. tcg-target.c.inc
12
contains the target specific code; it is #included by tcg/tcg.c, rather
13
than being a standalone C file.
14
15
So far only "tcg/tcg.h" requires these headers.
16
17
Remove the "target-tcg.h" header dependency on TCG frontends, so we
18
don't have to rebuild all frontends when hacking a single backend.
19
5
20
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
21
Message-Id: <20210204191423.1754158-1-f4bug@amsat.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-Id: <20210517105140.1062037-18-f4bug@amsat.org>
22
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
23
---
10
---
24
include/exec/cpu-defs.h | 3 ---
11
include/hw/core/cpu.h | 1 -
25
1 file changed, 3 deletions(-)
12
include/hw/core/sysemu-cpu-ops.h | 5 +++++
13
hw/core/cpu-sysemu.c | 4 ++--
14
target/i386/cpu.c | 2 +-
15
target/s390x/cpu.c | 2 +-
16
5 files changed, 9 insertions(+), 5 deletions(-)
26
17
27
diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h
18
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
28
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
29
--- a/include/exec/cpu-defs.h
20
--- a/include/hw/core/cpu.h
30
+++ b/include/exec/cpu-defs.h
21
+++ b/include/hw/core/cpu.h
22
@@ -XXX,XX +XXX,XX @@ struct CPUClass {
23
int (*memory_rw_debug)(CPUState *cpu, vaddr addr,
24
uint8_t *buf, int len, bool is_write);
25
void (*dump_state)(CPUState *cpu, FILE *, int flags);
26
- GuestPanicInformation* (*get_crash_info)(CPUState *cpu);
27
void (*dump_statistics)(CPUState *cpu, int flags);
28
int64_t (*get_arch_id)(CPUState *cpu);
29
bool (*get_paging_enabled)(const CPUState *cpu);
30
diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h
31
index XXXXXXX..XXXXXXX 100644
32
--- a/include/hw/core/sysemu-cpu-ops.h
33
+++ b/include/hw/core/sysemu-cpu-ops.h
31
@@ -XXX,XX +XXX,XX @@
34
@@ -XXX,XX +XXX,XX @@
32
35
* struct SysemuCPUOps: System operations specific to a CPU class
33
#include "qemu/host-utils.h"
36
*/
34
#include "qemu/thread.h"
37
typedef struct SysemuCPUOps {
35
-#ifdef CONFIG_TCG
38
+ /**
36
-#include "tcg-target.h"
39
+ * @get_crash_info: Callback for reporting guest crash information in
37
-#endif
40
+ * GUEST_PANICKED events.
41
+ */
42
+ GuestPanicInformation* (*get_crash_info)(CPUState *cpu);
43
/**
44
* @virtio_is_big_endian: Callback to return %true if a CPU which supports
45
* runtime configurable endianness is currently big-endian.
46
diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c
47
index XXXXXXX..XXXXXXX 100644
48
--- a/hw/core/cpu-sysemu.c
49
+++ b/hw/core/cpu-sysemu.c
50
@@ -XXX,XX +XXX,XX @@ GuestPanicInformation *cpu_get_crash_info(CPUState *cpu)
51
CPUClass *cc = CPU_GET_CLASS(cpu);
52
GuestPanicInformation *res = NULL;
53
54
- if (cc->get_crash_info) {
55
- res = cc->get_crash_info(cpu);
56
+ if (cc->sysemu_ops->get_crash_info) {
57
+ res = cc->sysemu_ops->get_crash_info(cpu);
58
}
59
return res;
60
}
61
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
62
index XXXXXXX..XXXXXXX 100644
63
--- a/target/i386/cpu.c
64
+++ b/target/i386/cpu.c
65
@@ -XXX,XX +XXX,XX @@ static Property x86_cpu_properties[] = {
66
#include "hw/core/sysemu-cpu-ops.h"
67
68
static const struct SysemuCPUOps i386_sysemu_ops = {
69
+ .get_crash_info = x86_cpu_get_crash_info,
70
.legacy_vmsd = &vmstate_x86_cpu,
71
};
72
#endif
73
@@ -XXX,XX +XXX,XX @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
74
cc->asidx_from_attrs = x86_asidx_from_attrs;
75
cc->get_memory_mapping = x86_cpu_get_memory_mapping;
76
cc->get_phys_page_attrs_debug = x86_cpu_get_phys_page_attrs_debug;
77
- cc->get_crash_info = x86_cpu_get_crash_info;
78
cc->write_elf64_note = x86_cpu_write_elf64_note;
79
cc->write_elf64_qemunote = x86_cpu_write_elf64_qemunote;
80
cc->write_elf32_note = x86_cpu_write_elf32_note;
81
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
82
index XXXXXXX..XXXXXXX 100644
83
--- a/target/s390x/cpu.c
84
+++ b/target/s390x/cpu.c
85
@@ -XXX,XX +XXX,XX @@ static void s390_cpu_reset_full(DeviceState *dev)
86
#include "hw/core/sysemu-cpu-ops.h"
87
88
static const struct SysemuCPUOps s390_sysemu_ops = {
89
+ .get_crash_info = s390_cpu_get_crash_info,
90
.legacy_vmsd = &vmstate_s390_cpu,
91
};
92
#endif
93
@@ -XXX,XX +XXX,XX @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)
94
cc->gdb_write_register = s390_cpu_gdb_write_register;
38
#ifndef CONFIG_USER_ONLY
95
#ifndef CONFIG_USER_ONLY
39
#include "exec/hwaddr.h"
96
cc->get_phys_page_debug = s390_cpu_get_phys_page_debug;
97
- cc->get_crash_info = s390_cpu_get_crash_info;
98
cc->write_elf64_note = s390_cpu_write_elf64_note;
99
cc->sysemu_ops = &s390_sysemu_ops;
40
#endif
100
#endif
41
--
101
--
42
2.25.1
102
2.25.1
43
103
44
104
diff view generated by jsdifflib
Deleted patch
1
The configure option was backward, and we failed to
2
pass the value on to meson.
3
1
4
Fixes: 23a77b2d18b ("build-system: clean up TCG/TCI configury")
5
Tested-by: Stefan Weil <sw@weilnetz.de>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
9
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11
---
12
configure | 5 +++--
13
1 file changed, 3 insertions(+), 2 deletions(-)
14
15
diff --git a/configure b/configure
16
index XXXXXXX..XXXXXXX 100755
17
--- a/configure
18
+++ b/configure
19
@@ -XXX,XX +XXX,XX @@ for opt do
20
;;
21
--enable-whpx) whpx="enabled"
22
;;
23
- --disable-tcg-interpreter) tcg_interpreter="true"
24
+ --disable-tcg-interpreter) tcg_interpreter="false"
25
;;
26
- --enable-tcg-interpreter) tcg_interpreter="false"
27
+ --enable-tcg-interpreter) tcg_interpreter="true"
28
;;
29
--disable-cap-ng) cap_ng="disabled"
30
;;
31
@@ -XXX,XX +XXX,XX @@ NINJA=$ninja $meson setup \
32
-Dvhost_user_blk_server=$vhost_user_blk_server \
33
-Dfuse=$fuse -Dfuse_lseek=$fuse_lseek -Dguest_agent_msi=$guest_agent_msi \
34
$(if test "$default_features" = no; then echo "-Dauto_features=disabled"; fi) \
35
+    -Dtcg_interpreter=$tcg_interpreter \
36
$cross_arg \
37
"$PWD" "$source_path"
38
39
--
40
2.25.1
41
42
diff view generated by jsdifflib
Deleted patch
1
From: Stefan Weil <sw@weilnetz.de>
2
1
3
That TCG opcode is used by debian-buster (arm64) running ffmpeg:
4
5
qemu-aarch64 /usr/bin/ffmpeg -i theora.mkv theora.webm
6
7
Tested-by: Alex Bennée <alex.bennee@linaro.org>
8
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
9
Reported-by: Alex Bennée <alex.bennee@linaro.org>
10
Signed-off-by: Stefan Weil <sw@weilnetz.de>
11
Message-Id: <20210128024814.2056958-1-sw@weilnetz.de>
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
---
14
tcg/tci.c | 5 ++++-
15
1 file changed, 4 insertions(+), 1 deletion(-)
16
17
diff --git a/tcg/tci.c b/tcg/tci.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/tcg/tci.c
20
+++ b/tcg/tci.c
21
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
22
TODO();
23
break;
24
case INDEX_op_ld16s_i32:
25
- TODO();
26
+ t0 = *tb_ptr++;
27
+ t1 = tci_read_r(regs, &tb_ptr);
28
+ t2 = tci_read_s32(&tb_ptr);
29
+ tci_write_reg(regs, t0, *(int16_t *)(t1 + t2));
30
break;
31
case INDEX_op_ld_i32:
32
t0 = *tb_ptr++;
33
--
34
2.25.1
35
36
diff view generated by jsdifflib
Deleted patch
1
From: Stefan Weil <sw@weilnetz.de>
2
1
3
That TCG opcode is used by debian-buster (arm64) running ffmpeg:
4
5
qemu-aarch64 /usr/bin/ffmpeg -i theora.mkv theora.webm
6
7
Tested-by: Alex Bennée <alex.bennee@linaro.org>
8
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
9
Reported-by: Alex Bennée <alex.bennee@linaro.org>
10
Signed-off-by: Stefan Weil <sw@weilnetz.de>
11
Message-Id: <20210128020425.2055454-1-sw@weilnetz.de>
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
---
14
tcg/tci.c | 5 ++++-
15
1 file changed, 4 insertions(+), 1 deletion(-)
16
17
diff --git a/tcg/tci.c b/tcg/tci.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/tcg/tci.c
20
+++ b/tcg/tci.c
21
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
22
tci_write_reg8(regs, t0, *(uint8_t *)(t1 + t2));
23
break;
24
case INDEX_op_ld8s_i64:
25
- TODO();
26
+ t0 = *tb_ptr++;
27
+ t1 = tci_read_r(regs, &tb_ptr);
28
+ t2 = tci_read_s32(&tb_ptr);
29
+ tci_write_reg(regs, t0, *(int8_t *)(t1 + t2));
30
break;
31
case INDEX_op_ld16u_i64:
32
t0 = *tb_ptr++;
33
--
34
2.25.1
35
36
diff view generated by jsdifflib
1
From: Eduardo Habkost <ehabkost@redhat.com>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3
The write_elf*() handlers are used to dump vmcore images.
4
Signed-off-by: Claudio Fontana <cfontana@suse.de>
4
This feature is only meaningful for system emulation.
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
6
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-Id: <20210204163931.7358-8-cfontana@suse.de>
8
Message-Id: <20210517105140.1062037-19-f4bug@amsat.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
---
10
---
10
include/hw/core/cpu.h | 4 ++--
11
include/hw/core/cpu.h | 17 -----------------
11
accel/tcg/cpu-exec.c | 4 ++--
12
include/hw/core/sysemu-cpu-ops.h | 24 ++++++++++++++++++++++++
12
target/arm/cpu.c | 2 +-
13
hw/core/cpu-sysemu.c | 16 ++++++++--------
13
target/i386/tcg/tcg-cpu.c | 2 +-
14
target/arm/cpu.c | 4 ++--
14
target/lm32/cpu.c | 2 +-
15
target/i386/cpu.c | 8 ++++----
15
target/s390x/cpu.c | 2 +-
16
target/ppc/cpu_init.c | 6 ++----
16
target/xtensa/cpu.c | 2 +-
17
target/riscv/cpu.c | 4 ++--
17
7 files changed, 9 insertions(+), 9 deletions(-)
18
target/s390x/cpu.c | 2 +-
19
8 files changed, 43 insertions(+), 38 deletions(-)
18
20
19
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
21
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
20
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
21
--- a/include/hw/core/cpu.h
23
--- a/include/hw/core/cpu.h
22
+++ b/include/hw/core/cpu.h
24
+++ b/include/hw/core/cpu.h
23
@@ -XXX,XX +XXX,XX @@ typedef struct TcgCpuOperations {
25
@@ -XXX,XX +XXX,XX @@ struct SysemuCPUOps;
24
bool (*tlb_fill)(CPUState *cpu, vaddr address, int size,
26
* a memory access with the specified memory transaction attributes.
25
MMUAccessType access_type, int mmu_idx,
27
* @gdb_read_register: Callback for letting GDB read a register.
26
bool probe, uintptr_t retaddr);
27
+ /** @debug_excp_handler: Callback for handling debug exceptions */
28
+ void (*debug_excp_handler)(CPUState *cpu);
29
30
} TcgCpuOperations;
31
32
@@ -XXX,XX +XXX,XX @@ typedef struct TcgCpuOperations {
33
* @gdb_write_register: Callback for letting GDB write a register.
28
* @gdb_write_register: Callback for letting GDB write a register.
34
* @debug_check_watchpoint: Callback: return true if the architectural
29
- * @write_elf64_note: Callback for writing a CPU-specific ELF note to a
35
* watchpoint whose address has matched should really fire.
30
- * 64-bit VM coredump.
36
- * @debug_excp_handler: Callback for handling debug exceptions.
31
- * @write_elf32_qemunote: Callback for writing a CPU- and QEMU-specific ELF
37
* @write_elf64_note: Callback for writing a CPU-specific ELF note to a
32
- * note to a 32-bit VM coredump.
38
* 64-bit VM coredump.
33
- * @write_elf32_note: Callback for writing a CPU-specific ELF note to a
39
* @write_elf32_qemunote: Callback for writing a CPU- and QEMU-specific ELF
34
- * 32-bit VM coredump.
35
- * @write_elf32_qemunote: Callback for writing a CPU- and QEMU-specific ELF
36
- * note to a 32-bit VM coredump.
37
* @gdb_num_core_regs: Number of core registers accessible to GDB.
38
* @gdb_core_xml_file: File name for core registers GDB XML description.
39
* @gdb_stop_before_watchpoint: Indicates whether GDB expects the CPU to stop
40
@@ -XXX,XX +XXX,XX @@ struct CPUClass {
40
@@ -XXX,XX +XXX,XX @@ struct CPUClass {
41
int (*gdb_read_register)(CPUState *cpu, GByteArray *buf, int reg);
41
int (*gdb_read_register)(CPUState *cpu, GByteArray *buf, int reg);
42
int (*gdb_write_register)(CPUState *cpu, uint8_t *buf, int reg);
42
int (*gdb_write_register)(CPUState *cpu, uint8_t *buf, int reg);
43
bool (*debug_check_watchpoint)(CPUState *cpu, CPUWatchpoint *wp);
43
44
- void (*debug_excp_handler)(CPUState *cpu);
44
- int (*write_elf64_note)(WriteCoreDumpFunction f, CPUState *cpu,
45
45
- int cpuid, void *opaque);
46
int (*write_elf64_note)(WriteCoreDumpFunction f, CPUState *cpu,
46
- int (*write_elf64_qemunote)(WriteCoreDumpFunction f, CPUState *cpu,
47
int cpuid, void *opaque);
47
- void *opaque);
48
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
48
- int (*write_elf32_note)(WriteCoreDumpFunction f, CPUState *cpu,
49
index XXXXXXX..XXXXXXX 100644
49
- int cpuid, void *opaque);
50
--- a/accel/tcg/cpu-exec.c
50
- int (*write_elf32_qemunote)(WriteCoreDumpFunction f, CPUState *cpu,
51
+++ b/accel/tcg/cpu-exec.c
51
- void *opaque);
52
@@ -XXX,XX +XXX,XX @@ static inline void cpu_handle_debug_exception(CPUState *cpu)
52
-
53
}
53
const char *gdb_core_xml_file;
54
}
54
gchar * (*gdb_arch_name)(CPUState *cpu);
55
55
const char * (*gdb_get_dynamic_xml)(CPUState *cpu, const char *xmlname);
56
- if (cc->debug_excp_handler) {
56
diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h
57
- cc->debug_excp_handler(cpu);
57
index XXXXXXX..XXXXXXX 100644
58
+ if (cc->tcg_ops.debug_excp_handler) {
58
--- a/include/hw/core/sysemu-cpu-ops.h
59
+ cc->tcg_ops.debug_excp_handler(cpu);
59
+++ b/include/hw/core/sysemu-cpu-ops.h
60
}
60
@@ -XXX,XX +XXX,XX @@ typedef struct SysemuCPUOps {
61
}
61
* GUEST_PANICKED events.
62
62
*/
63
GuestPanicInformation* (*get_crash_info)(CPUState *cpu);
64
+ /**
65
+ * @write_elf32_note: Callback for writing a CPU-specific ELF note to a
66
+ * 32-bit VM coredump.
67
+ */
68
+ int (*write_elf32_note)(WriteCoreDumpFunction f, CPUState *cpu,
69
+ int cpuid, void *opaque);
70
+ /**
71
+ * @write_elf64_note: Callback for writing a CPU-specific ELF note to a
72
+ * 64-bit VM coredump.
73
+ */
74
+ int (*write_elf64_note)(WriteCoreDumpFunction f, CPUState *cpu,
75
+ int cpuid, void *opaque);
76
+ /**
77
+ * @write_elf32_qemunote: Callback for writing a CPU- and QEMU-specific ELF
78
+ * note to a 32-bit VM coredump.
79
+ */
80
+ int (*write_elf32_qemunote)(WriteCoreDumpFunction f, CPUState *cpu,
81
+ void *opaque);
82
+ /**
83
+ * @write_elf64_qemunote: Callback for writing a CPU- and QEMU-specific ELF
84
+ * note to a 64-bit VM coredump.
85
+ */
86
+ int (*write_elf64_qemunote)(WriteCoreDumpFunction f, CPUState *cpu,
87
+ void *opaque);
88
/**
89
* @virtio_is_big_endian: Callback to return %true if a CPU which supports
90
* runtime configurable endianness is currently big-endian.
91
diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c
92
index XXXXXXX..XXXXXXX 100644
93
--- a/hw/core/cpu-sysemu.c
94
+++ b/hw/core/cpu-sysemu.c
95
@@ -XXX,XX +XXX,XX @@ int cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
96
{
97
CPUClass *cc = CPU_GET_CLASS(cpu);
98
99
- if (!cc->write_elf32_qemunote) {
100
+ if (!cc->sysemu_ops->write_elf32_qemunote) {
101
return 0;
102
}
103
- return (*cc->write_elf32_qemunote)(f, cpu, opaque);
104
+ return (*cc->sysemu_ops->write_elf32_qemunote)(f, cpu, opaque);
105
}
106
107
int cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cpu,
108
@@ -XXX,XX +XXX,XX @@ int cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cpu,
109
{
110
CPUClass *cc = CPU_GET_CLASS(cpu);
111
112
- if (!cc->write_elf32_note) {
113
+ if (!cc->sysemu_ops->write_elf32_note) {
114
return -1;
115
}
116
- return (*cc->write_elf32_note)(f, cpu, cpuid, opaque);
117
+ return (*cc->sysemu_ops->write_elf32_note)(f, cpu, cpuid, opaque);
118
}
119
120
int cpu_write_elf64_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
121
@@ -XXX,XX +XXX,XX @@ int cpu_write_elf64_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
122
{
123
CPUClass *cc = CPU_GET_CLASS(cpu);
124
125
- if (!cc->write_elf64_qemunote) {
126
+ if (!cc->sysemu_ops->write_elf64_qemunote) {
127
return 0;
128
}
129
- return (*cc->write_elf64_qemunote)(f, cpu, opaque);
130
+ return (*cc->sysemu_ops->write_elf64_qemunote)(f, cpu, opaque);
131
}
132
133
int cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cpu,
134
@@ -XXX,XX +XXX,XX @@ int cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cpu,
135
{
136
CPUClass *cc = CPU_GET_CLASS(cpu);
137
138
- if (!cc->write_elf64_note) {
139
+ if (!cc->sysemu_ops->write_elf64_note) {
140
return -1;
141
}
142
- return (*cc->write_elf64_note)(f, cpu, cpuid, opaque);
143
+ return (*cc->sysemu_ops->write_elf64_note)(f, cpu, cpuid, opaque);
144
}
145
146
bool cpu_virtio_is_big_endian(CPUState *cpu)
63
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
147
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
64
index XXXXXXX..XXXXXXX 100644
148
index XXXXXXX..XXXXXXX 100644
65
--- a/target/arm/cpu.c
149
--- a/target/arm/cpu.c
66
+++ b/target/arm/cpu.c
150
+++ b/target/arm/cpu.c
151
@@ -XXX,XX +XXX,XX @@ static gchar *arm_gdb_arch_name(CPUState *cs)
152
#include "hw/core/sysemu-cpu-ops.h"
153
154
static const struct SysemuCPUOps arm_sysemu_ops = {
155
+ .write_elf32_note = arm_cpu_write_elf32_note,
156
+ .write_elf64_note = arm_cpu_write_elf64_note,
157
.virtio_is_big_endian = arm_cpu_virtio_is_big_endian,
158
.legacy_vmsd = &vmstate_arm_cpu,
159
};
67
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
160
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
68
cc->tcg_ops.cpu_exec_interrupt = arm_cpu_exec_interrupt;
161
#ifndef CONFIG_USER_ONLY
69
cc->tcg_ops.synchronize_from_tb = arm_cpu_synchronize_from_tb;
162
cc->get_phys_page_attrs_debug = arm_cpu_get_phys_page_attrs_debug;
70
cc->tcg_ops.tlb_fill = arm_cpu_tlb_fill;
163
cc->asidx_from_attrs = arm_asidx_from_attrs;
71
- cc->debug_excp_handler = arm_debug_excp_handler;
164
- cc->write_elf64_note = arm_cpu_write_elf64_note;
72
+ cc->tcg_ops.debug_excp_handler = arm_debug_excp_handler;
165
- cc->write_elf32_note = arm_cpu_write_elf32_note;
73
cc->debug_check_watchpoint = arm_debug_check_watchpoint;
166
cc->sysemu_ops = &arm_sysemu_ops;
74
cc->do_unaligned_access = arm_cpu_do_unaligned_access;
167
#endif
75
#if !defined(CONFIG_USER_ONLY)
168
cc->gdb_num_core_regs = 26;
76
diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c
169
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
77
index XXXXXXX..XXXXXXX 100644
170
index XXXXXXX..XXXXXXX 100644
78
--- a/target/i386/tcg/tcg-cpu.c
171
--- a/target/i386/cpu.c
79
+++ b/target/i386/tcg/tcg-cpu.c
172
+++ b/target/i386/cpu.c
80
@@ -XXX,XX +XXX,XX @@ void tcg_cpu_common_class_init(CPUClass *cc)
173
@@ -XXX,XX +XXX,XX @@ static Property x86_cpu_properties[] = {
81
cc->tcg_ops.initialize = tcg_x86_init;
174
82
cc->tcg_ops.tlb_fill = x86_cpu_tlb_fill;
175
static const struct SysemuCPUOps i386_sysemu_ops = {
83
#ifndef CONFIG_USER_ONLY
176
.get_crash_info = x86_cpu_get_crash_info,
84
- cc->debug_excp_handler = breakpoint_handler;
177
+ .write_elf32_note = x86_cpu_write_elf32_note,
85
+ cc->tcg_ops.debug_excp_handler = breakpoint_handler;
178
+ .write_elf64_note = x86_cpu_write_elf64_note,
86
#endif
179
+ .write_elf32_qemunote = x86_cpu_write_elf32_qemunote,
87
}
180
+ .write_elf64_qemunote = x86_cpu_write_elf64_qemunote,
88
diff --git a/target/lm32/cpu.c b/target/lm32/cpu.c
181
.legacy_vmsd = &vmstate_x86_cpu,
89
index XXXXXXX..XXXXXXX 100644
182
};
90
--- a/target/lm32/cpu.c
183
#endif
91
+++ b/target/lm32/cpu.c
184
@@ -XXX,XX +XXX,XX @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
92
@@ -XXX,XX +XXX,XX @@ static void lm32_cpu_class_init(ObjectClass *oc, void *data)
185
cc->asidx_from_attrs = x86_asidx_from_attrs;
93
#endif
186
cc->get_memory_mapping = x86_cpu_get_memory_mapping;
94
cc->gdb_num_core_regs = 32 + 7;
187
cc->get_phys_page_attrs_debug = x86_cpu_get_phys_page_attrs_debug;
95
cc->gdb_stop_before_watchpoint = true;
188
- cc->write_elf64_note = x86_cpu_write_elf64_note;
96
- cc->debug_excp_handler = lm32_debug_excp_handler;
189
- cc->write_elf64_qemunote = x86_cpu_write_elf64_qemunote;
97
+ cc->tcg_ops.debug_excp_handler = lm32_debug_excp_handler;
190
- cc->write_elf32_note = x86_cpu_write_elf32_note;
98
cc->disas_set_info = lm32_cpu_disas_set_info;
191
- cc->write_elf32_qemunote = x86_cpu_write_elf32_qemunote;
99
cc->tcg_ops.initialize = lm32_translate_init;
192
cc->sysemu_ops = &i386_sysemu_ops;
100
}
193
#endif /* !CONFIG_USER_ONLY */
194
195
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
196
index XXXXXXX..XXXXXXX 100644
197
--- a/target/ppc/cpu_init.c
198
+++ b/target/ppc/cpu_init.c
199
@@ -XXX,XX +XXX,XX @@ static Property ppc_cpu_properties[] = {
200
#include "hw/core/sysemu-cpu-ops.h"
201
202
static const struct SysemuCPUOps ppc_sysemu_ops = {
203
+ .write_elf32_note = ppc32_cpu_write_elf32_note,
204
+ .write_elf64_note = ppc64_cpu_write_elf64_note,
205
.virtio_is_big_endian = ppc_cpu_is_big_endian,
206
.legacy_vmsd = &vmstate_ppc_cpu,
207
};
208
@@ -XXX,XX +XXX,XX @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
209
cc->get_phys_page_debug = ppc_cpu_get_phys_page_debug;
210
cc->sysemu_ops = &ppc_sysemu_ops;
211
#endif
212
-#if defined(CONFIG_SOFTMMU)
213
- cc->write_elf64_note = ppc64_cpu_write_elf64_note;
214
- cc->write_elf32_note = ppc32_cpu_write_elf32_note;
215
-#endif
216
217
cc->gdb_num_core_regs = 71;
218
#ifndef CONFIG_USER_ONLY
219
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
220
index XXXXXXX..XXXXXXX 100644
221
--- a/target/riscv/cpu.c
222
+++ b/target/riscv/cpu.c
223
@@ -XXX,XX +XXX,XX @@ static const char *riscv_gdb_get_dynamic_xml(CPUState *cs, const char *xmlname)
224
#include "hw/core/sysemu-cpu-ops.h"
225
226
static const struct SysemuCPUOps riscv_sysemu_ops = {
227
+ .write_elf64_note = riscv_cpu_write_elf64_note,
228
+ .write_elf32_note = riscv_cpu_write_elf32_note,
229
.legacy_vmsd = &vmstate_riscv_cpu,
230
};
231
#endif
232
@@ -XXX,XX +XXX,XX @@ static void riscv_cpu_class_init(ObjectClass *c, void *data)
233
#ifndef CONFIG_USER_ONLY
234
cc->get_phys_page_debug = riscv_cpu_get_phys_page_debug;
235
cc->sysemu_ops = &riscv_sysemu_ops;
236
- cc->write_elf64_note = riscv_cpu_write_elf64_note;
237
- cc->write_elf32_note = riscv_cpu_write_elf32_note;
238
#endif
239
cc->gdb_arch_name = riscv_gdb_arch_name;
240
cc->gdb_get_dynamic_xml = riscv_gdb_get_dynamic_xml;
101
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
241
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
102
index XXXXXXX..XXXXXXX 100644
242
index XXXXXXX..XXXXXXX 100644
103
--- a/target/s390x/cpu.c
243
--- a/target/s390x/cpu.c
104
+++ b/target/s390x/cpu.c
244
+++ b/target/s390x/cpu.c
245
@@ -XXX,XX +XXX,XX @@ static void s390_cpu_reset_full(DeviceState *dev)
246
247
static const struct SysemuCPUOps s390_sysemu_ops = {
248
.get_crash_info = s390_cpu_get_crash_info,
249
+ .write_elf64_note = s390_cpu_write_elf64_note,
250
.legacy_vmsd = &vmstate_s390_cpu,
251
};
252
#endif
105
@@ -XXX,XX +XXX,XX @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)
253
@@ -XXX,XX +XXX,XX @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)
106
cc->write_elf64_note = s390_cpu_write_elf64_note;
254
cc->gdb_write_register = s390_cpu_gdb_write_register;
107
#ifdef CONFIG_TCG
255
#ifndef CONFIG_USER_ONLY
108
cc->tcg_ops.cpu_exec_interrupt = s390_cpu_exec_interrupt;
256
cc->get_phys_page_debug = s390_cpu_get_phys_page_debug;
109
- cc->debug_excp_handler = s390x_cpu_debug_excp_handler;
257
- cc->write_elf64_note = s390_cpu_write_elf64_note;
110
+ cc->tcg_ops.debug_excp_handler = s390x_cpu_debug_excp_handler;
258
cc->sysemu_ops = &s390_sysemu_ops;
111
cc->do_unaligned_access = s390x_cpu_do_unaligned_access;
259
#endif
112
#endif
260
cc->disas_set_info = s390_cpu_disas_set_info;
113
#endif
114
diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c
115
index XXXXXXX..XXXXXXX 100644
116
--- a/target/xtensa/cpu.c
117
+++ b/target/xtensa/cpu.c
118
@@ -XXX,XX +XXX,XX @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data)
119
cc->get_phys_page_debug = xtensa_cpu_get_phys_page_debug;
120
cc->do_transaction_failed = xtensa_cpu_do_transaction_failed;
121
#endif
122
- cc->debug_excp_handler = xtensa_breakpoint_handler;
123
+ cc->tcg_ops.debug_excp_handler = xtensa_breakpoint_handler;
124
cc->disas_set_info = xtensa_cpu_disas_set_info;
125
cc->tcg_ops.initialize = xtensa_translate_init;
126
dc->vmsd = &vmstate_xtensa_cpu;
127
--
261
--
128
2.25.1
262
2.25.1
129
263
130
264
diff view generated by jsdifflib
1
From: Eduardo Habkost <ehabkost@redhat.com>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
3
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
4
[claudio: wrapped target code in CONFIG_TCG, reworded comments]
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Signed-off-by: Claudio Fontana <cfontana@suse.de>
5
Message-Id: <20210517105140.1062037-20-f4bug@amsat.org>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Message-Id: <20210204163931.7358-5-cfontana@suse.de>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
---
7
---
10
include/hw/core/cpu.h | 22 +++++++++++++---------
8
include/hw/core/cpu.h | 3 ---
11
accel/tcg/cpu-exec.c | 4 ++--
9
include/hw/core/sysemu-cpu-ops.h | 5 +++++
12
target/arm/cpu.c | 4 +++-
10
hw/core/cpu-sysemu.c | 4 ++--
13
target/avr/cpu.c | 2 +-
11
target/arm/cpu.c | 2 +-
14
target/hppa/cpu.c | 2 +-
12
target/i386/cpu.c | 2 +-
15
target/i386/tcg/tcg-cpu.c | 2 +-
13
5 files changed, 9 insertions(+), 7 deletions(-)
16
target/microblaze/cpu.c | 2 +-
17
target/mips/cpu.c | 4 +++-
18
target/riscv/cpu.c | 2 +-
19
target/rx/cpu.c | 2 +-
20
target/sh4/cpu.c | 2 +-
21
target/sparc/cpu.c | 2 +-
22
target/tricore/cpu.c | 2 +-
23
13 files changed, 30 insertions(+), 22 deletions(-)
24
14
25
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
15
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
26
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
27
--- a/include/hw/core/cpu.h
17
--- a/include/hw/core/cpu.h
28
+++ b/include/hw/core/cpu.h
18
+++ b/include/hw/core/cpu.h
29
@@ -XXX,XX +XXX,XX @@ typedef struct TcgCpuOperations {
19
@@ -XXX,XX +XXX,XX @@ struct SysemuCPUOps;
30
* Called when the first CPU is realized.
20
* associated memory transaction attributes to use for the access.
31
*/
21
* CPUs which use memory transaction attributes should implement this
32
void (*initialize)(void);
22
* instead of get_phys_page_debug.
23
- * @asidx_from_attrs: Callback to return the CPU AddressSpace to use for
24
- * a memory access with the specified memory transaction attributes.
25
* @gdb_read_register: Callback for letting GDB read a register.
26
* @gdb_write_register: Callback for letting GDB write a register.
27
* @gdb_num_core_regs: Number of core registers accessible to GDB.
28
@@ -XXX,XX +XXX,XX @@ struct CPUClass {
29
hwaddr (*get_phys_page_debug)(CPUState *cpu, vaddr addr);
30
hwaddr (*get_phys_page_attrs_debug)(CPUState *cpu, vaddr addr,
31
MemTxAttrs *attrs);
32
- int (*asidx_from_attrs)(CPUState *cpu, MemTxAttrs attrs);
33
int (*gdb_read_register)(CPUState *cpu, GByteArray *buf, int reg);
34
int (*gdb_write_register)(CPUState *cpu, uint8_t *buf, int reg);
35
36
diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h
37
index XXXXXXX..XXXXXXX 100644
38
--- a/include/hw/core/sysemu-cpu-ops.h
39
+++ b/include/hw/core/sysemu-cpu-ops.h
40
@@ -XXX,XX +XXX,XX @@
41
* struct SysemuCPUOps: System operations specific to a CPU class
42
*/
43
typedef struct SysemuCPUOps {
33
+ /**
44
+ /**
34
+ * @synchronize_from_tb: Synchronize state from a TCG #TranslationBlock
45
+ * @asidx_from_attrs: Callback to return the CPU AddressSpace to use for
35
+ *
46
+ * a memory access with the specified memory transaction attributes.
36
+ * This is called when we abandon execution of a TB before starting it,
37
+ * and must set all parts of the CPU state which the previous TB in the
38
+ * chain may not have updated.
39
+ * By default, when this is NULL, a call is made to @set_pc(tb->pc).
40
+ *
41
+ * If more state needs to be restored, the target must implement a
42
+ * function to restore all the state, and register it here.
43
+ */
47
+ */
44
+ void (*synchronize_from_tb)(CPUState *cpu,
48
+ int (*asidx_from_attrs)(CPUState *cpu, MemTxAttrs attrs);
45
+ const struct TranslationBlock *tb);
49
/**
46
50
* @get_crash_info: Callback for reporting guest crash information in
47
} TcgCpuOperations;
51
* GUEST_PANICKED events.
48
52
diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c
49
@@ -XXX,XX +XXX,XX @@ typedef struct TcgCpuOperations {
50
* If the target behaviour here is anything other than "set
51
* the PC register to the value passed in" then the target must
52
* also implement the synchronize_from_tb hook.
53
- * @synchronize_from_tb: Callback for synchronizing state from a TCG
54
- * #TranslationBlock. This is called when we abandon execution
55
- * of a TB before starting it, and must set all parts of the CPU
56
- * state which the previous TB in the chain may not have updated.
57
- * This always includes at least the program counter; some targets
58
- * will need to do more. If this hook is not implemented then the
59
- * default is to call @set_pc(tb->pc).
60
* @tlb_fill: Callback for handling a softmmu tlb miss or user-only
61
* address fault. For system mode, if the access is valid, call
62
* tlb_set_page and return true; if the access is invalid, and
63
@@ -XXX,XX +XXX,XX @@ struct CPUClass {
64
void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list,
65
Error **errp);
66
void (*set_pc)(CPUState *cpu, vaddr value);
67
- void (*synchronize_from_tb)(CPUState *cpu,
68
- const struct TranslationBlock *tb);
69
bool (*tlb_fill)(CPUState *cpu, vaddr address, int size,
70
MMUAccessType access_type, int mmu_idx,
71
bool probe, uintptr_t retaddr);
72
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
73
index XXXXXXX..XXXXXXX 100644
53
index XXXXXXX..XXXXXXX 100644
74
--- a/accel/tcg/cpu-exec.c
54
--- a/hw/core/cpu-sysemu.c
75
+++ b/accel/tcg/cpu-exec.c
55
+++ b/hw/core/cpu-sysemu.c
76
@@ -XXX,XX +XXX,XX @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit)
56
@@ -XXX,XX +XXX,XX @@ int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs)
77
TARGET_FMT_lx "] %s\n",
57
CPUClass *cc = CPU_GET_CLASS(cpu);
78
last_tb->tc.ptr, last_tb->pc,
58
int ret = 0;
79
lookup_symbol(last_tb->pc));
59
80
- if (cc->synchronize_from_tb) {
60
- if (cc->asidx_from_attrs) {
81
- cc->synchronize_from_tb(cpu, last_tb);
61
- ret = cc->asidx_from_attrs(cpu, attrs);
82
+ if (cc->tcg_ops.synchronize_from_tb) {
62
+ if (cc->sysemu_ops->asidx_from_attrs) {
83
+ cc->tcg_ops.synchronize_from_tb(cpu, last_tb);
63
+ ret = cc->sysemu_ops->asidx_from_attrs(cpu, attrs);
84
} else {
64
assert(ret < cpu->num_ases && ret >= 0);
85
assert(cc->set_pc);
65
}
86
cc->set_pc(cpu, last_tb->pc);
66
return ret;
87
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
67
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
88
index XXXXXXX..XXXXXXX 100644
68
index XXXXXXX..XXXXXXX 100644
89
--- a/target/arm/cpu.c
69
--- a/target/arm/cpu.c
90
+++ b/target/arm/cpu.c
70
+++ b/target/arm/cpu.c
91
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_set_pc(CPUState *cs, vaddr value)
71
@@ -XXX,XX +XXX,XX @@ static gchar *arm_gdb_arch_name(CPUState *cs)
92
}
72
#include "hw/core/sysemu-cpu-ops.h"
93
}
73
94
74
static const struct SysemuCPUOps arm_sysemu_ops = {
95
+#ifdef CONFIG_TCG
75
+ .asidx_from_attrs = arm_asidx_from_attrs,
96
static void arm_cpu_synchronize_from_tb(CPUState *cs,
76
.write_elf32_note = arm_cpu_write_elf32_note,
97
const TranslationBlock *tb)
77
.write_elf64_note = arm_cpu_write_elf64_note,
98
{
78
.virtio_is_big_endian = arm_cpu_virtio_is_big_endian,
99
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_synchronize_from_tb(CPUState *cs,
100
env->regs[15] = tb->pc;
101
}
102
}
103
+#endif /* CONFIG_TCG */
104
105
static bool arm_cpu_has_work(CPUState *cs)
106
{
107
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
79
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
108
cc->cpu_exec_interrupt = arm_cpu_exec_interrupt;
109
cc->dump_state = arm_cpu_dump_state;
110
cc->set_pc = arm_cpu_set_pc;
111
- cc->synchronize_from_tb = arm_cpu_synchronize_from_tb;
112
cc->gdb_read_register = arm_cpu_gdb_read_register;
113
cc->gdb_write_register = arm_cpu_gdb_write_register;
80
cc->gdb_write_register = arm_cpu_gdb_write_register;
114
#ifndef CONFIG_USER_ONLY
81
#ifndef CONFIG_USER_ONLY
115
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
82
cc->get_phys_page_attrs_debug = arm_cpu_get_phys_page_attrs_debug;
116
cc->disas_set_info = arm_disas_set_info;
83
- cc->asidx_from_attrs = arm_asidx_from_attrs;
117
#ifdef CONFIG_TCG
84
cc->sysemu_ops = &arm_sysemu_ops;
118
cc->tcg_ops.initialize = arm_translate_init;
85
#endif
119
+ cc->tcg_ops.synchronize_from_tb = arm_cpu_synchronize_from_tb;
86
cc->gdb_num_core_regs = 26;
120
cc->tlb_fill = arm_cpu_tlb_fill;
87
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
121
cc->debug_excp_handler = arm_debug_excp_handler;
122
cc->debug_check_watchpoint = arm_debug_check_watchpoint;
123
diff --git a/target/avr/cpu.c b/target/avr/cpu.c
124
index XXXXXXX..XXXXXXX 100644
88
index XXXXXXX..XXXXXXX 100644
125
--- a/target/avr/cpu.c
89
--- a/target/i386/cpu.c
126
+++ b/target/avr/cpu.c
90
+++ b/target/i386/cpu.c
127
@@ -XXX,XX +XXX,XX @@ static void avr_cpu_class_init(ObjectClass *oc, void *data)
91
@@ -XXX,XX +XXX,XX @@ static Property x86_cpu_properties[] = {
128
cc->vmsd = &vms_avr_cpu;
92
#include "hw/core/sysemu-cpu-ops.h"
129
cc->disas_set_info = avr_cpu_disas_set_info;
93
130
cc->tcg_ops.initialize = avr_cpu_tcg_init;
94
static const struct SysemuCPUOps i386_sysemu_ops = {
131
- cc->synchronize_from_tb = avr_cpu_synchronize_from_tb;
95
+ .asidx_from_attrs = x86_asidx_from_attrs,
132
+ cc->tcg_ops.synchronize_from_tb = avr_cpu_synchronize_from_tb;
96
.get_crash_info = x86_cpu_get_crash_info,
133
cc->gdb_read_register = avr_cpu_gdb_read_register;
97
.write_elf32_note = x86_cpu_write_elf32_note,
134
cc->gdb_write_register = avr_cpu_gdb_write_register;
98
.write_elf64_note = x86_cpu_write_elf64_note,
135
cc->gdb_num_core_regs = 35;
99
@@ -XXX,XX +XXX,XX @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
136
diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
100
cc->get_paging_enabled = x86_cpu_get_paging_enabled;
137
index XXXXXXX..XXXXXXX 100644
101
138
--- a/target/hppa/cpu.c
139
+++ b/target/hppa/cpu.c
140
@@ -XXX,XX +XXX,XX @@ static void hppa_cpu_class_init(ObjectClass *oc, void *data)
141
cc->cpu_exec_interrupt = hppa_cpu_exec_interrupt;
142
cc->dump_state = hppa_cpu_dump_state;
143
cc->set_pc = hppa_cpu_set_pc;
144
- cc->synchronize_from_tb = hppa_cpu_synchronize_from_tb;
145
+ cc->tcg_ops.synchronize_from_tb = hppa_cpu_synchronize_from_tb;
146
cc->gdb_read_register = hppa_cpu_gdb_read_register;
147
cc->gdb_write_register = hppa_cpu_gdb_write_register;
148
cc->tlb_fill = hppa_cpu_tlb_fill;
149
diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c
150
index XXXXXXX..XXXXXXX 100644
151
--- a/target/i386/tcg/tcg-cpu.c
152
+++ b/target/i386/tcg/tcg-cpu.c
153
@@ -XXX,XX +XXX,XX @@ void tcg_cpu_common_class_init(CPUClass *cc)
154
{
155
cc->do_interrupt = x86_cpu_do_interrupt;
156
cc->cpu_exec_interrupt = x86_cpu_exec_interrupt;
157
- cc->synchronize_from_tb = x86_cpu_synchronize_from_tb;
158
+ cc->tcg_ops.synchronize_from_tb = x86_cpu_synchronize_from_tb;
159
cc->cpu_exec_enter = x86_cpu_exec_enter;
160
cc->cpu_exec_exit = x86_cpu_exec_exit;
161
cc->tcg_ops.initialize = tcg_x86_init;
162
diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c
163
index XXXXXXX..XXXXXXX 100644
164
--- a/target/microblaze/cpu.c
165
+++ b/target/microblaze/cpu.c
166
@@ -XXX,XX +XXX,XX @@ static void mb_cpu_class_init(ObjectClass *oc, void *data)
167
cc->cpu_exec_interrupt = mb_cpu_exec_interrupt;
168
cc->dump_state = mb_cpu_dump_state;
169
cc->set_pc = mb_cpu_set_pc;
170
- cc->synchronize_from_tb = mb_cpu_synchronize_from_tb;
171
+ cc->tcg_ops.synchronize_from_tb = mb_cpu_synchronize_from_tb;
172
cc->gdb_read_register = mb_cpu_gdb_read_register;
173
cc->gdb_write_register = mb_cpu_gdb_write_register;
174
cc->tlb_fill = mb_cpu_tlb_fill;
175
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
176
index XXXXXXX..XXXXXXX 100644
177
--- a/target/mips/cpu.c
178
+++ b/target/mips/cpu.c
179
@@ -XXX,XX +XXX,XX @@ static void mips_cpu_set_pc(CPUState *cs, vaddr value)
180
}
181
}
182
183
+#ifdef CONFIG_TCG
184
static void mips_cpu_synchronize_from_tb(CPUState *cs,
185
const TranslationBlock *tb)
186
{
187
@@ -XXX,XX +XXX,XX @@ static void mips_cpu_synchronize_from_tb(CPUState *cs,
188
env->hflags &= ~MIPS_HFLAG_BMASK;
189
env->hflags |= tb->flags & MIPS_HFLAG_BMASK;
190
}
191
+#endif /* CONFIG_TCG */
192
193
static bool mips_cpu_has_work(CPUState *cs)
194
{
195
@@ -XXX,XX +XXX,XX @@ static void mips_cpu_class_init(ObjectClass *c, void *data)
196
cc->cpu_exec_interrupt = mips_cpu_exec_interrupt;
197
cc->dump_state = mips_cpu_dump_state;
198
cc->set_pc = mips_cpu_set_pc;
199
- cc->synchronize_from_tb = mips_cpu_synchronize_from_tb;
200
cc->gdb_read_register = mips_cpu_gdb_read_register;
201
cc->gdb_write_register = mips_cpu_gdb_write_register;
202
#ifndef CONFIG_USER_ONLY
102
#ifndef CONFIG_USER_ONLY
203
@@ -XXX,XX +XXX,XX @@ static void mips_cpu_class_init(ObjectClass *c, void *data)
103
- cc->asidx_from_attrs = x86_asidx_from_attrs;
204
cc->disas_set_info = mips_cpu_disas_set_info;
104
cc->get_memory_mapping = x86_cpu_get_memory_mapping;
205
#ifdef CONFIG_TCG
105
cc->get_phys_page_attrs_debug = x86_cpu_get_phys_page_attrs_debug;
206
cc->tcg_ops.initialize = mips_tcg_init;
106
cc->sysemu_ops = &i386_sysemu_ops;
207
+ cc->tcg_ops.synchronize_from_tb = mips_cpu_synchronize_from_tb;
208
cc->tlb_fill = mips_cpu_tlb_fill;
209
#endif
210
211
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
212
index XXXXXXX..XXXXXXX 100644
213
--- a/target/riscv/cpu.c
214
+++ b/target/riscv/cpu.c
215
@@ -XXX,XX +XXX,XX @@ static void riscv_cpu_class_init(ObjectClass *c, void *data)
216
cc->cpu_exec_interrupt = riscv_cpu_exec_interrupt;
217
cc->dump_state = riscv_cpu_dump_state;
218
cc->set_pc = riscv_cpu_set_pc;
219
- cc->synchronize_from_tb = riscv_cpu_synchronize_from_tb;
220
+ cc->tcg_ops.synchronize_from_tb = riscv_cpu_synchronize_from_tb;
221
cc->gdb_read_register = riscv_cpu_gdb_read_register;
222
cc->gdb_write_register = riscv_cpu_gdb_write_register;
223
cc->gdb_num_core_regs = 33;
224
diff --git a/target/rx/cpu.c b/target/rx/cpu.c
225
index XXXXXXX..XXXXXXX 100644
226
--- a/target/rx/cpu.c
227
+++ b/target/rx/cpu.c
228
@@ -XXX,XX +XXX,XX @@ static void rx_cpu_class_init(ObjectClass *klass, void *data)
229
cc->cpu_exec_interrupt = rx_cpu_exec_interrupt;
230
cc->dump_state = rx_cpu_dump_state;
231
cc->set_pc = rx_cpu_set_pc;
232
- cc->synchronize_from_tb = rx_cpu_synchronize_from_tb;
233
+ cc->tcg_ops.synchronize_from_tb = rx_cpu_synchronize_from_tb;
234
cc->gdb_read_register = rx_cpu_gdb_read_register;
235
cc->gdb_write_register = rx_cpu_gdb_write_register;
236
cc->get_phys_page_debug = rx_cpu_get_phys_page_debug;
237
diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c
238
index XXXXXXX..XXXXXXX 100644
239
--- a/target/sh4/cpu.c
240
+++ b/target/sh4/cpu.c
241
@@ -XXX,XX +XXX,XX @@ static void superh_cpu_class_init(ObjectClass *oc, void *data)
242
cc->cpu_exec_interrupt = superh_cpu_exec_interrupt;
243
cc->dump_state = superh_cpu_dump_state;
244
cc->set_pc = superh_cpu_set_pc;
245
- cc->synchronize_from_tb = superh_cpu_synchronize_from_tb;
246
+ cc->tcg_ops.synchronize_from_tb = superh_cpu_synchronize_from_tb;
247
cc->gdb_read_register = superh_cpu_gdb_read_register;
248
cc->gdb_write_register = superh_cpu_gdb_write_register;
249
cc->tlb_fill = superh_cpu_tlb_fill;
250
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
251
index XXXXXXX..XXXXXXX 100644
252
--- a/target/sparc/cpu.c
253
+++ b/target/sparc/cpu.c
254
@@ -XXX,XX +XXX,XX @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data)
255
cc->memory_rw_debug = sparc_cpu_memory_rw_debug;
256
#endif
257
cc->set_pc = sparc_cpu_set_pc;
258
- cc->synchronize_from_tb = sparc_cpu_synchronize_from_tb;
259
+ cc->tcg_ops.synchronize_from_tb = sparc_cpu_synchronize_from_tb;
260
cc->gdb_read_register = sparc_cpu_gdb_read_register;
261
cc->gdb_write_register = sparc_cpu_gdb_write_register;
262
cc->tlb_fill = sparc_cpu_tlb_fill;
263
diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c
264
index XXXXXXX..XXXXXXX 100644
265
--- a/target/tricore/cpu.c
266
+++ b/target/tricore/cpu.c
267
@@ -XXX,XX +XXX,XX @@ static void tricore_cpu_class_init(ObjectClass *c, void *data)
268
269
cc->dump_state = tricore_cpu_dump_state;
270
cc->set_pc = tricore_cpu_set_pc;
271
- cc->synchronize_from_tb = tricore_cpu_synchronize_from_tb;
272
+ cc->tcg_ops.synchronize_from_tb = tricore_cpu_synchronize_from_tb;
273
cc->get_phys_page_debug = tricore_cpu_get_phys_page_debug;
274
cc->tcg_ops.initialize = tricore_tcg_init;
275
cc->tlb_fill = tricore_cpu_tlb_fill;
276
--
107
--
277
2.25.1
108
2.25.1
278
109
279
110
diff view generated by jsdifflib
1
From: Eduardo Habkost <ehabkost@redhat.com>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
[claudio: wrapped target code in CONFIG_TCG]
3
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
4
5
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
6
Signed-off-by: Claudio Fontana <cfontana@suse.de>
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-Id: <20210204163931.7358-7-cfontana@suse.de>
5
Message-Id: <20210517105140.1062037-21-f4bug@amsat.org>
6
[rth: Drop declaration movement from target/*/cpu.h]
11
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12
---
8
---
13
include/hw/core/cpu.h | 21 ++++++++++++---------
9
include/hw/core/cpu.h | 8 --------
14
accel/tcg/cputlb.c | 7 ++++---
10
include/hw/core/sysemu-cpu-ops.h | 13 +++++++++++++
15
accel/tcg/user-exec.c | 6 +++---
11
hw/core/cpu-sysemu.c | 6 +++---
16
target/alpha/cpu.c | 2 +-
12
target/alpha/cpu.c | 2 +-
17
target/arm/cpu.c | 2 +-
13
target/arm/cpu.c | 2 +-
18
target/avr/cpu.c | 2 +-
14
target/avr/cpu.c | 2 +-
19
target/cris/cpu.c | 2 +-
15
target/cris/cpu.c | 2 +-
20
target/hppa/cpu.c | 2 +-
16
target/hppa/cpu.c | 2 +-
21
target/i386/tcg/tcg-cpu.c | 2 +-
17
target/i386/cpu.c | 2 +-
22
target/lm32/cpu.c | 2 +-
18
target/m68k/cpu.c | 2 +-
23
target/m68k/cpu.c | 2 +-
19
target/microblaze/cpu.c | 2 +-
24
target/microblaze/cpu.c | 2 +-
20
target/mips/cpu.c | 2 +-
25
target/mips/cpu.c | 2 +-
21
target/nios2/cpu.c | 2 +-
26
target/moxie/cpu.c | 2 +-
22
target/openrisc/cpu.c | 2 +-
27
target/nios2/cpu.c | 2 +-
23
target/ppc/cpu_init.c | 2 +-
28
target/openrisc/cpu.c | 2 +-
24
target/riscv/cpu.c | 2 +-
29
target/riscv/cpu.c | 2 +-
25
target/rx/cpu.c | 2 +-
30
target/rx/cpu.c | 2 +-
26
target/s390x/cpu.c | 2 +-
31
target/s390x/cpu.c | 2 +-
27
target/sh4/cpu.c | 2 +-
32
target/sh4/cpu.c | 2 +-
28
target/sparc/cpu.c | 2 +-
33
target/sparc/cpu.c | 2 +-
29
target/tricore/cpu.c | 2 +-
34
target/tilegx/cpu.c | 2 +-
30
target/xtensa/cpu.c | 2 +-
35
target/tricore/cpu.c | 2 +-
31
22 files changed, 35 insertions(+), 30 deletions(-)
36
target/unicore32/cpu.c | 2 +-
37
target/xtensa/cpu.c | 2 +-
38
target/ppc/translate_init.c.inc | 2 +-
39
26 files changed, 42 insertions(+), 38 deletions(-)
40
32
41
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
33
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
42
index XXXXXXX..XXXXXXX 100644
34
index XXXXXXX..XXXXXXX 100644
43
--- a/include/hw/core/cpu.h
35
--- a/include/hw/core/cpu.h
44
+++ b/include/hw/core/cpu.h
36
+++ b/include/hw/core/cpu.h
45
@@ -XXX,XX +XXX,XX @@ typedef struct TcgCpuOperations {
37
@@ -XXX,XX +XXX,XX @@ struct SysemuCPUOps;
46
void (*cpu_exec_exit)(CPUState *cpu);
47
/** @cpu_exec_interrupt: Callback for processing interrupts in cpu_exec */
48
bool (*cpu_exec_interrupt)(CPUState *cpu, int interrupt_request);
49
+ /**
50
+ * @tlb_fill: Handle a softmmu tlb miss or user-only address fault
51
+ *
52
+ * For system mode, if the access is valid, call tlb_set_page
53
+ * and return true; if the access is invalid, and probe is
54
+ * true, return false; otherwise raise an exception and do
55
+ * not return. For user-only mode, always raise an exception
56
+ * and do not return.
57
+ */
58
+ bool (*tlb_fill)(CPUState *cpu, vaddr address, int size,
59
+ MMUAccessType access_type, int mmu_idx,
60
+ bool probe, uintptr_t retaddr);
61
62
} TcgCpuOperations;
63
64
@@ -XXX,XX +XXX,XX @@ typedef struct TcgCpuOperations {
65
* If the target behaviour here is anything other than "set
38
* If the target behaviour here is anything other than "set
66
* the PC register to the value passed in" then the target must
39
* the PC register to the value passed in" then the target must
67
* also implement the synchronize_from_tb hook.
40
* also implement the synchronize_from_tb hook.
68
- * @tlb_fill: Callback for handling a softmmu tlb miss or user-only
41
- * @get_phys_page_debug: Callback for obtaining a physical address.
69
- * address fault. For system mode, if the access is valid, call
42
- * @get_phys_page_attrs_debug: Callback for obtaining a physical address and the
70
- * tlb_set_page and return true; if the access is invalid, and
43
- * associated memory transaction attributes to use for the access.
71
- * probe is true, return false; otherwise raise an exception and
44
- * CPUs which use memory transaction attributes should implement this
72
- * do not return. For user-only mode, always raise an exception
45
- * instead of get_phys_page_debug.
73
- * and do not return.
46
* @gdb_read_register: Callback for letting GDB read a register.
74
* @get_phys_page_debug: Callback for obtaining a physical address.
47
* @gdb_write_register: Callback for letting GDB write a register.
75
* @get_phys_page_attrs_debug: Callback for obtaining a physical address and the
48
* @gdb_num_core_regs: Number of core registers accessible to GDB.
76
* associated memory transaction attributes to use for the access.
77
@@ -XXX,XX +XXX,XX @@ struct CPUClass {
49
@@ -XXX,XX +XXX,XX @@ struct CPUClass {
78
void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list,
50
void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list,
79
Error **errp);
51
Error **errp);
80
void (*set_pc)(CPUState *cpu, vaddr value);
52
void (*set_pc)(CPUState *cpu, vaddr value);
81
- bool (*tlb_fill)(CPUState *cpu, vaddr address, int size,
53
- hwaddr (*get_phys_page_debug)(CPUState *cpu, vaddr addr);
82
- MMUAccessType access_type, int mmu_idx,
54
- hwaddr (*get_phys_page_attrs_debug)(CPUState *cpu, vaddr addr,
83
- bool probe, uintptr_t retaddr);
55
- MemTxAttrs *attrs);
84
hwaddr (*get_phys_page_debug)(CPUState *cpu, vaddr addr);
56
int (*gdb_read_register)(CPUState *cpu, GByteArray *buf, int reg);
85
hwaddr (*get_phys_page_attrs_debug)(CPUState *cpu, vaddr addr,
57
int (*gdb_write_register)(CPUState *cpu, uint8_t *buf, int reg);
86
MemTxAttrs *attrs);
58
87
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
59
diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h
88
index XXXXXXX..XXXXXXX 100644
60
index XXXXXXX..XXXXXXX 100644
89
--- a/accel/tcg/cputlb.c
61
--- a/include/hw/core/sysemu-cpu-ops.h
90
+++ b/accel/tcg/cputlb.c
62
+++ b/include/hw/core/sysemu-cpu-ops.h
91
@@ -XXX,XX +XXX,XX @@ static void tlb_fill(CPUState *cpu, target_ulong addr, int size,
63
@@ -XXX,XX +XXX,XX @@
92
* This is not a probe, so only valid return is success; failure
64
* struct SysemuCPUOps: System operations specific to a CPU class
93
* should result in exception + longjmp to the cpu loop.
65
*/
94
*/
66
typedef struct SysemuCPUOps {
95
- ok = cc->tlb_fill(cpu, addr, size, access_type, mmu_idx, false, retaddr);
67
+ /**
96
+ ok = cc->tcg_ops.tlb_fill(cpu, addr, size,
68
+ * @get_phys_page_debug: Callback for obtaining a physical address.
97
+ access_type, mmu_idx, false, retaddr);
69
+ */
98
assert(ok);
70
+ hwaddr (*get_phys_page_debug)(CPUState *cpu, vaddr addr);
71
+ /**
72
+ * @get_phys_page_attrs_debug: Callback for obtaining a physical address
73
+ * and the associated memory transaction attributes to use for the
74
+ * access.
75
+ * CPUs which use memory transaction attributes should implement this
76
+ * instead of get_phys_page_debug.
77
+ */
78
+ hwaddr (*get_phys_page_attrs_debug)(CPUState *cpu, vaddr addr,
79
+ MemTxAttrs *attrs);
80
/**
81
* @asidx_from_attrs: Callback to return the CPU AddressSpace to use for
82
* a memory access with the specified memory transaction attributes.
83
diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c
84
index XXXXXXX..XXXXXXX 100644
85
--- a/hw/core/cpu-sysemu.c
86
+++ b/hw/core/cpu-sysemu.c
87
@@ -XXX,XX +XXX,XX @@ hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
88
{
89
CPUClass *cc = CPU_GET_CLASS(cpu);
90
91
- if (cc->get_phys_page_attrs_debug) {
92
- return cc->get_phys_page_attrs_debug(cpu, addr, attrs);
93
+ if (cc->sysemu_ops->get_phys_page_attrs_debug) {
94
+ return cc->sysemu_ops->get_phys_page_attrs_debug(cpu, addr, attrs);
95
}
96
/* Fallback for CPUs which don't implement the _attrs_ hook */
97
*attrs = MEMTXATTRS_UNSPECIFIED;
98
- return cc->get_phys_page_debug(cpu, addr);
99
+ return cc->sysemu_ops->get_phys_page_debug(cpu, addr);
99
}
100
}
100
101
101
@@ -XXX,XX +XXX,XX @@ static int probe_access_internal(CPUArchState *env, target_ulong addr,
102
hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr)
102
CPUState *cs = env_cpu(env);
103
CPUClass *cc = CPU_GET_CLASS(cs);
104
105
- if (!cc->tlb_fill(cs, addr, fault_size, access_type,
106
- mmu_idx, nonfault, retaddr)) {
107
+ if (!cc->tcg_ops.tlb_fill(cs, addr, fault_size, access_type,
108
+ mmu_idx, nonfault, retaddr)) {
109
/* Non-faulting page table read failed. */
110
*phost = NULL;
111
return TLB_INVALID_MASK;
112
diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
113
index XXXXXXX..XXXXXXX 100644
114
--- a/accel/tcg/user-exec.c
115
+++ b/accel/tcg/user-exec.c
116
@@ -XXX,XX +XXX,XX @@ static inline int handle_cpu_signal(uintptr_t pc, siginfo_t *info,
117
clear_helper_retaddr();
118
119
cc = CPU_GET_CLASS(cpu);
120
- cc->tlb_fill(cpu, address, 0, access_type, MMU_USER_IDX, false, pc);
121
+ cc->tcg_ops.tlb_fill(cpu, address, 0, access_type, MMU_USER_IDX, false, pc);
122
g_assert_not_reached();
123
}
124
125
@@ -XXX,XX +XXX,XX @@ static int probe_access_internal(CPUArchState *env, target_ulong addr,
126
} else {
127
CPUState *cpu = env_cpu(env);
128
CPUClass *cc = CPU_GET_CLASS(cpu);
129
- cc->tlb_fill(cpu, addr, fault_size, access_type,
130
- MMU_USER_IDX, false, ra);
131
+ cc->tcg_ops.tlb_fill(cpu, addr, fault_size, access_type,
132
+ MMU_USER_IDX, false, ra);
133
g_assert_not_reached();
134
}
135
}
136
diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c
103
diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c
137
index XXXXXXX..XXXXXXX 100644
104
index XXXXXXX..XXXXXXX 100644
138
--- a/target/alpha/cpu.c
105
--- a/target/alpha/cpu.c
139
+++ b/target/alpha/cpu.c
106
+++ b/target/alpha/cpu.c
107
@@ -XXX,XX +XXX,XX @@ static void alpha_cpu_initfn(Object *obj)
108
#include "hw/core/sysemu-cpu-ops.h"
109
110
static const struct SysemuCPUOps alpha_sysemu_ops = {
111
+ .get_phys_page_debug = alpha_cpu_get_phys_page_debug,
112
};
113
#endif
114
140
@@ -XXX,XX +XXX,XX @@ static void alpha_cpu_class_init(ObjectClass *oc, void *data)
115
@@ -XXX,XX +XXX,XX @@ static void alpha_cpu_class_init(ObjectClass *oc, void *data)
141
cc->set_pc = alpha_cpu_set_pc;
142
cc->gdb_read_register = alpha_cpu_gdb_read_register;
116
cc->gdb_read_register = alpha_cpu_gdb_read_register;
143
cc->gdb_write_register = alpha_cpu_gdb_write_register;
117
cc->gdb_write_register = alpha_cpu_gdb_write_register;
144
- cc->tlb_fill = alpha_cpu_tlb_fill;
118
#ifndef CONFIG_USER_ONLY
145
+ cc->tcg_ops.tlb_fill = alpha_cpu_tlb_fill;
119
- cc->get_phys_page_debug = alpha_cpu_get_phys_page_debug;
146
#ifndef CONFIG_USER_ONLY
120
dc->vmsd = &vmstate_alpha_cpu;
147
cc->do_transaction_failed = alpha_cpu_do_transaction_failed;
121
cc->sysemu_ops = &alpha_sysemu_ops;
148
cc->do_unaligned_access = alpha_cpu_do_unaligned_access;
122
#endif
149
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
123
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
150
index XXXXXXX..XXXXXXX 100644
124
index XXXXXXX..XXXXXXX 100644
151
--- a/target/arm/cpu.c
125
--- a/target/arm/cpu.c
152
+++ b/target/arm/cpu.c
126
+++ b/target/arm/cpu.c
127
@@ -XXX,XX +XXX,XX @@ static gchar *arm_gdb_arch_name(CPUState *cs)
128
#include "hw/core/sysemu-cpu-ops.h"
129
130
static const struct SysemuCPUOps arm_sysemu_ops = {
131
+ .get_phys_page_attrs_debug = arm_cpu_get_phys_page_attrs_debug,
132
.asidx_from_attrs = arm_asidx_from_attrs,
133
.write_elf32_note = arm_cpu_write_elf32_note,
134
.write_elf64_note = arm_cpu_write_elf64_note,
153
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
135
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
154
cc->tcg_ops.initialize = arm_translate_init;
136
cc->gdb_read_register = arm_cpu_gdb_read_register;
155
cc->tcg_ops.cpu_exec_interrupt = arm_cpu_exec_interrupt;
137
cc->gdb_write_register = arm_cpu_gdb_write_register;
156
cc->tcg_ops.synchronize_from_tb = arm_cpu_synchronize_from_tb;
138
#ifndef CONFIG_USER_ONLY
157
- cc->tlb_fill = arm_cpu_tlb_fill;
139
- cc->get_phys_page_attrs_debug = arm_cpu_get_phys_page_attrs_debug;
158
+ cc->tcg_ops.tlb_fill = arm_cpu_tlb_fill;
140
cc->sysemu_ops = &arm_sysemu_ops;
159
cc->debug_excp_handler = arm_debug_excp_handler;
141
#endif
160
cc->debug_check_watchpoint = arm_debug_check_watchpoint;
142
cc->gdb_num_core_regs = 26;
161
cc->do_unaligned_access = arm_cpu_do_unaligned_access;
162
diff --git a/target/avr/cpu.c b/target/avr/cpu.c
143
diff --git a/target/avr/cpu.c b/target/avr/cpu.c
163
index XXXXXXX..XXXXXXX 100644
144
index XXXXXXX..XXXXXXX 100644
164
--- a/target/avr/cpu.c
145
--- a/target/avr/cpu.c
165
+++ b/target/avr/cpu.c
146
+++ b/target/avr/cpu.c
147
@@ -XXX,XX +XXX,XX @@ static void avr_cpu_dump_state(CPUState *cs, FILE *f, int flags)
148
#include "hw/core/sysemu-cpu-ops.h"
149
150
static const struct SysemuCPUOps avr_sysemu_ops = {
151
+ .get_phys_page_debug = avr_cpu_get_phys_page_debug,
152
};
153
154
#include "hw/core/tcg-cpu-ops.h"
166
@@ -XXX,XX +XXX,XX @@ static void avr_cpu_class_init(ObjectClass *oc, void *data)
155
@@ -XXX,XX +XXX,XX @@ static void avr_cpu_class_init(ObjectClass *oc, void *data)
156
cc->dump_state = avr_cpu_dump_state;
167
cc->set_pc = avr_cpu_set_pc;
157
cc->set_pc = avr_cpu_set_pc;
168
cc->memory_rw_debug = avr_cpu_memory_rw_debug;
158
cc->memory_rw_debug = avr_cpu_memory_rw_debug;
169
cc->get_phys_page_debug = avr_cpu_get_phys_page_debug;
159
- cc->get_phys_page_debug = avr_cpu_get_phys_page_debug;
170
- cc->tlb_fill = avr_cpu_tlb_fill;
160
dc->vmsd = &vms_avr_cpu;
171
+ cc->tcg_ops.tlb_fill = avr_cpu_tlb_fill;
161
cc->sysemu_ops = &avr_sysemu_ops;
172
cc->vmsd = &vms_avr_cpu;
173
cc->disas_set_info = avr_cpu_disas_set_info;
162
cc->disas_set_info = avr_cpu_disas_set_info;
174
cc->tcg_ops.initialize = avr_cpu_tcg_init;
175
diff --git a/target/cris/cpu.c b/target/cris/cpu.c
163
diff --git a/target/cris/cpu.c b/target/cris/cpu.c
176
index XXXXXXX..XXXXXXX 100644
164
index XXXXXXX..XXXXXXX 100644
177
--- a/target/cris/cpu.c
165
--- a/target/cris/cpu.c
178
+++ b/target/cris/cpu.c
166
+++ b/target/cris/cpu.c
167
@@ -XXX,XX +XXX,XX @@ static void cris_cpu_initfn(Object *obj)
168
#include "hw/core/sysemu-cpu-ops.h"
169
170
static const struct SysemuCPUOps cris_sysemu_ops = {
171
+ .get_phys_page_debug = cris_cpu_get_phys_page_debug,
172
};
173
#endif
174
179
@@ -XXX,XX +XXX,XX @@ static void cris_cpu_class_init(ObjectClass *oc, void *data)
175
@@ -XXX,XX +XXX,XX @@ static void cris_cpu_class_init(ObjectClass *oc, void *data)
180
cc->set_pc = cris_cpu_set_pc;
181
cc->gdb_read_register = cris_cpu_gdb_read_register;
176
cc->gdb_read_register = cris_cpu_gdb_read_register;
182
cc->gdb_write_register = cris_cpu_gdb_write_register;
177
cc->gdb_write_register = cris_cpu_gdb_write_register;
183
- cc->tlb_fill = cris_cpu_tlb_fill;
178
#ifndef CONFIG_USER_ONLY
184
+ cc->tcg_ops.tlb_fill = cris_cpu_tlb_fill;
179
- cc->get_phys_page_debug = cris_cpu_get_phys_page_debug;
185
#ifndef CONFIG_USER_ONLY
186
cc->get_phys_page_debug = cris_cpu_get_phys_page_debug;
187
dc->vmsd = &vmstate_cris_cpu;
180
dc->vmsd = &vmstate_cris_cpu;
181
cc->sysemu_ops = &cris_sysemu_ops;
182
#endif
188
diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
183
diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
189
index XXXXXXX..XXXXXXX 100644
184
index XXXXXXX..XXXXXXX 100644
190
--- a/target/hppa/cpu.c
185
--- a/target/hppa/cpu.c
191
+++ b/target/hppa/cpu.c
186
+++ b/target/hppa/cpu.c
187
@@ -XXX,XX +XXX,XX @@ static ObjectClass *hppa_cpu_class_by_name(const char *cpu_model)
188
#include "hw/core/sysemu-cpu-ops.h"
189
190
static const struct SysemuCPUOps hppa_sysemu_ops = {
191
+ .get_phys_page_debug = hppa_cpu_get_phys_page_debug,
192
};
193
#endif
194
192
@@ -XXX,XX +XXX,XX @@ static void hppa_cpu_class_init(ObjectClass *oc, void *data)
195
@@ -XXX,XX +XXX,XX @@ static void hppa_cpu_class_init(ObjectClass *oc, void *data)
193
cc->tcg_ops.synchronize_from_tb = hppa_cpu_synchronize_from_tb;
194
cc->gdb_read_register = hppa_cpu_gdb_read_register;
196
cc->gdb_read_register = hppa_cpu_gdb_read_register;
195
cc->gdb_write_register = hppa_cpu_gdb_write_register;
197
cc->gdb_write_register = hppa_cpu_gdb_write_register;
196
- cc->tlb_fill = hppa_cpu_tlb_fill;
198
#ifndef CONFIG_USER_ONLY
197
+ cc->tcg_ops.tlb_fill = hppa_cpu_tlb_fill;
199
- cc->get_phys_page_debug = hppa_cpu_get_phys_page_debug;
198
#ifndef CONFIG_USER_ONLY
199
cc->get_phys_page_debug = hppa_cpu_get_phys_page_debug;
200
dc->vmsd = &vmstate_hppa_cpu;
200
dc->vmsd = &vmstate_hppa_cpu;
201
diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c
201
cc->sysemu_ops = &hppa_sysemu_ops;
202
index XXXXXXX..XXXXXXX 100644
202
#endif
203
--- a/target/i386/tcg/tcg-cpu.c
203
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
204
+++ b/target/i386/tcg/tcg-cpu.c
204
index XXXXXXX..XXXXXXX 100644
205
@@ -XXX,XX +XXX,XX @@ void tcg_cpu_common_class_init(CPUClass *cc)
205
--- a/target/i386/cpu.c
206
cc->tcg_ops.cpu_exec_enter = x86_cpu_exec_enter;
206
+++ b/target/i386/cpu.c
207
cc->tcg_ops.cpu_exec_exit = x86_cpu_exec_exit;
207
@@ -XXX,XX +XXX,XX @@ static Property x86_cpu_properties[] = {
208
cc->tcg_ops.initialize = tcg_x86_init;
208
#include "hw/core/sysemu-cpu-ops.h"
209
- cc->tlb_fill = x86_cpu_tlb_fill;
209
210
+ cc->tcg_ops.tlb_fill = x86_cpu_tlb_fill;
210
static const struct SysemuCPUOps i386_sysemu_ops = {
211
#ifndef CONFIG_USER_ONLY
211
+ .get_phys_page_attrs_debug = x86_cpu_get_phys_page_attrs_debug,
212
cc->debug_excp_handler = breakpoint_handler;
212
.asidx_from_attrs = x86_asidx_from_attrs,
213
#endif
213
.get_crash_info = x86_cpu_get_crash_info,
214
diff --git a/target/lm32/cpu.c b/target/lm32/cpu.c
214
.write_elf32_note = x86_cpu_write_elf32_note,
215
index XXXXXXX..XXXXXXX 100644
215
@@ -XXX,XX +XXX,XX @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
216
--- a/target/lm32/cpu.c
216
217
+++ b/target/lm32/cpu.c
217
#ifndef CONFIG_USER_ONLY
218
@@ -XXX,XX +XXX,XX @@ static void lm32_cpu_class_init(ObjectClass *oc, void *data)
218
cc->get_memory_mapping = x86_cpu_get_memory_mapping;
219
cc->set_pc = lm32_cpu_set_pc;
219
- cc->get_phys_page_attrs_debug = x86_cpu_get_phys_page_attrs_debug;
220
cc->gdb_read_register = lm32_cpu_gdb_read_register;
220
cc->sysemu_ops = &i386_sysemu_ops;
221
cc->gdb_write_register = lm32_cpu_gdb_write_register;
221
#endif /* !CONFIG_USER_ONLY */
222
- cc->tlb_fill = lm32_cpu_tlb_fill;
222
223
+ cc->tcg_ops.tlb_fill = lm32_cpu_tlb_fill;
224
#ifndef CONFIG_USER_ONLY
225
cc->get_phys_page_debug = lm32_cpu_get_phys_page_debug;
226
cc->vmsd = &vmstate_lm32_cpu;
227
diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c
223
diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c
228
index XXXXXXX..XXXXXXX 100644
224
index XXXXXXX..XXXXXXX 100644
229
--- a/target/m68k/cpu.c
225
--- a/target/m68k/cpu.c
230
+++ b/target/m68k/cpu.c
226
+++ b/target/m68k/cpu.c
227
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m68k_cpu = {
228
#include "hw/core/sysemu-cpu-ops.h"
229
230
static const struct SysemuCPUOps m68k_sysemu_ops = {
231
+ .get_phys_page_debug = m68k_cpu_get_phys_page_debug,
232
};
233
#endif
234
231
@@ -XXX,XX +XXX,XX @@ static void m68k_cpu_class_init(ObjectClass *c, void *data)
235
@@ -XXX,XX +XXX,XX @@ static void m68k_cpu_class_init(ObjectClass *c, void *data)
232
cc->set_pc = m68k_cpu_set_pc;
233
cc->gdb_read_register = m68k_cpu_gdb_read_register;
236
cc->gdb_read_register = m68k_cpu_gdb_read_register;
234
cc->gdb_write_register = m68k_cpu_gdb_write_register;
237
cc->gdb_write_register = m68k_cpu_gdb_write_register;
235
- cc->tlb_fill = m68k_cpu_tlb_fill;
236
+ cc->tcg_ops.tlb_fill = m68k_cpu_tlb_fill;
237
#if defined(CONFIG_SOFTMMU)
238
#if defined(CONFIG_SOFTMMU)
238
cc->do_transaction_failed = m68k_cpu_transaction_failed;
239
- cc->get_phys_page_debug = m68k_cpu_get_phys_page_debug;
239
cc->get_phys_page_debug = m68k_cpu_get_phys_page_debug;
240
dc->vmsd = &vmstate_m68k_cpu;
241
cc->sysemu_ops = &m68k_sysemu_ops;
242
#endif
240
diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c
243
diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c
241
index XXXXXXX..XXXXXXX 100644
244
index XXXXXXX..XXXXXXX 100644
242
--- a/target/microblaze/cpu.c
245
--- a/target/microblaze/cpu.c
243
+++ b/target/microblaze/cpu.c
246
+++ b/target/microblaze/cpu.c
247
@@ -XXX,XX +XXX,XX @@ static ObjectClass *mb_cpu_class_by_name(const char *cpu_model)
248
#include "hw/core/sysemu-cpu-ops.h"
249
250
static const struct SysemuCPUOps mb_sysemu_ops = {
251
+ .get_phys_page_attrs_debug = mb_cpu_get_phys_page_attrs_debug,
252
};
253
#endif
254
244
@@ -XXX,XX +XXX,XX @@ static void mb_cpu_class_init(ObjectClass *oc, void *data)
255
@@ -XXX,XX +XXX,XX @@ static void mb_cpu_class_init(ObjectClass *oc, void *data)
245
cc->tcg_ops.synchronize_from_tb = mb_cpu_synchronize_from_tb;
246
cc->gdb_read_register = mb_cpu_gdb_read_register;
247
cc->gdb_write_register = mb_cpu_gdb_write_register;
256
cc->gdb_write_register = mb_cpu_gdb_write_register;
248
- cc->tlb_fill = mb_cpu_tlb_fill;
257
249
+ cc->tcg_ops.tlb_fill = mb_cpu_tlb_fill;
258
#ifndef CONFIG_USER_ONLY
250
#ifndef CONFIG_USER_ONLY
259
- cc->get_phys_page_attrs_debug = mb_cpu_get_phys_page_attrs_debug;
251
cc->do_transaction_failed = mb_cpu_transaction_failed;
260
dc->vmsd = &vmstate_mb_cpu;
252
cc->get_phys_page_attrs_debug = mb_cpu_get_phys_page_attrs_debug;
261
cc->sysemu_ops = &mb_sysemu_ops;
262
#endif
253
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
263
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
254
index XXXXXXX..XXXXXXX 100644
264
index XXXXXXX..XXXXXXX 100644
255
--- a/target/mips/cpu.c
265
--- a/target/mips/cpu.c
256
+++ b/target/mips/cpu.c
266
+++ b/target/mips/cpu.c
267
@@ -XXX,XX +XXX,XX @@ static Property mips_cpu_properties[] = {
268
#include "hw/core/sysemu-cpu-ops.h"
269
270
static const struct SysemuCPUOps mips_sysemu_ops = {
271
+ .get_phys_page_debug = mips_cpu_get_phys_page_debug,
272
.legacy_vmsd = &vmstate_mips_cpu,
273
};
274
#endif
257
@@ -XXX,XX +XXX,XX @@ static void mips_cpu_class_init(ObjectClass *c, void *data)
275
@@ -XXX,XX +XXX,XX @@ static void mips_cpu_class_init(ObjectClass *c, void *data)
258
cc->tcg_ops.initialize = mips_tcg_init;
276
cc->gdb_read_register = mips_cpu_gdb_read_register;
259
cc->tcg_ops.cpu_exec_interrupt = mips_cpu_exec_interrupt;
277
cc->gdb_write_register = mips_cpu_gdb_write_register;
260
cc->tcg_ops.synchronize_from_tb = mips_cpu_synchronize_from_tb;
278
#ifndef CONFIG_USER_ONLY
261
- cc->tlb_fill = mips_cpu_tlb_fill;
279
- cc->get_phys_page_debug = mips_cpu_get_phys_page_debug;
262
+ cc->tcg_ops.tlb_fill = mips_cpu_tlb_fill;
280
cc->sysemu_ops = &mips_sysemu_ops;
263
#endif
281
#endif
264
282
cc->disas_set_info = mips_cpu_disas_set_info;
265
cc->gdb_num_core_regs = 73;
266
diff --git a/target/moxie/cpu.c b/target/moxie/cpu.c
267
index XXXXXXX..XXXXXXX 100644
268
--- a/target/moxie/cpu.c
269
+++ b/target/moxie/cpu.c
270
@@ -XXX,XX +XXX,XX @@ static void moxie_cpu_class_init(ObjectClass *oc, void *data)
271
cc->do_interrupt = moxie_cpu_do_interrupt;
272
cc->dump_state = moxie_cpu_dump_state;
273
cc->set_pc = moxie_cpu_set_pc;
274
- cc->tlb_fill = moxie_cpu_tlb_fill;
275
+ cc->tcg_ops.tlb_fill = moxie_cpu_tlb_fill;
276
#ifndef CONFIG_USER_ONLY
277
cc->get_phys_page_debug = moxie_cpu_get_phys_page_debug;
278
cc->vmsd = &vmstate_moxie_cpu;
279
diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c
283
diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c
280
index XXXXXXX..XXXXXXX 100644
284
index XXXXXXX..XXXXXXX 100644
281
--- a/target/nios2/cpu.c
285
--- a/target/nios2/cpu.c
282
+++ b/target/nios2/cpu.c
286
+++ b/target/nios2/cpu.c
287
@@ -XXX,XX +XXX,XX @@ static Property nios2_properties[] = {
288
#include "hw/core/sysemu-cpu-ops.h"
289
290
static const struct SysemuCPUOps nios2_sysemu_ops = {
291
+ .get_phys_page_debug = nios2_cpu_get_phys_page_debug,
292
};
293
#endif
294
283
@@ -XXX,XX +XXX,XX @@ static void nios2_cpu_class_init(ObjectClass *oc, void *data)
295
@@ -XXX,XX +XXX,XX @@ static void nios2_cpu_class_init(ObjectClass *oc, void *data)
284
cc->dump_state = nios2_cpu_dump_state;
285
cc->set_pc = nios2_cpu_set_pc;
296
cc->set_pc = nios2_cpu_set_pc;
286
cc->disas_set_info = nios2_cpu_disas_set_info;
297
cc->disas_set_info = nios2_cpu_disas_set_info;
287
- cc->tlb_fill = nios2_cpu_tlb_fill;
298
#ifndef CONFIG_USER_ONLY
288
+ cc->tcg_ops.tlb_fill = nios2_cpu_tlb_fill;
299
- cc->get_phys_page_debug = nios2_cpu_get_phys_page_debug;
289
#ifndef CONFIG_USER_ONLY
300
cc->sysemu_ops = &nios2_sysemu_ops;
290
cc->do_unaligned_access = nios2_cpu_do_unaligned_access;
301
#endif
291
cc->get_phys_page_debug = nios2_cpu_get_phys_page_debug;
302
cc->gdb_read_register = nios2_cpu_gdb_read_register;
292
diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c
303
diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c
293
index XXXXXXX..XXXXXXX 100644
304
index XXXXXXX..XXXXXXX 100644
294
--- a/target/openrisc/cpu.c
305
--- a/target/openrisc/cpu.c
295
+++ b/target/openrisc/cpu.c
306
+++ b/target/openrisc/cpu.c
307
@@ -XXX,XX +XXX,XX @@ static void openrisc_any_initfn(Object *obj)
308
#include "hw/core/sysemu-cpu-ops.h"
309
310
static const struct SysemuCPUOps openrisc_sysemu_ops = {
311
+ .get_phys_page_debug = openrisc_cpu_get_phys_page_debug,
312
};
313
#endif
314
296
@@ -XXX,XX +XXX,XX @@ static void openrisc_cpu_class_init(ObjectClass *oc, void *data)
315
@@ -XXX,XX +XXX,XX @@ static void openrisc_cpu_class_init(ObjectClass *oc, void *data)
297
cc->set_pc = openrisc_cpu_set_pc;
298
cc->gdb_read_register = openrisc_cpu_gdb_read_register;
316
cc->gdb_read_register = openrisc_cpu_gdb_read_register;
299
cc->gdb_write_register = openrisc_cpu_gdb_write_register;
317
cc->gdb_write_register = openrisc_cpu_gdb_write_register;
300
- cc->tlb_fill = openrisc_cpu_tlb_fill;
318
#ifndef CONFIG_USER_ONLY
301
+ cc->tcg_ops.tlb_fill = openrisc_cpu_tlb_fill;
319
- cc->get_phys_page_debug = openrisc_cpu_get_phys_page_debug;
302
#ifndef CONFIG_USER_ONLY
303
cc->get_phys_page_debug = openrisc_cpu_get_phys_page_debug;
304
dc->vmsd = &vmstate_openrisc_cpu;
320
dc->vmsd = &vmstate_openrisc_cpu;
321
cc->sysemu_ops = &openrisc_sysemu_ops;
322
#endif
323
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
324
index XXXXXXX..XXXXXXX 100644
325
--- a/target/ppc/cpu_init.c
326
+++ b/target/ppc/cpu_init.c
327
@@ -XXX,XX +XXX,XX @@ static Property ppc_cpu_properties[] = {
328
#include "hw/core/sysemu-cpu-ops.h"
329
330
static const struct SysemuCPUOps ppc_sysemu_ops = {
331
+ .get_phys_page_debug = ppc_cpu_get_phys_page_debug,
332
.write_elf32_note = ppc32_cpu_write_elf32_note,
333
.write_elf64_note = ppc64_cpu_write_elf64_note,
334
.virtio_is_big_endian = ppc_cpu_is_big_endian,
335
@@ -XXX,XX +XXX,XX @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
336
cc->gdb_read_register = ppc_cpu_gdb_read_register;
337
cc->gdb_write_register = ppc_cpu_gdb_write_register;
338
#ifndef CONFIG_USER_ONLY
339
- cc->get_phys_page_debug = ppc_cpu_get_phys_page_debug;
340
cc->sysemu_ops = &ppc_sysemu_ops;
341
#endif
342
305
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
343
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
306
index XXXXXXX..XXXXXXX 100644
344
index XXXXXXX..XXXXXXX 100644
307
--- a/target/riscv/cpu.c
345
--- a/target/riscv/cpu.c
308
+++ b/target/riscv/cpu.c
346
+++ b/target/riscv/cpu.c
347
@@ -XXX,XX +XXX,XX @@ static const char *riscv_gdb_get_dynamic_xml(CPUState *cs, const char *xmlname)
348
#include "hw/core/sysemu-cpu-ops.h"
349
350
static const struct SysemuCPUOps riscv_sysemu_ops = {
351
+ .get_phys_page_debug = riscv_cpu_get_phys_page_debug,
352
.write_elf64_note = riscv_cpu_write_elf64_note,
353
.write_elf32_note = riscv_cpu_write_elf32_note,
354
.legacy_vmsd = &vmstate_riscv_cpu,
309
@@ -XXX,XX +XXX,XX @@ static void riscv_cpu_class_init(ObjectClass *c, void *data)
355
@@ -XXX,XX +XXX,XX @@ static void riscv_cpu_class_init(ObjectClass *c, void *data)
356
cc->gdb_stop_before_watchpoint = true;
357
cc->disas_set_info = riscv_cpu_disas_set_info;
358
#ifndef CONFIG_USER_ONLY
359
- cc->get_phys_page_debug = riscv_cpu_get_phys_page_debug;
360
cc->sysemu_ops = &riscv_sysemu_ops;
361
#endif
310
cc->gdb_arch_name = riscv_gdb_arch_name;
362
cc->gdb_arch_name = riscv_gdb_arch_name;
311
cc->gdb_get_dynamic_xml = riscv_gdb_get_dynamic_xml;
312
cc->tcg_ops.initialize = riscv_translate_init;
313
- cc->tlb_fill = riscv_cpu_tlb_fill;
314
+ cc->tcg_ops.tlb_fill = riscv_cpu_tlb_fill;
315
316
device_class_set_props(dc, riscv_cpu_properties);
317
}
318
diff --git a/target/rx/cpu.c b/target/rx/cpu.c
363
diff --git a/target/rx/cpu.c b/target/rx/cpu.c
319
index XXXXXXX..XXXXXXX 100644
364
index XXXXXXX..XXXXXXX 100644
320
--- a/target/rx/cpu.c
365
--- a/target/rx/cpu.c
321
+++ b/target/rx/cpu.c
366
+++ b/target/rx/cpu.c
367
@@ -XXX,XX +XXX,XX @@ static void rx_cpu_init(Object *obj)
368
#include "hw/core/sysemu-cpu-ops.h"
369
370
static const struct SysemuCPUOps rx_sysemu_ops = {
371
+ .get_phys_page_debug = rx_cpu_get_phys_page_debug,
372
};
373
#endif
374
322
@@ -XXX,XX +XXX,XX @@ static void rx_cpu_class_init(ObjectClass *klass, void *data)
375
@@ -XXX,XX +XXX,XX @@ static void rx_cpu_class_init(ObjectClass *klass, void *data)
323
cc->get_phys_page_debug = rx_cpu_get_phys_page_debug;
376
#endif
377
cc->gdb_read_register = rx_cpu_gdb_read_register;
378
cc->gdb_write_register = rx_cpu_gdb_write_register;
379
- cc->get_phys_page_debug = rx_cpu_get_phys_page_debug;
324
cc->disas_set_info = rx_cpu_disas_set_info;
380
cc->disas_set_info = rx_cpu_disas_set_info;
325
cc->tcg_ops.initialize = rx_translate_init;
326
- cc->tlb_fill = rx_cpu_tlb_fill;
327
+ cc->tcg_ops.tlb_fill = rx_cpu_tlb_fill;
328
381
329
cc->gdb_num_core_regs = 26;
382
cc->gdb_num_core_regs = 26;
330
cc->gdb_core_xml_file = "rx-core.xml";
331
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
383
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
332
index XXXXXXX..XXXXXXX 100644
384
index XXXXXXX..XXXXXXX 100644
333
--- a/target/s390x/cpu.c
385
--- a/target/s390x/cpu.c
334
+++ b/target/s390x/cpu.c
386
+++ b/target/s390x/cpu.c
387
@@ -XXX,XX +XXX,XX @@ static void s390_cpu_reset_full(DeviceState *dev)
388
#include "hw/core/sysemu-cpu-ops.h"
389
390
static const struct SysemuCPUOps s390_sysemu_ops = {
391
+ .get_phys_page_debug = s390_cpu_get_phys_page_debug,
392
.get_crash_info = s390_cpu_get_crash_info,
393
.write_elf64_note = s390_cpu_write_elf64_note,
394
.legacy_vmsd = &vmstate_s390_cpu,
335
@@ -XXX,XX +XXX,XX @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)
395
@@ -XXX,XX +XXX,XX @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)
396
cc->gdb_read_register = s390_cpu_gdb_read_register;
397
cc->gdb_write_register = s390_cpu_gdb_write_register;
398
#ifndef CONFIG_USER_ONLY
399
- cc->get_phys_page_debug = s390_cpu_get_phys_page_debug;
400
cc->sysemu_ops = &s390_sysemu_ops;
401
#endif
336
cc->disas_set_info = s390_cpu_disas_set_info;
402
cc->disas_set_info = s390_cpu_disas_set_info;
337
#ifdef CONFIG_TCG
338
cc->tcg_ops.initialize = s390x_translate_init;
339
- cc->tlb_fill = s390_cpu_tlb_fill;
340
+ cc->tcg_ops.tlb_fill = s390_cpu_tlb_fill;
341
#endif
342
343
cc->gdb_num_core_regs = S390_NUM_CORE_REGS;
344
diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c
403
diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c
345
index XXXXXXX..XXXXXXX 100644
404
index XXXXXXX..XXXXXXX 100644
346
--- a/target/sh4/cpu.c
405
--- a/target/sh4/cpu.c
347
+++ b/target/sh4/cpu.c
406
+++ b/target/sh4/cpu.c
407
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_sh_cpu = {
408
#include "hw/core/sysemu-cpu-ops.h"
409
410
static const struct SysemuCPUOps sh4_sysemu_ops = {
411
+ .get_phys_page_debug = superh_cpu_get_phys_page_debug,
412
};
413
#endif
414
348
@@ -XXX,XX +XXX,XX @@ static void superh_cpu_class_init(ObjectClass *oc, void *data)
415
@@ -XXX,XX +XXX,XX @@ static void superh_cpu_class_init(ObjectClass *oc, void *data)
349
cc->tcg_ops.synchronize_from_tb = superh_cpu_synchronize_from_tb;
350
cc->gdb_read_register = superh_cpu_gdb_read_register;
416
cc->gdb_read_register = superh_cpu_gdb_read_register;
351
cc->gdb_write_register = superh_cpu_gdb_write_register;
417
cc->gdb_write_register = superh_cpu_gdb_write_register;
352
- cc->tlb_fill = superh_cpu_tlb_fill;
418
#ifndef CONFIG_USER_ONLY
353
+ cc->tcg_ops.tlb_fill = superh_cpu_tlb_fill;
419
- cc->get_phys_page_debug = superh_cpu_get_phys_page_debug;
354
#ifndef CONFIG_USER_ONLY
420
cc->sysemu_ops = &sh4_sysemu_ops;
355
cc->do_unaligned_access = superh_cpu_do_unaligned_access;
421
dc->vmsd = &vmstate_sh_cpu;
356
cc->get_phys_page_debug = superh_cpu_get_phys_page_debug;
422
#endif
357
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
423
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
358
index XXXXXXX..XXXXXXX 100644
424
index XXXXXXX..XXXXXXX 100644
359
--- a/target/sparc/cpu.c
425
--- a/target/sparc/cpu.c
360
+++ b/target/sparc/cpu.c
426
+++ b/target/sparc/cpu.c
427
@@ -XXX,XX +XXX,XX @@ static Property sparc_cpu_properties[] = {
428
#include "hw/core/sysemu-cpu-ops.h"
429
430
static const struct SysemuCPUOps sparc_sysemu_ops = {
431
+ .get_phys_page_debug = sparc_cpu_get_phys_page_debug,
432
.legacy_vmsd = &vmstate_sparc_cpu,
433
};
434
#endif
361
@@ -XXX,XX +XXX,XX @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data)
435
@@ -XXX,XX +XXX,XX @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data)
362
cc->tcg_ops.synchronize_from_tb = sparc_cpu_synchronize_from_tb;
363
cc->gdb_read_register = sparc_cpu_gdb_read_register;
436
cc->gdb_read_register = sparc_cpu_gdb_read_register;
364
cc->gdb_write_register = sparc_cpu_gdb_write_register;
437
cc->gdb_write_register = sparc_cpu_gdb_write_register;
365
- cc->tlb_fill = sparc_cpu_tlb_fill;
438
#ifndef CONFIG_USER_ONLY
366
+ cc->tcg_ops.tlb_fill = sparc_cpu_tlb_fill;
439
- cc->get_phys_page_debug = sparc_cpu_get_phys_page_debug;
367
#ifndef CONFIG_USER_ONLY
440
cc->sysemu_ops = &sparc_sysemu_ops;
368
cc->do_transaction_failed = sparc_cpu_do_transaction_failed;
441
#endif
369
cc->do_unaligned_access = sparc_cpu_do_unaligned_access;
442
cc->disas_set_info = cpu_sparc_disas_set_info;
370
diff --git a/target/tilegx/cpu.c b/target/tilegx/cpu.c
371
index XXXXXXX..XXXXXXX 100644
372
--- a/target/tilegx/cpu.c
373
+++ b/target/tilegx/cpu.c
374
@@ -XXX,XX +XXX,XX @@ static void tilegx_cpu_class_init(ObjectClass *oc, void *data)
375
cc->tcg_ops.cpu_exec_interrupt = tilegx_cpu_exec_interrupt;
376
cc->dump_state = tilegx_cpu_dump_state;
377
cc->set_pc = tilegx_cpu_set_pc;
378
- cc->tlb_fill = tilegx_cpu_tlb_fill;
379
+ cc->tcg_ops.tlb_fill = tilegx_cpu_tlb_fill;
380
cc->gdb_num_core_regs = 0;
381
cc->tcg_ops.initialize = tilegx_tcg_init;
382
}
383
diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c
443
diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c
384
index XXXXXXX..XXXXXXX 100644
444
index XXXXXXX..XXXXXXX 100644
385
--- a/target/tricore/cpu.c
445
--- a/target/tricore/cpu.c
386
+++ b/target/tricore/cpu.c
446
+++ b/target/tricore/cpu.c
447
@@ -XXX,XX +XXX,XX @@ static void tc27x_initfn(Object *obj)
448
#include "hw/core/sysemu-cpu-ops.h"
449
450
static const struct SysemuCPUOps tricore_sysemu_ops = {
451
+ .get_phys_page_debug = tricore_cpu_get_phys_page_debug,
452
};
453
454
#include "hw/core/tcg-cpu-ops.h"
387
@@ -XXX,XX +XXX,XX @@ static void tricore_cpu_class_init(ObjectClass *c, void *data)
455
@@ -XXX,XX +XXX,XX @@ static void tricore_cpu_class_init(ObjectClass *c, void *data)
388
cc->tcg_ops.synchronize_from_tb = tricore_cpu_synchronize_from_tb;
456
389
cc->get_phys_page_debug = tricore_cpu_get_phys_page_debug;
457
cc->dump_state = tricore_cpu_dump_state;
390
cc->tcg_ops.initialize = tricore_tcg_init;
458
cc->set_pc = tricore_cpu_set_pc;
391
- cc->tlb_fill = tricore_cpu_tlb_fill;
459
- cc->get_phys_page_debug = tricore_cpu_get_phys_page_debug;
392
+ cc->tcg_ops.tlb_fill = tricore_cpu_tlb_fill;
460
cc->sysemu_ops = &tricore_sysemu_ops;
461
cc->tcg_ops = &tricore_tcg_ops;
393
}
462
}
394
395
#define DEFINE_TRICORE_CPU_TYPE(cpu_model, initfn) \
396
diff --git a/target/unicore32/cpu.c b/target/unicore32/cpu.c
397
index XXXXXXX..XXXXXXX 100644
398
--- a/target/unicore32/cpu.c
399
+++ b/target/unicore32/cpu.c
400
@@ -XXX,XX +XXX,XX @@ static void uc32_cpu_class_init(ObjectClass *oc, void *data)
401
cc->tcg_ops.cpu_exec_interrupt = uc32_cpu_exec_interrupt;
402
cc->dump_state = uc32_cpu_dump_state;
403
cc->set_pc = uc32_cpu_set_pc;
404
- cc->tlb_fill = uc32_cpu_tlb_fill;
405
+ cc->tcg_ops.tlb_fill = uc32_cpu_tlb_fill;
406
cc->get_phys_page_debug = uc32_cpu_get_phys_page_debug;
407
cc->tcg_ops.initialize = uc32_translate_init;
408
dc->vmsd = &vmstate_uc32_cpu;
409
diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c
463
diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c
410
index XXXXXXX..XXXXXXX 100644
464
index XXXXXXX..XXXXXXX 100644
411
--- a/target/xtensa/cpu.c
465
--- a/target/xtensa/cpu.c
412
+++ b/target/xtensa/cpu.c
466
+++ b/target/xtensa/cpu.c
467
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_xtensa_cpu = {
468
#include "hw/core/sysemu-cpu-ops.h"
469
470
static const struct SysemuCPUOps xtensa_sysemu_ops = {
471
+ .get_phys_page_debug = xtensa_cpu_get_phys_page_debug,
472
};
473
#endif
474
413
@@ -XXX,XX +XXX,XX @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data)
475
@@ -XXX,XX +XXX,XX @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data)
414
cc->gdb_read_register = xtensa_cpu_gdb_read_register;
415
cc->gdb_write_register = xtensa_cpu_gdb_write_register;
416
cc->gdb_stop_before_watchpoint = true;
476
cc->gdb_stop_before_watchpoint = true;
417
- cc->tlb_fill = xtensa_cpu_tlb_fill;
477
#ifndef CONFIG_USER_ONLY
418
+ cc->tcg_ops.tlb_fill = xtensa_cpu_tlb_fill;
478
cc->sysemu_ops = &xtensa_sysemu_ops;
419
#ifndef CONFIG_USER_ONLY
479
- cc->get_phys_page_debug = xtensa_cpu_get_phys_page_debug;
420
cc->do_unaligned_access = xtensa_cpu_do_unaligned_access;
480
dc->vmsd = &vmstate_xtensa_cpu;
421
cc->get_phys_page_debug = xtensa_cpu_get_phys_page_debug;
481
#endif
422
diff --git a/target/ppc/translate_init.c.inc b/target/ppc/translate_init.c.inc
482
cc->disas_set_info = xtensa_cpu_disas_set_info;
423
index XXXXXXX..XXXXXXX 100644
424
--- a/target/ppc/translate_init.c.inc
425
+++ b/target/ppc/translate_init.c.inc
426
@@ -XXX,XX +XXX,XX @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
427
#ifdef CONFIG_TCG
428
cc->tcg_ops.initialize = ppc_translate_init;
429
cc->tcg_ops.cpu_exec_interrupt = ppc_cpu_exec_interrupt;
430
- cc->tlb_fill = ppc_cpu_tlb_fill;
431
+ cc->tcg_ops.tlb_fill = ppc_cpu_tlb_fill;
432
#ifndef CONFIG_USER_ONLY
433
cc->tcg_ops.cpu_exec_enter = ppc_cpu_exec_enter;
434
cc->tcg_ops.cpu_exec_exit = ppc_cpu_exec_exit;
435
--
483
--
436
2.25.1
484
2.25.1
437
485
438
486
diff view generated by jsdifflib
1
From: Claudio Fontana <cfontana@suse.de>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
2
3
commit 40612000599e ("arm: Correctly handle watchpoints for BE32 CPUs")
3
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
4
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
introduced this ARM-specific, TCG-specific hack to adjust the address,
5
Message-Id: <20210517105140.1062037-22-f4bug@amsat.org>
6
before checking it with cpu_check_watchpoint.
7
8
Make adjust_watchpoint_address optional and move it to tcg_ops.
9
10
Signed-off-by: Claudio Fontana <cfontana@suse.de>
11
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
12
Message-Id: <20210204163931.7358-14-cfontana@suse.de>
13
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
14
---
7
---
15
include/hw/core/cpu.h | 6 +++++-
8
include/hw/core/cpu.h | 3 ---
16
hw/core/cpu.c | 6 ------
9
include/hw/core/sysemu-cpu-ops.h | 5 +++++
17
softmmu/physmem.c | 5 ++++-
10
hw/core/cpu-sysemu.c | 4 ++--
18
target/arm/cpu.c | 2 +-
11
target/i386/cpu.c | 2 +-
19
4 files changed, 10 insertions(+), 9 deletions(-)
12
4 files changed, 8 insertions(+), 6 deletions(-)
20
13
21
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
14
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
22
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
23
--- a/include/hw/core/cpu.h
16
--- a/include/hw/core/cpu.h
24
+++ b/include/hw/core/cpu.h
17
+++ b/include/hw/core/cpu.h
25
@@ -XXX,XX +XXX,XX @@ typedef struct TcgCpuOperations {
18
@@ -XXX,XX +XXX,XX @@ struct SysemuCPUOps;
26
void (*do_unaligned_access)(CPUState *cpu, vaddr addr,
19
* @dump_statistics: Callback for dumping statistics.
27
MMUAccessType access_type,
20
* @get_arch_id: Callback for getting architecture-dependent CPU ID.
28
int mmu_idx, uintptr_t retaddr);
21
* @get_paging_enabled: Callback for inquiring whether paging is enabled.
22
- * @get_memory_mapping: Callback for obtaining the memory mappings.
23
* @set_pc: Callback for setting the Program Counter register. This
24
* should have the semantics used by the target architecture when
25
* setting the PC from a source such as an ELF file entry point;
26
@@ -XXX,XX +XXX,XX @@ struct CPUClass {
27
void (*dump_statistics)(CPUState *cpu, int flags);
28
int64_t (*get_arch_id)(CPUState *cpu);
29
bool (*get_paging_enabled)(const CPUState *cpu);
30
- void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list,
31
- Error **errp);
32
void (*set_pc)(CPUState *cpu, vaddr value);
33
int (*gdb_read_register)(CPUState *cpu, GByteArray *buf, int reg);
34
int (*gdb_write_register)(CPUState *cpu, uint8_t *buf, int reg);
35
diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h
36
index XXXXXXX..XXXXXXX 100644
37
--- a/include/hw/core/sysemu-cpu-ops.h
38
+++ b/include/hw/core/sysemu-cpu-ops.h
39
@@ -XXX,XX +XXX,XX @@
40
* struct SysemuCPUOps: System operations specific to a CPU class
41
*/
42
typedef struct SysemuCPUOps {
29
+ /**
43
+ /**
30
+ * @adjust_watchpoint_address: hack for cpu_check_watchpoint used by ARM
44
+ * @get_memory_mapping: Callback for obtaining the memory mappings.
31
+ */
45
+ */
32
+ vaddr (*adjust_watchpoint_address)(CPUState *cpu, vaddr addr, int len);
46
+ void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list,
33
+
47
+ Error **errp);
34
} TcgCpuOperations;
48
/**
35
49
* @get_phys_page_debug: Callback for obtaining a physical address.
36
/**
50
*/
37
@@ -XXX,XX +XXX,XX @@ struct CPUClass {
51
diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c
38
const char * (*gdb_get_dynamic_xml)(CPUState *cpu, const char *xmlname);
39
40
void (*disas_set_info)(CPUState *cpu, disassemble_info *info);
41
- vaddr (*adjust_watchpoint_address)(CPUState *cpu, vaddr addr, int len);
42
43
const char *deprecation_note;
44
/* Keep non-pointer data at the end to minimize holes. */
45
diff --git a/hw/core/cpu.c b/hw/core/cpu.c
46
index XXXXXXX..XXXXXXX 100644
52
index XXXXXXX..XXXXXXX 100644
47
--- a/hw/core/cpu.c
53
--- a/hw/core/cpu-sysemu.c
48
+++ b/hw/core/cpu.c
54
+++ b/hw/core/cpu-sysemu.c
49
@@ -XXX,XX +XXX,XX @@ static int64_t cpu_common_get_arch_id(CPUState *cpu)
55
@@ -XXX,XX +XXX,XX @@ void cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list,
50
return cpu->cpu_index;
56
{
51
}
57
CPUClass *cc = CPU_GET_CLASS(cpu);
52
58
53
-static vaddr cpu_adjust_watchpoint_address(CPUState *cpu, vaddr addr, int len)
59
- if (cc->get_memory_mapping) {
54
-{
60
- cc->get_memory_mapping(cpu, list, errp);
55
- return addr;
61
+ if (cc->sysemu_ops->get_memory_mapping) {
56
-}
62
+ cc->sysemu_ops->get_memory_mapping(cpu, list, errp);
57
-
58
static Property cpu_common_props[] = {
59
#ifndef CONFIG_USER_ONLY
60
/* Create a memory property for softmmu CPU object,
61
@@ -XXX,XX +XXX,XX @@ static void cpu_class_init(ObjectClass *klass, void *data)
62
k->gdb_write_register = cpu_common_gdb_write_register;
63
k->virtio_is_big_endian = cpu_common_virtio_is_big_endian;
64
k->debug_check_watchpoint = cpu_common_debug_check_watchpoint;
65
- k->adjust_watchpoint_address = cpu_adjust_watchpoint_address;
66
set_bit(DEVICE_CATEGORY_CPU, dc->categories);
67
dc->realize = cpu_common_realizefn;
68
dc->unrealize = cpu_common_unrealizefn;
69
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
70
index XXXXXXX..XXXXXXX 100644
71
--- a/softmmu/physmem.c
72
+++ b/softmmu/physmem.c
73
@@ -XXX,XX +XXX,XX @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len,
74
return;
63
return;
75
}
64
}
76
65
77
- addr = cc->adjust_watchpoint_address(cpu, addr, len);
66
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
78
+ if (cc->tcg_ops.adjust_watchpoint_address) {
79
+ /* this is currently used only by ARM BE32 */
80
+ addr = cc->tcg_ops.adjust_watchpoint_address(cpu, addr, len);
81
+ }
82
QTAILQ_FOREACH(wp, &cpu->watchpoints, entry) {
83
if (watchpoint_address_matches(wp, addr, len)
84
&& (wp->flags & flags)) {
85
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
86
index XXXXXXX..XXXXXXX 100644
67
index XXXXXXX..XXXXXXX 100644
87
--- a/target/arm/cpu.c
68
--- a/target/i386/cpu.c
88
+++ b/target/arm/cpu.c
69
+++ b/target/i386/cpu.c
89
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
70
@@ -XXX,XX +XXX,XX @@ static Property x86_cpu_properties[] = {
90
#if !defined(CONFIG_USER_ONLY)
71
#include "hw/core/sysemu-cpu-ops.h"
91
cc->tcg_ops.do_transaction_failed = arm_cpu_do_transaction_failed;
72
92
cc->tcg_ops.do_unaligned_access = arm_cpu_do_unaligned_access;
73
static const struct SysemuCPUOps i386_sysemu_ops = {
93
- cc->adjust_watchpoint_address = arm_adjust_watchpoint_address;
74
+ .get_memory_mapping = x86_cpu_get_memory_mapping,
94
+ cc->tcg_ops.adjust_watchpoint_address = arm_adjust_watchpoint_address;
75
.get_phys_page_attrs_debug = x86_cpu_get_phys_page_attrs_debug,
95
cc->tcg_ops.do_interrupt = arm_cpu_do_interrupt;
76
.asidx_from_attrs = x86_asidx_from_attrs,
96
#endif /* CONFIG_TCG && !CONFIG_USER_ONLY */
77
.get_crash_info = x86_cpu_get_crash_info,
97
#endif /* CONFIG_TCG */
78
@@ -XXX,XX +XXX,XX @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
79
cc->get_paging_enabled = x86_cpu_get_paging_enabled;
80
81
#ifndef CONFIG_USER_ONLY
82
- cc->get_memory_mapping = x86_cpu_get_memory_mapping;
83
cc->sysemu_ops = &i386_sysemu_ops;
84
#endif /* !CONFIG_USER_ONLY */
85
98
--
86
--
99
2.25.1
87
2.25.1
100
88
101
89
diff view generated by jsdifflib
1
Tested-by: Alex Bennée <alex.bennee@linaro.org>
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
2
3
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-Id: <20210517105140.1062037-23-f4bug@amsat.org>
3
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
4
---
7
---
5
tcg/tci.c | 10 +---------
8
include/hw/core/cpu.h | 2 --
6
1 file changed, 1 insertion(+), 9 deletions(-)
9
include/hw/core/sysemu-cpu-ops.h | 4 ++++
10
hw/core/cpu-sysemu.c | 4 ++--
11
target/i386/cpu.c | 4 +++-
12
4 files changed, 9 insertions(+), 5 deletions(-)
7
13
8
diff --git a/tcg/tci.c b/tcg/tci.c
14
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
9
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
10
--- a/tcg/tci.c
16
--- a/include/hw/core/cpu.h
11
+++ b/tcg/tci.c
17
+++ b/include/hw/core/cpu.h
12
@@ -XXX,XX +XXX,XX @@ tci_write_reg(tcg_target_ulong *regs, TCGReg index, tcg_target_ulong value)
18
@@ -XXX,XX +XXX,XX @@ struct SysemuCPUOps;
13
regs[index] = value;
19
* @dump_state: Callback for dumping state.
20
* @dump_statistics: Callback for dumping statistics.
21
* @get_arch_id: Callback for getting architecture-dependent CPU ID.
22
- * @get_paging_enabled: Callback for inquiring whether paging is enabled.
23
* @set_pc: Callback for setting the Program Counter register. This
24
* should have the semantics used by the target architecture when
25
* setting the PC from a source such as an ELF file entry point;
26
@@ -XXX,XX +XXX,XX @@ struct CPUClass {
27
void (*dump_state)(CPUState *cpu, FILE *, int flags);
28
void (*dump_statistics)(CPUState *cpu, int flags);
29
int64_t (*get_arch_id)(CPUState *cpu);
30
- bool (*get_paging_enabled)(const CPUState *cpu);
31
void (*set_pc)(CPUState *cpu, vaddr value);
32
int (*gdb_read_register)(CPUState *cpu, GByteArray *buf, int reg);
33
int (*gdb_write_register)(CPUState *cpu, uint8_t *buf, int reg);
34
diff --git a/include/hw/core/sysemu-cpu-ops.h b/include/hw/core/sysemu-cpu-ops.h
35
index XXXXXXX..XXXXXXX 100644
36
--- a/include/hw/core/sysemu-cpu-ops.h
37
+++ b/include/hw/core/sysemu-cpu-ops.h
38
@@ -XXX,XX +XXX,XX @@ typedef struct SysemuCPUOps {
39
*/
40
void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list,
41
Error **errp);
42
+ /**
43
+ * @get_paging_enabled: Callback for inquiring whether paging is enabled.
44
+ */
45
+ bool (*get_paging_enabled)(const CPUState *cpu);
46
/**
47
* @get_phys_page_debug: Callback for obtaining a physical address.
48
*/
49
diff --git a/hw/core/cpu-sysemu.c b/hw/core/cpu-sysemu.c
50
index XXXXXXX..XXXXXXX 100644
51
--- a/hw/core/cpu-sysemu.c
52
+++ b/hw/core/cpu-sysemu.c
53
@@ -XXX,XX +XXX,XX @@ bool cpu_paging_enabled(const CPUState *cpu)
54
{
55
CPUClass *cc = CPU_GET_CLASS(cpu);
56
57
- if (cc->get_paging_enabled) {
58
- return cc->get_paging_enabled(cpu);
59
+ if (cc->sysemu_ops->get_paging_enabled) {
60
+ return cc->sysemu_ops->get_paging_enabled(cpu);
61
}
62
63
return false;
64
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
65
index XXXXXXX..XXXXXXX 100644
66
--- a/target/i386/cpu.c
67
+++ b/target/i386/cpu.c
68
@@ -XXX,XX +XXX,XX @@ static int64_t x86_cpu_get_arch_id(CPUState *cs)
69
return cpu->apic_id;
14
}
70
}
15
71
16
-#if TCG_TARGET_REG_BITS == 64
72
+#if !defined(CONFIG_USER_ONLY)
17
-static void
73
static bool x86_cpu_get_paging_enabled(const CPUState *cs)
18
-tci_write_reg32s(tcg_target_ulong *regs, TCGReg index, int32_t value)
19
-{
20
- tci_write_reg(regs, index, value);
21
-}
22
-#endif
23
-
24
static void tci_write_reg8(tcg_target_ulong *regs, TCGReg index, uint8_t value)
25
{
74
{
26
tci_write_reg(regs, index, value);
75
X86CPU *cpu = X86_CPU(cs);
27
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
76
28
t0 = *tb_ptr++;
77
return cpu->env.cr[0] & CR0_PG_MASK;
29
t1 = tci_read_r(regs, &tb_ptr);
78
}
30
t2 = tci_read_s32(&tb_ptr);
79
+#endif /* !CONFIG_USER_ONLY */
31
- tci_write_reg32s(regs, t0, *(int32_t *)(t1 + t2));
80
32
+ tci_write_reg(regs, t0, *(int32_t *)(t1 + t2));
81
static void x86_cpu_set_pc(CPUState *cs, vaddr value)
33
break;
82
{
34
case INDEX_op_ld_i64:
83
@@ -XXX,XX +XXX,XX @@ static Property x86_cpu_properties[] = {
35
t0 = *tb_ptr++;
84
85
static const struct SysemuCPUOps i386_sysemu_ops = {
86
.get_memory_mapping = x86_cpu_get_memory_mapping,
87
+ .get_paging_enabled = x86_cpu_get_paging_enabled,
88
.get_phys_page_attrs_debug = x86_cpu_get_phys_page_attrs_debug,
89
.asidx_from_attrs = x86_asidx_from_attrs,
90
.get_crash_info = x86_cpu_get_crash_info,
91
@@ -XXX,XX +XXX,XX @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
92
cc->gdb_read_register = x86_cpu_gdb_read_register;
93
cc->gdb_write_register = x86_cpu_gdb_write_register;
94
cc->get_arch_id = x86_cpu_get_arch_id;
95
- cc->get_paging_enabled = x86_cpu_get_paging_enabled;
96
97
#ifndef CONFIG_USER_ONLY
98
cc->sysemu_ops = &i386_sysemu_ops;
36
--
99
--
37
2.25.1
100
2.25.1
38
101
39
102
diff view generated by jsdifflib
Deleted patch
1
Note that we had two functions of the same name: a 32-bit version
2
which took two register numbers and a 64-bit version which was a
3
no-op wrapper for tcg_write_reg. After this, we are left with
4
only the 32-bit version.
5
1
6
Tested-by: Alex Bennée <alex.bennee@linaro.org>
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
---
10
tcg/tci.c | 60 +++++++++++++++++++++++++------------------------------
11
1 file changed, 27 insertions(+), 33 deletions(-)
12
13
diff --git a/tcg/tci.c b/tcg/tci.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/tcg/tci.c
16
+++ b/tcg/tci.c
17
@@ -XXX,XX +XXX,XX @@ static void tci_write_reg64(tcg_target_ulong *regs, uint32_t high_index,
18
tci_write_reg(regs, low_index, value);
19
tci_write_reg(regs, high_index, value >> 32);
20
}
21
-#elif TCG_TARGET_REG_BITS == 64
22
-static void
23
-tci_write_reg64(tcg_target_ulong *regs, TCGReg index, uint64_t value)
24
-{
25
- tci_write_reg(regs, index, value);
26
-}
27
#endif
28
29
#if TCG_TARGET_REG_BITS == 32
30
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
31
t1 = tci_read_r64(regs, &tb_ptr);
32
t2 = tci_read_ri64(regs, &tb_ptr);
33
condition = *tb_ptr++;
34
- tci_write_reg64(regs, t0, tci_compare64(t1, t2, condition));
35
+ tci_write_reg(regs, t0, tci_compare64(t1, t2, condition));
36
break;
37
#endif
38
case INDEX_op_mov_i32:
39
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
40
case INDEX_op_mov_i64:
41
t0 = *tb_ptr++;
42
t1 = tci_read_r64(regs, &tb_ptr);
43
- tci_write_reg64(regs, t0, t1);
44
+ tci_write_reg(regs, t0, t1);
45
break;
46
case INDEX_op_tci_movi_i64:
47
t0 = *tb_ptr++;
48
t1 = tci_read_i64(&tb_ptr);
49
- tci_write_reg64(regs, t0, t1);
50
+ tci_write_reg(regs, t0, t1);
51
break;
52
53
/* Load/store operations (64 bit). */
54
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
55
t0 = *tb_ptr++;
56
t1 = tci_read_r(regs, &tb_ptr);
57
t2 = tci_read_s32(&tb_ptr);
58
- tci_write_reg64(regs, t0, *(uint64_t *)(t1 + t2));
59
+ tci_write_reg(regs, t0, *(uint64_t *)(t1 + t2));
60
break;
61
case INDEX_op_st8_i64:
62
t0 = tci_read_r8(regs, &tb_ptr);
63
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
64
t0 = *tb_ptr++;
65
t1 = tci_read_ri64(regs, &tb_ptr);
66
t2 = tci_read_ri64(regs, &tb_ptr);
67
- tci_write_reg64(regs, t0, t1 + t2);
68
+ tci_write_reg(regs, t0, t1 + t2);
69
break;
70
case INDEX_op_sub_i64:
71
t0 = *tb_ptr++;
72
t1 = tci_read_ri64(regs, &tb_ptr);
73
t2 = tci_read_ri64(regs, &tb_ptr);
74
- tci_write_reg64(regs, t0, t1 - t2);
75
+ tci_write_reg(regs, t0, t1 - t2);
76
break;
77
case INDEX_op_mul_i64:
78
t0 = *tb_ptr++;
79
t1 = tci_read_ri64(regs, &tb_ptr);
80
t2 = tci_read_ri64(regs, &tb_ptr);
81
- tci_write_reg64(regs, t0, t1 * t2);
82
+ tci_write_reg(regs, t0, t1 * t2);
83
break;
84
#if TCG_TARGET_HAS_div_i64
85
case INDEX_op_div_i64:
86
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
87
t0 = *tb_ptr++;
88
t1 = tci_read_ri64(regs, &tb_ptr);
89
t2 = tci_read_ri64(regs, &tb_ptr);
90
- tci_write_reg64(regs, t0, t1 & t2);
91
+ tci_write_reg(regs, t0, t1 & t2);
92
break;
93
case INDEX_op_or_i64:
94
t0 = *tb_ptr++;
95
t1 = tci_read_ri64(regs, &tb_ptr);
96
t2 = tci_read_ri64(regs, &tb_ptr);
97
- tci_write_reg64(regs, t0, t1 | t2);
98
+ tci_write_reg(regs, t0, t1 | t2);
99
break;
100
case INDEX_op_xor_i64:
101
t0 = *tb_ptr++;
102
t1 = tci_read_ri64(regs, &tb_ptr);
103
t2 = tci_read_ri64(regs, &tb_ptr);
104
- tci_write_reg64(regs, t0, t1 ^ t2);
105
+ tci_write_reg(regs, t0, t1 ^ t2);
106
break;
107
108
/* Shift/rotate operations (64 bit). */
109
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
110
t0 = *tb_ptr++;
111
t1 = tci_read_ri64(regs, &tb_ptr);
112
t2 = tci_read_ri64(regs, &tb_ptr);
113
- tci_write_reg64(regs, t0, t1 << (t2 & 63));
114
+ tci_write_reg(regs, t0, t1 << (t2 & 63));
115
break;
116
case INDEX_op_shr_i64:
117
t0 = *tb_ptr++;
118
t1 = tci_read_ri64(regs, &tb_ptr);
119
t2 = tci_read_ri64(regs, &tb_ptr);
120
- tci_write_reg64(regs, t0, t1 >> (t2 & 63));
121
+ tci_write_reg(regs, t0, t1 >> (t2 & 63));
122
break;
123
case INDEX_op_sar_i64:
124
t0 = *tb_ptr++;
125
t1 = tci_read_ri64(regs, &tb_ptr);
126
t2 = tci_read_ri64(regs, &tb_ptr);
127
- tci_write_reg64(regs, t0, ((int64_t)t1 >> (t2 & 63)));
128
+ tci_write_reg(regs, t0, ((int64_t)t1 >> (t2 & 63)));
129
break;
130
#if TCG_TARGET_HAS_rot_i64
131
case INDEX_op_rotl_i64:
132
t0 = *tb_ptr++;
133
t1 = tci_read_ri64(regs, &tb_ptr);
134
t2 = tci_read_ri64(regs, &tb_ptr);
135
- tci_write_reg64(regs, t0, rol64(t1, t2 & 63));
136
+ tci_write_reg(regs, t0, rol64(t1, t2 & 63));
137
break;
138
case INDEX_op_rotr_i64:
139
t0 = *tb_ptr++;
140
t1 = tci_read_ri64(regs, &tb_ptr);
141
t2 = tci_read_ri64(regs, &tb_ptr);
142
- tci_write_reg64(regs, t0, ror64(t1, t2 & 63));
143
+ tci_write_reg(regs, t0, ror64(t1, t2 & 63));
144
break;
145
#endif
146
#if TCG_TARGET_HAS_deposit_i64
147
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
148
tmp16 = *tb_ptr++;
149
tmp8 = *tb_ptr++;
150
tmp64 = (((1ULL << tmp8) - 1) << tmp16);
151
- tci_write_reg64(regs, t0, (t1 & ~tmp64) | ((t2 << tmp16) & tmp64));
152
+ tci_write_reg(regs, t0, (t1 & ~tmp64) | ((t2 << tmp16) & tmp64));
153
break;
154
#endif
155
case INDEX_op_brcond_i64:
156
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
157
case INDEX_op_ext8u_i64:
158
t0 = *tb_ptr++;
159
t1 = tci_read_r8(regs, &tb_ptr);
160
- tci_write_reg64(regs, t0, t1);
161
+ tci_write_reg(regs, t0, t1);
162
break;
163
#endif
164
#if TCG_TARGET_HAS_ext8s_i64
165
case INDEX_op_ext8s_i64:
166
t0 = *tb_ptr++;
167
t1 = tci_read_r8s(regs, &tb_ptr);
168
- tci_write_reg64(regs, t0, t1);
169
+ tci_write_reg(regs, t0, t1);
170
break;
171
#endif
172
#if TCG_TARGET_HAS_ext16s_i64
173
case INDEX_op_ext16s_i64:
174
t0 = *tb_ptr++;
175
t1 = tci_read_r16s(regs, &tb_ptr);
176
- tci_write_reg64(regs, t0, t1);
177
+ tci_write_reg(regs, t0, t1);
178
break;
179
#endif
180
#if TCG_TARGET_HAS_ext16u_i64
181
case INDEX_op_ext16u_i64:
182
t0 = *tb_ptr++;
183
t1 = tci_read_r16(regs, &tb_ptr);
184
- tci_write_reg64(regs, t0, t1);
185
+ tci_write_reg(regs, t0, t1);
186
break;
187
#endif
188
#if TCG_TARGET_HAS_ext32s_i64
189
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
190
case INDEX_op_ext_i32_i64:
191
t0 = *tb_ptr++;
192
t1 = tci_read_r32s(regs, &tb_ptr);
193
- tci_write_reg64(regs, t0, t1);
194
+ tci_write_reg(regs, t0, t1);
195
break;
196
#if TCG_TARGET_HAS_ext32u_i64
197
case INDEX_op_ext32u_i64:
198
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
199
case INDEX_op_extu_i32_i64:
200
t0 = *tb_ptr++;
201
t1 = tci_read_r32(regs, &tb_ptr);
202
- tci_write_reg64(regs, t0, t1);
203
+ tci_write_reg(regs, t0, t1);
204
break;
205
#if TCG_TARGET_HAS_bswap16_i64
206
case INDEX_op_bswap16_i64:
207
t0 = *tb_ptr++;
208
t1 = tci_read_r16(regs, &tb_ptr);
209
- tci_write_reg64(regs, t0, bswap16(t1));
210
+ tci_write_reg(regs, t0, bswap16(t1));
211
break;
212
#endif
213
#if TCG_TARGET_HAS_bswap32_i64
214
case INDEX_op_bswap32_i64:
215
t0 = *tb_ptr++;
216
t1 = tci_read_r32(regs, &tb_ptr);
217
- tci_write_reg64(regs, t0, bswap32(t1));
218
+ tci_write_reg(regs, t0, bswap32(t1));
219
break;
220
#endif
221
#if TCG_TARGET_HAS_bswap64_i64
222
case INDEX_op_bswap64_i64:
223
t0 = *tb_ptr++;
224
t1 = tci_read_r64(regs, &tb_ptr);
225
- tci_write_reg64(regs, t0, bswap64(t1));
226
+ tci_write_reg(regs, t0, bswap64(t1));
227
break;
228
#endif
229
#if TCG_TARGET_HAS_not_i64
230
case INDEX_op_not_i64:
231
t0 = *tb_ptr++;
232
t1 = tci_read_r64(regs, &tb_ptr);
233
- tci_write_reg64(regs, t0, ~t1);
234
+ tci_write_reg(regs, t0, ~t1);
235
break;
236
#endif
237
#if TCG_TARGET_HAS_neg_i64
238
case INDEX_op_neg_i64:
239
t0 = *tb_ptr++;
240
t1 = tci_read_r64(regs, &tb_ptr);
241
- tci_write_reg64(regs, t0, -t1);
242
+ tci_write_reg(regs, t0, -t1);
243
break;
244
#endif
245
#endif /* TCG_TARGET_REG_BITS == 64 */
246
--
247
2.25.1
248
249
diff view generated by jsdifflib
Deleted patch
1
Tested-by: Alex Bennée <alex.bennee@linaro.org>
2
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
3
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
4
---
5
tcg/tci.c | 20 +++++++++++++-------
6
1 file changed, 13 insertions(+), 7 deletions(-)
7
1
8
diff --git a/tcg/tci.c b/tcg/tci.c
9
index XXXXXXX..XXXXXXX 100644
10
--- a/tcg/tci.c
11
+++ b/tcg/tci.c
12
@@ -XXX,XX +XXX,XX @@ static bool tci_compare64(uint64_t u0, uint64_t u1, TCGCond condition)
13
# define qemu_st_beq(X) stq_be_p(g2h(taddr), X)
14
#endif
15
16
+#if TCG_TARGET_REG_BITS == 64
17
+# define CASE_32_64(x) \
18
+ case glue(glue(INDEX_op_, x), _i64): \
19
+ case glue(glue(INDEX_op_, x), _i32):
20
+# define CASE_64(x) \
21
+ case glue(glue(INDEX_op_, x), _i64):
22
+#else
23
+# define CASE_32_64(x) \
24
+ case glue(glue(INDEX_op_, x), _i32):
25
+# define CASE_64(x)
26
+#endif
27
+
28
/* Interpret pseudo code in tb. */
29
/*
30
* Disable CFI checks.
31
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
32
33
/* Load/store operations (32 bit). */
34
35
- case INDEX_op_ld8u_i32:
36
+ CASE_32_64(ld8u)
37
t0 = *tb_ptr++;
38
t1 = tci_read_r(regs, &tb_ptr);
39
t2 = tci_read_s32(&tb_ptr);
40
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
41
42
/* Load/store operations (64 bit). */
43
44
- case INDEX_op_ld8u_i64:
45
- t0 = *tb_ptr++;
46
- t1 = tci_read_r(regs, &tb_ptr);
47
- t2 = tci_read_s32(&tb_ptr);
48
- tci_write_reg(regs, t0, *(uint8_t *)(t1 + t2));
49
- break;
50
case INDEX_op_ld8s_i64:
51
t0 = *tb_ptr++;
52
t1 = tci_read_r(regs, &tb_ptr);
53
--
54
2.25.1
55
56
diff view generated by jsdifflib
Deleted patch
1
Eliminating a TODO for ld8s_i32.
2
1
3
Tested-by: Alex Bennée <alex.bennee@linaro.org>
4
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
tcg/tci.c | 13 +++++--------
8
1 file changed, 5 insertions(+), 8 deletions(-)
9
10
diff --git a/tcg/tci.c b/tcg/tci.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/tcg/tci.c
13
+++ b/tcg/tci.c
14
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
15
t2 = tci_read_s32(&tb_ptr);
16
tci_write_reg(regs, t0, *(uint8_t *)(t1 + t2));
17
break;
18
- case INDEX_op_ld8s_i32:
19
- TODO();
20
+ CASE_32_64(ld8s)
21
+ t0 = *tb_ptr++;
22
+ t1 = tci_read_r(regs, &tb_ptr);
23
+ t2 = tci_read_s32(&tb_ptr);
24
+ tci_write_reg(regs, t0, *(int8_t *)(t1 + t2));
25
break;
26
case INDEX_op_ld16u_i32:
27
TODO();
28
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
29
30
/* Load/store operations (64 bit). */
31
32
- case INDEX_op_ld8s_i64:
33
- t0 = *tb_ptr++;
34
- t1 = tci_read_r(regs, &tb_ptr);
35
- t2 = tci_read_s32(&tb_ptr);
36
- tci_write_reg(regs, t0, *(int8_t *)(t1 + t2));
37
- break;
38
case INDEX_op_ld16u_i64:
39
t0 = *tb_ptr++;
40
t1 = tci_read_r(regs, &tb_ptr);
41
--
42
2.25.1
43
44
diff view generated by jsdifflib
Deleted patch
1
Eliminating a TODO for ld16u_i32.
2
1
3
Tested-by: Alex Bennée <alex.bennee@linaro.org>
4
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
tcg/tci.c | 13 +++++--------
8
1 file changed, 5 insertions(+), 8 deletions(-)
9
10
diff --git a/tcg/tci.c b/tcg/tci.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/tcg/tci.c
13
+++ b/tcg/tci.c
14
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
15
t2 = tci_read_s32(&tb_ptr);
16
tci_write_reg(regs, t0, *(int8_t *)(t1 + t2));
17
break;
18
- case INDEX_op_ld16u_i32:
19
- TODO();
20
+ CASE_32_64(ld16u)
21
+ t0 = *tb_ptr++;
22
+ t1 = tci_read_r(regs, &tb_ptr);
23
+ t2 = tci_read_s32(&tb_ptr);
24
+ tci_write_reg(regs, t0, *(uint16_t *)(t1 + t2));
25
break;
26
case INDEX_op_ld16s_i32:
27
t0 = *tb_ptr++;
28
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
29
30
/* Load/store operations (64 bit). */
31
32
- case INDEX_op_ld16u_i64:
33
- t0 = *tb_ptr++;
34
- t1 = tci_read_r(regs, &tb_ptr);
35
- t2 = tci_read_s32(&tb_ptr);
36
- tci_write_reg(regs, t0, *(uint16_t *)(t1 + t2));
37
- break;
38
case INDEX_op_ld16s_i64:
39
TODO();
40
break;
41
--
42
2.25.1
43
44
diff view generated by jsdifflib
Deleted patch
1
Eliminating a TODO for ld16s_i64.
2
1
3
Tested-by: Alex Bennée <alex.bennee@linaro.org>
4
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
tcg/tci.c | 5 +----
8
1 file changed, 1 insertion(+), 4 deletions(-)
9
10
diff --git a/tcg/tci.c b/tcg/tci.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/tcg/tci.c
13
+++ b/tcg/tci.c
14
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
15
t2 = tci_read_s32(&tb_ptr);
16
tci_write_reg(regs, t0, *(uint16_t *)(t1 + t2));
17
break;
18
- case INDEX_op_ld16s_i32:
19
+ CASE_32_64(ld16s)
20
t0 = *tb_ptr++;
21
t1 = tci_read_r(regs, &tb_ptr);
22
t2 = tci_read_s32(&tb_ptr);
23
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
24
25
/* Load/store operations (64 bit). */
26
27
- case INDEX_op_ld16s_i64:
28
- TODO();
29
- break;
30
case INDEX_op_ld32u_i64:
31
t0 = *tb_ptr++;
32
t1 = tci_read_r(regs, &tb_ptr);
33
--
34
2.25.1
35
36
diff view generated by jsdifflib
Deleted patch
1
Tested-by: Alex Bennée <alex.bennee@linaro.org>
2
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
3
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
4
---
5
tcg/tci.c | 7 +------
6
1 file changed, 1 insertion(+), 6 deletions(-)
7
1
8
diff --git a/tcg/tci.c b/tcg/tci.c
9
index XXXXXXX..XXXXXXX 100644
10
--- a/tcg/tci.c
11
+++ b/tcg/tci.c
12
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
13
tci_write_reg(regs, t0, *(int16_t *)(t1 + t2));
14
break;
15
case INDEX_op_ld_i32:
16
+ CASE_64(ld32u)
17
t0 = *tb_ptr++;
18
t1 = tci_read_r(regs, &tb_ptr);
19
t2 = tci_read_s32(&tb_ptr);
20
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
21
22
/* Load/store operations (64 bit). */
23
24
- case INDEX_op_ld32u_i64:
25
- t0 = *tb_ptr++;
26
- t1 = tci_read_r(regs, &tb_ptr);
27
- t2 = tci_read_s32(&tb_ptr);
28
- tci_write_reg(regs, t0, *(uint32_t *)(t1 + t2));
29
- break;
30
case INDEX_op_ld32s_i64:
31
t0 = *tb_ptr++;
32
t1 = tci_read_r(regs, &tb_ptr);
33
--
34
2.25.1
35
36
diff view generated by jsdifflib
Deleted patch
1
Tested-by: Alex Bennée <alex.bennee@linaro.org>
2
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
3
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
4
---
5
tcg/tci.c | 8 +-------
6
1 file changed, 1 insertion(+), 7 deletions(-)
7
1
8
diff --git a/tcg/tci.c b/tcg/tci.c
9
index XXXXXXX..XXXXXXX 100644
10
--- a/tcg/tci.c
11
+++ b/tcg/tci.c
12
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
13
t2 = tci_read_s32(&tb_ptr);
14
tci_write_reg(regs, t0, *(uint32_t *)(t1 + t2));
15
break;
16
- case INDEX_op_st8_i32:
17
+ CASE_32_64(st8)
18
t0 = tci_read_r8(regs, &tb_ptr);
19
t1 = tci_read_r(regs, &tb_ptr);
20
t2 = tci_read_s32(&tb_ptr);
21
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
22
t2 = tci_read_s32(&tb_ptr);
23
tci_write_reg(regs, t0, *(uint64_t *)(t1 + t2));
24
break;
25
- case INDEX_op_st8_i64:
26
- t0 = tci_read_r8(regs, &tb_ptr);
27
- t1 = tci_read_r(regs, &tb_ptr);
28
- t2 = tci_read_s32(&tb_ptr);
29
- *(uint8_t *)(t1 + t2) = t0;
30
- break;
31
case INDEX_op_st16_i64:
32
t0 = tci_read_r16(regs, &tb_ptr);
33
t1 = tci_read_r(regs, &tb_ptr);
34
--
35
2.25.1
36
37
diff view generated by jsdifflib
Deleted patch
1
Tested-by: Alex Bennée <alex.bennee@linaro.org>
2
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
3
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
4
---
5
tcg/tci.c | 8 +-------
6
1 file changed, 1 insertion(+), 7 deletions(-)
7
1
8
diff --git a/tcg/tci.c b/tcg/tci.c
9
index XXXXXXX..XXXXXXX 100644
10
--- a/tcg/tci.c
11
+++ b/tcg/tci.c
12
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
13
t2 = tci_read_s32(&tb_ptr);
14
*(uint8_t *)(t1 + t2) = t0;
15
break;
16
- case INDEX_op_st16_i32:
17
+ CASE_32_64(st16)
18
t0 = tci_read_r16(regs, &tb_ptr);
19
t1 = tci_read_r(regs, &tb_ptr);
20
t2 = tci_read_s32(&tb_ptr);
21
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
22
t2 = tci_read_s32(&tb_ptr);
23
tci_write_reg(regs, t0, *(uint64_t *)(t1 + t2));
24
break;
25
- case INDEX_op_st16_i64:
26
- t0 = tci_read_r16(regs, &tb_ptr);
27
- t1 = tci_read_r(regs, &tb_ptr);
28
- t2 = tci_read_s32(&tb_ptr);
29
- *(uint16_t *)(t1 + t2) = t0;
30
- break;
31
case INDEX_op_st32_i64:
32
t0 = tci_read_r32(regs, &tb_ptr);
33
t1 = tci_read_r(regs, &tb_ptr);
34
--
35
2.25.1
36
37
diff view generated by jsdifflib
Deleted patch
1
Tested-by: Alex Bennée <alex.bennee@linaro.org>
2
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
3
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
4
---
5
tcg/tci.c | 7 +------
6
1 file changed, 1 insertion(+), 6 deletions(-)
7
1
8
diff --git a/tcg/tci.c b/tcg/tci.c
9
index XXXXXXX..XXXXXXX 100644
10
--- a/tcg/tci.c
11
+++ b/tcg/tci.c
12
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
13
*(uint16_t *)(t1 + t2) = t0;
14
break;
15
case INDEX_op_st_i32:
16
+ CASE_64(st32)
17
t0 = tci_read_r32(regs, &tb_ptr);
18
t1 = tci_read_r(regs, &tb_ptr);
19
t2 = tci_read_s32(&tb_ptr);
20
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
21
t2 = tci_read_s32(&tb_ptr);
22
tci_write_reg(regs, t0, *(uint64_t *)(t1 + t2));
23
break;
24
- case INDEX_op_st32_i64:
25
- t0 = tci_read_r32(regs, &tb_ptr);
26
- t1 = tci_read_r(regs, &tb_ptr);
27
- t2 = tci_read_s32(&tb_ptr);
28
- *(uint32_t *)(t1 + t2) = t0;
29
- break;
30
case INDEX_op_st_i64:
31
t0 = tci_read_r64(regs, &tb_ptr);
32
t1 = tci_read_r(regs, &tb_ptr);
33
--
34
2.25.1
35
36
diff view generated by jsdifflib
Deleted patch
1
Three TODO instances are never happen cases.
2
Other uses of tcg_abort are also indicating unreachable cases.
3
1
4
Tested-by: Alex Bennée <alex.bennee@linaro.org>
5
Reviewed-by: Stefan Weil <sw@weilnetz.de>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
---
9
tcg/tci.c | 15 +++++++--------
10
1 file changed, 7 insertions(+), 8 deletions(-)
11
12
diff --git a/tcg/tci.c b/tcg/tci.c
13
index XXXXXXX..XXXXXXX 100644
14
--- a/tcg/tci.c
15
+++ b/tcg/tci.c
16
@@ -XXX,XX +XXX,XX @@ static bool tci_compare32(uint32_t u0, uint32_t u1, TCGCond condition)
17
result = (u0 > u1);
18
break;
19
default:
20
- TODO();
21
+ g_assert_not_reached();
22
}
23
return result;
24
}
25
@@ -XXX,XX +XXX,XX @@ static bool tci_compare64(uint64_t u0, uint64_t u1, TCGCond condition)
26
result = (u0 > u1);
27
break;
28
default:
29
- TODO();
30
+ g_assert_not_reached();
31
}
32
return result;
33
}
34
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
35
tmp32 = qemu_ld_beul;
36
break;
37
default:
38
- tcg_abort();
39
+ g_assert_not_reached();
40
}
41
tci_write_reg(regs, t0, tmp32);
42
break;
43
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
44
tmp64 = qemu_ld_beq;
45
break;
46
default:
47
- tcg_abort();
48
+ g_assert_not_reached();
49
}
50
tci_write_reg(regs, t0, tmp64);
51
if (TCG_TARGET_REG_BITS == 32) {
52
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
53
qemu_st_bel(t0);
54
break;
55
default:
56
- tcg_abort();
57
+ g_assert_not_reached();
58
}
59
break;
60
case INDEX_op_qemu_st_i64:
61
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
62
qemu_st_beq(tmp64);
63
break;
64
default:
65
- tcg_abort();
66
+ g_assert_not_reached();
67
}
68
break;
69
case INDEX_op_mb:
70
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
71
smp_mb();
72
break;
73
default:
74
- TODO();
75
- break;
76
+ g_assert_not_reached();
77
}
78
tci_assert(tb_ptr == old_code_ptr + op_size);
79
}
80
--
81
2.25.1
82
83
diff view generated by jsdifflib
Deleted patch
1
We do not simultaneously support div and div2 -- it's one
2
or the other. TCI is already using div, so remove div2.
3
1
4
Tested-by: Alex Bennée <alex.bennee@linaro.org>
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
---
8
tcg/tci.c | 12 ------------
9
tcg/tci/tcg-target.c.inc | 8 --------
10
2 files changed, 20 deletions(-)
11
12
diff --git a/tcg/tci.c b/tcg/tci.c
13
index XXXXXXX..XXXXXXX 100644
14
--- a/tcg/tci.c
15
+++ b/tcg/tci.c
16
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
17
t2 = tci_read_ri32(regs, &tb_ptr);
18
tci_write_reg(regs, t0, t1 * t2);
19
break;
20
-#if TCG_TARGET_HAS_div_i32
21
case INDEX_op_div_i32:
22
t0 = *tb_ptr++;
23
t1 = tci_read_ri32(regs, &tb_ptr);
24
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
25
t2 = tci_read_ri32(regs, &tb_ptr);
26
tci_write_reg(regs, t0, t1 % t2);
27
break;
28
-#elif TCG_TARGET_HAS_div2_i32
29
- case INDEX_op_div2_i32:
30
- case INDEX_op_divu2_i32:
31
- TODO();
32
- break;
33
-#endif
34
case INDEX_op_and_i32:
35
t0 = *tb_ptr++;
36
t1 = tci_read_ri32(regs, &tb_ptr);
37
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
38
case INDEX_op_remu_i64:
39
TODO();
40
break;
41
-#elif TCG_TARGET_HAS_div2_i64
42
- case INDEX_op_div2_i64:
43
- case INDEX_op_divu2_i64:
44
- TODO();
45
- break;
46
#endif
47
case INDEX_op_and_i64:
48
t0 = *tb_ptr++;
49
diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc
50
index XXXXXXX..XXXXXXX 100644
51
--- a/tcg/tci/tcg-target.c.inc
52
+++ b/tcg/tci/tcg-target.c.inc
53
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,
54
case INDEX_op_remu_i64: /* Optional (TCG_TARGET_HAS_div_i64). */
55
TODO();
56
break;
57
- case INDEX_op_div2_i64: /* Optional (TCG_TARGET_HAS_div2_i64). */
58
- case INDEX_op_divu2_i64: /* Optional (TCG_TARGET_HAS_div2_i64). */
59
- TODO();
60
- break;
61
case INDEX_op_brcond_i64:
62
tcg_out_r(s, args[0]);
63
tcg_out_ri64(s, const_args[1], args[1]);
64
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,
65
tcg_out_ri32(s, const_args[1], args[1]);
66
tcg_out_ri32(s, const_args[2], args[2]);
67
break;
68
- case INDEX_op_div2_i32: /* Optional (TCG_TARGET_HAS_div2_i32). */
69
- case INDEX_op_divu2_i32: /* Optional (TCG_TARGET_HAS_div2_i32). */
70
- TODO();
71
- break;
72
#if TCG_TARGET_REG_BITS == 32
73
case INDEX_op_add2_i32:
74
case INDEX_op_sub2_i32:
75
--
76
2.25.1
77
78
diff view generated by jsdifflib
Deleted patch
1
Trivially implemented like other arithmetic.
2
Tested via check-tcg and the ppc64 target.
3
1
4
Tested-by: Alex Bennée <alex.bennee@linaro.org>
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
---
8
tcg/tci/tcg-target.h | 4 ++--
9
tcg/tci.c | 28 ++++++++++++++++++++++------
10
tcg/tci/tcg-target.c.inc | 10 ++++------
11
3 files changed, 28 insertions(+), 14 deletions(-)
12
13
diff --git a/tcg/tci/tcg-target.h b/tcg/tci/tcg-target.h
14
index XXXXXXX..XXXXXXX 100644
15
--- a/tcg/tci/tcg-target.h
16
+++ b/tcg/tci/tcg-target.h
17
@@ -XXX,XX +XXX,XX @@
18
#define TCG_TARGET_HAS_extract_i64 0
19
#define TCG_TARGET_HAS_sextract_i64 0
20
#define TCG_TARGET_HAS_extract2_i64 0
21
-#define TCG_TARGET_HAS_div_i64 0
22
-#define TCG_TARGET_HAS_rem_i64 0
23
+#define TCG_TARGET_HAS_div_i64 1
24
+#define TCG_TARGET_HAS_rem_i64 1
25
#define TCG_TARGET_HAS_ext8s_i64 1
26
#define TCG_TARGET_HAS_ext16s_i64 1
27
#define TCG_TARGET_HAS_ext32s_i64 1
28
diff --git a/tcg/tci.c b/tcg/tci.c
29
index XXXXXXX..XXXXXXX 100644
30
--- a/tcg/tci.c
31
+++ b/tcg/tci.c
32
@@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env,
33
t2 = tci_read_ri64(regs, &tb_ptr);
34
tci_write_reg(regs, t0, t1 * t2);
35
break;
36
-#if TCG_TARGET_HAS_div_i64
37
case INDEX_op_div_i64:
38
- case INDEX_op_divu_i64:
39
- case INDEX_op_rem_i64:
40
- case INDEX_op_remu_i64:
41
- TODO();
42
+ t0 = *tb_ptr++;
43
+ t1 = tci_read_ri64(regs, &tb_ptr);
44
+ t2 = tci_read_ri64(regs, &tb_ptr);
45
+ tci_write_reg(regs, t0, (int64_t)t1 / (int64_t)t2);
46
+ break;
47
+ case INDEX_op_divu_i64:
48
+ t0 = *tb_ptr++;
49
+ t1 = tci_read_ri64(regs, &tb_ptr);
50
+ t2 = tci_read_ri64(regs, &tb_ptr);
51
+ tci_write_reg(regs, t0, (uint64_t)t1 / (uint64_t)t2);
52
+ break;
53
+ case INDEX_op_rem_i64:
54
+ t0 = *tb_ptr++;
55
+ t1 = tci_read_ri64(regs, &tb_ptr);
56
+ t2 = tci_read_ri64(regs, &tb_ptr);
57
+ tci_write_reg(regs, t0, (int64_t)t1 % (int64_t)t2);
58
+ break;
59
+ case INDEX_op_remu_i64:
60
+ t0 = *tb_ptr++;
61
+ t1 = tci_read_ri64(regs, &tb_ptr);
62
+ t2 = tci_read_ri64(regs, &tb_ptr);
63
+ tci_write_reg(regs, t0, (uint64_t)t1 % (uint64_t)t2);
64
break;
65
-#endif
66
case INDEX_op_and_i64:
67
t0 = *tb_ptr++;
68
t1 = tci_read_ri64(regs, &tb_ptr);
69
diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc
70
index XXXXXXX..XXXXXXX 100644
71
--- a/tcg/tci/tcg-target.c.inc
72
+++ b/tcg/tci/tcg-target.c.inc
73
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,
74
case INDEX_op_sar_i64:
75
case INDEX_op_rotl_i64: /* Optional (TCG_TARGET_HAS_rot_i64). */
76
case INDEX_op_rotr_i64: /* Optional (TCG_TARGET_HAS_rot_i64). */
77
+ case INDEX_op_div_i64: /* Optional (TCG_TARGET_HAS_div_i64). */
78
+ case INDEX_op_divu_i64: /* Optional (TCG_TARGET_HAS_div_i64). */
79
+ case INDEX_op_rem_i64: /* Optional (TCG_TARGET_HAS_div_i64). */
80
+ case INDEX_op_remu_i64: /* Optional (TCG_TARGET_HAS_div_i64). */
81
tcg_out_r(s, args[0]);
82
tcg_out_ri64(s, const_args[1], args[1]);
83
tcg_out_ri64(s, const_args[2], args[2]);
84
@@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, const TCGArg *args,
85
tcg_debug_assert(args[4] <= UINT8_MAX);
86
tcg_out8(s, args[4]);
87
break;
88
- case INDEX_op_div_i64: /* Optional (TCG_TARGET_HAS_div_i64). */
89
- case INDEX_op_divu_i64: /* Optional (TCG_TARGET_HAS_div_i64). */
90
- case INDEX_op_rem_i64: /* Optional (TCG_TARGET_HAS_div_i64). */
91
- case INDEX_op_remu_i64: /* Optional (TCG_TARGET_HAS_div_i64). */
92
- TODO();
93
- break;
94
case INDEX_op_brcond_i64:
95
tcg_out_r(s, args[0]);
96
tcg_out_ri64(s, const_args[1], args[1]);
97
--
98
2.25.1
99
100
diff view generated by jsdifflib
1
From: Claudio Fontana <cfontana@suse.de>
1
Add a flag to MIPSCPUClass in order to avoid needing to
2
replace mips_tcg_ops.do_transaction_failed.
2
3
3
Signed-off-by: Claudio Fontana <cfontana@suse.de>
4
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
4
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-ID: <20210227232519.222663-2-richard.henderson@linaro.org>
8
---
9
target/mips/cpu-qom.h | 3 +++
10
hw/mips/jazz.c | 35 +++--------------------------------
11
target/mips/tcg/op_helper.c | 3 ++-
12
3 files changed, 8 insertions(+), 33 deletions(-)
7
13
8
[claudio: wrap target code around CONFIG_TCG and !CONFIG_USER_ONLY]
14
diff --git a/target/mips/cpu-qom.h b/target/mips/cpu-qom.h
9
10
avoiding its use in headers used by common_ss code (should be poisoned).
11
12
Note: need to be careful with the use of CONFIG_USER_ONLY,
13
Message-Id: <20210204163931.7358-11-cfontana@suse.de>
14
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
15
---
16
include/hw/core/cpu.h | 28 +++++++++++++---------------
17
hw/mips/jazz.c | 9 +++++++--
18
target/alpha/cpu.c | 2 +-
19
target/arm/cpu.c | 4 ++--
20
target/m68k/cpu.c | 2 +-
21
target/microblaze/cpu.c | 2 +-
22
target/mips/cpu.c | 4 +++-
23
target/riscv/cpu.c | 2 +-
24
target/riscv/cpu_helper.c | 2 +-
25
target/sparc/cpu.c | 2 +-
26
target/xtensa/cpu.c | 2 +-
27
target/xtensa/helper.c | 4 ++--
28
12 files changed, 34 insertions(+), 29 deletions(-)
29
30
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
31
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
32
--- a/include/hw/core/cpu.h
16
--- a/target/mips/cpu-qom.h
33
+++ b/include/hw/core/cpu.h
17
+++ b/target/mips/cpu-qom.h
34
@@ -XXX,XX +XXX,XX @@ typedef struct TcgCpuOperations {
18
@@ -XXX,XX +XXX,XX @@ struct MIPSCPUClass {
35
/** @debug_excp_handler: Callback for handling debug exceptions */
19
DeviceRealize parent_realize;
36
void (*debug_excp_handler)(CPUState *cpu);
20
DeviceReset parent_reset;
37
21
const struct mips_def_t *cpu_def;
38
+ /**
22
+
39
+ * @do_transaction_failed: Callback for handling failed memory transactions
23
+ /* Used for the jazz board to modify mips_cpu_do_transaction_failed. */
40
+ * (ie bus faults or external aborts; not MMU faults)
24
+ bool no_data_aborts;
41
+ */
25
};
42
+ void (*do_transaction_failed)(CPUState *cpu, hwaddr physaddr, vaddr addr,
26
43
+ unsigned size, MMUAccessType access_type,
27
44
+ int mmu_idx, MemTxAttrs attrs,
45
+ MemTxResult response, uintptr_t retaddr);
46
} TcgCpuOperations;
47
48
/**
49
@@ -XXX,XX +XXX,XX @@ typedef struct TcgCpuOperations {
50
* @has_work: Callback for checking if there is work to do.
51
* @do_unaligned_access: Callback for unaligned access handling, if
52
* the target defines #TARGET_ALIGNED_ONLY.
53
- * @do_transaction_failed: Callback for handling failed memory transactions
54
- * (ie bus faults or external aborts; not MMU faults)
55
* @virtio_is_big_endian: Callback to return %true if a CPU which supports
56
* runtime configurable endianness is currently big-endian. Non-configurable
57
* CPUs can use the default implementation of this method. This method should
58
@@ -XXX,XX +XXX,XX @@ struct CPUClass {
59
void (*do_unaligned_access)(CPUState *cpu, vaddr addr,
60
MMUAccessType access_type,
61
int mmu_idx, uintptr_t retaddr);
62
- void (*do_transaction_failed)(CPUState *cpu, hwaddr physaddr, vaddr addr,
63
- unsigned size, MMUAccessType access_type,
64
- int mmu_idx, MemTxAttrs attrs,
65
- MemTxResult response, uintptr_t retaddr);
66
bool (*virtio_is_big_endian)(CPUState *cpu);
67
int (*memory_rw_debug)(CPUState *cpu, vaddr addr,
68
uint8_t *buf, int len, bool is_write);
69
@@ -XXX,XX +XXX,XX @@ CPUState *cpu_by_arch_id(int64_t id);
70
71
void cpu_interrupt(CPUState *cpu, int mask);
72
73
-#ifdef NEED_CPU_H
74
-
75
-#ifdef CONFIG_SOFTMMU
76
static inline void cpu_unaligned_access(CPUState *cpu, vaddr addr,
77
MMUAccessType access_type,
78
int mmu_idx, uintptr_t retaddr)
79
@@ -XXX,XX +XXX,XX @@ static inline void cpu_transaction_failed(CPUState *cpu, hwaddr physaddr,
80
{
81
CPUClass *cc = CPU_GET_CLASS(cpu);
82
83
- if (!cpu->ignore_memory_transaction_failures && cc->do_transaction_failed) {
84
- cc->do_transaction_failed(cpu, physaddr, addr, size, access_type,
85
- mmu_idx, attrs, response, retaddr);
86
+ if (!cpu->ignore_memory_transaction_failures &&
87
+ cc->tcg_ops.do_transaction_failed) {
88
+ cc->tcg_ops.do_transaction_failed(cpu, physaddr, addr, size,
89
+ access_type, mmu_idx, attrs,
90
+ response, retaddr);
91
}
92
}
93
-#endif
94
-
95
-#endif /* NEED_CPU_H */
96
97
/**
98
* cpu_set_pc:
99
diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c
28
diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c
100
index XXXXXXX..XXXXXXX 100644
29
index XXXXXXX..XXXXXXX 100644
101
--- a/hw/mips/jazz.c
30
--- a/hw/mips/jazz.c
102
+++ b/hw/mips/jazz.c
31
+++ b/hw/mips/jazz.c
103
@@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps dma_dummy_ops = {
32
@@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps dma_dummy_ops = {
104
#define MAGNUM_BIOS_SIZE_MAX 0x7e000
105
#define MAGNUM_BIOS_SIZE \
33
#define MAGNUM_BIOS_SIZE \
106
(BIOS_SIZE < MAGNUM_BIOS_SIZE_MAX ? BIOS_SIZE : MAGNUM_BIOS_SIZE_MAX)
34
(BIOS_SIZE < MAGNUM_BIOS_SIZE_MAX ? BIOS_SIZE : MAGNUM_BIOS_SIZE_MAX)
107
+
35
108
+#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
36
-#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
109
static void (*real_do_transaction_failed)(CPUState *cpu, hwaddr physaddr,
37
-static void (*real_do_transaction_failed)(CPUState *cpu, hwaddr physaddr,
110
vaddr addr, unsigned size,
38
- vaddr addr, unsigned size,
111
MMUAccessType access_type,
39
- MMUAccessType access_type,
112
@@ -XXX,XX +XXX,XX @@ static void mips_jazz_do_transaction_failed(CPUState *cs, hwaddr physaddr,
40
- int mmu_idx, MemTxAttrs attrs,
113
(*real_do_transaction_failed)(cs, physaddr, addr, size, access_type,
41
- MemTxResult response,
114
mmu_idx, attrs, response, retaddr);
42
- uintptr_t retaddr);
115
}
43
-
116
+#endif /* CONFIG_TCG && !CONFIG_USER_ONLY */
44
-static void mips_jazz_do_transaction_failed(CPUState *cs, hwaddr physaddr,
117
45
- vaddr addr, unsigned size,
46
- MMUAccessType access_type,
47
- int mmu_idx, MemTxAttrs attrs,
48
- MemTxResult response,
49
- uintptr_t retaddr)
50
-{
51
- if (access_type != MMU_INST_FETCH) {
52
- /* ignore invalid access (ie do not raise exception) */
53
- return;
54
- }
55
- (*real_do_transaction_failed)(cs, physaddr, addr, size, access_type,
56
- mmu_idx, attrs, response, retaddr);
57
-}
58
-#endif /* CONFIG_TCG && !CONFIG_USER_ONLY */
59
-
118
static void mips_jazz_init(MachineState *machine,
60
static void mips_jazz_init(MachineState *machine,
119
enum jazz_model_e jazz_model)
61
enum jazz_model_e jazz_model)
62
{
120
@@ -XXX,XX +XXX,XX @@ static void mips_jazz_init(MachineState *machine,
63
@@ -XXX,XX +XXX,XX @@ static void mips_jazz_init(MachineState *machine,
64
int bios_size, n;
65
Clock *cpuclk;
66
MIPSCPU *cpu;
67
- CPUClass *cc;
68
+ MIPSCPUClass *mcc;
69
CPUMIPSState *env;
70
qemu_irq *i8259;
71
rc4030_dma *dmas;
72
@@ -XXX,XX +XXX,XX @@ static void mips_jazz_init(MachineState *machine,
73
* However, we can't simply add a global memory region to catch
74
* everything, as this would make all accesses including instruction
75
* accesses be ignored and not raise exceptions.
76
- * So instead we hijack the do_transaction_failed method on the CPU, and
77
- * do not raise exceptions for data access.
78
*
79
* NOTE: this behaviour of raising exceptions for bad instruction
80
* fetches but not bad data accesses was added in commit 54e755588cf1e9
81
@@ -XXX,XX +XXX,XX @@ static void mips_jazz_init(MachineState *machine,
82
* we could replace this hijacking of CPU methods with a simple global
121
* memory region that catches all memory accesses, as we do on Malta.
83
* memory region that catches all memory accesses, as we do on Malta.
122
*/
84
*/
123
cc = CPU_GET_CLASS(cpu);
85
- cc = CPU_GET_CLASS(cpu);
124
- real_do_transaction_failed = cc->do_transaction_failed;
86
-#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
125
- cc->do_transaction_failed = mips_jazz_do_transaction_failed;
87
- real_do_transaction_failed = cc->tcg_ops->do_transaction_failed;
126
+#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
88
- cc->tcg_ops->do_transaction_failed = mips_jazz_do_transaction_failed;
127
+ real_do_transaction_failed = cc->tcg_ops.do_transaction_failed;
89
-#endif /* CONFIG_TCG && !CONFIG_USER_ONLY */
128
+ cc->tcg_ops.do_transaction_failed = mips_jazz_do_transaction_failed;
90
+ mcc = MIPS_CPU_GET_CLASS(cpu);
129
+#endif /* CONFIG_TCG && !CONFIG_USER_ONLY */
91
+ mcc->no_data_aborts = true;
130
92
131
/* allocate RAM */
93
/* allocate RAM */
132
memory_region_add_subregion(address_space, 0, machine->ram);
94
memory_region_add_subregion(address_space, 0, machine->ram);
133
diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c
95
diff --git a/target/mips/tcg/op_helper.c b/target/mips/tcg/op_helper.c
134
index XXXXXXX..XXXXXXX 100644
96
index XXXXXXX..XXXXXXX 100644
135
--- a/target/alpha/cpu.c
97
--- a/target/mips/tcg/op_helper.c
136
+++ b/target/alpha/cpu.c
98
+++ b/target/mips/tcg/op_helper.c
137
@@ -XXX,XX +XXX,XX @@ static void alpha_cpu_class_init(ObjectClass *oc, void *data)
99
@@ -XXX,XX +XXX,XX @@ void mips_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
138
cc->gdb_write_register = alpha_cpu_gdb_write_register;
100
MemTxResult response, uintptr_t retaddr)
139
cc->tcg_ops.tlb_fill = alpha_cpu_tlb_fill;
101
{
140
#ifndef CONFIG_USER_ONLY
102
MIPSCPU *cpu = MIPS_CPU(cs);
141
- cc->do_transaction_failed = alpha_cpu_do_transaction_failed;
103
+ MIPSCPUClass *mcc = MIPS_CPU_GET_CLASS(cpu);
142
+ cc->tcg_ops.do_transaction_failed = alpha_cpu_do_transaction_failed;
104
CPUMIPSState *env = &cpu->env;
143
cc->do_unaligned_access = alpha_cpu_do_unaligned_access;
105
144
cc->get_phys_page_debug = alpha_cpu_get_phys_page_debug;
106
if (access_type == MMU_INST_FETCH) {
145
dc->vmsd = &vmstate_alpha_cpu;
107
do_raise_exception(env, EXCP_IBE, retaddr);
146
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
108
- } else {
147
index XXXXXXX..XXXXXXX 100644
109
+ } else if (!mcc->no_data_aborts) {
148
--- a/target/arm/cpu.c
110
do_raise_exception(env, EXCP_DBE, retaddr);
149
+++ b/target/arm/cpu.c
150
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
151
cc->debug_check_watchpoint = arm_debug_check_watchpoint;
152
cc->do_unaligned_access = arm_cpu_do_unaligned_access;
153
#if !defined(CONFIG_USER_ONLY)
154
- cc->do_transaction_failed = arm_cpu_do_transaction_failed;
155
+ cc->tcg_ops.do_transaction_failed = arm_cpu_do_transaction_failed;
156
cc->adjust_watchpoint_address = arm_adjust_watchpoint_address;
157
cc->tcg_ops.do_interrupt = arm_cpu_do_interrupt;
158
#endif /* CONFIG_TCG && !CONFIG_USER_ONLY */
159
-#endif
160
+#endif /* CONFIG_TCG */
161
}
162
163
#ifdef CONFIG_KVM
164
diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c
165
index XXXXXXX..XXXXXXX 100644
166
--- a/target/m68k/cpu.c
167
+++ b/target/m68k/cpu.c
168
@@ -XXX,XX +XXX,XX @@ static void m68k_cpu_class_init(ObjectClass *c, void *data)
169
cc->gdb_write_register = m68k_cpu_gdb_write_register;
170
cc->tcg_ops.tlb_fill = m68k_cpu_tlb_fill;
171
#if defined(CONFIG_SOFTMMU)
172
- cc->do_transaction_failed = m68k_cpu_transaction_failed;
173
+ cc->tcg_ops.do_transaction_failed = m68k_cpu_transaction_failed;
174
cc->get_phys_page_debug = m68k_cpu_get_phys_page_debug;
175
dc->vmsd = &vmstate_m68k_cpu;
176
#endif
177
diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c
178
index XXXXXXX..XXXXXXX 100644
179
--- a/target/microblaze/cpu.c
180
+++ b/target/microblaze/cpu.c
181
@@ -XXX,XX +XXX,XX @@ static void mb_cpu_class_init(ObjectClass *oc, void *data)
182
cc->gdb_write_register = mb_cpu_gdb_write_register;
183
cc->tcg_ops.tlb_fill = mb_cpu_tlb_fill;
184
#ifndef CONFIG_USER_ONLY
185
- cc->do_transaction_failed = mb_cpu_transaction_failed;
186
+ cc->tcg_ops.do_transaction_failed = mb_cpu_transaction_failed;
187
cc->get_phys_page_attrs_debug = mb_cpu_get_phys_page_attrs_debug;
188
dc->vmsd = &vmstate_mb_cpu;
189
#endif
190
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
191
index XXXXXXX..XXXXXXX 100644
192
--- a/target/mips/cpu.c
193
+++ b/target/mips/cpu.c
194
@@ -XXX,XX +XXX,XX @@ static void mips_cpu_class_init(ObjectClass *c, void *data)
195
cc->gdb_read_register = mips_cpu_gdb_read_register;
196
cc->gdb_write_register = mips_cpu_gdb_write_register;
197
#ifndef CONFIG_USER_ONLY
198
- cc->do_transaction_failed = mips_cpu_do_transaction_failed;
199
cc->do_unaligned_access = mips_cpu_do_unaligned_access;
200
cc->get_phys_page_debug = mips_cpu_get_phys_page_debug;
201
cc->vmsd = &vmstate_mips_cpu;
202
@@ -XXX,XX +XXX,XX @@ static void mips_cpu_class_init(ObjectClass *c, void *data)
203
cc->tcg_ops.cpu_exec_interrupt = mips_cpu_exec_interrupt;
204
cc->tcg_ops.synchronize_from_tb = mips_cpu_synchronize_from_tb;
205
cc->tcg_ops.tlb_fill = mips_cpu_tlb_fill;
206
+#ifndef CONFIG_USER_ONLY
207
+ cc->tcg_ops.do_transaction_failed = mips_cpu_do_transaction_failed;
208
+#endif /* CONFIG_USER_ONLY */
209
#endif /* CONFIG_TCG */
210
211
cc->gdb_num_core_regs = 73;
212
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
213
index XXXXXXX..XXXXXXX 100644
214
--- a/target/riscv/cpu.c
215
+++ b/target/riscv/cpu.c
216
@@ -XXX,XX +XXX,XX @@ static void riscv_cpu_class_init(ObjectClass *c, void *data)
217
cc->gdb_stop_before_watchpoint = true;
218
cc->disas_set_info = riscv_cpu_disas_set_info;
219
#ifndef CONFIG_USER_ONLY
220
- cc->do_transaction_failed = riscv_cpu_do_transaction_failed;
221
+ cc->tcg_ops.do_transaction_failed = riscv_cpu_do_transaction_failed;
222
cc->do_unaligned_access = riscv_cpu_do_unaligned_access;
223
cc->get_phys_page_debug = riscv_cpu_get_phys_page_debug;
224
/* For now, mark unmigratable: */
225
diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
226
index XXXXXXX..XXXXXXX 100644
227
--- a/target/riscv/cpu_helper.c
228
+++ b/target/riscv/cpu_helper.c
229
@@ -XXX,XX +XXX,XX @@ void riscv_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
230
env->badaddr = addr;
231
riscv_raise_exception(env, cs->exception_index, retaddr);
232
}
233
-#endif
234
+#endif /* !CONFIG_USER_ONLY */
235
236
bool riscv_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
237
MMUAccessType access_type, int mmu_idx,
238
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
239
index XXXXXXX..XXXXXXX 100644
240
--- a/target/sparc/cpu.c
241
+++ b/target/sparc/cpu.c
242
@@ -XXX,XX +XXX,XX @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data)
243
cc->gdb_write_register = sparc_cpu_gdb_write_register;
244
cc->tcg_ops.tlb_fill = sparc_cpu_tlb_fill;
245
#ifndef CONFIG_USER_ONLY
246
- cc->do_transaction_failed = sparc_cpu_do_transaction_failed;
247
+ cc->tcg_ops.do_transaction_failed = sparc_cpu_do_transaction_failed;
248
cc->do_unaligned_access = sparc_cpu_do_unaligned_access;
249
cc->get_phys_page_debug = sparc_cpu_get_phys_page_debug;
250
cc->vmsd = &vmstate_sparc_cpu;
251
diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c
252
index XXXXXXX..XXXXXXX 100644
253
--- a/target/xtensa/cpu.c
254
+++ b/target/xtensa/cpu.c
255
@@ -XXX,XX +XXX,XX @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data)
256
#ifndef CONFIG_USER_ONLY
257
cc->do_unaligned_access = xtensa_cpu_do_unaligned_access;
258
cc->get_phys_page_debug = xtensa_cpu_get_phys_page_debug;
259
- cc->do_transaction_failed = xtensa_cpu_do_transaction_failed;
260
+ cc->tcg_ops.do_transaction_failed = xtensa_cpu_do_transaction_failed;
261
#endif
262
cc->tcg_ops.debug_excp_handler = xtensa_breakpoint_handler;
263
cc->disas_set_info = xtensa_cpu_disas_set_info;
264
diff --git a/target/xtensa/helper.c b/target/xtensa/helper.c
265
index XXXXXXX..XXXXXXX 100644
266
--- a/target/xtensa/helper.c
267
+++ b/target/xtensa/helper.c
268
@@ -XXX,XX +XXX,XX @@ bool xtensa_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
269
cpu_loop_exit_restore(cs, retaddr);
270
}
271
272
-#else
273
+#else /* !CONFIG_USER_ONLY */
274
275
void xtensa_cpu_do_unaligned_access(CPUState *cs,
276
vaddr addr, MMUAccessType access_type,
277
@@ -XXX,XX +XXX,XX @@ void xtensa_runstall(CPUXtensaState *env, bool runstall)
278
qemu_cpu_kick(cpu);
279
}
111
}
280
}
112
}
281
-#endif
282
+#endif /* !CONFIG_USER_ONLY */
283
--
113
--
284
2.25.1
114
2.25.1
285
115
286
116
diff view generated by jsdifflib
1
From: Claudio Fontana <cfontana@suse.de>
1
We no longer have any runtime modifications to this struct,
2
so declare them all const.
2
3
3
Signed-off-by: Claudio Fontana <cfontana@suse.de>
4
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
4
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-Id: <20210204163931.7358-10-cfontana@suse.de>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-ID: <20210227232519.222663-3-richard.henderson@linaro.org>
8
---
8
---
9
include/hw/core/cpu.h | 4 ++--
9
include/hw/core/cpu.h | 2 +-
10
accel/tcg/cpu-exec.c | 4 ++--
10
target/alpha/cpu.c | 2 +-
11
target/alpha/cpu.c | 2 +-
11
target/arm/cpu.c | 2 +-
12
target/arm/cpu.c | 4 ++--
12
target/arm/cpu_tcg.c | 2 +-
13
target/arm/cpu_tcg.c | 9 ++++-----
13
target/avr/cpu.c | 2 +-
14
target/avr/cpu.c | 2 +-
14
target/cris/cpu.c | 4 ++--
15
target/avr/helper.c | 4 ++--
15
target/hexagon/cpu.c | 2 +-
16
target/cris/cpu.c | 12 ++++++------
16
target/hppa/cpu.c | 2 +-
17
target/cris/helper.c | 4 ++--
17
target/i386/tcg/tcg-cpu.c | 2 +-
18
target/hppa/cpu.c | 2 +-
18
target/m68k/cpu.c | 2 +-
19
target/i386/tcg/tcg-cpu.c | 2 +-
19
target/microblaze/cpu.c | 2 +-
20
target/lm32/cpu.c | 2 +-
20
target/mips/cpu.c | 2 +-
21
target/m68k/cpu.c | 2 +-
21
target/nios2/cpu.c | 2 +-
22
target/microblaze/cpu.c | 2 +-
22
target/openrisc/cpu.c | 2 +-
23
target/mips/cpu.c | 4 ++--
23
target/ppc/cpu_init.c | 2 +-
24
target/moxie/cpu.c | 2 +-
24
target/riscv/cpu.c | 2 +-
25
target/nios2/cpu.c | 2 +-
25
target/rx/cpu.c | 2 +-
26
target/openrisc/cpu.c | 2 +-
26
target/s390x/cpu.c | 2 +-
27
target/riscv/cpu.c | 2 +-
27
target/sh4/cpu.c | 2 +-
28
target/rx/cpu.c | 2 +-
28
target/sparc/cpu.c | 2 +-
29
target/s390x/cpu.c | 2 +-
29
target/tricore/cpu.c | 2 +-
30
target/sh4/cpu.c | 2 +-
30
target/xtensa/cpu.c | 2 +-
31
target/sparc/cpu.c | 2 +-
31
22 files changed, 23 insertions(+), 23 deletions(-)
32
target/tilegx/cpu.c | 2 +-
33
target/unicore32/cpu.c | 2 +-
34
target/xtensa/cpu.c | 2 +-
35
target/ppc/translate_init.c.inc | 2 +-
36
27 files changed, 41 insertions(+), 42 deletions(-)
37
32
38
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
33
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
39
index XXXXXXX..XXXXXXX 100644
34
index XXXXXXX..XXXXXXX 100644
40
--- a/include/hw/core/cpu.h
35
--- a/include/hw/core/cpu.h
41
+++ b/include/hw/core/cpu.h
36
+++ b/include/hw/core/cpu.h
42
@@ -XXX,XX +XXX,XX @@ typedef struct TcgCpuOperations {
43
void (*cpu_exec_exit)(CPUState *cpu);
44
/** @cpu_exec_interrupt: Callback for processing interrupts in cpu_exec */
45
bool (*cpu_exec_interrupt)(CPUState *cpu, int interrupt_request);
46
+ /** @do_interrupt: Callback for interrupt handling. */
47
+ void (*do_interrupt)(CPUState *cpu);
48
/**
49
* @tlb_fill: Handle a softmmu tlb miss or user-only address fault
50
*
51
@@ -XXX,XX +XXX,XX @@ typedef struct TcgCpuOperations {
52
* @parse_features: Callback to parse command line arguments.
53
* @reset_dump_flags: #CPUDumpFlags to use for reset logging.
54
* @has_work: Callback for checking if there is work to do.
55
- * @do_interrupt: Callback for interrupt handling.
56
* @do_unaligned_access: Callback for unaligned access handling, if
57
* the target defines #TARGET_ALIGNED_ONLY.
58
* @do_transaction_failed: Callback for handling failed memory transactions
59
@@ -XXX,XX +XXX,XX @@ struct CPUClass {
37
@@ -XXX,XX +XXX,XX @@ struct CPUClass {
60
38
const struct SysemuCPUOps *sysemu_ops;
61
int reset_dump_flags;
39
62
bool (*has_work)(CPUState *cpu);
40
/* when TCG is not available, this pointer is NULL */
63
- void (*do_interrupt)(CPUState *cpu);
41
- struct TCGCPUOps *tcg_ops;
64
void (*do_unaligned_access)(CPUState *cpu, vaddr addr,
42
+ const struct TCGCPUOps *tcg_ops;
65
MMUAccessType access_type,
43
66
int mmu_idx, uintptr_t retaddr);
44
/*
67
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
45
* if not NULL, this is called in order for the CPUClass to initialize
68
index XXXXXXX..XXXXXXX 100644
69
--- a/accel/tcg/cpu-exec.c
70
+++ b/accel/tcg/cpu-exec.c
71
@@ -XXX,XX +XXX,XX @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret)
72
loop */
73
#if defined(TARGET_I386)
74
CPUClass *cc = CPU_GET_CLASS(cpu);
75
- cc->do_interrupt(cpu);
76
+ cc->tcg_ops.do_interrupt(cpu);
77
#endif
78
*ret = cpu->exception_index;
79
cpu->exception_index = -1;
80
@@ -XXX,XX +XXX,XX @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret)
81
if (replay_exception()) {
82
CPUClass *cc = CPU_GET_CLASS(cpu);
83
qemu_mutex_lock_iothread();
84
- cc->do_interrupt(cpu);
85
+ cc->tcg_ops.do_interrupt(cpu);
86
qemu_mutex_unlock_iothread();
87
cpu->exception_index = -1;
88
89
diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c
46
diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c
90
index XXXXXXX..XXXXXXX 100644
47
index XXXXXXX..XXXXXXX 100644
91
--- a/target/alpha/cpu.c
48
--- a/target/alpha/cpu.c
92
+++ b/target/alpha/cpu.c
49
+++ b/target/alpha/cpu.c
93
@@ -XXX,XX +XXX,XX @@ static void alpha_cpu_class_init(ObjectClass *oc, void *data)
50
@@ -XXX,XX +XXX,XX @@ static const struct SysemuCPUOps alpha_sysemu_ops = {
94
51
95
cc->class_by_name = alpha_cpu_class_by_name;
52
#include "hw/core/tcg-cpu-ops.h"
96
cc->has_work = alpha_cpu_has_work;
53
97
- cc->do_interrupt = alpha_cpu_do_interrupt;
54
-static struct TCGCPUOps alpha_tcg_ops = {
98
+ cc->tcg_ops.do_interrupt = alpha_cpu_do_interrupt;
55
+static const struct TCGCPUOps alpha_tcg_ops = {
99
cc->tcg_ops.cpu_exec_interrupt = alpha_cpu_exec_interrupt;
56
.initialize = alpha_translate_init,
100
cc->dump_state = alpha_cpu_dump_state;
57
.cpu_exec_interrupt = alpha_cpu_exec_interrupt,
101
cc->set_pc = alpha_cpu_set_pc;
58
.tlb_fill = alpha_cpu_tlb_fill,
102
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
59
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
103
index XXXXXXX..XXXXXXX 100644
60
index XXXXXXX..XXXXXXX 100644
104
--- a/target/arm/cpu.c
61
--- a/target/arm/cpu.c
105
+++ b/target/arm/cpu.c
62
+++ b/target/arm/cpu.c
106
@@ -XXX,XX +XXX,XX @@ bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
63
@@ -XXX,XX +XXX,XX @@ static const struct SysemuCPUOps arm_sysemu_ops = {
107
found:
108
cs->exception_index = excp_idx;
109
env->exception.target_el = target_el;
110
- cc->do_interrupt(cs);
111
+ cc->tcg_ops.do_interrupt(cs);
112
return true;
113
}
114
115
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
116
cc->gdb_read_register = arm_cpu_gdb_read_register;
117
cc->gdb_write_register = arm_cpu_gdb_write_register;
118
#ifndef CONFIG_USER_ONLY
119
- cc->do_interrupt = arm_cpu_do_interrupt;
120
cc->get_phys_page_attrs_debug = arm_cpu_get_phys_page_attrs_debug;
121
cc->asidx_from_attrs = arm_asidx_from_attrs;
122
cc->vmsd = &vmstate_arm_cpu;
123
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data)
124
#if !defined(CONFIG_USER_ONLY)
125
cc->do_transaction_failed = arm_cpu_do_transaction_failed;
126
cc->adjust_watchpoint_address = arm_adjust_watchpoint_address;
127
+ cc->tcg_ops.do_interrupt = arm_cpu_do_interrupt;
128
#endif /* CONFIG_TCG && !CONFIG_USER_ONLY */
129
#endif
64
#endif
130
}
65
66
#ifdef CONFIG_TCG
67
-static struct TCGCPUOps arm_tcg_ops = {
68
+static const struct TCGCPUOps arm_tcg_ops = {
69
.initialize = arm_translate_init,
70
.synchronize_from_tb = arm_cpu_synchronize_from_tb,
71
.cpu_exec_interrupt = arm_cpu_exec_interrupt,
131
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
72
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
132
index XXXXXXX..XXXXXXX 100644
73
index XXXXXXX..XXXXXXX 100644
133
--- a/target/arm/cpu_tcg.c
74
--- a/target/arm/cpu_tcg.c
134
+++ b/target/arm/cpu_tcg.c
75
+++ b/target/arm/cpu_tcg.c
135
@@ -XXX,XX +XXX,XX @@ static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
76
@@ -XXX,XX +XXX,XX @@ static void pxa270c5_initfn(Object *obj)
136
if (interrupt_request & CPU_INTERRUPT_HARD
77
}
137
&& (armv7m_nvic_can_take_pending_exception(env->nvic))) {
78
138
cs->exception_index = EXCP_IRQ;
79
#ifdef CONFIG_TCG
139
- cc->do_interrupt(cs);
80
-static struct TCGCPUOps arm_v7m_tcg_ops = {
140
+ cc->tcg_ops.do_interrupt(cs);
81
+static const struct TCGCPUOps arm_v7m_tcg_ops = {
141
ret = true;
82
.initialize = arm_translate_init,
142
}
83
.synchronize_from_tb = arm_cpu_synchronize_from_tb,
143
return ret;
84
.cpu_exec_interrupt = arm_v7m_cpu_exec_interrupt,
144
@@ -XXX,XX +XXX,XX @@ static void arm_v7m_class_init(ObjectClass *oc, void *data)
145
CPUClass *cc = CPU_CLASS(oc);
146
147
acc->info = data;
148
-#ifndef CONFIG_USER_ONLY
149
- cc->do_interrupt = arm_v7m_cpu_do_interrupt;
150
-#endif
151
-
152
#ifdef CONFIG_TCG
153
cc->tcg_ops.cpu_exec_interrupt = arm_v7m_cpu_exec_interrupt;
154
+#ifndef CONFIG_USER_ONLY
155
+ cc->tcg_ops.do_interrupt = arm_v7m_cpu_do_interrupt;
156
+#endif
157
#endif /* CONFIG_TCG */
158
159
cc->gdb_core_xml_file = "arm-m-profile.xml";
160
diff --git a/target/avr/cpu.c b/target/avr/cpu.c
85
diff --git a/target/avr/cpu.c b/target/avr/cpu.c
161
index XXXXXXX..XXXXXXX 100644
86
index XXXXXXX..XXXXXXX 100644
162
--- a/target/avr/cpu.c
87
--- a/target/avr/cpu.c
163
+++ b/target/avr/cpu.c
88
+++ b/target/avr/cpu.c
164
@@ -XXX,XX +XXX,XX @@ static void avr_cpu_class_init(ObjectClass *oc, void *data)
89
@@ -XXX,XX +XXX,XX @@ static const struct SysemuCPUOps avr_sysemu_ops = {
165
cc->class_by_name = avr_cpu_class_by_name;
90
166
91
#include "hw/core/tcg-cpu-ops.h"
167
cc->has_work = avr_cpu_has_work;
92
168
- cc->do_interrupt = avr_cpu_do_interrupt;
93
-static struct TCGCPUOps avr_tcg_ops = {
169
+ cc->tcg_ops.do_interrupt = avr_cpu_do_interrupt;
94
+static const struct TCGCPUOps avr_tcg_ops = {
170
cc->tcg_ops.cpu_exec_interrupt = avr_cpu_exec_interrupt;
95
.initialize = avr_cpu_tcg_init,
171
cc->dump_state = avr_cpu_dump_state;
96
.synchronize_from_tb = avr_cpu_synchronize_from_tb,
172
cc->set_pc = avr_cpu_set_pc;
97
.cpu_exec_interrupt = avr_cpu_exec_interrupt,
173
diff --git a/target/avr/helper.c b/target/avr/helper.c
174
index XXXXXXX..XXXXXXX 100644
175
--- a/target/avr/helper.c
176
+++ b/target/avr/helper.c
177
@@ -XXX,XX +XXX,XX @@ bool avr_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
178
if (interrupt_request & CPU_INTERRUPT_RESET) {
179
if (cpu_interrupts_enabled(env)) {
180
cs->exception_index = EXCP_RESET;
181
- cc->do_interrupt(cs);
182
+ cc->tcg_ops.do_interrupt(cs);
183
184
cs->interrupt_request &= ~CPU_INTERRUPT_RESET;
185
186
@@ -XXX,XX +XXX,XX @@ bool avr_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
187
if (cpu_interrupts_enabled(env) && env->intsrc != 0) {
188
int index = ctz32(env->intsrc);
189
cs->exception_index = EXCP_INT(index);
190
- cc->do_interrupt(cs);
191
+ cc->tcg_ops.do_interrupt(cs);
192
193
env->intsrc &= env->intsrc - 1; /* clear the interrupt */
194
cs->interrupt_request &= ~CPU_INTERRUPT_HARD;
195
diff --git a/target/cris/cpu.c b/target/cris/cpu.c
98
diff --git a/target/cris/cpu.c b/target/cris/cpu.c
196
index XXXXXXX..XXXXXXX 100644
99
index XXXXXXX..XXXXXXX 100644
197
--- a/target/cris/cpu.c
100
--- a/target/cris/cpu.c
198
+++ b/target/cris/cpu.c
101
+++ b/target/cris/cpu.c
199
@@ -XXX,XX +XXX,XX @@ static void crisv8_cpu_class_init(ObjectClass *oc, void *data)
102
@@ -XXX,XX +XXX,XX @@ static const struct SysemuCPUOps cris_sysemu_ops = {
200
CRISCPUClass *ccc = CRIS_CPU_CLASS(oc);
103
201
104
#include "hw/core/tcg-cpu-ops.h"
202
ccc->vr = 8;
105
203
- cc->do_interrupt = crisv10_cpu_do_interrupt;
106
-static struct TCGCPUOps crisv10_tcg_ops = {
204
+ cc->tcg_ops.do_interrupt = crisv10_cpu_do_interrupt;
107
+static const struct TCGCPUOps crisv10_tcg_ops = {
205
cc->gdb_read_register = crisv10_cpu_gdb_read_register;
108
.initialize = cris_initialize_crisv10_tcg,
206
cc->tcg_ops.initialize = cris_initialize_crisv10_tcg;
109
.cpu_exec_interrupt = cris_cpu_exec_interrupt,
207
}
110
.tlb_fill = cris_cpu_tlb_fill,
208
@@ -XXX,XX +XXX,XX @@ static void crisv9_cpu_class_init(ObjectClass *oc, void *data)
111
@@ -XXX,XX +XXX,XX @@ static struct TCGCPUOps crisv10_tcg_ops = {
209
CRISCPUClass *ccc = CRIS_CPU_CLASS(oc);
112
#endif /* !CONFIG_USER_ONLY */
210
113
};
211
ccc->vr = 9;
114
212
- cc->do_interrupt = crisv10_cpu_do_interrupt;
115
-static struct TCGCPUOps crisv32_tcg_ops = {
213
+ cc->tcg_ops.do_interrupt = crisv10_cpu_do_interrupt;
116
+static const struct TCGCPUOps crisv32_tcg_ops = {
214
cc->gdb_read_register = crisv10_cpu_gdb_read_register;
117
.initialize = cris_initialize_tcg,
215
cc->tcg_ops.initialize = cris_initialize_crisv10_tcg;
118
.cpu_exec_interrupt = cris_cpu_exec_interrupt,
216
}
119
.tlb_fill = cris_cpu_tlb_fill,
217
@@ -XXX,XX +XXX,XX @@ static void crisv10_cpu_class_init(ObjectClass *oc, void *data)
120
diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c
218
CRISCPUClass *ccc = CRIS_CPU_CLASS(oc);
121
index XXXXXXX..XXXXXXX 100644
219
122
--- a/target/hexagon/cpu.c
220
ccc->vr = 10;
123
+++ b/target/hexagon/cpu.c
221
- cc->do_interrupt = crisv10_cpu_do_interrupt;
124
@@ -XXX,XX +XXX,XX @@ static bool hexagon_tlb_fill(CPUState *cs, vaddr address, int size,
222
+ cc->tcg_ops.do_interrupt = crisv10_cpu_do_interrupt;
125
223
cc->gdb_read_register = crisv10_cpu_gdb_read_register;
126
#include "hw/core/tcg-cpu-ops.h"
224
cc->tcg_ops.initialize = cris_initialize_crisv10_tcg;
127
225
}
128
-static struct TCGCPUOps hexagon_tcg_ops = {
226
@@ -XXX,XX +XXX,XX @@ static void crisv11_cpu_class_init(ObjectClass *oc, void *data)
129
+static const struct TCGCPUOps hexagon_tcg_ops = {
227
CRISCPUClass *ccc = CRIS_CPU_CLASS(oc);
130
.initialize = hexagon_translate_init,
228
131
.synchronize_from_tb = hexagon_cpu_synchronize_from_tb,
229
ccc->vr = 11;
132
.tlb_fill = hexagon_tlb_fill,
230
- cc->do_interrupt = crisv10_cpu_do_interrupt;
231
+ cc->tcg_ops.do_interrupt = crisv10_cpu_do_interrupt;
232
cc->gdb_read_register = crisv10_cpu_gdb_read_register;
233
cc->tcg_ops.initialize = cris_initialize_crisv10_tcg;
234
}
235
@@ -XXX,XX +XXX,XX @@ static void crisv17_cpu_class_init(ObjectClass *oc, void *data)
236
CRISCPUClass *ccc = CRIS_CPU_CLASS(oc);
237
238
ccc->vr = 17;
239
- cc->do_interrupt = crisv10_cpu_do_interrupt;
240
+ cc->tcg_ops.do_interrupt = crisv10_cpu_do_interrupt;
241
cc->gdb_read_register = crisv10_cpu_gdb_read_register;
242
cc->tcg_ops.initialize = cris_initialize_crisv10_tcg;
243
}
244
@@ -XXX,XX +XXX,XX @@ static void cris_cpu_class_init(ObjectClass *oc, void *data)
245
246
cc->class_by_name = cris_cpu_class_by_name;
247
cc->has_work = cris_cpu_has_work;
248
- cc->do_interrupt = cris_cpu_do_interrupt;
249
+ cc->tcg_ops.do_interrupt = cris_cpu_do_interrupt;
250
cc->tcg_ops.cpu_exec_interrupt = cris_cpu_exec_interrupt;
251
cc->dump_state = cris_cpu_dump_state;
252
cc->set_pc = cris_cpu_set_pc;
253
diff --git a/target/cris/helper.c b/target/cris/helper.c
254
index XXXXXXX..XXXXXXX 100644
255
--- a/target/cris/helper.c
256
+++ b/target/cris/helper.c
257
@@ -XXX,XX +XXX,XX @@ bool cris_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
258
&& (env->pregs[PR_CCS] & I_FLAG)
259
&& !env->locked_irq) {
260
cs->exception_index = EXCP_IRQ;
261
- cc->do_interrupt(cs);
262
+ cc->tcg_ops.do_interrupt(cs);
263
ret = true;
264
}
265
if (interrupt_request & CPU_INTERRUPT_NMI) {
266
@@ -XXX,XX +XXX,XX @@ bool cris_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
267
}
268
if ((env->pregs[PR_CCS] & m_flag_archval)) {
269
cs->exception_index = EXCP_NMI;
270
- cc->do_interrupt(cs);
271
+ cc->tcg_ops.do_interrupt(cs);
272
ret = true;
273
}
274
}
275
diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
133
diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
276
index XXXXXXX..XXXXXXX 100644
134
index XXXXXXX..XXXXXXX 100644
277
--- a/target/hppa/cpu.c
135
--- a/target/hppa/cpu.c
278
+++ b/target/hppa/cpu.c
136
+++ b/target/hppa/cpu.c
279
@@ -XXX,XX +XXX,XX @@ static void hppa_cpu_class_init(ObjectClass *oc, void *data)
137
@@ -XXX,XX +XXX,XX @@ static const struct SysemuCPUOps hppa_sysemu_ops = {
280
138
281
cc->class_by_name = hppa_cpu_class_by_name;
139
#include "hw/core/tcg-cpu-ops.h"
282
cc->has_work = hppa_cpu_has_work;
140
283
- cc->do_interrupt = hppa_cpu_do_interrupt;
141
-static struct TCGCPUOps hppa_tcg_ops = {
284
+ cc->tcg_ops.do_interrupt = hppa_cpu_do_interrupt;
142
+static const struct TCGCPUOps hppa_tcg_ops = {
285
cc->tcg_ops.cpu_exec_interrupt = hppa_cpu_exec_interrupt;
143
.initialize = hppa_translate_init,
286
cc->dump_state = hppa_cpu_dump_state;
144
.synchronize_from_tb = hppa_cpu_synchronize_from_tb,
287
cc->set_pc = hppa_cpu_set_pc;
145
.cpu_exec_interrupt = hppa_cpu_exec_interrupt,
288
diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c
146
diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c
289
index XXXXXXX..XXXXXXX 100644
147
index XXXXXXX..XXXXXXX 100644
290
--- a/target/i386/tcg/tcg-cpu.c
148
--- a/target/i386/tcg/tcg-cpu.c
291
+++ b/target/i386/tcg/tcg-cpu.c
149
+++ b/target/i386/tcg/tcg-cpu.c
292
@@ -XXX,XX +XXX,XX @@ static void x86_cpu_synchronize_from_tb(CPUState *cs,
150
@@ -XXX,XX +XXX,XX @@ static void x86_cpu_synchronize_from_tb(CPUState *cs,
293
151
294
void tcg_cpu_common_class_init(CPUClass *cc)
152
#include "hw/core/tcg-cpu-ops.h"
295
{
153
296
- cc->do_interrupt = x86_cpu_do_interrupt;
154
-static struct TCGCPUOps x86_tcg_ops = {
297
+ cc->tcg_ops.do_interrupt = x86_cpu_do_interrupt;
155
+static const struct TCGCPUOps x86_tcg_ops = {
298
cc->tcg_ops.cpu_exec_interrupt = x86_cpu_exec_interrupt;
156
.initialize = tcg_x86_init,
299
cc->tcg_ops.synchronize_from_tb = x86_cpu_synchronize_from_tb;
157
.synchronize_from_tb = x86_cpu_synchronize_from_tb,
300
cc->tcg_ops.cpu_exec_enter = x86_cpu_exec_enter;
158
.cpu_exec_enter = x86_cpu_exec_enter,
301
diff --git a/target/lm32/cpu.c b/target/lm32/cpu.c
302
index XXXXXXX..XXXXXXX 100644
303
--- a/target/lm32/cpu.c
304
+++ b/target/lm32/cpu.c
305
@@ -XXX,XX +XXX,XX @@ static void lm32_cpu_class_init(ObjectClass *oc, void *data)
306
307
cc->class_by_name = lm32_cpu_class_by_name;
308
cc->has_work = lm32_cpu_has_work;
309
- cc->do_interrupt = lm32_cpu_do_interrupt;
310
+ cc->tcg_ops.do_interrupt = lm32_cpu_do_interrupt;
311
cc->tcg_ops.cpu_exec_interrupt = lm32_cpu_exec_interrupt;
312
cc->dump_state = lm32_cpu_dump_state;
313
cc->set_pc = lm32_cpu_set_pc;
314
diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c
159
diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c
315
index XXXXXXX..XXXXXXX 100644
160
index XXXXXXX..XXXXXXX 100644
316
--- a/target/m68k/cpu.c
161
--- a/target/m68k/cpu.c
317
+++ b/target/m68k/cpu.c
162
+++ b/target/m68k/cpu.c
318
@@ -XXX,XX +XXX,XX @@ static void m68k_cpu_class_init(ObjectClass *c, void *data)
163
@@ -XXX,XX +XXX,XX @@ static const struct SysemuCPUOps m68k_sysemu_ops = {
319
164
320
cc->class_by_name = m68k_cpu_class_by_name;
165
#include "hw/core/tcg-cpu-ops.h"
321
cc->has_work = m68k_cpu_has_work;
166
322
- cc->do_interrupt = m68k_cpu_do_interrupt;
167
-static struct TCGCPUOps m68k_tcg_ops = {
323
+ cc->tcg_ops.do_interrupt = m68k_cpu_do_interrupt;
168
+static const struct TCGCPUOps m68k_tcg_ops = {
324
cc->tcg_ops.cpu_exec_interrupt = m68k_cpu_exec_interrupt;
169
.initialize = m68k_tcg_init,
325
cc->dump_state = m68k_cpu_dump_state;
170
.cpu_exec_interrupt = m68k_cpu_exec_interrupt,
326
cc->set_pc = m68k_cpu_set_pc;
171
.tlb_fill = m68k_cpu_tlb_fill,
327
diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c
172
diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c
328
index XXXXXXX..XXXXXXX 100644
173
index XXXXXXX..XXXXXXX 100644
329
--- a/target/microblaze/cpu.c
174
--- a/target/microblaze/cpu.c
330
+++ b/target/microblaze/cpu.c
175
+++ b/target/microblaze/cpu.c
331
@@ -XXX,XX +XXX,XX @@ static void mb_cpu_class_init(ObjectClass *oc, void *data)
176
@@ -XXX,XX +XXX,XX @@ static const struct SysemuCPUOps mb_sysemu_ops = {
332
177
333
cc->class_by_name = mb_cpu_class_by_name;
178
#include "hw/core/tcg-cpu-ops.h"
334
cc->has_work = mb_cpu_has_work;
179
335
- cc->do_interrupt = mb_cpu_do_interrupt;
180
-static struct TCGCPUOps mb_tcg_ops = {
336
+ cc->tcg_ops.do_interrupt = mb_cpu_do_interrupt;
181
+static const struct TCGCPUOps mb_tcg_ops = {
337
cc->do_unaligned_access = mb_cpu_do_unaligned_access;
182
.initialize = mb_tcg_init,
338
cc->tcg_ops.cpu_exec_interrupt = mb_cpu_exec_interrupt;
183
.synchronize_from_tb = mb_cpu_synchronize_from_tb,
339
cc->dump_state = mb_cpu_dump_state;
184
.cpu_exec_interrupt = mb_cpu_exec_interrupt,
340
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
185
diff --git a/target/mips/cpu.c b/target/mips/cpu.c
341
index XXXXXXX..XXXXXXX 100644
186
index XXXXXXX..XXXXXXX 100644
342
--- a/target/mips/cpu.c
187
--- a/target/mips/cpu.c
343
+++ b/target/mips/cpu.c
188
+++ b/target/mips/cpu.c
344
@@ -XXX,XX +XXX,XX @@ static void mips_cpu_class_init(ObjectClass *c, void *data)
189
@@ -XXX,XX +XXX,XX @@ static const struct SysemuCPUOps mips_sysemu_ops = {
345
190
* NB: cannot be const, as some elements are changed for specific
346
cc->class_by_name = mips_cpu_class_by_name;
191
* mips hardware (see hw/mips/jazz.c).
347
cc->has_work = mips_cpu_has_work;
192
*/
348
- cc->do_interrupt = mips_cpu_do_interrupt;
193
-static struct TCGCPUOps mips_tcg_ops = {
349
cc->dump_state = mips_cpu_dump_state;
194
+static const struct TCGCPUOps mips_tcg_ops = {
350
cc->set_pc = mips_cpu_set_pc;
195
.initialize = mips_tcg_init,
351
cc->gdb_read_register = mips_cpu_gdb_read_register;
196
.synchronize_from_tb = mips_cpu_synchronize_from_tb,
352
@@ -XXX,XX +XXX,XX @@ static void mips_cpu_class_init(ObjectClass *c, void *data)
197
.cpu_exec_interrupt = mips_cpu_exec_interrupt,
353
cc->disas_set_info = mips_cpu_disas_set_info;
354
#ifdef CONFIG_TCG
355
cc->tcg_ops.initialize = mips_tcg_init;
356
+ cc->tcg_ops.do_interrupt = mips_cpu_do_interrupt;
357
cc->tcg_ops.cpu_exec_interrupt = mips_cpu_exec_interrupt;
358
cc->tcg_ops.synchronize_from_tb = mips_cpu_synchronize_from_tb;
359
cc->tcg_ops.tlb_fill = mips_cpu_tlb_fill;
360
-#endif
361
+#endif /* CONFIG_TCG */
362
363
cc->gdb_num_core_regs = 73;
364
cc->gdb_stop_before_watchpoint = true;
365
diff --git a/target/moxie/cpu.c b/target/moxie/cpu.c
366
index XXXXXXX..XXXXXXX 100644
367
--- a/target/moxie/cpu.c
368
+++ b/target/moxie/cpu.c
369
@@ -XXX,XX +XXX,XX @@ static void moxie_cpu_class_init(ObjectClass *oc, void *data)
370
cc->class_by_name = moxie_cpu_class_by_name;
371
372
cc->has_work = moxie_cpu_has_work;
373
- cc->do_interrupt = moxie_cpu_do_interrupt;
374
+ cc->tcg_ops.do_interrupt = moxie_cpu_do_interrupt;
375
cc->dump_state = moxie_cpu_dump_state;
376
cc->set_pc = moxie_cpu_set_pc;
377
cc->tcg_ops.tlb_fill = moxie_cpu_tlb_fill;
378
diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c
198
diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c
379
index XXXXXXX..XXXXXXX 100644
199
index XXXXXXX..XXXXXXX 100644
380
--- a/target/nios2/cpu.c
200
--- a/target/nios2/cpu.c
381
+++ b/target/nios2/cpu.c
201
+++ b/target/nios2/cpu.c
382
@@ -XXX,XX +XXX,XX @@ static void nios2_cpu_class_init(ObjectClass *oc, void *data)
202
@@ -XXX,XX +XXX,XX @@ static const struct SysemuCPUOps nios2_sysemu_ops = {
383
203
384
cc->class_by_name = nios2_cpu_class_by_name;
204
#include "hw/core/tcg-cpu-ops.h"
385
cc->has_work = nios2_cpu_has_work;
205
386
- cc->do_interrupt = nios2_cpu_do_interrupt;
206
-static struct TCGCPUOps nios2_tcg_ops = {
387
+ cc->tcg_ops.do_interrupt = nios2_cpu_do_interrupt;
207
+static const struct TCGCPUOps nios2_tcg_ops = {
388
cc->tcg_ops.cpu_exec_interrupt = nios2_cpu_exec_interrupt;
208
.initialize = nios2_tcg_init,
389
cc->dump_state = nios2_cpu_dump_state;
209
.cpu_exec_interrupt = nios2_cpu_exec_interrupt,
390
cc->set_pc = nios2_cpu_set_pc;
210
.tlb_fill = nios2_cpu_tlb_fill,
391
diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c
211
diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c
392
index XXXXXXX..XXXXXXX 100644
212
index XXXXXXX..XXXXXXX 100644
393
--- a/target/openrisc/cpu.c
213
--- a/target/openrisc/cpu.c
394
+++ b/target/openrisc/cpu.c
214
+++ b/target/openrisc/cpu.c
395
@@ -XXX,XX +XXX,XX @@ static void openrisc_cpu_class_init(ObjectClass *oc, void *data)
215
@@ -XXX,XX +XXX,XX @@ static const struct SysemuCPUOps openrisc_sysemu_ops = {
396
216
397
cc->class_by_name = openrisc_cpu_class_by_name;
217
#include "hw/core/tcg-cpu-ops.h"
398
cc->has_work = openrisc_cpu_has_work;
218
399
- cc->do_interrupt = openrisc_cpu_do_interrupt;
219
-static struct TCGCPUOps openrisc_tcg_ops = {
400
+ cc->tcg_ops.do_interrupt = openrisc_cpu_do_interrupt;
220
+static const struct TCGCPUOps openrisc_tcg_ops = {
401
cc->tcg_ops.cpu_exec_interrupt = openrisc_cpu_exec_interrupt;
221
.initialize = openrisc_translate_init,
402
cc->dump_state = openrisc_cpu_dump_state;
222
.cpu_exec_interrupt = openrisc_cpu_exec_interrupt,
403
cc->set_pc = openrisc_cpu_set_pc;
223
.tlb_fill = openrisc_cpu_tlb_fill,
224
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
225
index XXXXXXX..XXXXXXX 100644
226
--- a/target/ppc/cpu_init.c
227
+++ b/target/ppc/cpu_init.c
228
@@ -XXX,XX +XXX,XX @@ static const struct SysemuCPUOps ppc_sysemu_ops = {
229
#ifdef CONFIG_TCG
230
#include "hw/core/tcg-cpu-ops.h"
231
232
-static struct TCGCPUOps ppc_tcg_ops = {
233
+static const struct TCGCPUOps ppc_tcg_ops = {
234
.initialize = ppc_translate_init,
235
.cpu_exec_interrupt = ppc_cpu_exec_interrupt,
236
.tlb_fill = ppc_cpu_tlb_fill,
404
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
237
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
405
index XXXXXXX..XXXXXXX 100644
238
index XXXXXXX..XXXXXXX 100644
406
--- a/target/riscv/cpu.c
239
--- a/target/riscv/cpu.c
407
+++ b/target/riscv/cpu.c
240
+++ b/target/riscv/cpu.c
408
@@ -XXX,XX +XXX,XX @@ static void riscv_cpu_class_init(ObjectClass *c, void *data)
241
@@ -XXX,XX +XXX,XX @@ static const struct SysemuCPUOps riscv_sysemu_ops = {
409
242
410
cc->class_by_name = riscv_cpu_class_by_name;
243
#include "hw/core/tcg-cpu-ops.h"
411
cc->has_work = riscv_cpu_has_work;
244
412
- cc->do_interrupt = riscv_cpu_do_interrupt;
245
-static struct TCGCPUOps riscv_tcg_ops = {
413
+ cc->tcg_ops.do_interrupt = riscv_cpu_do_interrupt;
246
+static const struct TCGCPUOps riscv_tcg_ops = {
414
cc->tcg_ops.cpu_exec_interrupt = riscv_cpu_exec_interrupt;
247
.initialize = riscv_translate_init,
415
cc->dump_state = riscv_cpu_dump_state;
248
.synchronize_from_tb = riscv_cpu_synchronize_from_tb,
416
cc->set_pc = riscv_cpu_set_pc;
249
.cpu_exec_interrupt = riscv_cpu_exec_interrupt,
417
diff --git a/target/rx/cpu.c b/target/rx/cpu.c
250
diff --git a/target/rx/cpu.c b/target/rx/cpu.c
418
index XXXXXXX..XXXXXXX 100644
251
index XXXXXXX..XXXXXXX 100644
419
--- a/target/rx/cpu.c
252
--- a/target/rx/cpu.c
420
+++ b/target/rx/cpu.c
253
+++ b/target/rx/cpu.c
421
@@ -XXX,XX +XXX,XX @@ static void rx_cpu_class_init(ObjectClass *klass, void *data)
254
@@ -XXX,XX +XXX,XX @@ static const struct SysemuCPUOps rx_sysemu_ops = {
422
255
423
cc->class_by_name = rx_cpu_class_by_name;
256
#include "hw/core/tcg-cpu-ops.h"
424
cc->has_work = rx_cpu_has_work;
257
425
- cc->do_interrupt = rx_cpu_do_interrupt;
258
-static struct TCGCPUOps rx_tcg_ops = {
426
+ cc->tcg_ops.do_interrupt = rx_cpu_do_interrupt;
259
+static const struct TCGCPUOps rx_tcg_ops = {
427
cc->tcg_ops.cpu_exec_interrupt = rx_cpu_exec_interrupt;
260
.initialize = rx_translate_init,
428
cc->dump_state = rx_cpu_dump_state;
261
.synchronize_from_tb = rx_cpu_synchronize_from_tb,
429
cc->set_pc = rx_cpu_set_pc;
262
.cpu_exec_interrupt = rx_cpu_exec_interrupt,
430
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
263
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
431
index XXXXXXX..XXXXXXX 100644
264
index XXXXXXX..XXXXXXX 100644
432
--- a/target/s390x/cpu.c
265
--- a/target/s390x/cpu.c
433
+++ b/target/s390x/cpu.c
266
+++ b/target/s390x/cpu.c
434
@@ -XXX,XX +XXX,XX @@ static void s390_cpu_class_init(ObjectClass *oc, void *data)
267
@@ -XXX,XX +XXX,XX @@ static const struct SysemuCPUOps s390_sysemu_ops = {
435
cc->class_by_name = s390_cpu_class_by_name,
268
#ifdef CONFIG_TCG
436
cc->has_work = s390_cpu_has_work;
269
#include "hw/core/tcg-cpu-ops.h"
437
#ifdef CONFIG_TCG
270
438
- cc->do_interrupt = s390_cpu_do_interrupt;
271
-static struct TCGCPUOps s390_tcg_ops = {
439
+ cc->tcg_ops.do_interrupt = s390_cpu_do_interrupt;
272
+static const struct TCGCPUOps s390_tcg_ops = {
440
#endif
273
.initialize = s390x_translate_init,
441
cc->dump_state = s390_cpu_dump_state;
274
.tlb_fill = s390_cpu_tlb_fill,
442
cc->set_pc = s390_cpu_set_pc;
275
443
diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c
276
diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c
444
index XXXXXXX..XXXXXXX 100644
277
index XXXXXXX..XXXXXXX 100644
445
--- a/target/sh4/cpu.c
278
--- a/target/sh4/cpu.c
446
+++ b/target/sh4/cpu.c
279
+++ b/target/sh4/cpu.c
447
@@ -XXX,XX +XXX,XX @@ static void superh_cpu_class_init(ObjectClass *oc, void *data)
280
@@ -XXX,XX +XXX,XX @@ static const struct SysemuCPUOps sh4_sysemu_ops = {
448
281
449
cc->class_by_name = superh_cpu_class_by_name;
282
#include "hw/core/tcg-cpu-ops.h"
450
cc->has_work = superh_cpu_has_work;
283
451
- cc->do_interrupt = superh_cpu_do_interrupt;
284
-static struct TCGCPUOps superh_tcg_ops = {
452
+ cc->tcg_ops.do_interrupt = superh_cpu_do_interrupt;
285
+static const struct TCGCPUOps superh_tcg_ops = {
453
cc->tcg_ops.cpu_exec_interrupt = superh_cpu_exec_interrupt;
286
.initialize = sh4_translate_init,
454
cc->dump_state = superh_cpu_dump_state;
287
.synchronize_from_tb = superh_cpu_synchronize_from_tb,
455
cc->set_pc = superh_cpu_set_pc;
288
.cpu_exec_interrupt = superh_cpu_exec_interrupt,
456
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
289
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
457
index XXXXXXX..XXXXXXX 100644
290
index XXXXXXX..XXXXXXX 100644
458
--- a/target/sparc/cpu.c
291
--- a/target/sparc/cpu.c
459
+++ b/target/sparc/cpu.c
292
+++ b/target/sparc/cpu.c
460
@@ -XXX,XX +XXX,XX @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data)
293
@@ -XXX,XX +XXX,XX @@ static const struct SysemuCPUOps sparc_sysemu_ops = {
461
cc->class_by_name = sparc_cpu_class_by_name;
294
#ifdef CONFIG_TCG
462
cc->parse_features = sparc_cpu_parse_features;
295
#include "hw/core/tcg-cpu-ops.h"
463
cc->has_work = sparc_cpu_has_work;
296
464
- cc->do_interrupt = sparc_cpu_do_interrupt;
297
-static struct TCGCPUOps sparc_tcg_ops = {
465
+ cc->tcg_ops.do_interrupt = sparc_cpu_do_interrupt;
298
+static const struct TCGCPUOps sparc_tcg_ops = {
466
cc->tcg_ops.cpu_exec_interrupt = sparc_cpu_exec_interrupt;
299
.initialize = sparc_tcg_init,
467
cc->dump_state = sparc_cpu_dump_state;
300
.synchronize_from_tb = sparc_cpu_synchronize_from_tb,
468
#if !defined(TARGET_SPARC64) && !defined(CONFIG_USER_ONLY)
301
.cpu_exec_interrupt = sparc_cpu_exec_interrupt,
469
diff --git a/target/tilegx/cpu.c b/target/tilegx/cpu.c
302
diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c
470
index XXXXXXX..XXXXXXX 100644
303
index XXXXXXX..XXXXXXX 100644
471
--- a/target/tilegx/cpu.c
304
--- a/target/tricore/cpu.c
472
+++ b/target/tilegx/cpu.c
305
+++ b/target/tricore/cpu.c
473
@@ -XXX,XX +XXX,XX @@ static void tilegx_cpu_class_init(ObjectClass *oc, void *data)
306
@@ -XXX,XX +XXX,XX @@ static const struct SysemuCPUOps tricore_sysemu_ops = {
474
307
475
cc->class_by_name = tilegx_cpu_class_by_name;
308
#include "hw/core/tcg-cpu-ops.h"
476
cc->has_work = tilegx_cpu_has_work;
309
477
- cc->do_interrupt = tilegx_cpu_do_interrupt;
310
-static struct TCGCPUOps tricore_tcg_ops = {
478
+ cc->tcg_ops.do_interrupt = tilegx_cpu_do_interrupt;
311
+static const struct TCGCPUOps tricore_tcg_ops = {
479
cc->tcg_ops.cpu_exec_interrupt = tilegx_cpu_exec_interrupt;
312
.initialize = tricore_tcg_init,
480
cc->dump_state = tilegx_cpu_dump_state;
313
.synchronize_from_tb = tricore_cpu_synchronize_from_tb,
481
cc->set_pc = tilegx_cpu_set_pc;
314
.tlb_fill = tricore_cpu_tlb_fill,
482
diff --git a/target/unicore32/cpu.c b/target/unicore32/cpu.c
483
index XXXXXXX..XXXXXXX 100644
484
--- a/target/unicore32/cpu.c
485
+++ b/target/unicore32/cpu.c
486
@@ -XXX,XX +XXX,XX @@ static void uc32_cpu_class_init(ObjectClass *oc, void *data)
487
488
cc->class_by_name = uc32_cpu_class_by_name;
489
cc->has_work = uc32_cpu_has_work;
490
- cc->do_interrupt = uc32_cpu_do_interrupt;
491
+ cc->tcg_ops.do_interrupt = uc32_cpu_do_interrupt;
492
cc->tcg_ops.cpu_exec_interrupt = uc32_cpu_exec_interrupt;
493
cc->dump_state = uc32_cpu_dump_state;
494
cc->set_pc = uc32_cpu_set_pc;
495
diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c
315
diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c
496
index XXXXXXX..XXXXXXX 100644
316
index XXXXXXX..XXXXXXX 100644
497
--- a/target/xtensa/cpu.c
317
--- a/target/xtensa/cpu.c
498
+++ b/target/xtensa/cpu.c
318
+++ b/target/xtensa/cpu.c
499
@@ -XXX,XX +XXX,XX @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data)
319
@@ -XXX,XX +XXX,XX @@ static const struct SysemuCPUOps xtensa_sysemu_ops = {
500
320
501
cc->class_by_name = xtensa_cpu_class_by_name;
321
#include "hw/core/tcg-cpu-ops.h"
502
cc->has_work = xtensa_cpu_has_work;
322
503
- cc->do_interrupt = xtensa_cpu_do_interrupt;
323
-static struct TCGCPUOps xtensa_tcg_ops = {
504
+ cc->tcg_ops.do_interrupt = xtensa_cpu_do_interrupt;
324
+static const struct TCGCPUOps xtensa_tcg_ops = {
505
cc->tcg_ops.cpu_exec_interrupt = xtensa_cpu_exec_interrupt;
325
.initialize = xtensa_translate_init,
506
cc->dump_state = xtensa_cpu_dump_state;
326
.cpu_exec_interrupt = xtensa_cpu_exec_interrupt,
507
cc->set_pc = xtensa_cpu_set_pc;
327
.tlb_fill = xtensa_cpu_tlb_fill,
508
diff --git a/target/ppc/translate_init.c.inc b/target/ppc/translate_init.c.inc
509
index XXXXXXX..XXXXXXX 100644
510
--- a/target/ppc/translate_init.c.inc
511
+++ b/target/ppc/translate_init.c.inc
512
@@ -XXX,XX +XXX,XX @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
513
514
cc->class_by_name = ppc_cpu_class_by_name;
515
cc->has_work = ppc_cpu_has_work;
516
- cc->do_interrupt = ppc_cpu_do_interrupt;
517
cc->dump_state = ppc_cpu_dump_state;
518
cc->dump_statistics = ppc_cpu_dump_statistics;
519
cc->set_pc = ppc_cpu_set_pc;
520
@@ -XXX,XX +XXX,XX @@ static void ppc_cpu_class_init(ObjectClass *oc, void *data)
521
#ifdef CONFIG_TCG
522
cc->tcg_ops.initialize = ppc_translate_init;
523
cc->tcg_ops.cpu_exec_interrupt = ppc_cpu_exec_interrupt;
524
+ cc->tcg_ops.do_interrupt = ppc_cpu_do_interrupt;
525
cc->tcg_ops.tlb_fill = ppc_cpu_tlb_fill;
526
#ifndef CONFIG_USER_ONLY
527
cc->tcg_ops.cpu_exec_enter = ppc_cpu_exec_enter;
528
--
328
--
529
2.25.1
329
2.25.1
530
330
531
331
diff view generated by jsdifflib