1 | The following changes since commit d0dddab40e472ba62b5f43f11cc7dba085dabe71: | 1 | The following changes since commit 60ab36907ded2918d33683f2b66f603b7400d8f3: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (2021-02-05 15:27:02 +0000) | 3 | Update VERSION for v7.2.0-rc0 (2022-11-08 15:53:41 -0500) |
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-20221109 |
8 | 8 | ||
9 | for you to fetch changes up to fb6916dd6ca8bb4b42d44baba9c67ecaf2279577: | 9 | for you to fetch changes up to 344b63b380541a63c02ef7a8a6ae66cb0b6f0273: |
10 | 10 | ||
11 | accel: introduce AccelCPUClass extending CPUClass (2021-02-05 10:24:15 -1000) | 11 | accel/tcg: Split out setjmp_gen_code (2022-11-09 12:29:03 +1100) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | TCGCPUOps cleanups (claudio) | 14 | Fix -Werror=clobbered issue with tb_gen_code |
15 | tcg/s390 compare fix (phil) | ||
16 | tcg/aarch64 rotli_vec fix | ||
17 | tcg/tci cleanups and fixes | ||
18 | 15 | ||
19 | ---------------------------------------------------------------- | 16 | ---------------------------------------------------------------- |
20 | Claudio Fontana (13): | 17 | Richard Henderson (2): |
21 | target/riscv: remove CONFIG_TCG, as it is always TCG | 18 | tcg: Move TCG_TARGET_HAS_direct_jump init to tb_gen_code |
22 | accel/tcg: split TCG-only code from cpu_exec_realizefn | 19 | accel/tcg: Split out setjmp_gen_code |
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 | 20 | ||
35 | Eduardo Habkost (5): | 21 | accel/tcg/translate-all.c | 68 +++++++++++++++++++++++------------------------ |
36 | cpu: Introduce TCGCpuOperations struct | 22 | tcg/tcg.c | 12 +++++++++ |
37 | cpu: Move synchronize_from_tb() to tcg_ops | 23 | 2 files changed, 45 insertions(+), 35 deletions(-) |
38 | cpu: Move cpu_exec_* to tcg_ops | ||
39 | cpu: Move tlb_fill to tcg_ops | ||
40 | cpu: Move debug_excp_handler to tcg_ops | ||
41 | |||
42 | Philippe Mathieu-Daudé (2): | ||
43 | tcg/s390: Fix compare instruction from extended-immediate facility | ||
44 | exec/cpu-defs: Remove TCG backends dependency | ||
45 | |||
46 | Richard Henderson (24): | ||
47 | tcg/aarch64: Do not convert TCGArg to temps that are not temps | ||
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 | |||
72 | Stefan Weil (2): | ||
73 | tcg/tci: Implement INDEX_op_ld16s_i32 | ||
74 | tcg/tci: Implement INDEX_op_ld8s_i64 | ||
75 | |||
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 |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
2 | 1 | ||
3 | The code is currently comparing c2 to the type promotion of | ||
4 | uint32_t and int32_t. That is, the conversion rules are as: | ||
5 | |||
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> | ||
26 | Message-Id: <20210204182902.1742826-1-f4bug@amsat.org> | ||
27 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
28 | --- | ||
29 | tcg/s390/tcg-target.c.inc | 2 +- | ||
30 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
31 | |||
32 | diff --git a/tcg/s390/tcg-target.c.inc b/tcg/s390/tcg-target.c.inc | ||
33 | index XXXXXXX..XXXXXXX 100644 | ||
34 | --- a/tcg/s390/tcg-target.c.inc | ||
35 | +++ b/tcg/s390/tcg-target.c.inc | ||
36 | @@ -XXX,XX +XXX,XX @@ static int tgen_cmp(TCGContext *s, TCGType type, TCGCond c, TCGReg r1, | ||
37 | op = (is_unsigned ? RIL_CLFI : RIL_CFI); | ||
38 | tcg_out_insn_RIL(s, op, r1, c2); | ||
39 | goto exit; | ||
40 | - } else if (c2 == (is_unsigned ? (uint32_t)c2 : (int32_t)c2)) { | ||
41 | + } else if (c2 == (is_unsigned ? (TCGArg)(uint32_t)c2 : (TCGArg)(int32_t)c2)) { | ||
42 | op = (is_unsigned ? RIL_CLGFI : RIL_CGFI); | ||
43 | tcg_out_insn_RIL(s, op, r1, c2); | ||
44 | goto exit; | ||
45 | -- | ||
46 | 2.25.1 | ||
47 | |||
48 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
2 | 1 | ||
3 | "exec/cpu-defs.h" contains generic CPU definitions for the | ||
4 | TCG frontends (mostly related to TLB). TCG backends definitions | ||
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 | |||
20 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
21 | Message-Id: <20210204191423.1754158-1-f4bug@amsat.org> | ||
22 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
23 | --- | ||
24 | include/exec/cpu-defs.h | 3 --- | ||
25 | 1 file changed, 3 deletions(-) | ||
26 | |||
27 | diff --git a/include/exec/cpu-defs.h b/include/exec/cpu-defs.h | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/include/exec/cpu-defs.h | ||
30 | +++ b/include/exec/cpu-defs.h | ||
31 | @@ -XXX,XX +XXX,XX @@ | ||
32 | |||
33 | #include "qemu/host-utils.h" | ||
34 | #include "qemu/thread.h" | ||
35 | -#ifdef CONFIG_TCG | ||
36 | -#include "tcg-target.h" | ||
37 | -#endif | ||
38 | #ifndef CONFIG_USER_ONLY | ||
39 | #include "exec/hwaddr.h" | ||
40 | #endif | ||
41 | -- | ||
42 | 2.25.1 | ||
43 | |||
44 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Fixes INDEX_op_rotli_vec for aarch64 host, where the 3rd | ||
2 | argument is an integer, not a temporary, which now tickles | ||
3 | an assert added in e89b28a6350. | ||
4 | 1 | ||
5 | Previously, the value computed into v2 would be garbage for | ||
6 | rotli_vec, but as the value was unused it caused no harm. | ||
7 | |||
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | --- | ||
10 | tcg/aarch64/tcg-target.c.inc | 7 ++++--- | ||
11 | 1 file changed, 4 insertions(+), 3 deletions(-) | ||
12 | |||
13 | diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/tcg/aarch64/tcg-target.c.inc | ||
16 | +++ b/tcg/aarch64/tcg-target.c.inc | ||
17 | @@ -XXX,XX +XXX,XX @@ void tcg_expand_vec_op(TCGOpcode opc, TCGType type, unsigned vece, | ||
18 | v0 = temp_tcgv_vec(arg_temp(a0)); | ||
19 | v1 = temp_tcgv_vec(arg_temp(va_arg(va, TCGArg))); | ||
20 | a2 = va_arg(va, TCGArg); | ||
21 | - v2 = temp_tcgv_vec(arg_temp(a2)); | ||
22 | + va_end(va); | ||
23 | |||
24 | switch (opc) { | ||
25 | case INDEX_op_rotli_vec: | ||
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 | } | ||
57 | |||
58 | static TCGConstraintSetIndex tcg_target_op_def(TCGOpcode op) | ||
59 | -- | ||
60 | 2.25.1 | ||
61 | |||
62 | 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 | Each thread must have its own pc, even under TCI. | ||
2 | 1 | ||
3 | Remove the GETPC ifdef, because GETPC is always available for | ||
4 | helpers, and thus is always required. Move the assignment | ||
5 | under INDEX_op_call, because the value is only visible when | ||
6 | we make a call to a helper function. | ||
7 | |||
8 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Message-Id: <20210204014509.882821-6-richard.henderson@linaro.org> | ||
11 | --- | ||
12 | include/exec/exec-all.h | 2 +- | ||
13 | tcg/tcg-common.c | 4 ---- | ||
14 | tcg/tci.c | 7 +++---- | ||
15 | 3 files changed, 4 insertions(+), 9 deletions(-) | ||
16 | |||
17 | diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h | ||
18 | index XXXXXXX..XXXXXXX 100644 | ||
19 | --- a/include/exec/exec-all.h | ||
20 | +++ b/include/exec/exec-all.h | ||
21 | @@ -XXX,XX +XXX,XX @@ void tb_set_jmp_target(TranslationBlock *tb, int n, uintptr_t addr); | ||
22 | |||
23 | /* GETPC is the true target of the return instruction that we'll execute. */ | ||
24 | #if defined(CONFIG_TCG_INTERPRETER) | ||
25 | -extern uintptr_t tci_tb_ptr; | ||
26 | +extern __thread uintptr_t tci_tb_ptr; | ||
27 | # define GETPC() tci_tb_ptr | ||
28 | #else | ||
29 | # define GETPC() \ | ||
30 | diff --git a/tcg/tcg-common.c b/tcg/tcg-common.c | ||
31 | index XXXXXXX..XXXXXXX 100644 | ||
32 | --- a/tcg/tcg-common.c | ||
33 | +++ b/tcg/tcg-common.c | ||
34 | @@ -XXX,XX +XXX,XX @@ | ||
35 | #include "qemu/osdep.h" | ||
36 | #include "tcg/tcg.h" | ||
37 | |||
38 | -#if defined(CONFIG_TCG_INTERPRETER) | ||
39 | -uintptr_t tci_tb_ptr; | ||
40 | -#endif | ||
41 | - | ||
42 | TCGOpDef tcg_op_defs[] = { | ||
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 | ||
47 | --- a/tcg/tci.c | ||
48 | +++ b/tcg/tci.c | ||
49 | @@ -XXX,XX +XXX,XX @@ typedef uint64_t (*helper_function)(tcg_target_ulong, tcg_target_ulong, | ||
50 | tcg_target_ulong, tcg_target_ulong); | ||
51 | #endif | ||
52 | |||
53 | +__thread uintptr_t tci_tb_ptr; | ||
54 | + | ||
55 | static tcg_target_ulong tci_read_reg(const tcg_target_ulong *regs, TCGReg index) | ||
56 | { | ||
57 | tci_assert(index < TCG_TARGET_NB_REGS); | ||
58 | @@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, | ||
59 | #endif | ||
60 | TCGMemOpIdx oi; | ||
61 | |||
62 | -#if defined(GETPC) | ||
63 | - tci_tb_ptr = (uintptr_t)tb_ptr; | ||
64 | -#endif | ||
65 | - | ||
66 | /* Skip opcode and size entry. */ | ||
67 | tb_ptr += 2; | ||
68 | |||
69 | switch (opc) { | ||
70 | case INDEX_op_call: | ||
71 | t0 = tci_read_ri(regs, &tb_ptr); | ||
72 | + tci_tb_ptr = (uintptr_t)tb_ptr; | ||
73 | #if TCG_TARGET_REG_BITS == 32 | ||
74 | tmp64 = ((helper_function)t0)(tci_read_reg(regs, TCG_REG_R0), | ||
75 | tci_read_reg(regs, TCG_REG_R1), | ||
76 | -- | ||
77 | 2.25.1 | ||
78 | |||
79 | 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 |
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 | 10 +--------- | ||
6 | 1 file changed, 1 insertion(+), 9 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 @@ tci_write_reg(tcg_target_ulong *regs, TCGReg index, tcg_target_ulong value) | ||
13 | regs[index] = value; | ||
14 | } | ||
15 | |||
16 | -#if TCG_TARGET_REG_BITS == 64 | ||
17 | -static void | ||
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 | { | ||
26 | tci_write_reg(regs, index, value); | ||
27 | @@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, | ||
28 | t0 = *tb_ptr++; | ||
29 | t1 = tci_read_r(regs, &tb_ptr); | ||
30 | t2 = tci_read_s32(&tb_ptr); | ||
31 | - tci_write_reg32s(regs, t0, *(int32_t *)(t1 + t2)); | ||
32 | + tci_write_reg(regs, t0, *(int32_t *)(t1 + t2)); | ||
33 | break; | ||
34 | case INDEX_op_ld_i64: | ||
35 | t0 = *tb_ptr++; | ||
36 | -- | ||
37 | 2.25.1 | ||
38 | |||
39 | 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 | 9 ++------- | ||
6 | 1 file changed, 2 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 @@ tci_write_reg(tcg_target_ulong *regs, TCGReg index, tcg_target_ulong value) | ||
13 | regs[index] = value; | ||
14 | } | ||
15 | |||
16 | -static void tci_write_reg8(tcg_target_ulong *regs, TCGReg index, uint8_t value) | ||
17 | -{ | ||
18 | - tci_write_reg(regs, index, value); | ||
19 | -} | ||
20 | - | ||
21 | #if TCG_TARGET_REG_BITS == 64 | ||
22 | static void | ||
23 | tci_write_reg16(tcg_target_ulong *regs, TCGReg index, uint16_t value) | ||
24 | @@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, | ||
25 | t0 = *tb_ptr++; | ||
26 | t1 = tci_read_r(regs, &tb_ptr); | ||
27 | t2 = tci_read_s32(&tb_ptr); | ||
28 | - tci_write_reg8(regs, t0, *(uint8_t *)(t1 + t2)); | ||
29 | + tci_write_reg(regs, t0, *(uint8_t *)(t1 + t2)); | ||
30 | break; | ||
31 | case INDEX_op_ld8s_i32: | ||
32 | TODO(); | ||
33 | @@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, | ||
34 | t0 = *tb_ptr++; | ||
35 | t1 = tci_read_r(regs, &tb_ptr); | ||
36 | t2 = tci_read_s32(&tb_ptr); | ||
37 | - tci_write_reg8(regs, t0, *(uint8_t *)(t1 + t2)); | ||
38 | + tci_write_reg(regs, t0, *(uint8_t *)(t1 + t2)); | ||
39 | break; | ||
40 | case INDEX_op_ld8s_i64: | ||
41 | t0 = *tb_ptr++; | ||
42 | -- | ||
43 | 2.25.1 | ||
44 | |||
45 | 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 | 10 +--------- | ||
6 | 1 file changed, 1 insertion(+), 9 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 @@ tci_write_reg(tcg_target_ulong *regs, TCGReg index, tcg_target_ulong value) | ||
13 | regs[index] = value; | ||
14 | } | ||
15 | |||
16 | -#if TCG_TARGET_REG_BITS == 64 | ||
17 | -static void | ||
18 | -tci_write_reg16(tcg_target_ulong *regs, TCGReg index, uint16_t value) | ||
19 | -{ | ||
20 | - tci_write_reg(regs, index, value); | ||
21 | -} | ||
22 | -#endif | ||
23 | - | ||
24 | static void | ||
25 | tci_write_reg32(tcg_target_ulong *regs, TCGReg index, uint32_t value) | ||
26 | { | ||
27 | @@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, | ||
28 | t0 = *tb_ptr++; | ||
29 | t1 = tci_read_r(regs, &tb_ptr); | ||
30 | t2 = tci_read_s32(&tb_ptr); | ||
31 | - tci_write_reg16(regs, t0, *(uint16_t *)(t1 + t2)); | ||
32 | + tci_write_reg(regs, t0, *(uint16_t *)(t1 + t2)); | ||
33 | break; | ||
34 | case INDEX_op_ld16s_i64: | ||
35 | TODO(); | ||
36 | -- | ||
37 | 2.25.1 | ||
38 | |||
39 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | For a 64-bit TCI, the upper bits of a 32-bit operation are | ||
2 | undefined (much like a native ppc64 32-bit operation). It | ||
3 | simplifies everything if we don't force-extend the result. | ||
4 | 1 | ||
5 | Tested-by: Alex Bennée <alex.bennee@linaro.org> | ||
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 | 66 +++++++++++++++++++++++++------------------------------ | ||
10 | 1 file changed, 30 insertions(+), 36 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 @@ tci_write_reg(tcg_target_ulong *regs, TCGReg index, tcg_target_ulong value) | ||
17 | regs[index] = value; | ||
18 | } | ||
19 | |||
20 | -static void | ||
21 | -tci_write_reg32(tcg_target_ulong *regs, TCGReg index, uint32_t value) | ||
22 | -{ | ||
23 | - tci_write_reg(regs, index, value); | ||
24 | -} | ||
25 | - | ||
26 | #if TCG_TARGET_REG_BITS == 32 | ||
27 | static void tci_write_reg64(tcg_target_ulong *regs, uint32_t high_index, | ||
28 | uint32_t low_index, uint64_t value) | ||
29 | @@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, | ||
30 | t1 = tci_read_r32(regs, &tb_ptr); | ||
31 | t2 = tci_read_ri32(regs, &tb_ptr); | ||
32 | condition = *tb_ptr++; | ||
33 | - tci_write_reg32(regs, t0, tci_compare32(t1, t2, condition)); | ||
34 | + tci_write_reg(regs, t0, tci_compare32(t1, t2, condition)); | ||
35 | break; | ||
36 | #if TCG_TARGET_REG_BITS == 32 | ||
37 | case INDEX_op_setcond2_i32: | ||
38 | @@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, | ||
39 | tmp64 = tci_read_r64(regs, &tb_ptr); | ||
40 | v64 = tci_read_ri64(regs, &tb_ptr); | ||
41 | condition = *tb_ptr++; | ||
42 | - tci_write_reg32(regs, t0, tci_compare64(tmp64, v64, condition)); | ||
43 | + tci_write_reg(regs, t0, tci_compare64(tmp64, v64, condition)); | ||
44 | break; | ||
45 | #elif TCG_TARGET_REG_BITS == 64 | ||
46 | case INDEX_op_setcond_i64: | ||
47 | @@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, | ||
48 | case INDEX_op_mov_i32: | ||
49 | t0 = *tb_ptr++; | ||
50 | t1 = tci_read_r32(regs, &tb_ptr); | ||
51 | - tci_write_reg32(regs, t0, t1); | ||
52 | + tci_write_reg(regs, t0, t1); | ||
53 | break; | ||
54 | case INDEX_op_tci_movi_i32: | ||
55 | t0 = *tb_ptr++; | ||
56 | t1 = tci_read_i32(&tb_ptr); | ||
57 | - tci_write_reg32(regs, t0, t1); | ||
58 | + tci_write_reg(regs, t0, t1); | ||
59 | break; | ||
60 | |||
61 | /* Load/store operations (32 bit). */ | ||
62 | @@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, | ||
63 | t0 = *tb_ptr++; | ||
64 | t1 = tci_read_r(regs, &tb_ptr); | ||
65 | t2 = tci_read_s32(&tb_ptr); | ||
66 | - tci_write_reg32(regs, t0, *(uint32_t *)(t1 + t2)); | ||
67 | + tci_write_reg(regs, t0, *(uint32_t *)(t1 + t2)); | ||
68 | break; | ||
69 | case INDEX_op_st8_i32: | ||
70 | t0 = tci_read_r8(regs, &tb_ptr); | ||
71 | @@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, | ||
72 | t0 = *tb_ptr++; | ||
73 | t1 = tci_read_ri32(regs, &tb_ptr); | ||
74 | t2 = tci_read_ri32(regs, &tb_ptr); | ||
75 | - tci_write_reg32(regs, t0, t1 + t2); | ||
76 | + tci_write_reg(regs, t0, t1 + t2); | ||
77 | break; | ||
78 | case INDEX_op_sub_i32: | ||
79 | t0 = *tb_ptr++; | ||
80 | t1 = tci_read_ri32(regs, &tb_ptr); | ||
81 | t2 = tci_read_ri32(regs, &tb_ptr); | ||
82 | - tci_write_reg32(regs, t0, t1 - t2); | ||
83 | + tci_write_reg(regs, t0, t1 - t2); | ||
84 | break; | ||
85 | case INDEX_op_mul_i32: | ||
86 | t0 = *tb_ptr++; | ||
87 | t1 = tci_read_ri32(regs, &tb_ptr); | ||
88 | t2 = tci_read_ri32(regs, &tb_ptr); | ||
89 | - tci_write_reg32(regs, t0, t1 * t2); | ||
90 | + tci_write_reg(regs, t0, t1 * t2); | ||
91 | break; | ||
92 | #if TCG_TARGET_HAS_div_i32 | ||
93 | case INDEX_op_div_i32: | ||
94 | t0 = *tb_ptr++; | ||
95 | t1 = tci_read_ri32(regs, &tb_ptr); | ||
96 | t2 = tci_read_ri32(regs, &tb_ptr); | ||
97 | - tci_write_reg32(regs, t0, (int32_t)t1 / (int32_t)t2); | ||
98 | + tci_write_reg(regs, t0, (int32_t)t1 / (int32_t)t2); | ||
99 | break; | ||
100 | case INDEX_op_divu_i32: | ||
101 | t0 = *tb_ptr++; | ||
102 | t1 = tci_read_ri32(regs, &tb_ptr); | ||
103 | t2 = tci_read_ri32(regs, &tb_ptr); | ||
104 | - tci_write_reg32(regs, t0, t1 / t2); | ||
105 | + tci_write_reg(regs, t0, t1 / t2); | ||
106 | break; | ||
107 | case INDEX_op_rem_i32: | ||
108 | t0 = *tb_ptr++; | ||
109 | t1 = tci_read_ri32(regs, &tb_ptr); | ||
110 | t2 = tci_read_ri32(regs, &tb_ptr); | ||
111 | - tci_write_reg32(regs, t0, (int32_t)t1 % (int32_t)t2); | ||
112 | + tci_write_reg(regs, t0, (int32_t)t1 % (int32_t)t2); | ||
113 | break; | ||
114 | case INDEX_op_remu_i32: | ||
115 | t0 = *tb_ptr++; | ||
116 | t1 = tci_read_ri32(regs, &tb_ptr); | ||
117 | t2 = tci_read_ri32(regs, &tb_ptr); | ||
118 | - tci_write_reg32(regs, t0, t1 % t2); | ||
119 | + tci_write_reg(regs, t0, t1 % t2); | ||
120 | break; | ||
121 | #elif TCG_TARGET_HAS_div2_i32 | ||
122 | case INDEX_op_div2_i32: | ||
123 | @@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, | ||
124 | t0 = *tb_ptr++; | ||
125 | t1 = tci_read_ri32(regs, &tb_ptr); | ||
126 | t2 = tci_read_ri32(regs, &tb_ptr); | ||
127 | - tci_write_reg32(regs, t0, t1 & t2); | ||
128 | + tci_write_reg(regs, t0, t1 & t2); | ||
129 | break; | ||
130 | case INDEX_op_or_i32: | ||
131 | t0 = *tb_ptr++; | ||
132 | t1 = tci_read_ri32(regs, &tb_ptr); | ||
133 | t2 = tci_read_ri32(regs, &tb_ptr); | ||
134 | - tci_write_reg32(regs, t0, t1 | t2); | ||
135 | + tci_write_reg(regs, t0, t1 | t2); | ||
136 | break; | ||
137 | case INDEX_op_xor_i32: | ||
138 | t0 = *tb_ptr++; | ||
139 | t1 = tci_read_ri32(regs, &tb_ptr); | ||
140 | t2 = tci_read_ri32(regs, &tb_ptr); | ||
141 | - tci_write_reg32(regs, t0, t1 ^ t2); | ||
142 | + tci_write_reg(regs, t0, t1 ^ t2); | ||
143 | break; | ||
144 | |||
145 | /* Shift/rotate operations (32 bit). */ | ||
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 | -- | ||
268 | 2.25.1 | ||
269 | |||
270 | diff view generated by jsdifflib |
1 | Note that we had two functions of the same name: a 32-bit version | 1 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
---|---|---|---|
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 | |||
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> | 2 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
9 | --- | 3 | --- |
10 | tcg/tci.c | 60 +++++++++++++++++++++++++------------------------------ | 4 | accel/tcg/translate-all.c | 10 ---------- |
11 | 1 file changed, 27 insertions(+), 33 deletions(-) | 5 | tcg/tcg.c | 12 ++++++++++++ |
6 | 2 files changed, 12 insertions(+), 10 deletions(-) | ||
12 | 7 | ||
13 | diff --git a/tcg/tci.c b/tcg/tci.c | 8 | diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c |
14 | index XXXXXXX..XXXXXXX 100644 | 9 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/tcg/tci.c | 10 | --- a/accel/tcg/translate-all.c |
16 | +++ b/tcg/tci.c | 11 | +++ b/accel/tcg/translate-all.c |
17 | @@ -XXX,XX +XXX,XX @@ static void tci_write_reg64(tcg_target_ulong *regs, uint32_t high_index, | 12 | @@ -XXX,XX +XXX,XX @@ TranslationBlock *tb_gen_code(CPUState *cpu, |
18 | tci_write_reg(regs, low_index, value); | 13 | trace_translate_block(tb, pc, tb->tc.ptr); |
19 | tci_write_reg(regs, high_index, value >> 32); | 14 | |
20 | } | 15 | /* generate machine code */ |
21 | -#elif TCG_TARGET_REG_BITS == 64 | 16 | - tb->jmp_reset_offset[0] = TB_JMP_RESET_OFFSET_INVALID; |
22 | -static void | 17 | - tb->jmp_reset_offset[1] = TB_JMP_RESET_OFFSET_INVALID; |
23 | -tci_write_reg64(tcg_target_ulong *regs, TCGReg index, uint64_t value) | 18 | - tcg_ctx->tb_jmp_reset_offset = tb->jmp_reset_offset; |
24 | -{ | 19 | - if (TCG_TARGET_HAS_direct_jump) { |
25 | - tci_write_reg(regs, index, value); | 20 | - tcg_ctx->tb_jmp_insn_offset = tb->jmp_target_arg; |
26 | -} | 21 | - tcg_ctx->tb_jmp_target_addr = NULL; |
22 | - } else { | ||
23 | - tcg_ctx->tb_jmp_insn_offset = NULL; | ||
24 | - tcg_ctx->tb_jmp_target_addr = tb->jmp_target_arg; | ||
25 | - } | ||
26 | |||
27 | #ifdef CONFIG_PROFILER | ||
28 | qatomic_set(&prof->tb_count, prof->tb_count + 1); | ||
29 | diff --git a/tcg/tcg.c b/tcg/tcg.c | ||
30 | index XXXXXXX..XXXXXXX 100644 | ||
31 | --- a/tcg/tcg.c | ||
32 | +++ b/tcg/tcg.c | ||
33 | @@ -XXX,XX +XXX,XX @@ int tcg_gen_code(TCGContext *s, TranslationBlock *tb, target_ulong pc_start) | ||
34 | } | ||
27 | #endif | 35 | #endif |
28 | 36 | ||
29 | #if TCG_TARGET_REG_BITS == 32 | 37 | + /* Initialize goto_tb jump offsets. */ |
30 | @@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, | 38 | + tb->jmp_reset_offset[0] = TB_JMP_RESET_OFFSET_INVALID; |
31 | t1 = tci_read_r64(regs, &tb_ptr); | 39 | + tb->jmp_reset_offset[1] = TB_JMP_RESET_OFFSET_INVALID; |
32 | t2 = tci_read_ri64(regs, &tb_ptr); | 40 | + tcg_ctx->tb_jmp_reset_offset = tb->jmp_reset_offset; |
33 | condition = *tb_ptr++; | 41 | + if (TCG_TARGET_HAS_direct_jump) { |
34 | - tci_write_reg64(regs, t0, tci_compare64(t1, t2, condition)); | 42 | + tcg_ctx->tb_jmp_insn_offset = tb->jmp_target_arg; |
35 | + tci_write_reg(regs, t0, tci_compare64(t1, t2, condition)); | 43 | + tcg_ctx->tb_jmp_target_addr = NULL; |
36 | break; | 44 | + } else { |
37 | #endif | 45 | + tcg_ctx->tb_jmp_insn_offset = NULL; |
38 | case INDEX_op_mov_i32: | 46 | + tcg_ctx->tb_jmp_target_addr = tb->jmp_target_arg; |
39 | @@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, | 47 | + } |
40 | case INDEX_op_mov_i64: | 48 | + |
41 | t0 = *tb_ptr++; | 49 | tcg_reg_alloc_start(s); |
42 | t1 = tci_read_r64(regs, &tb_ptr); | 50 | |
43 | - tci_write_reg64(regs, t0, t1); | 51 | /* |
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 | -- | 52 | -- |
247 | 2.25.1 | 53 | 2.34.1 |
248 | 54 | ||
249 | 55 | 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 | The existing check was incomplete: | ||
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 | 1 | ||
5 | Doing this at compile time means that we don't need to do it | ||
6 | at runtime as well. | ||
7 | |||
8 | Tested-by: Alex Bennée <alex.bennee@linaro.org> | ||
9 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | --- | ||
12 | tcg/tci.c | 2 -- | ||
13 | tcg/tci/tcg-target.c.inc | 13 +++++++++++++ | ||
14 | 2 files changed, 13 insertions(+), 2 deletions(-) | ||
15 | |||
16 | diff --git a/tcg/tci.c b/tcg/tci.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/tcg/tci.c | ||
19 | +++ b/tcg/tci.c | ||
20 | @@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, | ||
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 | } | ||
43 | |||
44 | +static void stack_bounds_check(TCGReg base, target_long offset) | ||
45 | +{ | ||
46 | + if (base == TCG_REG_CALL_STACK) { | ||
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 | { | ||
55 | uint8_t *old_code_ptr = s->code_ptr; | ||
56 | + | ||
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 | -- | ||
79 | 2.25.1 | ||
80 | |||
81 | 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 |
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, 8 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 @@ | ||
13 | #include "tcg/tcg-op.h" | ||
14 | #include "qemu/compiler.h" | ||
15 | |||
16 | -/* Marker for missing code. */ | ||
17 | -#define TODO() \ | ||
18 | - do { \ | ||
19 | - fprintf(stderr, "TODO %s:%u: %s()\n", \ | ||
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 | -- | ||
28 | 2.25.1 | ||
29 | |||
30 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | As noted in several comments, 8 regs is not enough for 32-bit | ||
2 | to perform calls, as currently implemented. Shortly, we will | ||
3 | rearrange the encoding which will make 32 regs impossible. | ||
4 | 1 | ||
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 | 32 +++++--------------------------- | ||
9 | tcg/tci/tcg-target.c.inc | 26 -------------------------- | ||
10 | 2 files changed, 5 insertions(+), 53 deletions(-) | ||
11 | |||
12 | diff --git a/tcg/tci/tcg-target.h b/tcg/tci/tcg-target.h | ||
13 | index XXXXXXX..XXXXXXX 100644 | ||
14 | --- a/tcg/tci/tcg-target.h | ||
15 | +++ b/tcg/tci/tcg-target.h | ||
16 | @@ -XXX,XX +XXX,XX @@ | ||
17 | #define TCG_TARGET_HAS_mulu2_i32 1 | ||
18 | #endif /* TCG_TARGET_REG_BITS == 64 */ | ||
19 | |||
20 | -/* Number of registers available. | ||
21 | - For 32 bit hosts, we need more than 8 registers (call arguments). */ | ||
22 | -/* #define TCG_TARGET_NB_REGS 8 */ | ||
23 | +/* Number of registers available. */ | ||
24 | #define TCG_TARGET_NB_REGS 16 | ||
25 | -/* #define TCG_TARGET_NB_REGS 32 */ | ||
26 | |||
27 | /* List of registers which are used by TCG. */ | ||
28 | typedef enum { | ||
29 | @@ -XXX,XX +XXX,XX @@ typedef enum { | ||
30 | TCG_REG_R5, | ||
31 | TCG_REG_R6, | ||
32 | TCG_REG_R7, | ||
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 | -- | ||
146 | 2.25.1 | ||
147 | |||
148 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | This was removed from tcg_target_reg_alloc_order and | ||
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 | 1 | ||
6 | By adding R4 back to tcg_target_call_iarg_regs, adjust the other | ||
7 | entries so that 6 (or 12) entries are still present in the array, | ||
8 | and adjust the numbers in the interpreter. | ||
9 | |||
10 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
12 | --- | ||
13 | tcg/tci.c | 8 ++++---- | ||
14 | tcg/tci/tcg-target.c.inc | 7 +------ | ||
15 | 2 files changed, 5 insertions(+), 10 deletions(-) | ||
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_read_reg(regs, TCG_REG_R1), | ||
23 | tci_read_reg(regs, TCG_REG_R2), | ||
24 | tci_read_reg(regs, TCG_REG_R3), | ||
25 | + tci_read_reg(regs, TCG_REG_R4), | ||
26 | tci_read_reg(regs, TCG_REG_R5), | ||
27 | tci_read_reg(regs, TCG_REG_R6), | ||
28 | tci_read_reg(regs, TCG_REG_R7), | ||
29 | tci_read_reg(regs, TCG_REG_R8), | ||
30 | tci_read_reg(regs, TCG_REG_R9), | ||
31 | tci_read_reg(regs, TCG_REG_R10), | ||
32 | - tci_read_reg(regs, TCG_REG_R11), | ||
33 | - tci_read_reg(regs, TCG_REG_R12)); | ||
34 | + tci_read_reg(regs, TCG_REG_R11)); | ||
35 | tci_write_reg(regs, TCG_REG_R0, tmp64); | ||
36 | tci_write_reg(regs, TCG_REG_R1, tmp64 >> 32); | ||
37 | #else | ||
38 | @@ -XXX,XX +XXX,XX @@ uintptr_t QEMU_DISABLE_CFI tcg_qemu_tb_exec(CPUArchState *env, | ||
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 | -- | ||
85 | 2.25.1 | ||
86 | |||
87 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Restrict all operands to registers. All constants will be forced | ||
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 | 1 | ||
6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | --- | ||
9 | tcg/tci/tcg-target-con-set.h | 6 +- | ||
10 | tcg/tci/tcg-target.h | 3 - | ||
11 | tcg/tci.c | 189 +++++++++++++---------------------- | ||
12 | tcg/tci/tcg-target.c.inc | 85 ++++------------ | ||
13 | 4 files changed, 89 insertions(+), 194 deletions(-) | ||
14 | |||
15 | diff --git a/tcg/tci/tcg-target-con-set.h b/tcg/tci/tcg-target-con-set.h | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/tcg/tci/tcg-target-con-set.h | ||
18 | +++ b/tcg/tci/tcg-target-con-set.h | ||
19 | @@ -XXX,XX +XXX,XX @@ | ||
20 | * tcg-target-con-str.h; the constraint combination is inclusive or. | ||
21 | */ | ||
22 | C_O0_I2(r, r) | ||
23 | -C_O0_I2(r, ri) | ||
24 | C_O0_I3(r, r, r) | ||
25 | -C_O0_I4(r, r, ri, ri) | ||
26 | C_O0_I4(r, r, r, r) | ||
27 | C_O1_I1(r, r) | ||
28 | C_O1_I2(r, 0, r) | ||
29 | -C_O1_I2(r, ri, ri) | ||
30 | C_O1_I2(r, r, r) | ||
31 | -C_O1_I2(r, r, ri) | ||
32 | -C_O1_I4(r, r, r, ri, ri) | ||
33 | +C_O1_I4(r, r, r, r, r) | ||
34 | C_O2_I1(r, r, r) | ||
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 | } | ||
58 | |||
59 | -/* Read indexed register or constant (native size) from bytecode. */ | ||
60 | -static tcg_target_ulong | ||
61 | -tci_read_ri(const tcg_target_ulong *regs, const uint8_t **tb_ptr) | ||
62 | -{ | ||
63 | - tcg_target_ulong value; | ||
64 | - TCGReg r = **tb_ptr; | ||
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 | -} | ||
73 | - | ||
74 | -/* Read indexed register or constant (32 bit) from bytecode. */ | ||
75 | -static uint32_t tci_read_ri32(const tcg_target_ulong *regs, | ||
76 | - const uint8_t **tb_ptr) | ||
77 | -{ | ||
78 | - uint32_t value; | ||
79 | - TCGReg r = **tb_ptr; | ||
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 | -} | ||
88 | - | ||
89 | -#if TCG_TARGET_REG_BITS == 32 | ||
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 | -{ | ||
94 | - uint32_t low = tci_read_ri32(regs, tb_ptr); | ||
95 | - return tci_uint64(tci_read_ri32(regs, tb_ptr), low); | ||
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 | -} | ||
501 | - | ||
502 | -/* Write register or constant (32 bit). */ | ||
503 | -static void tcg_out_ri32(TCGContext *s, int const_arg, TCGArg arg) | ||
504 | -{ | ||
505 | - if (const_arg) { | ||
506 | - tcg_debug_assert(const_arg == 1); | ||
507 | - tcg_out8(s, TCG_CONST); | ||
508 | - tcg_out32(s, arg); | ||
509 | - } else { | ||
510 | - tcg_out_r(s, arg); | ||
511 | - } | ||
512 | -} | ||
513 | - | ||
514 | -#if TCG_TARGET_REG_BITS == 64 | ||
515 | -/* Write register or constant (64 bit). */ | ||
516 | -static void tcg_out_ri64(TCGContext *s, int const_arg, TCGArg arg) | ||
517 | -{ | ||
518 | - if (const_arg) { | ||
519 | - tcg_debug_assert(const_arg == 1); | ||
520 | - tcg_out8(s, TCG_CONST); | ||
521 | - tcg_out64(s, arg); | ||
522 | - } else { | ||
523 | - tcg_out_r(s, arg); | ||
524 | - } | ||
525 | -} | ||
526 | -#endif | ||
527 | - | ||
528 | /* Write label. */ | ||
529 | static void tci_out_label(TCGContext *s, TCGLabel *label) | ||
530 | { | ||
531 | @@ -XXX,XX +XXX,XX @@ static inline void tcg_out_call(TCGContext *s, const tcg_insn_unit *arg) | ||
532 | { | ||
533 | uint8_t *old_code_ptr = s->code_ptr; | ||
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 | -- | ||
631 | 2.25.1 | ||
632 | |||
633 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Eduardo Habkost <ehabkost@redhat.com> | ||
2 | 1 | ||
3 | The TCG-specific CPU methods will be moved to a separate struct, | ||
4 | to make it easier to move accel-specific code outside generic CPU | ||
5 | code in the future. Start by moving tcg_initialize(). | ||
6 | |||
7 | The new CPUClass.tcg_opts field may eventually become a pointer, | ||
8 | but keep it an embedded struct for now, to make code conversion | ||
9 | easier. | ||
10 | |||
11 | Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> | ||
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> | ||
16 | --- | ||
17 | include/hw/core/cpu.h | 16 +++++++++++++++- | ||
18 | cpu.c | 6 +++++- | ||
19 | target/alpha/cpu.c | 2 +- | ||
20 | target/arm/cpu.c | 2 +- | ||
21 | target/avr/cpu.c | 2 +- | ||
22 | target/cris/cpu.c | 12 ++++++------ | ||
23 | target/hppa/cpu.c | 2 +- | ||
24 | target/i386/tcg/tcg-cpu.c | 2 +- | ||
25 | target/lm32/cpu.c | 2 +- | ||
26 | target/m68k/cpu.c | 2 +- | ||
27 | target/microblaze/cpu.c | 2 +- | ||
28 | target/mips/cpu.c | 2 +- | ||
29 | target/moxie/cpu.c | 2 +- | ||
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 | |||
44 | diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h | ||
45 | index XXXXXXX..XXXXXXX 100644 | ||
46 | --- a/include/hw/core/cpu.h | ||
47 | +++ b/include/hw/core/cpu.h | ||
48 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUWatchpoint CPUWatchpoint; | ||
49 | |||
50 | struct TranslationBlock; | ||
51 | |||
52 | +/** | ||
53 | + * struct TcgCpuOperations: TCG operations specific to a CPU class | ||
54 | + */ | ||
55 | +typedef struct TcgCpuOperations { | ||
56 | + /** | ||
57 | + * @initialize: Initalize TCG state | ||
58 | + * | ||
59 | + * Called when the first CPU is realized. | ||
60 | + */ | ||
61 | + void (*initialize)(void); | ||
62 | + | ||
63 | +} TcgCpuOperations; | ||
64 | + | ||
65 | /** | ||
66 | * CPUClass: | ||
67 | * @class_by_name: Callback to map -cpu command line model name to an | ||
68 | @@ -XXX,XX +XXX,XX @@ struct CPUClass { | ||
69 | |||
70 | void (*disas_set_info)(CPUState *cpu, disassemble_info *info); | ||
71 | vaddr (*adjust_watchpoint_address)(CPUState *cpu, vaddr addr, int len); | ||
72 | - void (*tcg_initialize)(void); | ||
73 | |||
74 | const char *deprecation_note; | ||
75 | /* Keep non-pointer data at the end to minimize holes. */ | ||
76 | int gdb_num_core_regs; | ||
77 | bool gdb_stop_before_watchpoint; | ||
78 | + | ||
79 | + TcgCpuOperations tcg_ops; | ||
80 | }; | ||
81 | |||
82 | /* | ||
83 | diff --git a/cpu.c b/cpu.c | ||
84 | index XXXXXXX..XXXXXXX 100644 | ||
85 | --- a/cpu.c | ||
86 | +++ b/cpu.c | ||
87 | @@ -XXX,XX +XXX,XX @@ void cpu_exec_initfn(CPUState *cpu) | ||
88 | void cpu_exec_realizefn(CPUState *cpu, Error **errp) | ||
89 | { | ||
90 | CPUClass *cc = CPU_GET_CLASS(cpu); | ||
91 | +#ifdef CONFIG_TCG | ||
92 | static bool tcg_target_initialized; | ||
93 | +#endif /* CONFIG_TCG */ | ||
94 | |||
95 | cpu_list_add(cpu); | ||
96 | |||
97 | +#ifdef CONFIG_TCG | ||
98 | if (tcg_enabled() && !tcg_target_initialized) { | ||
99 | tcg_target_initialized = true; | ||
100 | - cc->tcg_initialize(); | ||
101 | + cc->tcg_ops.initialize(); | ||
102 | } | ||
103 | +#endif /* CONFIG_TCG */ | ||
104 | tlb_init(cpu); | ||
105 | |||
106 | qemu_plugin_vcpu_init_hook(cpu); | ||
107 | diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c | ||
108 | index XXXXXXX..XXXXXXX 100644 | ||
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 | } | ||
120 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
121 | index XXXXXXX..XXXXXXX 100644 | ||
122 | --- a/target/arm/cpu.c | ||
123 | +++ b/target/arm/cpu.c | ||
124 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) | ||
125 | cc->gdb_stop_before_watchpoint = true; | ||
126 | cc->disas_set_info = arm_disas_set_info; | ||
127 | #ifdef CONFIG_TCG | ||
128 | - cc->tcg_initialize = arm_translate_init; | ||
129 | + cc->tcg_ops.initialize = arm_translate_init; | ||
130 | cc->tlb_fill = arm_cpu_tlb_fill; | ||
131 | cc->debug_excp_handler = arm_debug_excp_handler; | ||
132 | cc->debug_check_watchpoint = arm_debug_check_watchpoint; | ||
133 | diff --git a/target/avr/cpu.c b/target/avr/cpu.c | ||
134 | index XXXXXXX..XXXXXXX 100644 | ||
135 | --- a/target/avr/cpu.c | ||
136 | +++ b/target/avr/cpu.c | ||
137 | @@ -XXX,XX +XXX,XX @@ static void avr_cpu_class_init(ObjectClass *oc, void *data) | ||
138 | cc->tlb_fill = avr_cpu_tlb_fill; | ||
139 | cc->vmsd = &vms_avr_cpu; | ||
140 | cc->disas_set_info = avr_cpu_disas_set_info; | ||
141 | - cc->tcg_initialize = avr_cpu_tcg_init; | ||
142 | + cc->tcg_ops.initialize = avr_cpu_tcg_init; | ||
143 | cc->synchronize_from_tb = avr_cpu_synchronize_from_tb; | ||
144 | cc->gdb_read_register = avr_cpu_gdb_read_register; | ||
145 | cc->gdb_write_register = avr_cpu_gdb_write_register; | ||
146 | diff --git a/target/cris/cpu.c b/target/cris/cpu.c | ||
147 | index XXXXXXX..XXXXXXX 100644 | ||
148 | --- a/target/cris/cpu.c | ||
149 | +++ b/target/cris/cpu.c | ||
150 | @@ -XXX,XX +XXX,XX @@ static void crisv8_cpu_class_init(ObjectClass *oc, void *data) | ||
151 | ccc->vr = 8; | ||
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 | ||
270 | index XXXXXXX..XXXXXXX 100644 | ||
271 | --- a/target/mips/cpu.c | ||
272 | +++ b/target/mips/cpu.c | ||
273 | @@ -XXX,XX +XXX,XX @@ static void mips_cpu_class_init(ObjectClass *c, void *data) | ||
274 | #endif | ||
275 | cc->disas_set_info = mips_cpu_disas_set_info; | ||
276 | #ifdef CONFIG_TCG | ||
277 | - cc->tcg_initialize = mips_tcg_init; | ||
278 | + cc->tcg_ops.initialize = mips_tcg_init; | ||
279 | cc->tlb_fill = mips_cpu_tlb_fill; | ||
280 | #endif | ||
281 | |||
282 | diff --git a/target/moxie/cpu.c b/target/moxie/cpu.c | ||
283 | index XXXXXXX..XXXXXXX 100644 | ||
284 | --- a/target/moxie/cpu.c | ||
285 | +++ b/target/moxie/cpu.c | ||
286 | @@ -XXX,XX +XXX,XX @@ static void moxie_cpu_class_init(ObjectClass *oc, void *data) | ||
287 | cc->vmsd = &vmstate_moxie_cpu; | ||
288 | #endif | ||
289 | cc->disas_set_info = moxie_cpu_disas_set_info; | ||
290 | - cc->tcg_initialize = moxie_translate_init; | ||
291 | + cc->tcg_ops.initialize = moxie_translate_init; | ||
292 | } | ||
293 | |||
294 | static void moxielite_initfn(Object *obj) | ||
295 | diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c | ||
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 | ||
322 | index XXXXXXX..XXXXXXX 100644 | ||
323 | --- a/target/riscv/cpu.c | ||
324 | +++ b/target/riscv/cpu.c | ||
325 | @@ -XXX,XX +XXX,XX @@ static void riscv_cpu_class_init(ObjectClass *c, void *data) | ||
326 | cc->gdb_arch_name = riscv_gdb_arch_name; | ||
327 | cc->gdb_get_dynamic_xml = riscv_gdb_get_dynamic_xml; | ||
328 | #ifdef CONFIG_TCG | ||
329 | - cc->tcg_initialize = riscv_translate_init; | ||
330 | + cc->tcg_ops.initialize = riscv_translate_init; | ||
331 | cc->tlb_fill = riscv_cpu_tlb_fill; | ||
332 | #endif | ||
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 | ||
348 | index XXXXXXX..XXXXXXX 100644 | ||
349 | --- a/target/s390x/cpu.c | ||
350 | +++ b/target/s390x/cpu.c | ||
351 | @@ -XXX,XX +XXX,XX @@ static void s390_cpu_class_init(ObjectClass *oc, void *data) | ||
352 | #endif | ||
353 | cc->disas_set_info = s390_cpu_disas_set_info; | ||
354 | #ifdef CONFIG_TCG | ||
355 | - cc->tcg_initialize = s390x_translate_init; | ||
356 | + cc->tcg_ops.initialize = s390x_translate_init; | ||
357 | cc->tlb_fill = s390_cpu_tlb_fill; | ||
358 | #endif | ||
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 | ||
374 | index XXXXXXX..XXXXXXX 100644 | ||
375 | --- a/target/sparc/cpu.c | ||
376 | +++ b/target/sparc/cpu.c | ||
377 | @@ -XXX,XX +XXX,XX @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data) | ||
378 | cc->vmsd = &vmstate_sparc_cpu; | ||
379 | #endif | ||
380 | 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 | -- | ||
452 | 2.25.1 | ||
453 | |||
454 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Claudio Fontana <cfontana@suse.de> | ||
2 | 1 | ||
3 | for now only TCG is allowed as an accelerator for riscv, | ||
4 | so remove the CONFIG_TCG use. | ||
5 | |||
6 | Signed-off-by: Claudio Fontana <cfontana@suse.de> | ||
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.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> | ||
11 | --- | ||
12 | target/riscv/cpu.c | 3 +-- | ||
13 | 1 file changed, 1 insertion(+), 2 deletions(-) | ||
14 | |||
15 | diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/target/riscv/cpu.c | ||
18 | +++ b/target/riscv/cpu.c | ||
19 | @@ -XXX,XX +XXX,XX @@ static void riscv_cpu_class_init(ObjectClass *c, void *data) | ||
20 | #endif | ||
21 | cc->gdb_arch_name = riscv_gdb_arch_name; | ||
22 | cc->gdb_get_dynamic_xml = riscv_gdb_get_dynamic_xml; | ||
23 | -#ifdef CONFIG_TCG | ||
24 | cc->tcg_ops.initialize = riscv_translate_init; | ||
25 | cc->tlb_fill = riscv_cpu_tlb_fill; | ||
26 | -#endif | ||
27 | + | ||
28 | device_class_set_props(dc, riscv_cpu_properties); | ||
29 | } | ||
30 | |||
31 | -- | ||
32 | 2.25.1 | ||
33 | |||
34 | diff view generated by jsdifflib |
1 | From: Claudio Fontana <cfontana@suse.de> | 1 | Isolate the code protected by setjmp. Fixes: |
---|---|---|---|
2 | 2 | ||
3 | move away TCG-only code, make it compile only on TCG. | 3 | translate-all.c: In function ‘tb_gen_code’: |
4 | translate-all.c:748:51: error: argument ‘cflags’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered] | ||
4 | 5 | ||
5 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 6 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | [claudio: moved the prototypes from hw/core/cpu.h to exec/cpu-all.h] | ||
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> | 7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
11 | --- | 8 | --- |
12 | include/exec/cpu-all.h | 11 +++++-- | 9 | accel/tcg/translate-all.c | 58 ++++++++++++++++++++++----------------- |
13 | include/hw/core/cpu.h | 2 ++ | 10 | 1 file changed, 33 insertions(+), 25 deletions(-) |
14 | accel/tcg/cpu-exec.c | 28 +++++++++++++++++ | ||
15 | cpu.c | 70 ++++++++++++++++++++---------------------- | ||
16 | hw/core/cpu.c | 6 +++- | ||
17 | 5 files changed, 77 insertions(+), 40 deletions(-) | ||
18 | 11 | ||
19 | diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h | 12 | diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c |
20 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/include/exec/cpu-all.h | 14 | --- a/accel/tcg/translate-all.c |
22 | +++ b/include/exec/cpu-all.h | 15 | +++ b/accel/tcg/translate-all.c |
23 | @@ -XXX,XX +XXX,XX @@ static inline bool tlb_hit(target_ulong tlb_addr, target_ulong addr) | 16 | @@ -XXX,XX +XXX,XX @@ void page_collection_unlock(struct page_collection *set) |
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 | 17 | ||
34 | #endif /* !CONFIG_USER_ONLY */ | 18 | #endif /* !CONFIG_USER_ONLY */ |
35 | 19 | ||
36 | +#ifdef CONFIG_TCG | 20 | +/* |
37 | +/* accel/tcg/cpu-exec.c */ | 21 | + * Isolate the portion of code gen which can setjmp/longjmp. |
38 | +int cpu_exec(CPUState *cpu); | 22 | + * Return the size of the generated code, or negative on error. |
39 | +void tcg_exec_realizefn(CPUState *cpu, Error **errp); | 23 | + */ |
40 | +void tcg_exec_unrealizefn(CPUState *cpu); | 24 | +static int setjmp_gen_code(CPUArchState *env, TranslationBlock *tb, |
41 | +#endif /* CONFIG_TCG */ | 25 | + target_ulong pc, void *host_pc, |
26 | + int *max_insns, int64_t *ti) | ||
27 | +{ | ||
28 | + int ret = sigsetjmp(tcg_ctx->jmp_trans, 0); | ||
29 | + if (unlikely(ret != 0)) { | ||
30 | + return ret; | ||
31 | + } | ||
42 | + | 32 | + |
43 | /* Returns: 0 on success, -1 on error */ | 33 | + tcg_func_start(tcg_ctx); |
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 | + | 34 | + |
61 | +/* $(top_srcdir)/cpu.c */ | 35 | + tcg_ctx->cpu = env_cpu(env); |
62 | void cpu_exec_initfn(CPUState *cpu); | 36 | + gen_intermediate_code(env_cpu(env), tb, *max_insns, pc, host_pc); |
63 | void cpu_exec_realizefn(CPUState *cpu, Error **errp); | 37 | + assert(tb->size != 0); |
64 | void cpu_exec_unrealizefn(CPUState *cpu); | 38 | + tcg_ctx->cpu = NULL; |
65 | diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c | 39 | + *max_insns = tb->icount; |
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 | + | 40 | + |
78 | + if (!tcg_target_initialized) { | 41 | +#ifdef CONFIG_PROFILER |
79 | + cc->tcg_ops.initialize(); | 42 | + qatomic_set(&tcg_ctx->prof.tb_count, tcg_ctx->prof.tb_count + 1); |
80 | + tcg_target_initialized = true; | 43 | + qatomic_set(&tcg_ctx->prof.interm_time, |
81 | + } | 44 | + tcg_ctx->prof.interm_time + profile_getclock() - *ti); |
82 | + tlb_init(cpu); | 45 | + *ti = profile_getclock(); |
83 | + qemu_plugin_vcpu_init_hook(cpu); | 46 | +#endif |
84 | + | 47 | + |
85 | +#ifndef CONFIG_USER_ONLY | 48 | + return tcg_gen_code(tcg_ctx, tb, pc); |
86 | + tcg_iommu_init_notifier_list(cpu); | ||
87 | +#endif /* !CONFIG_USER_ONLY */ | ||
88 | +} | 49 | +} |
89 | + | 50 | + |
90 | +/* undo the initializations in reverse order */ | 51 | /* Called with mmap_lock held for user mode emulation. */ |
91 | +void tcg_exec_unrealizefn(CPUState *cpu) | 52 | TranslationBlock *tb_gen_code(CPUState *cpu, |
92 | +{ | 53 | target_ulong pc, target_ulong cs_base, |
93 | +#ifndef CONFIG_USER_ONLY | 54 | @@ -XXX,XX +XXX,XX @@ TranslationBlock *tb_gen_code(CPUState *cpu, |
94 | + tcg_iommu_free_notifier_list(cpu); | 55 | int gen_code_size, search_size, max_insns; |
95 | +#endif /* !CONFIG_USER_ONLY */ | 56 | #ifdef CONFIG_PROFILER |
96 | + | 57 | TCGProfile *prof = &tcg_ctx->prof; |
97 | + qemu_plugin_vcpu_exit_hook(cpu); | 58 | - int64_t ti; |
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 | ||
105 | index XXXXXXX..XXXXXXX 100644 | ||
106 | --- a/cpu.c | ||
107 | +++ b/cpu.c | ||
108 | @@ -XXX,XX +XXX,XX @@ const VMStateDescription vmstate_cpu_common = { | ||
109 | }; | ||
110 | #endif | 59 | #endif |
111 | 60 | + int64_t ti; | |
112 | -void cpu_exec_unrealizefn(CPUState *cpu) | 61 | void *host_pc; |
113 | +void cpu_exec_realizefn(CPUState *cpu, Error **errp) | 62 | |
114 | { | 63 | assert_memory_lock(); |
115 | CPUClass *cc = CPU_GET_CLASS(cpu); | 64 | @@ -XXX,XX +XXX,XX @@ TranslationBlock *tb_gen_code(CPUState *cpu, |
116 | 65 | ti = profile_getclock(); | |
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 | 66 | #endif |
152 | +#ifdef CONFIG_TCG | 67 | |
153 | + /* NB: errp parameter is unused currently */ | 68 | - gen_code_size = sigsetjmp(tcg_ctx->jmp_trans, 0); |
154 | + if (tcg_enabled()) { | 69 | - if (unlikely(gen_code_size != 0)) { |
155 | + tcg_exec_unrealizefn(cpu); | 70 | - goto error_return; |
156 | + } | ||
157 | +#endif /* CONFIG_TCG */ | ||
158 | + | ||
159 | + cpu_list_remove(cpu); | ||
160 | } | ||
161 | |||
162 | void cpu_exec_initfn(CPUState *cpu) | ||
163 | @@ -XXX,XX +XXX,XX @@ void cpu_exec_initfn(CPUState *cpu) | ||
164 | #endif | ||
165 | } | ||
166 | |||
167 | -void cpu_exec_realizefn(CPUState *cpu, Error **errp) | ||
168 | -{ | ||
169 | - CPUClass *cc = CPU_GET_CLASS(cpu); | ||
170 | -#ifdef CONFIG_TCG | ||
171 | - static bool tcg_target_initialized; | ||
172 | -#endif /* CONFIG_TCG */ | ||
173 | - | ||
174 | - cpu_list_add(cpu); | ||
175 | - | ||
176 | -#ifdef CONFIG_TCG | ||
177 | - if (tcg_enabled() && !tcg_target_initialized) { | ||
178 | - tcg_target_initialized = true; | ||
179 | - cc->tcg_ops.initialize(); | ||
180 | - } | ||
181 | -#endif /* CONFIG_TCG */ | ||
182 | - tlb_init(cpu); | ||
183 | - | ||
184 | - qemu_plugin_vcpu_init_hook(cpu); | ||
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 | - } | 71 | - } |
195 | - | 72 | - |
196 | - tcg_iommu_init_notifier_list(cpu); | 73 | - tcg_func_start(tcg_ctx); |
74 | - | ||
75 | - tcg_ctx->cpu = env_cpu(env); | ||
76 | - gen_intermediate_code(cpu, tb, max_insns, pc, host_pc); | ||
77 | - assert(tb->size != 0); | ||
78 | - tcg_ctx->cpu = NULL; | ||
79 | - max_insns = tb->icount; | ||
80 | - | ||
81 | trace_translate_block(tb, pc, tb->tc.ptr); | ||
82 | |||
83 | - /* generate machine code */ | ||
84 | - | ||
85 | -#ifdef CONFIG_PROFILER | ||
86 | - qatomic_set(&prof->tb_count, prof->tb_count + 1); | ||
87 | - qatomic_set(&prof->interm_time, | ||
88 | - prof->interm_time + profile_getclock() - ti); | ||
89 | - ti = profile_getclock(); | ||
197 | -#endif | 90 | -#endif |
198 | -} | ||
199 | - | 91 | - |
200 | const char *parse_cpu_option(const char *cpu_option) | 92 | - gen_code_size = tcg_gen_code(tcg_ctx, tb, pc); |
201 | { | 93 | + gen_code_size = setjmp_gen_code(env, tb, pc, host_pc, &max_insns, &ti); |
202 | ObjectClass *oc; | 94 | if (unlikely(gen_code_size < 0)) { |
203 | diff --git a/hw/core/cpu.c b/hw/core/cpu.c | 95 | - error_return: |
204 | index XXXXXXX..XXXXXXX 100644 | 96 | switch (gen_code_size) { |
205 | --- a/hw/core/cpu.c | 97 | case -1: |
206 | +++ b/hw/core/cpu.c | 98 | /* |
207 | @@ -XXX,XX +XXX,XX @@ static bool cpu_common_virtio_is_big_endian(CPUState *cpu) | ||
208 | return target_words_bigendian(); | ||
209 | } | ||
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 | |||
229 | -- | 99 | -- |
230 | 2.25.1 | 100 | 2.34.1 |
231 | 101 | ||
232 | 102 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Eduardo Habkost <ehabkost@redhat.com> | ||
2 | 1 | ||
3 | Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> | ||
4 | [claudio: wrapped target code in CONFIG_TCG, reworded comments] | ||
5 | Signed-off-by: Claudio Fontana <cfontana@suse.de> | ||
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> | ||
9 | --- | ||
10 | include/hw/core/cpu.h | 22 +++++++++++++--------- | ||
11 | accel/tcg/cpu-exec.c | 4 ++-- | ||
12 | target/arm/cpu.c | 4 +++- | ||
13 | target/avr/cpu.c | 2 +- | ||
14 | target/hppa/cpu.c | 2 +- | ||
15 | target/i386/tcg/tcg-cpu.c | 2 +- | ||
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 | |||
25 | diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h | ||
26 | index XXXXXXX..XXXXXXX 100644 | ||
27 | --- a/include/hw/core/cpu.h | ||
28 | +++ b/include/hw/core/cpu.h | ||
29 | @@ -XXX,XX +XXX,XX @@ typedef struct TcgCpuOperations { | ||
30 | * Called when the first CPU is realized. | ||
31 | */ | ||
32 | void (*initialize)(void); | ||
33 | + /** | ||
34 | + * @synchronize_from_tb: Synchronize state from a TCG #TranslationBlock | ||
35 | + * | ||
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 | + */ | ||
44 | + void (*synchronize_from_tb)(CPUState *cpu, | ||
45 | + const struct TranslationBlock *tb); | ||
46 | |||
47 | } TcgCpuOperations; | ||
48 | |||
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 | ||
74 | --- a/accel/tcg/cpu-exec.c | ||
75 | +++ b/accel/tcg/cpu-exec.c | ||
76 | @@ -XXX,XX +XXX,XX @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit) | ||
77 | TARGET_FMT_lx "] %s\n", | ||
78 | last_tb->tc.ptr, last_tb->pc, | ||
79 | lookup_symbol(last_tb->pc)); | ||
80 | - if (cc->synchronize_from_tb) { | ||
81 | - cc->synchronize_from_tb(cpu, last_tb); | ||
82 | + if (cc->tcg_ops.synchronize_from_tb) { | ||
83 | + cc->tcg_ops.synchronize_from_tb(cpu, last_tb); | ||
84 | } else { | ||
85 | assert(cc->set_pc); | ||
86 | cc->set_pc(cpu, last_tb->pc); | ||
87 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
88 | index XXXXXXX..XXXXXXX 100644 | ||
89 | --- a/target/arm/cpu.c | ||
90 | +++ b/target/arm/cpu.c | ||
91 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_set_pc(CPUState *cs, vaddr value) | ||
92 | } | ||
93 | } | ||
94 | |||
95 | +#ifdef CONFIG_TCG | ||
96 | static void arm_cpu_synchronize_from_tb(CPUState *cs, | ||
97 | const TranslationBlock *tb) | ||
98 | { | ||
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) | ||
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; | ||
114 | #ifndef CONFIG_USER_ONLY | ||
115 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) | ||
116 | cc->disas_set_info = arm_disas_set_info; | ||
117 | #ifdef CONFIG_TCG | ||
118 | cc->tcg_ops.initialize = arm_translate_init; | ||
119 | + cc->tcg_ops.synchronize_from_tb = arm_cpu_synchronize_from_tb; | ||
120 | cc->tlb_fill = arm_cpu_tlb_fill; | ||
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 | ||
125 | --- a/target/avr/cpu.c | ||
126 | +++ b/target/avr/cpu.c | ||
127 | @@ -XXX,XX +XXX,XX @@ static void avr_cpu_class_init(ObjectClass *oc, void *data) | ||
128 | cc->vmsd = &vms_avr_cpu; | ||
129 | cc->disas_set_info = avr_cpu_disas_set_info; | ||
130 | cc->tcg_ops.initialize = avr_cpu_tcg_init; | ||
131 | - cc->synchronize_from_tb = avr_cpu_synchronize_from_tb; | ||
132 | + cc->tcg_ops.synchronize_from_tb = avr_cpu_synchronize_from_tb; | ||
133 | cc->gdb_read_register = avr_cpu_gdb_read_register; | ||
134 | cc->gdb_write_register = avr_cpu_gdb_write_register; | ||
135 | cc->gdb_num_core_regs = 35; | ||
136 | diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c | ||
137 | index XXXXXXX..XXXXXXX 100644 | ||
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 | ||
203 | @@ -XXX,XX +XXX,XX @@ static void mips_cpu_class_init(ObjectClass *c, void *data) | ||
204 | cc->disas_set_info = mips_cpu_disas_set_info; | ||
205 | #ifdef CONFIG_TCG | ||
206 | cc->tcg_ops.initialize = mips_tcg_init; | ||
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 | -- | ||
277 | 2.25.1 | ||
278 | |||
279 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Eduardo Habkost <ehabkost@redhat.com> | ||
2 | 1 | ||
3 | Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> | ||
4 | [claudio: wrapped target code in CONFIG_TCG] | ||
5 | Signed-off-by: Claudio Fontana <cfontana@suse.de> | ||
6 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
7 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-Id: <20210204163931.7358-6-cfontana@suse.de> | ||
10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | --- | ||
12 | include/hw/core/cpu.h | 12 ++++++------ | ||
13 | accel/tcg/cpu-exec.c | 12 ++++++------ | ||
14 | target/alpha/cpu.c | 2 +- | ||
15 | target/arm/cpu.c | 2 +- | ||
16 | target/arm/cpu64.c | 5 ++++- | ||
17 | target/arm/cpu_tcg.c | 7 ++++++- | ||
18 | target/avr/cpu.c | 2 +- | ||
19 | target/cris/cpu.c | 2 +- | ||
20 | target/hppa/cpu.c | 2 +- | ||
21 | target/i386/tcg/tcg-cpu.c | 6 +++--- | ||
22 | target/lm32/cpu.c | 2 +- | ||
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 | |||
39 | diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/include/hw/core/cpu.h | ||
42 | +++ b/include/hw/core/cpu.h | ||
43 | @@ -XXX,XX +XXX,XX @@ typedef struct TcgCpuOperations { | ||
44 | */ | ||
45 | void (*synchronize_from_tb)(CPUState *cpu, | ||
46 | const struct TranslationBlock *tb); | ||
47 | + /** @cpu_exec_enter: Callback for cpu_exec preparation */ | ||
48 | + void (*cpu_exec_enter)(CPUState *cpu); | ||
49 | + /** @cpu_exec_exit: Callback for cpu_exec cleanup */ | ||
50 | + void (*cpu_exec_exit)(CPUState *cpu); | ||
51 | + /** @cpu_exec_interrupt: Callback for processing interrupts in cpu_exec */ | ||
52 | + bool (*cpu_exec_interrupt)(CPUState *cpu, int interrupt_request); | ||
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 { | ||
67 | const char *gdb_core_xml_file; | ||
68 | gchar * (*gdb_arch_name)(CPUState *cpu); | ||
69 | const char * (*gdb_get_dynamic_xml)(CPUState *cpu, const char *xmlname); | ||
70 | - void (*cpu_exec_enter)(CPUState *cpu); | ||
71 | - void (*cpu_exec_exit)(CPUState *cpu); | ||
72 | - bool (*cpu_exec_interrupt)(CPUState *cpu, int interrupt_request); | ||
73 | |||
74 | void (*disas_set_info)(CPUState *cpu, disassemble_info *info); | ||
75 | vaddr (*adjust_watchpoint_address)(CPUState *cpu, vaddr addr, int len); | ||
76 | diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c | ||
77 | index XXXXXXX..XXXXXXX 100644 | ||
78 | --- a/accel/tcg/cpu-exec.c | ||
79 | +++ b/accel/tcg/cpu-exec.c | ||
80 | @@ -XXX,XX +XXX,XX @@ static void cpu_exec_enter(CPUState *cpu) | ||
81 | { | ||
82 | CPUClass *cc = CPU_GET_CLASS(cpu); | ||
83 | |||
84 | - if (cc->cpu_exec_enter) { | ||
85 | - cc->cpu_exec_enter(cpu); | ||
86 | + if (cc->tcg_ops.cpu_exec_enter) { | ||
87 | + cc->tcg_ops.cpu_exec_enter(cpu); | ||
88 | } | ||
89 | } | ||
90 | |||
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 | ||
127 | index XXXXXXX..XXXXXXX 100644 | ||
128 | --- a/target/arm/cpu.c | ||
129 | +++ b/target/arm/cpu.c | ||
130 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) | ||
131 | |||
132 | cc->class_by_name = arm_cpu_class_by_name; | ||
133 | cc->has_work = arm_cpu_has_work; | ||
134 | - cc->cpu_exec_interrupt = arm_cpu_exec_interrupt; | ||
135 | cc->dump_state = arm_cpu_dump_state; | ||
136 | cc->set_pc = arm_cpu_set_pc; | ||
137 | cc->gdb_read_register = arm_cpu_gdb_read_register; | ||
138 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) | ||
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 | ||
195 | index XXXXXXX..XXXXXXX 100644 | ||
196 | --- a/target/avr/cpu.c | ||
197 | +++ b/target/avr/cpu.c | ||
198 | @@ -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; | ||
206 | cc->memory_rw_debug = avr_cpu_memory_rw_debug; | ||
207 | diff --git a/target/cris/cpu.c b/target/cris/cpu.c | ||
208 | index XXXXXXX..XXXXXXX 100644 | ||
209 | --- a/target/cris/cpu.c | ||
210 | +++ b/target/cris/cpu.c | ||
211 | @@ -XXX,XX +XXX,XX @@ static void cris_cpu_class_init(ObjectClass *oc, void *data) | ||
212 | cc->class_by_name = cris_cpu_class_by_name; | ||
213 | cc->has_work = cris_cpu_has_work; | ||
214 | cc->do_interrupt = cris_cpu_do_interrupt; | ||
215 | - cc->cpu_exec_interrupt = cris_cpu_exec_interrupt; | ||
216 | + cc->tcg_ops.cpu_exec_interrupt = cris_cpu_exec_interrupt; | ||
217 | cc->dump_state = cris_cpu_dump_state; | ||
218 | cc->set_pc = cris_cpu_set_pc; | ||
219 | cc->gdb_read_register = cris_cpu_gdb_read_register; | ||
220 | diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c | ||
221 | index XXXXXXX..XXXXXXX 100644 | ||
222 | --- a/target/hppa/cpu.c | ||
223 | +++ b/target/hppa/cpu.c | ||
224 | @@ -XXX,XX +XXX,XX @@ static void hppa_cpu_class_init(ObjectClass *oc, void *data) | ||
225 | cc->class_by_name = hppa_cpu_class_by_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 | ||
291 | index XXXXXXX..XXXXXXX 100644 | ||
292 | --- a/target/mips/cpu.c | ||
293 | +++ b/target/mips/cpu.c | ||
294 | @@ -XXX,XX +XXX,XX @@ static void mips_cpu_class_init(ObjectClass *c, void *data) | ||
295 | cc->class_by_name = mips_cpu_class_by_name; | ||
296 | cc->has_work = mips_cpu_has_work; | ||
297 | cc->do_interrupt = mips_cpu_do_interrupt; | ||
298 | - cc->cpu_exec_interrupt = mips_cpu_exec_interrupt; | ||
299 | cc->dump_state = mips_cpu_dump_state; | ||
300 | cc->set_pc = mips_cpu_set_pc; | ||
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; | ||
304 | #ifdef CONFIG_TCG | ||
305 | cc->tcg_ops.initialize = mips_tcg_init; | ||
306 | + cc->tcg_ops.cpu_exec_interrupt = mips_cpu_exec_interrupt; | ||
307 | cc->tcg_ops.synchronize_from_tb = mips_cpu_synchronize_from_tb; | ||
308 | cc->tlb_fill = mips_cpu_tlb_fill; | ||
309 | #endif | ||
310 | diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c | ||
311 | index XXXXXXX..XXXXXXX 100644 | ||
312 | --- a/target/nios2/cpu.c | ||
313 | +++ b/target/nios2/cpu.c | ||
314 | @@ -XXX,XX +XXX,XX @@ static void nios2_cpu_class_init(ObjectClass *oc, void *data) | ||
315 | cc->class_by_name = nios2_cpu_class_by_name; | ||
316 | cc->has_work = nios2_cpu_has_work; | ||
317 | cc->do_interrupt = nios2_cpu_do_interrupt; | ||
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 | ||
337 | index XXXXXXX..XXXXXXX 100644 | ||
338 | --- a/target/riscv/cpu.c | ||
339 | +++ b/target/riscv/cpu.c | ||
340 | @@ -XXX,XX +XXX,XX @@ static void riscv_cpu_class_init(ObjectClass *c, void *data) | ||
341 | cc->class_by_name = riscv_cpu_class_by_name; | ||
342 | cc->has_work = riscv_cpu_has_work; | ||
343 | cc->do_interrupt = riscv_cpu_do_interrupt; | ||
344 | - cc->cpu_exec_interrupt = riscv_cpu_exec_interrupt; | ||
345 | + cc->tcg_ops.cpu_exec_interrupt = riscv_cpu_exec_interrupt; | ||
346 | cc->dump_state = riscv_cpu_dump_state; | ||
347 | cc->set_pc = riscv_cpu_set_pc; | ||
348 | cc->tcg_ops.synchronize_from_tb = riscv_cpu_synchronize_from_tb; | ||
349 | diff --git a/target/rx/cpu.c b/target/rx/cpu.c | ||
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 | ||
363 | index XXXXXXX..XXXXXXX 100644 | ||
364 | --- a/target/s390x/cpu.c | ||
365 | +++ b/target/s390x/cpu.c | ||
366 | @@ -XXX,XX +XXX,XX @@ static void s390_cpu_class_init(ObjectClass *oc, void *data) | ||
367 | cc->get_crash_info = s390_cpu_get_crash_info; | ||
368 | cc->write_elf64_note = s390_cpu_write_elf64_note; | ||
369 | #ifdef CONFIG_TCG | ||
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 | ||
389 | index XXXXXXX..XXXXXXX 100644 | ||
390 | --- a/target/sparc/cpu.c | ||
391 | +++ b/target/sparc/cpu.c | ||
392 | @@ -XXX,XX +XXX,XX @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data) | ||
393 | cc->parse_features = sparc_cpu_parse_features; | ||
394 | cc->has_work = sparc_cpu_has_work; | ||
395 | cc->do_interrupt = sparc_cpu_do_interrupt; | ||
396 | - cc->cpu_exec_interrupt = sparc_cpu_exec_interrupt; | ||
397 | + cc->tcg_ops.cpu_exec_interrupt = sparc_cpu_exec_interrupt; | ||
398 | cc->dump_state = sparc_cpu_dump_state; | ||
399 | #if !defined(TARGET_SPARC64) && !defined(CONFIG_USER_ONLY) | ||
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 | |||
497 | -- | ||
498 | 2.25.1 | ||
499 | |||
500 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Eduardo Habkost <ehabkost@redhat.com> | ||
2 | 1 | ||
3 | [claudio: wrapped target code in CONFIG_TCG] | ||
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> | ||
10 | Message-Id: <20210204163931.7358-7-cfontana@suse.de> | ||
11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
12 | --- | ||
13 | include/hw/core/cpu.h | 21 ++++++++++++--------- | ||
14 | accel/tcg/cputlb.c | 7 ++++--- | ||
15 | accel/tcg/user-exec.c | 6 +++--- | ||
16 | target/alpha/cpu.c | 2 +- | ||
17 | target/arm/cpu.c | 2 +- | ||
18 | target/avr/cpu.c | 2 +- | ||
19 | target/cris/cpu.c | 2 +- | ||
20 | target/hppa/cpu.c | 2 +- | ||
21 | target/i386/tcg/tcg-cpu.c | 2 +- | ||
22 | target/lm32/cpu.c | 2 +- | ||
23 | target/m68k/cpu.c | 2 +- | ||
24 | target/microblaze/cpu.c | 2 +- | ||
25 | target/mips/cpu.c | 2 +- | ||
26 | target/moxie/cpu.c | 2 +- | ||
27 | target/nios2/cpu.c | 2 +- | ||
28 | target/openrisc/cpu.c | 2 +- | ||
29 | target/riscv/cpu.c | 2 +- | ||
30 | target/rx/cpu.c | 2 +- | ||
31 | target/s390x/cpu.c | 2 +- | ||
32 | target/sh4/cpu.c | 2 +- | ||
33 | target/sparc/cpu.c | 2 +- | ||
34 | target/tilegx/cpu.c | 2 +- | ||
35 | target/tricore/cpu.c | 2 +- | ||
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 | |||
41 | diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h | ||
42 | index XXXXXXX..XXXXXXX 100644 | ||
43 | --- a/include/hw/core/cpu.h | ||
44 | +++ b/include/hw/core/cpu.h | ||
45 | @@ -XXX,XX +XXX,XX @@ typedef struct TcgCpuOperations { | ||
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 | ||
66 | * the PC register to the value passed in" then the target must | ||
67 | * also implement the synchronize_from_tb hook. | ||
68 | - * @tlb_fill: Callback for handling a softmmu tlb miss or user-only | ||
69 | - * address fault. For system mode, if the access is valid, call | ||
70 | - * tlb_set_page and return true; if the access is invalid, and | ||
71 | - * probe is true, return false; otherwise raise an exception and | ||
72 | - * do not return. For user-only mode, always raise an exception | ||
73 | - * and do not return. | ||
74 | * @get_phys_page_debug: Callback for obtaining a physical address. | ||
75 | * @get_phys_page_attrs_debug: Callback for obtaining a physical address and the | ||
76 | * associated memory transaction attributes to use for the access. | ||
77 | @@ -XXX,XX +XXX,XX @@ struct CPUClass { | ||
78 | void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list, | ||
79 | Error **errp); | ||
80 | void (*set_pc)(CPUState *cpu, vaddr value); | ||
81 | - bool (*tlb_fill)(CPUState *cpu, vaddr address, int size, | ||
82 | - MMUAccessType access_type, int mmu_idx, | ||
83 | - bool probe, uintptr_t retaddr); | ||
84 | hwaddr (*get_phys_page_debug)(CPUState *cpu, vaddr addr); | ||
85 | hwaddr (*get_phys_page_attrs_debug)(CPUState *cpu, vaddr addr, | ||
86 | MemTxAttrs *attrs); | ||
87 | diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c | ||
88 | index XXXXXXX..XXXXXXX 100644 | ||
89 | --- a/accel/tcg/cputlb.c | ||
90 | +++ b/accel/tcg/cputlb.c | ||
91 | @@ -XXX,XX +XXX,XX @@ static void tlb_fill(CPUState *cpu, target_ulong addr, int size, | ||
92 | * This is not a probe, so only valid return is success; failure | ||
93 | * should result in exception + longjmp to the cpu loop. | ||
94 | */ | ||
95 | - ok = cc->tlb_fill(cpu, addr, size, access_type, mmu_idx, false, retaddr); | ||
96 | + ok = cc->tcg_ops.tlb_fill(cpu, addr, size, | ||
97 | + access_type, mmu_idx, false, retaddr); | ||
98 | assert(ok); | ||
99 | } | ||
100 | |||
101 | @@ -XXX,XX +XXX,XX @@ static int probe_access_internal(CPUArchState *env, target_ulong 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 | ||
137 | index XXXXXXX..XXXXXXX 100644 | ||
138 | --- a/target/alpha/cpu.c | ||
139 | +++ b/target/alpha/cpu.c | ||
140 | @@ -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; | ||
143 | cc->gdb_write_register = alpha_cpu_gdb_write_register; | ||
144 | - cc->tlb_fill = alpha_cpu_tlb_fill; | ||
145 | + cc->tcg_ops.tlb_fill = alpha_cpu_tlb_fill; | ||
146 | #ifndef CONFIG_USER_ONLY | ||
147 | cc->do_transaction_failed = alpha_cpu_do_transaction_failed; | ||
148 | cc->do_unaligned_access = alpha_cpu_do_unaligned_access; | ||
149 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
150 | index XXXXXXX..XXXXXXX 100644 | ||
151 | --- a/target/arm/cpu.c | ||
152 | +++ b/target/arm/cpu.c | ||
153 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) | ||
154 | cc->tcg_ops.initialize = arm_translate_init; | ||
155 | cc->tcg_ops.cpu_exec_interrupt = arm_cpu_exec_interrupt; | ||
156 | cc->tcg_ops.synchronize_from_tb = arm_cpu_synchronize_from_tb; | ||
157 | - cc->tlb_fill = arm_cpu_tlb_fill; | ||
158 | + cc->tcg_ops.tlb_fill = arm_cpu_tlb_fill; | ||
159 | cc->debug_excp_handler = arm_debug_excp_handler; | ||
160 | cc->debug_check_watchpoint = arm_debug_check_watchpoint; | ||
161 | cc->do_unaligned_access = arm_cpu_do_unaligned_access; | ||
162 | diff --git a/target/avr/cpu.c b/target/avr/cpu.c | ||
163 | index XXXXXXX..XXXXXXX 100644 | ||
164 | --- a/target/avr/cpu.c | ||
165 | +++ b/target/avr/cpu.c | ||
166 | @@ -XXX,XX +XXX,XX @@ static void avr_cpu_class_init(ObjectClass *oc, void *data) | ||
167 | cc->set_pc = avr_cpu_set_pc; | ||
168 | cc->memory_rw_debug = avr_cpu_memory_rw_debug; | ||
169 | cc->get_phys_page_debug = avr_cpu_get_phys_page_debug; | ||
170 | - cc->tlb_fill = avr_cpu_tlb_fill; | ||
171 | + cc->tcg_ops.tlb_fill = avr_cpu_tlb_fill; | ||
172 | cc->vmsd = &vms_avr_cpu; | ||
173 | 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 | ||
176 | index XXXXXXX..XXXXXXX 100644 | ||
177 | --- a/target/cris/cpu.c | ||
178 | +++ b/target/cris/cpu.c | ||
179 | @@ -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; | ||
182 | cc->gdb_write_register = cris_cpu_gdb_write_register; | ||
183 | - cc->tlb_fill = cris_cpu_tlb_fill; | ||
184 | + cc->tcg_ops.tlb_fill = cris_cpu_tlb_fill; | ||
185 | #ifndef CONFIG_USER_ONLY | ||
186 | cc->get_phys_page_debug = cris_cpu_get_phys_page_debug; | ||
187 | dc->vmsd = &vmstate_cris_cpu; | ||
188 | diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c | ||
189 | index XXXXXXX..XXXXXXX 100644 | ||
190 | --- a/target/hppa/cpu.c | ||
191 | +++ b/target/hppa/cpu.c | ||
192 | @@ -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; | ||
195 | cc->gdb_write_register = hppa_cpu_gdb_write_register; | ||
196 | - cc->tlb_fill = hppa_cpu_tlb_fill; | ||
197 | + cc->tcg_ops.tlb_fill = hppa_cpu_tlb_fill; | ||
198 | #ifndef CONFIG_USER_ONLY | ||
199 | cc->get_phys_page_debug = hppa_cpu_get_phys_page_debug; | ||
200 | dc->vmsd = &vmstate_hppa_cpu; | ||
201 | diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c | ||
202 | index XXXXXXX..XXXXXXX 100644 | ||
203 | --- a/target/i386/tcg/tcg-cpu.c | ||
204 | +++ b/target/i386/tcg/tcg-cpu.c | ||
205 | @@ -XXX,XX +XXX,XX @@ void tcg_cpu_common_class_init(CPUClass *cc) | ||
206 | cc->tcg_ops.cpu_exec_enter = x86_cpu_exec_enter; | ||
207 | cc->tcg_ops.cpu_exec_exit = x86_cpu_exec_exit; | ||
208 | cc->tcg_ops.initialize = tcg_x86_init; | ||
209 | - cc->tlb_fill = x86_cpu_tlb_fill; | ||
210 | + cc->tcg_ops.tlb_fill = x86_cpu_tlb_fill; | ||
211 | #ifndef CONFIG_USER_ONLY | ||
212 | cc->debug_excp_handler = breakpoint_handler; | ||
213 | #endif | ||
214 | diff --git a/target/lm32/cpu.c b/target/lm32/cpu.c | ||
215 | index XXXXXXX..XXXXXXX 100644 | ||
216 | --- a/target/lm32/cpu.c | ||
217 | +++ b/target/lm32/cpu.c | ||
218 | @@ -XXX,XX +XXX,XX @@ static void lm32_cpu_class_init(ObjectClass *oc, void *data) | ||
219 | cc->set_pc = lm32_cpu_set_pc; | ||
220 | cc->gdb_read_register = lm32_cpu_gdb_read_register; | ||
221 | cc->gdb_write_register = lm32_cpu_gdb_write_register; | ||
222 | - cc->tlb_fill = lm32_cpu_tlb_fill; | ||
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 | ||
228 | index XXXXXXX..XXXXXXX 100644 | ||
229 | --- a/target/m68k/cpu.c | ||
230 | +++ b/target/m68k/cpu.c | ||
231 | @@ -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; | ||
234 | 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 | cc->do_transaction_failed = m68k_cpu_transaction_failed; | ||
239 | cc->get_phys_page_debug = m68k_cpu_get_phys_page_debug; | ||
240 | diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c | ||
241 | index XXXXXXX..XXXXXXX 100644 | ||
242 | --- a/target/microblaze/cpu.c | ||
243 | +++ b/target/microblaze/cpu.c | ||
244 | @@ -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; | ||
248 | - cc->tlb_fill = mb_cpu_tlb_fill; | ||
249 | + cc->tcg_ops.tlb_fill = mb_cpu_tlb_fill; | ||
250 | #ifndef CONFIG_USER_ONLY | ||
251 | cc->do_transaction_failed = mb_cpu_transaction_failed; | ||
252 | cc->get_phys_page_attrs_debug = mb_cpu_get_phys_page_attrs_debug; | ||
253 | diff --git a/target/mips/cpu.c b/target/mips/cpu.c | ||
254 | index XXXXXXX..XXXXXXX 100644 | ||
255 | --- a/target/mips/cpu.c | ||
256 | +++ b/target/mips/cpu.c | ||
257 | @@ -XXX,XX +XXX,XX @@ static void mips_cpu_class_init(ObjectClass *c, void *data) | ||
258 | cc->tcg_ops.initialize = mips_tcg_init; | ||
259 | cc->tcg_ops.cpu_exec_interrupt = mips_cpu_exec_interrupt; | ||
260 | cc->tcg_ops.synchronize_from_tb = mips_cpu_synchronize_from_tb; | ||
261 | - cc->tlb_fill = mips_cpu_tlb_fill; | ||
262 | + cc->tcg_ops.tlb_fill = mips_cpu_tlb_fill; | ||
263 | #endif | ||
264 | |||
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 | ||
280 | index XXXXXXX..XXXXXXX 100644 | ||
281 | --- a/target/nios2/cpu.c | ||
282 | +++ b/target/nios2/cpu.c | ||
283 | @@ -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; | ||
286 | cc->disas_set_info = nios2_cpu_disas_set_info; | ||
287 | - cc->tlb_fill = nios2_cpu_tlb_fill; | ||
288 | + cc->tcg_ops.tlb_fill = nios2_cpu_tlb_fill; | ||
289 | #ifndef CONFIG_USER_ONLY | ||
290 | cc->do_unaligned_access = nios2_cpu_do_unaligned_access; | ||
291 | cc->get_phys_page_debug = nios2_cpu_get_phys_page_debug; | ||
292 | diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c | ||
293 | index XXXXXXX..XXXXXXX 100644 | ||
294 | --- a/target/openrisc/cpu.c | ||
295 | +++ b/target/openrisc/cpu.c | ||
296 | @@ -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; | ||
299 | cc->gdb_write_register = openrisc_cpu_gdb_write_register; | ||
300 | - cc->tlb_fill = openrisc_cpu_tlb_fill; | ||
301 | + cc->tcg_ops.tlb_fill = openrisc_cpu_tlb_fill; | ||
302 | #ifndef CONFIG_USER_ONLY | ||
303 | cc->get_phys_page_debug = openrisc_cpu_get_phys_page_debug; | ||
304 | dc->vmsd = &vmstate_openrisc_cpu; | ||
305 | diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c | ||
306 | index XXXXXXX..XXXXXXX 100644 | ||
307 | --- a/target/riscv/cpu.c | ||
308 | +++ b/target/riscv/cpu.c | ||
309 | @@ -XXX,XX +XXX,XX @@ static void riscv_cpu_class_init(ObjectClass *c, void *data) | ||
310 | 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 | ||
319 | index XXXXXXX..XXXXXXX 100644 | ||
320 | --- a/target/rx/cpu.c | ||
321 | +++ b/target/rx/cpu.c | ||
322 | @@ -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; | ||
324 | 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 | |||
329 | 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 | ||
332 | index XXXXXXX..XXXXXXX 100644 | ||
333 | --- a/target/s390x/cpu.c | ||
334 | +++ b/target/s390x/cpu.c | ||
335 | @@ -XXX,XX +XXX,XX @@ static void s390_cpu_class_init(ObjectClass *oc, void *data) | ||
336 | 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 | ||
345 | index XXXXXXX..XXXXXXX 100644 | ||
346 | --- a/target/sh4/cpu.c | ||
347 | +++ b/target/sh4/cpu.c | ||
348 | @@ -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; | ||
351 | cc->gdb_write_register = superh_cpu_gdb_write_register; | ||
352 | - cc->tlb_fill = superh_cpu_tlb_fill; | ||
353 | + cc->tcg_ops.tlb_fill = superh_cpu_tlb_fill; | ||
354 | #ifndef CONFIG_USER_ONLY | ||
355 | cc->do_unaligned_access = superh_cpu_do_unaligned_access; | ||
356 | cc->get_phys_page_debug = superh_cpu_get_phys_page_debug; | ||
357 | diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c | ||
358 | index XXXXXXX..XXXXXXX 100644 | ||
359 | --- a/target/sparc/cpu.c | ||
360 | +++ b/target/sparc/cpu.c | ||
361 | @@ -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; | ||
364 | cc->gdb_write_register = sparc_cpu_gdb_write_register; | ||
365 | - cc->tlb_fill = sparc_cpu_tlb_fill; | ||
366 | + cc->tcg_ops.tlb_fill = sparc_cpu_tlb_fill; | ||
367 | #ifndef CONFIG_USER_ONLY | ||
368 | cc->do_transaction_failed = sparc_cpu_do_transaction_failed; | ||
369 | cc->do_unaligned_access = sparc_cpu_do_unaligned_access; | ||
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 | ||
384 | index XXXXXXX..XXXXXXX 100644 | ||
385 | --- a/target/tricore/cpu.c | ||
386 | +++ b/target/tricore/cpu.c | ||
387 | @@ -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; | ||
389 | cc->get_phys_page_debug = tricore_cpu_get_phys_page_debug; | ||
390 | cc->tcg_ops.initialize = tricore_tcg_init; | ||
391 | - cc->tlb_fill = tricore_cpu_tlb_fill; | ||
392 | + cc->tcg_ops.tlb_fill = tricore_cpu_tlb_fill; | ||
393 | } | ||
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 | ||
410 | index XXXXXXX..XXXXXXX 100644 | ||
411 | --- a/target/xtensa/cpu.c | ||
412 | +++ b/target/xtensa/cpu.c | ||
413 | @@ -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; | ||
417 | - cc->tlb_fill = xtensa_cpu_tlb_fill; | ||
418 | + cc->tcg_ops.tlb_fill = xtensa_cpu_tlb_fill; | ||
419 | #ifndef CONFIG_USER_ONLY | ||
420 | cc->do_unaligned_access = xtensa_cpu_do_unaligned_access; | ||
421 | cc->get_phys_page_debug = xtensa_cpu_get_phys_page_debug; | ||
422 | diff --git a/target/ppc/translate_init.c.inc b/target/ppc/translate_init.c.inc | ||
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 | -- | ||
436 | 2.25.1 | ||
437 | |||
438 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Eduardo Habkost <ehabkost@redhat.com> | ||
2 | 1 | ||
3 | Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> | ||
4 | Signed-off-by: Claudio Fontana <cfontana@suse.de> | ||
5 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-Id: <20210204163931.7358-8-cfontana@suse.de> | ||
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | --- | ||
10 | include/hw/core/cpu.h | 4 ++-- | ||
11 | accel/tcg/cpu-exec.c | 4 ++-- | ||
12 | target/arm/cpu.c | 2 +- | ||
13 | target/i386/tcg/tcg-cpu.c | 2 +- | ||
14 | target/lm32/cpu.c | 2 +- | ||
15 | target/s390x/cpu.c | 2 +- | ||
16 | target/xtensa/cpu.c | 2 +- | ||
17 | 7 files changed, 9 insertions(+), 9 deletions(-) | ||
18 | |||
19 | diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/include/hw/core/cpu.h | ||
22 | +++ b/include/hw/core/cpu.h | ||
23 | @@ -XXX,XX +XXX,XX @@ typedef struct TcgCpuOperations { | ||
24 | bool (*tlb_fill)(CPUState *cpu, vaddr address, int size, | ||
25 | MMUAccessType access_type, int mmu_idx, | ||
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. | ||
34 | * @debug_check_watchpoint: Callback: return true if the architectural | ||
35 | * watchpoint whose address has matched should really fire. | ||
36 | - * @debug_excp_handler: Callback for handling debug exceptions. | ||
37 | * @write_elf64_note: Callback for writing a CPU-specific ELF note to a | ||
38 | * 64-bit VM coredump. | ||
39 | * @write_elf32_qemunote: Callback for writing a CPU- and QEMU-specific ELF | ||
40 | @@ -XXX,XX +XXX,XX @@ struct CPUClass { | ||
41 | int (*gdb_read_register)(CPUState *cpu, GByteArray *buf, int reg); | ||
42 | int (*gdb_write_register)(CPUState *cpu, uint8_t *buf, int reg); | ||
43 | bool (*debug_check_watchpoint)(CPUState *cpu, CPUWatchpoint *wp); | ||
44 | - void (*debug_excp_handler)(CPUState *cpu); | ||
45 | |||
46 | int (*write_elf64_note)(WriteCoreDumpFunction f, CPUState *cpu, | ||
47 | int cpuid, void *opaque); | ||
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 @@ static inline void cpu_handle_debug_exception(CPUState *cpu) | ||
53 | } | ||
54 | } | ||
55 | |||
56 | - if (cc->debug_excp_handler) { | ||
57 | - cc->debug_excp_handler(cpu); | ||
58 | + if (cc->tcg_ops.debug_excp_handler) { | ||
59 | + cc->tcg_ops.debug_excp_handler(cpu); | ||
60 | } | ||
61 | } | ||
62 | |||
63 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
64 | index XXXXXXX..XXXXXXX 100644 | ||
65 | --- a/target/arm/cpu.c | ||
66 | +++ b/target/arm/cpu.c | ||
67 | @@ -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; | ||
69 | cc->tcg_ops.synchronize_from_tb = arm_cpu_synchronize_from_tb; | ||
70 | cc->tcg_ops.tlb_fill = arm_cpu_tlb_fill; | ||
71 | - cc->debug_excp_handler = arm_debug_excp_handler; | ||
72 | + cc->tcg_ops.debug_excp_handler = arm_debug_excp_handler; | ||
73 | cc->debug_check_watchpoint = arm_debug_check_watchpoint; | ||
74 | cc->do_unaligned_access = arm_cpu_do_unaligned_access; | ||
75 | #if !defined(CONFIG_USER_ONLY) | ||
76 | diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c | ||
77 | index XXXXXXX..XXXXXXX 100644 | ||
78 | --- a/target/i386/tcg/tcg-cpu.c | ||
79 | +++ b/target/i386/tcg/tcg-cpu.c | ||
80 | @@ -XXX,XX +XXX,XX @@ void tcg_cpu_common_class_init(CPUClass *cc) | ||
81 | cc->tcg_ops.initialize = tcg_x86_init; | ||
82 | cc->tcg_ops.tlb_fill = x86_cpu_tlb_fill; | ||
83 | #ifndef CONFIG_USER_ONLY | ||
84 | - cc->debug_excp_handler = breakpoint_handler; | ||
85 | + cc->tcg_ops.debug_excp_handler = breakpoint_handler; | ||
86 | #endif | ||
87 | } | ||
88 | diff --git a/target/lm32/cpu.c b/target/lm32/cpu.c | ||
89 | index XXXXXXX..XXXXXXX 100644 | ||
90 | --- a/target/lm32/cpu.c | ||
91 | +++ b/target/lm32/cpu.c | ||
92 | @@ -XXX,XX +XXX,XX @@ static void lm32_cpu_class_init(ObjectClass *oc, void *data) | ||
93 | #endif | ||
94 | cc->gdb_num_core_regs = 32 + 7; | ||
95 | cc->gdb_stop_before_watchpoint = true; | ||
96 | - cc->debug_excp_handler = lm32_debug_excp_handler; | ||
97 | + cc->tcg_ops.debug_excp_handler = lm32_debug_excp_handler; | ||
98 | cc->disas_set_info = lm32_cpu_disas_set_info; | ||
99 | cc->tcg_ops.initialize = lm32_translate_init; | ||
100 | } | ||
101 | diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c | ||
102 | index XXXXXXX..XXXXXXX 100644 | ||
103 | --- a/target/s390x/cpu.c | ||
104 | +++ b/target/s390x/cpu.c | ||
105 | @@ -XXX,XX +XXX,XX @@ static void s390_cpu_class_init(ObjectClass *oc, void *data) | ||
106 | cc->write_elf64_note = s390_cpu_write_elf64_note; | ||
107 | #ifdef CONFIG_TCG | ||
108 | cc->tcg_ops.cpu_exec_interrupt = s390_cpu_exec_interrupt; | ||
109 | - cc->debug_excp_handler = s390x_cpu_debug_excp_handler; | ||
110 | + cc->tcg_ops.debug_excp_handler = s390x_cpu_debug_excp_handler; | ||
111 | cc->do_unaligned_access = s390x_cpu_do_unaligned_access; | ||
112 | #endif | ||
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 | -- | ||
128 | 2.25.1 | ||
129 | |||
130 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Claudio Fontana <cfontana@suse.de> | ||
2 | 1 | ||
3 | cc->do_interrupt is in theory a TCG callback used in accel/tcg only, | ||
4 | to prepare the emulated architecture to take an interrupt as defined | ||
5 | in the hardware specifications, | ||
6 | |||
7 | but in reality the _do_interrupt style of functions in targets are | ||
8 | also occasionally reused by KVM to prepare the architecture state in a | ||
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> | ||
36 | --- | ||
37 | target/arm/helper.c | 4 ++++ | ||
38 | target/arm/kvm64.c | 6 ++---- | ||
39 | 2 files changed, 6 insertions(+), 4 deletions(-) | ||
40 | |||
41 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
42 | index XXXXXXX..XXXXXXX 100644 | ||
43 | --- a/target/arm/helper.c | ||
44 | +++ b/target/arm/helper.c | ||
45 | @@ -XXX,XX +XXX,XX @@ static void handle_semihosting(CPUState *cs) | ||
46 | * Do any appropriate logging, handle PSCI calls, and then hand off | ||
47 | * to the AArch64-entry or AArch32-entry function depending on the | ||
48 | * target exception level's register width. | ||
49 | + * | ||
50 | + * Note: this is used for both TCG (as the do_interrupt tcg op), | ||
51 | + * and KVM to re-inject guest debug exceptions, and to | ||
52 | + * inject a Synchronous-External-Abort. | ||
53 | */ | ||
54 | void arm_cpu_do_interrupt(CPUState *cs) | ||
55 | { | ||
56 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c | ||
57 | index XXXXXXX..XXXXXXX 100644 | ||
58 | --- a/target/arm/kvm64.c | ||
59 | +++ b/target/arm/kvm64.c | ||
60 | @@ -XXX,XX +XXX,XX @@ static void kvm_inject_arm_sea(CPUState *c) | ||
61 | { | ||
62 | ARMCPU *cpu = ARM_CPU(c); | ||
63 | CPUARMState *env = &cpu->env; | ||
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 | |||
76 | #define AARCH64_CORE_REG(x) (KVM_REG_ARM64 | KVM_REG_SIZE_U64 | \ | ||
77 | @@ -XXX,XX +XXX,XX @@ bool kvm_arm_handle_debug(CPUState *cs, struct kvm_debug_exit_arch *debug_exit) | ||
78 | { | ||
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 | -- | ||
95 | 2.25.1 | ||
96 | |||
97 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Claudio Fontana <cfontana@suse.de> | ||
2 | 1 | ||
3 | Signed-off-by: Claudio Fontana <cfontana@suse.de> | ||
4 | Reviewed-by: Alex Bennée <alex.bennee@linaro.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> | ||
8 | --- | ||
9 | include/hw/core/cpu.h | 4 ++-- | ||
10 | accel/tcg/cpu-exec.c | 4 ++-- | ||
11 | target/alpha/cpu.c | 2 +- | ||
12 | target/arm/cpu.c | 4 ++-- | ||
13 | target/arm/cpu_tcg.c | 9 ++++----- | ||
14 | target/avr/cpu.c | 2 +- | ||
15 | target/avr/helper.c | 4 ++-- | ||
16 | target/cris/cpu.c | 12 ++++++------ | ||
17 | target/cris/helper.c | 4 ++-- | ||
18 | target/hppa/cpu.c | 2 +- | ||
19 | target/i386/tcg/tcg-cpu.c | 2 +- | ||
20 | target/lm32/cpu.c | 2 +- | ||
21 | target/m68k/cpu.c | 2 +- | ||
22 | target/microblaze/cpu.c | 2 +- | ||
23 | target/mips/cpu.c | 4 ++-- | ||
24 | target/moxie/cpu.c | 2 +- | ||
25 | target/nios2/cpu.c | 2 +- | ||
26 | target/openrisc/cpu.c | 2 +- | ||
27 | target/riscv/cpu.c | 2 +- | ||
28 | target/rx/cpu.c | 2 +- | ||
29 | target/s390x/cpu.c | 2 +- | ||
30 | target/sh4/cpu.c | 2 +- | ||
31 | target/sparc/cpu.c | 2 +- | ||
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 | |||
38 | diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/include/hw/core/cpu.h | ||
41 | +++ 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 { | ||
60 | |||
61 | int reset_dump_flags; | ||
62 | bool (*has_work)(CPUState *cpu); | ||
63 | - void (*do_interrupt)(CPUState *cpu); | ||
64 | void (*do_unaligned_access)(CPUState *cpu, vaddr addr, | ||
65 | MMUAccessType access_type, | ||
66 | int mmu_idx, uintptr_t retaddr); | ||
67 | diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c | ||
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 | ||
90 | index XXXXXXX..XXXXXXX 100644 | ||
91 | --- a/target/alpha/cpu.c | ||
92 | +++ b/target/alpha/cpu.c | ||
93 | @@ -XXX,XX +XXX,XX @@ static void alpha_cpu_class_init(ObjectClass *oc, void *data) | ||
94 | |||
95 | cc->class_by_name = alpha_cpu_class_by_name; | ||
96 | cc->has_work = alpha_cpu_has_work; | ||
97 | - cc->do_interrupt = alpha_cpu_do_interrupt; | ||
98 | + cc->tcg_ops.do_interrupt = alpha_cpu_do_interrupt; | ||
99 | cc->tcg_ops.cpu_exec_interrupt = alpha_cpu_exec_interrupt; | ||
100 | cc->dump_state = alpha_cpu_dump_state; | ||
101 | cc->set_pc = alpha_cpu_set_pc; | ||
102 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
103 | index XXXXXXX..XXXXXXX 100644 | ||
104 | --- a/target/arm/cpu.c | ||
105 | +++ b/target/arm/cpu.c | ||
106 | @@ -XXX,XX +XXX,XX @@ bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request) | ||
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 | ||
130 | } | ||
131 | diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c | ||
132 | index XXXXXXX..XXXXXXX 100644 | ||
133 | --- a/target/arm/cpu_tcg.c | ||
134 | +++ b/target/arm/cpu_tcg.c | ||
135 | @@ -XXX,XX +XXX,XX @@ static bool arm_v7m_cpu_exec_interrupt(CPUState *cs, int interrupt_request) | ||
136 | if (interrupt_request & CPU_INTERRUPT_HARD | ||
137 | && (armv7m_nvic_can_take_pending_exception(env->nvic))) { | ||
138 | cs->exception_index = EXCP_IRQ; | ||
139 | - cc->do_interrupt(cs); | ||
140 | + cc->tcg_ops.do_interrupt(cs); | ||
141 | ret = true; | ||
142 | } | ||
143 | return ret; | ||
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 | ||
161 | index XXXXXXX..XXXXXXX 100644 | ||
162 | --- a/target/avr/cpu.c | ||
163 | +++ b/target/avr/cpu.c | ||
164 | @@ -XXX,XX +XXX,XX @@ static void avr_cpu_class_init(ObjectClass *oc, void *data) | ||
165 | cc->class_by_name = avr_cpu_class_by_name; | ||
166 | |||
167 | cc->has_work = avr_cpu_has_work; | ||
168 | - cc->do_interrupt = avr_cpu_do_interrupt; | ||
169 | + cc->tcg_ops.do_interrupt = avr_cpu_do_interrupt; | ||
170 | cc->tcg_ops.cpu_exec_interrupt = avr_cpu_exec_interrupt; | ||
171 | cc->dump_state = avr_cpu_dump_state; | ||
172 | cc->set_pc = avr_cpu_set_pc; | ||
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 | ||
196 | index XXXXXXX..XXXXXXX 100644 | ||
197 | --- a/target/cris/cpu.c | ||
198 | +++ b/target/cris/cpu.c | ||
199 | @@ -XXX,XX +XXX,XX @@ static void crisv8_cpu_class_init(ObjectClass *oc, void *data) | ||
200 | CRISCPUClass *ccc = CRIS_CPU_CLASS(oc); | ||
201 | |||
202 | ccc->vr = 8; | ||
203 | - cc->do_interrupt = crisv10_cpu_do_interrupt; | ||
204 | + cc->tcg_ops.do_interrupt = crisv10_cpu_do_interrupt; | ||
205 | cc->gdb_read_register = crisv10_cpu_gdb_read_register; | ||
206 | cc->tcg_ops.initialize = cris_initialize_crisv10_tcg; | ||
207 | } | ||
208 | @@ -XXX,XX +XXX,XX @@ static void crisv9_cpu_class_init(ObjectClass *oc, void *data) | ||
209 | CRISCPUClass *ccc = CRIS_CPU_CLASS(oc); | ||
210 | |||
211 | ccc->vr = 9; | ||
212 | - cc->do_interrupt = crisv10_cpu_do_interrupt; | ||
213 | + cc->tcg_ops.do_interrupt = crisv10_cpu_do_interrupt; | ||
214 | cc->gdb_read_register = crisv10_cpu_gdb_read_register; | ||
215 | cc->tcg_ops.initialize = cris_initialize_crisv10_tcg; | ||
216 | } | ||
217 | @@ -XXX,XX +XXX,XX @@ static void crisv10_cpu_class_init(ObjectClass *oc, void *data) | ||
218 | CRISCPUClass *ccc = CRIS_CPU_CLASS(oc); | ||
219 | |||
220 | ccc->vr = 10; | ||
221 | - cc->do_interrupt = crisv10_cpu_do_interrupt; | ||
222 | + cc->tcg_ops.do_interrupt = crisv10_cpu_do_interrupt; | ||
223 | cc->gdb_read_register = crisv10_cpu_gdb_read_register; | ||
224 | cc->tcg_ops.initialize = cris_initialize_crisv10_tcg; | ||
225 | } | ||
226 | @@ -XXX,XX +XXX,XX @@ static void crisv11_cpu_class_init(ObjectClass *oc, void *data) | ||
227 | CRISCPUClass *ccc = CRIS_CPU_CLASS(oc); | ||
228 | |||
229 | ccc->vr = 11; | ||
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 | ||
276 | index XXXXXXX..XXXXXXX 100644 | ||
277 | --- a/target/hppa/cpu.c | ||
278 | +++ b/target/hppa/cpu.c | ||
279 | @@ -XXX,XX +XXX,XX @@ static void hppa_cpu_class_init(ObjectClass *oc, void *data) | ||
280 | |||
281 | cc->class_by_name = hppa_cpu_class_by_name; | ||
282 | cc->has_work = hppa_cpu_has_work; | ||
283 | - cc->do_interrupt = hppa_cpu_do_interrupt; | ||
284 | + cc->tcg_ops.do_interrupt = hppa_cpu_do_interrupt; | ||
285 | cc->tcg_ops.cpu_exec_interrupt = hppa_cpu_exec_interrupt; | ||
286 | cc->dump_state = hppa_cpu_dump_state; | ||
287 | cc->set_pc = hppa_cpu_set_pc; | ||
288 | diff --git a/target/i386/tcg/tcg-cpu.c b/target/i386/tcg/tcg-cpu.c | ||
289 | index XXXXXXX..XXXXXXX 100644 | ||
290 | --- a/target/i386/tcg/tcg-cpu.c | ||
291 | +++ b/target/i386/tcg/tcg-cpu.c | ||
292 | @@ -XXX,XX +XXX,XX @@ static void x86_cpu_synchronize_from_tb(CPUState *cs, | ||
293 | |||
294 | void tcg_cpu_common_class_init(CPUClass *cc) | ||
295 | { | ||
296 | - cc->do_interrupt = x86_cpu_do_interrupt; | ||
297 | + cc->tcg_ops.do_interrupt = x86_cpu_do_interrupt; | ||
298 | cc->tcg_ops.cpu_exec_interrupt = x86_cpu_exec_interrupt; | ||
299 | cc->tcg_ops.synchronize_from_tb = x86_cpu_synchronize_from_tb; | ||
300 | cc->tcg_ops.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 | ||
315 | index XXXXXXX..XXXXXXX 100644 | ||
316 | --- a/target/m68k/cpu.c | ||
317 | +++ b/target/m68k/cpu.c | ||
318 | @@ -XXX,XX +XXX,XX @@ static void m68k_cpu_class_init(ObjectClass *c, void *data) | ||
319 | |||
320 | cc->class_by_name = m68k_cpu_class_by_name; | ||
321 | cc->has_work = m68k_cpu_has_work; | ||
322 | - cc->do_interrupt = m68k_cpu_do_interrupt; | ||
323 | + cc->tcg_ops.do_interrupt = m68k_cpu_do_interrupt; | ||
324 | cc->tcg_ops.cpu_exec_interrupt = m68k_cpu_exec_interrupt; | ||
325 | cc->dump_state = m68k_cpu_dump_state; | ||
326 | cc->set_pc = m68k_cpu_set_pc; | ||
327 | diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c | ||
328 | index XXXXXXX..XXXXXXX 100644 | ||
329 | --- a/target/microblaze/cpu.c | ||
330 | +++ b/target/microblaze/cpu.c | ||
331 | @@ -XXX,XX +XXX,XX @@ static void mb_cpu_class_init(ObjectClass *oc, void *data) | ||
332 | |||
333 | cc->class_by_name = mb_cpu_class_by_name; | ||
334 | cc->has_work = mb_cpu_has_work; | ||
335 | - cc->do_interrupt = mb_cpu_do_interrupt; | ||
336 | + cc->tcg_ops.do_interrupt = mb_cpu_do_interrupt; | ||
337 | cc->do_unaligned_access = mb_cpu_do_unaligned_access; | ||
338 | cc->tcg_ops.cpu_exec_interrupt = mb_cpu_exec_interrupt; | ||
339 | cc->dump_state = mb_cpu_dump_state; | ||
340 | diff --git a/target/mips/cpu.c b/target/mips/cpu.c | ||
341 | index XXXXXXX..XXXXXXX 100644 | ||
342 | --- a/target/mips/cpu.c | ||
343 | +++ b/target/mips/cpu.c | ||
344 | @@ -XXX,XX +XXX,XX @@ static void mips_cpu_class_init(ObjectClass *c, void *data) | ||
345 | |||
346 | cc->class_by_name = mips_cpu_class_by_name; | ||
347 | cc->has_work = mips_cpu_has_work; | ||
348 | - cc->do_interrupt = mips_cpu_do_interrupt; | ||
349 | cc->dump_state = mips_cpu_dump_state; | ||
350 | cc->set_pc = mips_cpu_set_pc; | ||
351 | cc->gdb_read_register = mips_cpu_gdb_read_register; | ||
352 | @@ -XXX,XX +XXX,XX @@ static void mips_cpu_class_init(ObjectClass *c, void *data) | ||
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 | ||
379 | index XXXXXXX..XXXXXXX 100644 | ||
380 | --- a/target/nios2/cpu.c | ||
381 | +++ b/target/nios2/cpu.c | ||
382 | @@ -XXX,XX +XXX,XX @@ static void nios2_cpu_class_init(ObjectClass *oc, void *data) | ||
383 | |||
384 | cc->class_by_name = nios2_cpu_class_by_name; | ||
385 | cc->has_work = nios2_cpu_has_work; | ||
386 | - cc->do_interrupt = nios2_cpu_do_interrupt; | ||
387 | + cc->tcg_ops.do_interrupt = nios2_cpu_do_interrupt; | ||
388 | cc->tcg_ops.cpu_exec_interrupt = nios2_cpu_exec_interrupt; | ||
389 | cc->dump_state = nios2_cpu_dump_state; | ||
390 | cc->set_pc = nios2_cpu_set_pc; | ||
391 | diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c | ||
392 | index XXXXXXX..XXXXXXX 100644 | ||
393 | --- a/target/openrisc/cpu.c | ||
394 | +++ b/target/openrisc/cpu.c | ||
395 | @@ -XXX,XX +XXX,XX @@ static void openrisc_cpu_class_init(ObjectClass *oc, void *data) | ||
396 | |||
397 | cc->class_by_name = openrisc_cpu_class_by_name; | ||
398 | cc->has_work = openrisc_cpu_has_work; | ||
399 | - cc->do_interrupt = openrisc_cpu_do_interrupt; | ||
400 | + cc->tcg_ops.do_interrupt = openrisc_cpu_do_interrupt; | ||
401 | cc->tcg_ops.cpu_exec_interrupt = openrisc_cpu_exec_interrupt; | ||
402 | cc->dump_state = openrisc_cpu_dump_state; | ||
403 | cc->set_pc = openrisc_cpu_set_pc; | ||
404 | diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c | ||
405 | index XXXXXXX..XXXXXXX 100644 | ||
406 | --- a/target/riscv/cpu.c | ||
407 | +++ b/target/riscv/cpu.c | ||
408 | @@ -XXX,XX +XXX,XX @@ static void riscv_cpu_class_init(ObjectClass *c, void *data) | ||
409 | |||
410 | cc->class_by_name = riscv_cpu_class_by_name; | ||
411 | cc->has_work = riscv_cpu_has_work; | ||
412 | - cc->do_interrupt = riscv_cpu_do_interrupt; | ||
413 | + cc->tcg_ops.do_interrupt = riscv_cpu_do_interrupt; | ||
414 | cc->tcg_ops.cpu_exec_interrupt = riscv_cpu_exec_interrupt; | ||
415 | cc->dump_state = riscv_cpu_dump_state; | ||
416 | cc->set_pc = riscv_cpu_set_pc; | ||
417 | diff --git a/target/rx/cpu.c b/target/rx/cpu.c | ||
418 | index XXXXXXX..XXXXXXX 100644 | ||
419 | --- a/target/rx/cpu.c | ||
420 | +++ b/target/rx/cpu.c | ||
421 | @@ -XXX,XX +XXX,XX @@ static void rx_cpu_class_init(ObjectClass *klass, void *data) | ||
422 | |||
423 | cc->class_by_name = rx_cpu_class_by_name; | ||
424 | cc->has_work = rx_cpu_has_work; | ||
425 | - cc->do_interrupt = rx_cpu_do_interrupt; | ||
426 | + cc->tcg_ops.do_interrupt = rx_cpu_do_interrupt; | ||
427 | cc->tcg_ops.cpu_exec_interrupt = rx_cpu_exec_interrupt; | ||
428 | cc->dump_state = rx_cpu_dump_state; | ||
429 | cc->set_pc = rx_cpu_set_pc; | ||
430 | diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c | ||
431 | index XXXXXXX..XXXXXXX 100644 | ||
432 | --- a/target/s390x/cpu.c | ||
433 | +++ b/target/s390x/cpu.c | ||
434 | @@ -XXX,XX +XXX,XX @@ static void s390_cpu_class_init(ObjectClass *oc, void *data) | ||
435 | cc->class_by_name = s390_cpu_class_by_name, | ||
436 | cc->has_work = s390_cpu_has_work; | ||
437 | #ifdef CONFIG_TCG | ||
438 | - cc->do_interrupt = s390_cpu_do_interrupt; | ||
439 | + cc->tcg_ops.do_interrupt = s390_cpu_do_interrupt; | ||
440 | #endif | ||
441 | cc->dump_state = s390_cpu_dump_state; | ||
442 | cc->set_pc = s390_cpu_set_pc; | ||
443 | diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c | ||
444 | index XXXXXXX..XXXXXXX 100644 | ||
445 | --- a/target/sh4/cpu.c | ||
446 | +++ b/target/sh4/cpu.c | ||
447 | @@ -XXX,XX +XXX,XX @@ static void superh_cpu_class_init(ObjectClass *oc, void *data) | ||
448 | |||
449 | cc->class_by_name = superh_cpu_class_by_name; | ||
450 | cc->has_work = superh_cpu_has_work; | ||
451 | - cc->do_interrupt = superh_cpu_do_interrupt; | ||
452 | + cc->tcg_ops.do_interrupt = superh_cpu_do_interrupt; | ||
453 | cc->tcg_ops.cpu_exec_interrupt = superh_cpu_exec_interrupt; | ||
454 | cc->dump_state = superh_cpu_dump_state; | ||
455 | cc->set_pc = superh_cpu_set_pc; | ||
456 | diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c | ||
457 | index XXXXXXX..XXXXXXX 100644 | ||
458 | --- a/target/sparc/cpu.c | ||
459 | +++ b/target/sparc/cpu.c | ||
460 | @@ -XXX,XX +XXX,XX @@ static void sparc_cpu_class_init(ObjectClass *oc, void *data) | ||
461 | cc->class_by_name = sparc_cpu_class_by_name; | ||
462 | cc->parse_features = sparc_cpu_parse_features; | ||
463 | cc->has_work = sparc_cpu_has_work; | ||
464 | - cc->do_interrupt = sparc_cpu_do_interrupt; | ||
465 | + cc->tcg_ops.do_interrupt = sparc_cpu_do_interrupt; | ||
466 | cc->tcg_ops.cpu_exec_interrupt = sparc_cpu_exec_interrupt; | ||
467 | cc->dump_state = sparc_cpu_dump_state; | ||
468 | #if !defined(TARGET_SPARC64) && !defined(CONFIG_USER_ONLY) | ||
469 | diff --git a/target/tilegx/cpu.c b/target/tilegx/cpu.c | ||
470 | index XXXXXXX..XXXXXXX 100644 | ||
471 | --- a/target/tilegx/cpu.c | ||
472 | +++ b/target/tilegx/cpu.c | ||
473 | @@ -XXX,XX +XXX,XX @@ static void tilegx_cpu_class_init(ObjectClass *oc, void *data) | ||
474 | |||
475 | cc->class_by_name = tilegx_cpu_class_by_name; | ||
476 | cc->has_work = tilegx_cpu_has_work; | ||
477 | - cc->do_interrupt = tilegx_cpu_do_interrupt; | ||
478 | + cc->tcg_ops.do_interrupt = tilegx_cpu_do_interrupt; | ||
479 | cc->tcg_ops.cpu_exec_interrupt = tilegx_cpu_exec_interrupt; | ||
480 | cc->dump_state = tilegx_cpu_dump_state; | ||
481 | cc->set_pc = tilegx_cpu_set_pc; | ||
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 | ||
496 | index XXXXXXX..XXXXXXX 100644 | ||
497 | --- a/target/xtensa/cpu.c | ||
498 | +++ b/target/xtensa/cpu.c | ||
499 | @@ -XXX,XX +XXX,XX @@ static void xtensa_cpu_class_init(ObjectClass *oc, void *data) | ||
500 | |||
501 | cc->class_by_name = xtensa_cpu_class_by_name; | ||
502 | cc->has_work = xtensa_cpu_has_work; | ||
503 | - cc->do_interrupt = xtensa_cpu_do_interrupt; | ||
504 | + cc->tcg_ops.do_interrupt = xtensa_cpu_do_interrupt; | ||
505 | cc->tcg_ops.cpu_exec_interrupt = xtensa_cpu_exec_interrupt; | ||
506 | cc->dump_state = xtensa_cpu_dump_state; | ||
507 | cc->set_pc = xtensa_cpu_set_pc; | ||
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 | -- | ||
529 | 2.25.1 | ||
530 | |||
531 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Claudio Fontana <cfontana@suse.de> | ||
2 | 1 | ||
3 | Signed-off-by: Claudio Fontana <cfontana@suse.de> | ||
4 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
5 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | |||
8 | [claudio: wrap target code around CONFIG_TCG and !CONFIG_USER_ONLY] | ||
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 | ||
32 | --- a/include/hw/core/cpu.h | ||
33 | +++ b/include/hw/core/cpu.h | ||
34 | @@ -XXX,XX +XXX,XX @@ typedef struct TcgCpuOperations { | ||
35 | /** @debug_excp_handler: Callback for handling debug exceptions */ | ||
36 | void (*debug_excp_handler)(CPUState *cpu); | ||
37 | |||
38 | + /** | ||
39 | + * @do_transaction_failed: Callback for handling failed memory transactions | ||
40 | + * (ie bus faults or external aborts; not MMU faults) | ||
41 | + */ | ||
42 | + void (*do_transaction_failed)(CPUState *cpu, hwaddr physaddr, vaddr addr, | ||
43 | + unsigned size, MMUAccessType access_type, | ||
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 | ||
100 | index XXXXXXX..XXXXXXX 100644 | ||
101 | --- a/hw/mips/jazz.c | ||
102 | +++ b/hw/mips/jazz.c | ||
103 | @@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps dma_dummy_ops = { | ||
104 | #define MAGNUM_BIOS_SIZE_MAX 0x7e000 | ||
105 | #define MAGNUM_BIOS_SIZE \ | ||
106 | (BIOS_SIZE < MAGNUM_BIOS_SIZE_MAX ? BIOS_SIZE : MAGNUM_BIOS_SIZE_MAX) | ||
107 | + | ||
108 | +#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY) | ||
109 | static void (*real_do_transaction_failed)(CPUState *cpu, hwaddr physaddr, | ||
110 | vaddr addr, unsigned size, | ||
111 | MMUAccessType access_type, | ||
112 | @@ -XXX,XX +XXX,XX @@ static void mips_jazz_do_transaction_failed(CPUState *cs, hwaddr physaddr, | ||
113 | (*real_do_transaction_failed)(cs, physaddr, addr, size, access_type, | ||
114 | mmu_idx, attrs, response, retaddr); | ||
115 | } | ||
116 | +#endif /* CONFIG_TCG && !CONFIG_USER_ONLY */ | ||
117 | |||
118 | static void mips_jazz_init(MachineState *machine, | ||
119 | enum jazz_model_e jazz_model) | ||
120 | @@ -XXX,XX +XXX,XX @@ static void mips_jazz_init(MachineState *machine, | ||
121 | * memory region that catches all memory accesses, as we do on Malta. | ||
122 | */ | ||
123 | cc = CPU_GET_CLASS(cpu); | ||
124 | - real_do_transaction_failed = cc->do_transaction_failed; | ||
125 | - cc->do_transaction_failed = mips_jazz_do_transaction_failed; | ||
126 | +#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY) | ||
127 | + real_do_transaction_failed = cc->tcg_ops.do_transaction_failed; | ||
128 | + cc->tcg_ops.do_transaction_failed = mips_jazz_do_transaction_failed; | ||
129 | +#endif /* CONFIG_TCG && !CONFIG_USER_ONLY */ | ||
130 | |||
131 | /* allocate RAM */ | ||
132 | memory_region_add_subregion(address_space, 0, machine->ram); | ||
133 | diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c | ||
134 | index XXXXXXX..XXXXXXX 100644 | ||
135 | --- a/target/alpha/cpu.c | ||
136 | +++ b/target/alpha/cpu.c | ||
137 | @@ -XXX,XX +XXX,XX @@ static void alpha_cpu_class_init(ObjectClass *oc, void *data) | ||
138 | cc->gdb_write_register = alpha_cpu_gdb_write_register; | ||
139 | cc->tcg_ops.tlb_fill = alpha_cpu_tlb_fill; | ||
140 | #ifndef CONFIG_USER_ONLY | ||
141 | - cc->do_transaction_failed = alpha_cpu_do_transaction_failed; | ||
142 | + cc->tcg_ops.do_transaction_failed = alpha_cpu_do_transaction_failed; | ||
143 | cc->do_unaligned_access = alpha_cpu_do_unaligned_access; | ||
144 | cc->get_phys_page_debug = alpha_cpu_get_phys_page_debug; | ||
145 | dc->vmsd = &vmstate_alpha_cpu; | ||
146 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
147 | index XXXXXXX..XXXXXXX 100644 | ||
148 | --- a/target/arm/cpu.c | ||
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 | } | ||
280 | } | ||
281 | -#endif | ||
282 | +#endif /* !CONFIG_USER_ONLY */ | ||
283 | -- | ||
284 | 2.25.1 | ||
285 | |||
286 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Claudio Fontana <cfontana@suse.de> | ||
2 | 1 | ||
3 | make it consistently SOFTMMU-only. | ||
4 | |||
5 | Signed-off-by: Claudio Fontana <cfontana@suse.de> | ||
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> | ||
9 | |||
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> | ||
14 | --- | ||
15 | include/hw/core/cpu.h | 13 +++++++------ | ||
16 | target/alpha/cpu.c | 2 +- | ||
17 | target/arm/cpu.c | 2 +- | ||
18 | target/hppa/cpu.c | 4 +++- | ||
19 | target/microblaze/cpu.c | 2 +- | ||
20 | target/mips/cpu.c | 3 ++- | ||
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 | |||
31 | diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/include/hw/core/cpu.h | ||
34 | +++ b/include/hw/core/cpu.h | ||
35 | @@ -XXX,XX +XXX,XX @@ typedef struct TcgCpuOperations { | ||
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. | ||
50 | * @reset_dump_flags: #CPUDumpFlags to use for reset logging. | ||
51 | * @has_work: Callback for checking if there is work to do. | ||
52 | - * @do_unaligned_access: Callback for unaligned access handling, if | ||
53 | - * the target defines #TARGET_ALIGNED_ONLY. | ||
54 | * @virtio_is_big_endian: Callback to return %true if a CPU which supports | ||
55 | * runtime configurable endianness is currently big-endian. Non-configurable | ||
56 | * CPUs can use the default implementation of this method. This method should | ||
57 | @@ -XXX,XX +XXX,XX @@ struct CPUClass { | ||
58 | |||
59 | int reset_dump_flags; | ||
60 | bool (*has_work)(CPUState *cpu); | ||
61 | - void (*do_unaligned_access)(CPUState *cpu, vaddr addr, | ||
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, | ||
66 | uint8_t *buf, int len, bool is_write); | ||
67 | @@ -XXX,XX +XXX,XX @@ static inline void cpu_unaligned_access(CPUState *cpu, vaddr addr, | ||
68 | { | ||
69 | CPUClass *cc = CPU_GET_CLASS(cpu); | ||
70 | |||
71 | - cc->do_unaligned_access(cpu, addr, access_type, mmu_idx, retaddr); | ||
72 | + cc->tcg_ops.do_unaligned_access(cpu, addr, access_type, mmu_idx, retaddr); | ||
73 | } | ||
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 | ||
90 | index XXXXXXX..XXXXXXX 100644 | ||
91 | --- a/target/arm/cpu.c | ||
92 | +++ b/target/arm/cpu.c | ||
93 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) | ||
94 | cc->tcg_ops.tlb_fill = arm_cpu_tlb_fill; | ||
95 | cc->tcg_ops.debug_excp_handler = arm_debug_excp_handler; | ||
96 | cc->debug_check_watchpoint = arm_debug_check_watchpoint; | ||
97 | - cc->do_unaligned_access = arm_cpu_do_unaligned_access; | ||
98 | #if !defined(CONFIG_USER_ONLY) | ||
99 | cc->tcg_ops.do_transaction_failed = arm_cpu_do_transaction_failed; | ||
100 | + cc->tcg_ops.do_unaligned_access = arm_cpu_do_unaligned_access; | ||
101 | cc->adjust_watchpoint_address = arm_adjust_watchpoint_address; | ||
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 | ||
106 | --- a/target/hppa/cpu.c | ||
107 | +++ b/target/hppa/cpu.c | ||
108 | @@ -XXX,XX +XXX,XX @@ static void hppa_cpu_disas_set_info(CPUState *cs, disassemble_info *info) | ||
109 | info->print_insn = print_insn_hppa; | ||
110 | } | ||
111 | |||
112 | +#ifndef CONFIG_USER_ONLY | ||
113 | static void hppa_cpu_do_unaligned_access(CPUState *cs, vaddr addr, | ||
114 | MMUAccessType access_type, | ||
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 | ||
131 | - cc->do_unaligned_access = hppa_cpu_do_unaligned_access; | ||
132 | cc->disas_set_info = hppa_cpu_disas_set_info; | ||
133 | cc->tcg_ops.initialize = hppa_translate_init; | ||
134 | |||
135 | diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c | ||
136 | index XXXXXXX..XXXXXXX 100644 | ||
137 | --- a/target/microblaze/cpu.c | ||
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 | ||
155 | diff --git a/target/mips/cpu.c b/target/mips/cpu.c | ||
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 | |||
284 | -- | ||
285 | 2.25.1 | ||
286 | |||
287 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Claudio Fontana <cfontana@suse.de> | ||
2 | 1 | ||
3 | cpu_check_watchpoint, watchpoint_address_matches are TCG-only. | ||
4 | |||
5 | Signed-off-by: Claudio Fontana <cfontana@suse.de> | ||
6 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
7 | Message-Id: <20210204163931.7358-13-cfontana@suse.de> | ||
8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | --- | ||
10 | softmmu/physmem.c | 141 +++++++++++++++++++++++----------------------- | ||
11 | 1 file changed, 72 insertions(+), 69 deletions(-) | ||
12 | |||
13 | diff --git a/softmmu/physmem.c b/softmmu/physmem.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/softmmu/physmem.c | ||
16 | +++ b/softmmu/physmem.c | ||
17 | @@ -XXX,XX +XXX,XX @@ void cpu_watchpoint_remove_all(CPUState *cpu, int mask) | ||
18 | } | ||
19 | } | ||
20 | |||
21 | +#ifdef CONFIG_TCG | ||
22 | /* Return true if this watchpoint address matches the specified | ||
23 | * access (ie the address range covered by the watchpoint overlaps | ||
24 | * partially or completely with the address range covered by the | ||
25 | @@ -XXX,XX +XXX,XX @@ int cpu_watchpoint_address_matches(CPUState *cpu, vaddr addr, vaddr len) | ||
26 | return ret; | ||
27 | } | ||
28 | |||
29 | +/* Generate a debug exception if a watchpoint has been hit. */ | ||
30 | +void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len, | ||
31 | + MemTxAttrs attrs, int flags, uintptr_t ra) | ||
32 | +{ | ||
33 | + CPUClass *cc = CPU_GET_CLASS(cpu); | ||
34 | + CPUWatchpoint *wp; | ||
35 | + | ||
36 | + assert(tcg_enabled()); | ||
37 | + if (cpu->watchpoint_hit) { | ||
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; | ||
47 | + } | ||
48 | + | ||
49 | + addr = cc->adjust_watchpoint_address(cpu, addr, len); | ||
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 | +} | ||
97 | + | ||
98 | +#endif /* CONFIG_TCG */ | ||
99 | + | ||
100 | /* Called from RCU critical section */ | ||
101 | static RAMBlock *qemu_get_ram_block(ram_addr_t addr) | ||
102 | { | ||
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 | -- | ||
180 | 2.25.1 | ||
181 | |||
182 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Claudio Fontana <cfontana@suse.de> | ||
2 | 1 | ||
3 | commit 40612000599e ("arm: Correctly handle watchpoints for BE32 CPUs") | ||
4 | |||
5 | introduced this ARM-specific, TCG-specific hack to adjust the address, | ||
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> | ||
14 | --- | ||
15 | include/hw/core/cpu.h | 6 +++++- | ||
16 | hw/core/cpu.c | 6 ------ | ||
17 | softmmu/physmem.c | 5 ++++- | ||
18 | target/arm/cpu.c | 2 +- | ||
19 | 4 files changed, 10 insertions(+), 9 deletions(-) | ||
20 | |||
21 | diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/include/hw/core/cpu.h | ||
24 | +++ b/include/hw/core/cpu.h | ||
25 | @@ -XXX,XX +XXX,XX @@ typedef struct TcgCpuOperations { | ||
26 | void (*do_unaligned_access)(CPUState *cpu, vaddr addr, | ||
27 | MMUAccessType access_type, | ||
28 | int mmu_idx, uintptr_t retaddr); | ||
29 | + /** | ||
30 | + * @adjust_watchpoint_address: hack for cpu_check_watchpoint used by ARM | ||
31 | + */ | ||
32 | + vaddr (*adjust_watchpoint_address)(CPUState *cpu, vaddr addr, int len); | ||
33 | + | ||
34 | } TcgCpuOperations; | ||
35 | |||
36 | /** | ||
37 | @@ -XXX,XX +XXX,XX @@ struct CPUClass { | ||
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 | ||
47 | --- a/hw/core/cpu.c | ||
48 | +++ b/hw/core/cpu.c | ||
49 | @@ -XXX,XX +XXX,XX @@ static int64_t cpu_common_get_arch_id(CPUState *cpu) | ||
50 | return cpu->cpu_index; | ||
51 | } | ||
52 | |||
53 | -static vaddr cpu_adjust_watchpoint_address(CPUState *cpu, vaddr addr, int len) | ||
54 | -{ | ||
55 | - return addr; | ||
56 | -} | ||
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; | ||
75 | } | ||
76 | |||
77 | - addr = cc->adjust_watchpoint_address(cpu, addr, len); | ||
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 | ||
87 | --- a/target/arm/cpu.c | ||
88 | +++ b/target/arm/cpu.c | ||
89 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) | ||
90 | #if !defined(CONFIG_USER_ONLY) | ||
91 | cc->tcg_ops.do_transaction_failed = arm_cpu_do_transaction_failed; | ||
92 | cc->tcg_ops.do_unaligned_access = arm_cpu_do_unaligned_access; | ||
93 | - cc->adjust_watchpoint_address = arm_adjust_watchpoint_address; | ||
94 | + cc->tcg_ops.adjust_watchpoint_address = arm_adjust_watchpoint_address; | ||
95 | cc->tcg_ops.do_interrupt = arm_cpu_do_interrupt; | ||
96 | #endif /* CONFIG_TCG && !CONFIG_USER_ONLY */ | ||
97 | #endif /* CONFIG_TCG */ | ||
98 | -- | ||
99 | 2.25.1 | ||
100 | |||
101 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Claudio Fontana <cfontana@suse.de> | ||
2 | 1 | ||
3 | commit 568496c0c0f1 ("cpu: Add callback to check architectural") and | ||
4 | commit 3826121d9298 ("target-arm: Implement checking of fired") | ||
5 | introduced an ARM-specific hack for cpu_check_watchpoint. | ||
6 | |||
7 | Make debug_check_watchpoint optional, and move it to tcg_ops. | ||
8 | |||
9 | Signed-off-by: Claudio Fontana <cfontana@suse.de> | ||
10 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
11 | Message-Id: <20210204163931.7358-15-cfontana@suse.de> | ||
12 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | --- | ||
14 | include/hw/core/cpu.h | 9 ++++++--- | ||
15 | accel/tcg/user-exec.c | 3 ++- | ||
16 | hw/core/cpu.c | 9 --------- | ||
17 | softmmu/physmem.c | 4 ++-- | ||
18 | target/arm/cpu.c | 4 ++-- | ||
19 | 5 files changed, 12 insertions(+), 17 deletions(-) | ||
20 | |||
21 | diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h | ||
22 | index XXXXXXX..XXXXXXX 100644 | ||
23 | --- a/include/hw/core/cpu.h | ||
24 | +++ b/include/hw/core/cpu.h | ||
25 | @@ -XXX,XX +XXX,XX @@ typedef struct TcgCpuOperations { | ||
26 | */ | ||
27 | vaddr (*adjust_watchpoint_address)(CPUState *cpu, vaddr addr, int len); | ||
28 | |||
29 | + /** | ||
30 | + * @debug_check_watchpoint: return true if the architectural | ||
31 | + * watchpoint whose address has matched should really fire, used by ARM | ||
32 | + */ | ||
33 | + bool (*debug_check_watchpoint)(CPUState *cpu, CPUWatchpoint *wp); | ||
34 | + | ||
35 | } TcgCpuOperations; | ||
36 | |||
37 | /** | ||
38 | @@ -XXX,XX +XXX,XX @@ typedef struct TcgCpuOperations { | ||
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 | ||
57 | --- a/accel/tcg/user-exec.c | ||
58 | +++ b/accel/tcg/user-exec.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) | ||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | -static bool cpu_common_debug_check_watchpoint(CPUState *cpu, CPUWatchpoint *wp) | ||
78 | -{ | ||
79 | - /* If no extra check is required, QEMU watchpoint match can be considered | ||
80 | - * as an architectural match. | ||
81 | - */ | ||
82 | - return true; | ||
83 | -} | ||
84 | - | ||
85 | static bool cpu_common_virtio_is_big_endian(CPUState *cpu) | ||
86 | { | ||
87 | return target_words_bigendian(); | ||
88 | @@ -XXX,XX +XXX,XX @@ static void cpu_class_init(ObjectClass *klass, void *data) | ||
89 | k->gdb_read_register = cpu_common_gdb_read_register; | ||
90 | k->gdb_write_register = cpu_common_gdb_write_register; | ||
91 | 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); | ||
94 | dc->realize = cpu_common_realizefn; | ||
95 | dc->unrealize = cpu_common_unrealizefn; | ||
96 | diff --git a/softmmu/physmem.c b/softmmu/physmem.c | ||
97 | index XXXXXXX..XXXXXXX 100644 | ||
98 | --- a/softmmu/physmem.c | ||
99 | +++ b/softmmu/physmem.c | ||
100 | @@ -XXX,XX +XXX,XX @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len, | ||
101 | wp->hitaddr = MAX(addr, wp->vaddr); | ||
102 | wp->hitattrs = attrs; | ||
103 | if (!cpu->watchpoint_hit) { | ||
104 | - if (wp->flags & BP_CPU && | ||
105 | - !cc->debug_check_watchpoint(cpu, wp)) { | ||
106 | + if (wp->flags & BP_CPU && cc->tcg_ops.debug_check_watchpoint && | ||
107 | + !cc->tcg_ops.debug_check_watchpoint(cpu, wp)) { | ||
108 | wp->flags &= ~BP_WATCHPOINT_HIT; | ||
109 | continue; | ||
110 | } | ||
111 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
112 | index XXXXXXX..XXXXXXX 100644 | ||
113 | --- a/target/arm/cpu.c | ||
114 | +++ b/target/arm/cpu.c | ||
115 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) | ||
116 | cc->tcg_ops.synchronize_from_tb = arm_cpu_synchronize_from_tb; | ||
117 | cc->tcg_ops.tlb_fill = arm_cpu_tlb_fill; | ||
118 | cc->tcg_ops.debug_excp_handler = arm_debug_excp_handler; | ||
119 | - cc->debug_check_watchpoint = arm_debug_check_watchpoint; | ||
120 | #if !defined(CONFIG_USER_ONLY) | ||
121 | + cc->tcg_ops.do_interrupt = arm_cpu_do_interrupt; | ||
122 | cc->tcg_ops.do_transaction_failed = arm_cpu_do_transaction_failed; | ||
123 | cc->tcg_ops.do_unaligned_access = arm_cpu_do_unaligned_access; | ||
124 | cc->tcg_ops.adjust_watchpoint_address = arm_adjust_watchpoint_address; | ||
125 | - cc->tcg_ops.do_interrupt = arm_cpu_do_interrupt; | ||
126 | + cc->tcg_ops.debug_check_watchpoint = arm_debug_check_watchpoint; | ||
127 | #endif /* CONFIG_TCG && !CONFIG_USER_ONLY */ | ||
128 | #endif /* CONFIG_TCG */ | ||
129 | } | ||
130 | -- | ||
131 | 2.25.1 | ||
132 | |||
133 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Claudio Fontana <cfontana@suse.de> | ||
2 | 1 | ||
3 | we cannot in principle make the TCG Operations field definitions | ||
4 | conditional on CONFIG_TCG in code that is included by both common_ss | ||
5 | and specific_ss modules. | ||
6 | |||
7 | Therefore, what we can do safely to restrict the TCG fields to TCG-only | ||
8 | builds, is to move all tcg cpu operations into a separate header file, | ||
9 | which is only included by TCG, target-specific code. | ||
10 | |||
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> | ||
19 | --- | ||
20 | include/hw/core/cpu.h | 103 ++------------------------------ | ||
21 | include/hw/core/tcg-cpu-ops.h | 97 ++++++++++++++++++++++++++++++ | ||
22 | target/arm/internals.h | 6 ++ | ||
23 | accel/tcg/cpu-exec.c | 27 +++++---- | ||
24 | accel/tcg/cputlb.c | 35 +++++++++-- | ||
25 | accel/tcg/user-exec.c | 9 +-- | ||
26 | hw/mips/jazz.c | 7 ++- | ||
27 | softmmu/physmem.c | 13 ++-- | ||
28 | target/alpha/cpu.c | 21 +++++-- | ||
29 | target/arm/cpu.c | 41 ++++++++----- | ||
30 | target/arm/cpu64.c | 7 +-- | ||
31 | target/arm/cpu_tcg.c | 28 +++++++-- | ||
32 | target/avr/cpu.c | 19 ++++-- | ||
33 | target/avr/helper.c | 5 +- | ||
34 | target/cris/cpu.c | 43 ++++++++----- | ||
35 | target/cris/helper.c | 5 +- | ||
36 | target/hppa/cpu.c | 22 ++++--- | ||
37 | target/i386/tcg/tcg-cpu.c | 26 ++++---- | ||
38 | target/lm32/cpu.c | 19 ++++-- | ||
39 | target/m68k/cpu.c | 19 ++++-- | ||
40 | target/microblaze/cpu.c | 25 +++++--- | ||
41 | target/mips/cpu.c | 36 +++++++---- | ||
42 | target/moxie/cpu.c | 15 ++++- | ||
43 | target/nios2/cpu.c | 18 ++++-- | ||
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 | |||
59 | diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h | ||
60 | index XXXXXXX..XXXXXXX 100644 | ||
61 | --- a/include/hw/core/cpu.h | ||
62 | +++ b/include/hw/core/cpu.h | ||
63 | @@ -XXX,XX +XXX,XX @@ typedef struct CPUWatchpoint CPUWatchpoint; | ||
64 | |||
65 | struct TranslationBlock; | ||
66 | |||
67 | -/** | ||
68 | - * struct TcgCpuOperations: TCG operations specific to a CPU class | ||
69 | - */ | ||
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 | /** | ||
143 | * CPUClass: | ||
144 | @@ -XXX,XX +XXX,XX @@ struct CPUClass { | ||
145 | int gdb_num_core_regs; | ||
146 | bool gdb_stop_before_watchpoint; | ||
147 | |||
148 | - TcgCpuOperations tcg_ops; | ||
149 | + /* when TCG is not available, this pointer is NULL */ | ||
150 | + struct TCGCPUOps *tcg_ops; | ||
151 | }; | ||
152 | |||
153 | /* | ||
154 | @@ -XXX,XX +XXX,XX @@ CPUState *cpu_by_arch_id(int64_t id); | ||
155 | |||
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 | ||
189 | index XXXXXXX..XXXXXXX | ||
190 | --- /dev/null | ||
191 | +++ b/include/hw/core/tcg-cpu-ops.h | ||
192 | @@ -XXX,XX +XXX,XX @@ | ||
193 | +/* | ||
194 | + * TCG CPU-specific operations | ||
195 | + * | ||
196 | + * Copyright 2021 SUSE LLC | ||
197 | + * | ||
198 | + * 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. | ||
200 | + */ | ||
201 | + | ||
202 | +#ifndef TCG_CPU_OPS_H | ||
203 | +#define TCG_CPU_OPS_H | ||
204 | + | ||
205 | +#include "hw/core/cpu.h" | ||
206 | + | ||
207 | +struct TCGCPUOps { | ||
208 | + /** | ||
209 | + * @initialize: Initalize TCG state | ||
210 | + * | ||
211 | + * Called when the first CPU is realized. | ||
212 | + */ | ||
213 | + void (*initialize)(void); | ||
214 | + /** | ||
215 | + * @synchronize_from_tb: Synchronize state from a TCG #TranslationBlock | ||
216 | + * | ||
217 | + * This is called when we abandon execution of a TB before starting it, | ||
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 @@ | ||
312 | #include "qemu-common.h" | ||
313 | #include "qemu/qemu-print.h" | ||
314 | #include "cpu.h" | ||
315 | +#include "hw/core/tcg-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" | ||
413 | @@ -XXX,XX +XXX,XX @@ static void tlb_fill(CPUState *cpu, target_ulong addr, int size, | ||
414 | * This is not a probe, so only valid return is success; failure | ||
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 | ||
563 | index XXXXXXX..XXXXXXX 100644 | ||
564 | --- a/target/alpha/cpu.c | ||
565 | +++ b/target/alpha/cpu.c | ||
566 | @@ -XXX,XX +XXX,XX @@ static void alpha_cpu_initfn(Object *obj) | ||
567 | #endif | ||
568 | } | ||
569 | |||
570 | +#include "hw/core/tcg-cpu-ops.h" | ||
571 | + | ||
572 | +static struct TCGCPUOps alpha_tcg_ops = { | ||
573 | + .initialize = alpha_translate_init, | ||
574 | + .cpu_exec_interrupt = alpha_cpu_exec_interrupt, | ||
575 | + .tlb_fill = alpha_cpu_tlb_fill, | ||
576 | + | ||
577 | +#ifndef CONFIG_USER_ONLY | ||
578 | + .do_interrupt = alpha_cpu_do_interrupt, | ||
579 | + .do_transaction_failed = alpha_cpu_do_transaction_failed, | ||
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) | ||
588 | |||
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; | ||
602 | dc->vmsd = &vmstate_alpha_cpu; | ||
603 | #endif | ||
604 | 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 | |||
611 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
612 | index XXXXXXX..XXXXXXX 100644 | ||
613 | --- a/target/arm/cpu.c | ||
614 | +++ 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) | ||
646 | return g_strdup("arm"); | ||
647 | } | ||
648 | |||
649 | +#ifdef CONFIG_TCG | ||
650 | +static struct TCGCPUOps arm_tcg_ops = { | ||
651 | + .initialize = arm_translate_init, | ||
652 | + .synchronize_from_tb = arm_cpu_synchronize_from_tb, | ||
653 | + .cpu_exec_interrupt = arm_cpu_exec_interrupt, | ||
654 | + .tlb_fill = arm_cpu_tlb_fill, | ||
655 | + .debug_excp_handler = arm_debug_excp_handler, | ||
656 | + | ||
657 | +#if !defined(CONFIG_USER_ONLY) | ||
658 | + .do_interrupt = arm_cpu_do_interrupt, | ||
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) | ||
671 | cc->gdb_get_dynamic_xml = arm_gdb_get_dynamic_xml; | ||
672 | cc->gdb_stop_before_watchpoint = true; | ||
673 | cc->disas_set_info = arm_disas_set_info; | ||
674 | + | ||
675 | #ifdef CONFIG_TCG | ||
676 | - cc->tcg_ops.initialize = arm_translate_init; | ||
677 | - cc->tcg_ops.cpu_exec_interrupt = arm_cpu_exec_interrupt; | ||
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 | ||
778 | index XXXXXXX..XXXXXXX 100644 | ||
779 | --- a/target/avr/cpu.c | ||
780 | +++ b/target/avr/cpu.c | ||
781 | @@ -XXX,XX +XXX,XX @@ static void avr_cpu_dump_state(CPUState *cs, FILE *f, int flags) | ||
782 | qemu_fprintf(f, "\n"); | ||
783 | } | ||
784 | |||
785 | +#include "hw/core/tcg-cpu-ops.h" | ||
786 | + | ||
787 | +static struct TCGCPUOps avr_tcg_ops = { | ||
788 | + .initialize = avr_cpu_tcg_init, | ||
789 | + .synchronize_from_tb = avr_cpu_synchronize_from_tb, | ||
790 | + .cpu_exec_interrupt = avr_cpu_exec_interrupt, | ||
791 | + .tlb_fill = avr_cpu_tlb_fill, | ||
792 | + | ||
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) | ||
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; | ||
810 | cc->get_phys_page_debug = avr_cpu_get_phys_page_debug; | ||
811 | - cc->tcg_ops.tlb_fill = avr_cpu_tlb_fill; | ||
812 | cc->vmsd = &vms_avr_cpu; | ||
813 | 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; | ||
817 | 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 | ||
855 | index XXXXXXX..XXXXXXX 100644 | ||
856 | --- a/target/cris/cpu.c | ||
857 | +++ b/target/cris/cpu.c | ||
858 | @@ -XXX,XX +XXX,XX @@ static void cris_cpu_initfn(Object *obj) | ||
859 | #endif | ||
860 | } | ||
861 | |||
862 | +#include "hw/core/tcg-cpu-ops.h" | ||
863 | + | ||
864 | +static struct TCGCPUOps crisv10_tcg_ops = { | ||
865 | + .initialize = cris_initialize_crisv10_tcg, | ||
866 | + .cpu_exec_interrupt = cris_cpu_exec_interrupt, | ||
867 | + .tlb_fill = cris_cpu_tlb_fill, | ||
868 | + | ||
869 | +#ifndef CONFIG_USER_ONLY | ||
870 | + .do_interrupt = crisv10_cpu_do_interrupt, | ||
871 | +#endif /* !CONFIG_USER_ONLY */ | ||
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) | ||
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 | ||
962 | cc->get_phys_page_debug = cris_cpu_get_phys_page_debug; | ||
963 | dc->vmsd = &vmstate_cris_cpu; | ||
964 | @@ -XXX,XX +XXX,XX @@ static void cris_cpu_class_init(ObjectClass *oc, void *data) | ||
965 | cc->gdb_stop_before_watchpoint = true; | ||
966 | |||
967 | cc->disas_set_info = cris_disas_set_info; | ||
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 | ||
1003 | index XXXXXXX..XXXXXXX 100644 | ||
1004 | --- a/target/hppa/cpu.c | ||
1005 | +++ b/target/hppa/cpu.c | ||
1006 | @@ -XXX,XX +XXX,XX @@ static ObjectClass *hppa_cpu_class_by_name(const char *cpu_model) | ||
1007 | return object_class_by_name(TYPE_HPPA_CPU); | ||
1008 | } | ||
1009 | |||
1010 | +#include "hw/core/tcg-cpu-ops.h" | ||
1011 | + | ||
1012 | +static struct TCGCPUOps hppa_tcg_ops = { | ||
1013 | + .initialize = hppa_translate_init, | ||
1014 | + .synchronize_from_tb = hppa_cpu_synchronize_from_tb, | ||
1015 | + .cpu_exec_interrupt = hppa_cpu_exec_interrupt, | ||
1016 | + .tlb_fill = hppa_cpu_tlb_fill, | ||
1017 | + | ||
1018 | +#ifndef CONFIG_USER_ONLY | ||
1019 | + .do_interrupt = hppa_cpu_do_interrupt, | ||
1020 | + .do_unaligned_access = hppa_cpu_do_unaligned_access, | ||
1021 | +#endif /* !CONFIG_USER_ONLY */ | ||
1022 | +}; | ||
1023 | + | ||
1024 | static void hppa_cpu_class_init(ObjectClass *oc, void *data) | ||
1025 | { | ||
1026 | DeviceClass *dc = DEVICE_CLASS(oc); | ||
1027 | @@ -XXX,XX +XXX,XX @@ static void hppa_cpu_class_init(ObjectClass *oc, void *data) | ||
1028 | |||
1029 | cc->class_by_name = hppa_cpu_class_by_name; | ||
1030 | cc->has_work = hppa_cpu_has_work; | ||
1031 | - cc->tcg_ops.do_interrupt = hppa_cpu_do_interrupt; | ||
1032 | - cc->tcg_ops.cpu_exec_interrupt = hppa_cpu_exec_interrupt; | ||
1033 | cc->dump_state = hppa_cpu_dump_state; | ||
1034 | cc->set_pc = hppa_cpu_set_pc; | ||
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 | ||
1138 | index XXXXXXX..XXXXXXX 100644 | ||
1139 | --- a/target/m68k/cpu.c | ||
1140 | +++ b/target/m68k/cpu.c | ||
1141 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_m68k_cpu = { | ||
1142 | }; | ||
1143 | #endif | ||
1144 | |||
1145 | +#include "hw/core/tcg-cpu-ops.h" | ||
1146 | + | ||
1147 | +static struct TCGCPUOps m68k_tcg_ops = { | ||
1148 | + .initialize = m68k_tcg_init, | ||
1149 | + .cpu_exec_interrupt = m68k_cpu_exec_interrupt, | ||
1150 | + .tlb_fill = m68k_cpu_tlb_fill, | ||
1151 | + | ||
1152 | +#ifndef CONFIG_USER_ONLY | ||
1153 | + .do_interrupt = m68k_cpu_do_interrupt, | ||
1154 | + .do_transaction_failed = m68k_cpu_transaction_failed, | ||
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) | ||
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) | ||
1173 | - cc->tcg_ops.do_transaction_failed = m68k_cpu_transaction_failed; | ||
1174 | cc->get_phys_page_debug = m68k_cpu_get_phys_page_debug; | ||
1175 | dc->vmsd = &vmstate_m68k_cpu; | ||
1176 | #endif | ||
1177 | cc->disas_set_info = m68k_cpu_disas_set_info; | ||
1178 | - cc->tcg_ops.initialize = m68k_tcg_init; | ||
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 | ||
1186 | index XXXXXXX..XXXXXXX 100644 | ||
1187 | --- a/target/microblaze/cpu.c | ||
1188 | +++ b/target/microblaze/cpu.c | ||
1189 | @@ -XXX,XX +XXX,XX @@ static ObjectClass *mb_cpu_class_by_name(const char *cpu_model) | ||
1190 | return object_class_by_name(TYPE_MICROBLAZE_CPU); | ||
1191 | } | ||
1192 | |||
1193 | +#include "hw/core/tcg-cpu-ops.h" | ||
1194 | + | ||
1195 | +static struct TCGCPUOps mb_tcg_ops = { | ||
1196 | + .initialize = mb_tcg_init, | ||
1197 | + .synchronize_from_tb = mb_cpu_synchronize_from_tb, | ||
1198 | + .cpu_exec_interrupt = mb_cpu_exec_interrupt, | ||
1199 | + .tlb_fill = mb_cpu_tlb_fill, | ||
1200 | + | ||
1201 | +#ifndef CONFIG_USER_ONLY | ||
1202 | + .do_interrupt = mb_cpu_do_interrupt, | ||
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) | ||
1212 | |||
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; | ||
1229 | dc->vmsd = &vmstate_mb_cpu; | ||
1230 | #endif | ||
1231 | @@ -XXX,XX +XXX,XX @@ static void mb_cpu_class_init(ObjectClass *oc, void *data) | ||
1232 | 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 | ||
1241 | index XXXXXXX..XXXXXXX 100644 | ||
1242 | --- a/target/mips/cpu.c | ||
1243 | +++ b/target/mips/cpu.c | ||
1244 | @@ -XXX,XX +XXX,XX @@ static Property mips_cpu_properties[] = { | ||
1245 | DEFINE_PROP_END_OF_LIST() | ||
1246 | }; | ||
1247 | |||
1248 | +#ifdef CONFIG_TCG | ||
1249 | +#include "hw/core/tcg-cpu-ops.h" | ||
1250 | +/* | ||
1251 | + * NB: cannot be const, as some elements are changed for specific | ||
1252 | + * mips hardware (see hw/mips/jazz.c). | ||
1253 | + */ | ||
1254 | +static struct TCGCPUOps mips_tcg_ops = { | ||
1255 | + .initialize = mips_tcg_init, | ||
1256 | + .synchronize_from_tb = mips_cpu_synchronize_from_tb, | ||
1257 | + .cpu_exec_interrupt = mips_cpu_exec_interrupt, | ||
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) | ||
1272 | cc->vmsd = &vmstate_mips_cpu; | ||
1273 | #endif | ||
1274 | 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; | ||
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 | ||
1337 | index XXXXXXX..XXXXXXX 100644 | ||
1338 | --- a/target/nios2/cpu.c | ||
1339 | +++ b/target/nios2/cpu.c | ||
1340 | @@ -XXX,XX +XXX,XX @@ static Property nios2_properties[] = { | ||
1341 | DEFINE_PROP_END_OF_LIST(), | ||
1342 | }; | ||
1343 | |||
1344 | +#include "hw/core/tcg-cpu-ops.h" | ||
1345 | + | ||
1346 | +static struct TCGCPUOps nios2_tcg_ops = { | ||
1347 | + .initialize = nios2_tcg_init, | ||
1348 | + .cpu_exec_interrupt = nios2_cpu_exec_interrupt, | ||
1349 | + .tlb_fill = nios2_cpu_tlb_fill, | ||
1350 | + | ||
1351 | +#ifndef CONFIG_USER_ONLY | ||
1352 | + .do_interrupt = nios2_cpu_do_interrupt, | ||
1353 | + .do_unaligned_access = nios2_cpu_do_unaligned_access, | ||
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) | ||
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; | ||
1368 | - cc->tcg_ops.tlb_fill = nios2_cpu_tlb_fill; | ||
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; | ||
1372 | #endif | ||
1373 | cc->gdb_read_register = nios2_cpu_gdb_read_register; | ||
1374 | 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 | ||
1382 | index XXXXXXX..XXXXXXX 100644 | ||
1383 | --- a/target/openrisc/cpu.c | ||
1384 | +++ b/target/openrisc/cpu.c | ||
1385 | @@ -XXX,XX +XXX,XX @@ static void openrisc_any_initfn(Object *obj) | ||
1386 | | (IMMUCFGR_NTS & (ctz32(TLB_SIZE) << 2)); | ||
1387 | } | ||
1388 | |||
1389 | +#include "hw/core/tcg-cpu-ops.h" | ||
1390 | + | ||
1391 | +static struct TCGCPUOps openrisc_tcg_ops = { | ||
1392 | + .initialize = openrisc_translate_init, | ||
1393 | + .cpu_exec_interrupt = openrisc_cpu_exec_interrupt, | ||
1394 | + .tlb_fill = openrisc_cpu_tlb_fill, | ||
1395 | + | ||
1396 | +#ifndef CONFIG_USER_ONLY | ||
1397 | + .do_interrupt = openrisc_cpu_do_interrupt, | ||
1398 | +#endif /* !CONFIG_USER_ONLY */ | ||
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) | ||
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 | ||
1416 | cc->get_phys_page_debug = openrisc_cpu_get_phys_page_debug; | ||
1417 | dc->vmsd = &vmstate_openrisc_cpu; | ||
1418 | #endif | ||
1419 | cc->gdb_num_core_regs = 32 + 3; | ||
1420 | - cc->tcg_ops.initialize = openrisc_translate_init; | ||
1421 | cc->disas_set_info = openrisc_disas_set_info; | ||
1422 | + cc->tcg_ops = &openrisc_tcg_ops; | ||
1423 | } | ||
1424 | |||
1425 | /* Sort alphabetically by type name, except for "any". */ | ||
1426 | diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c | ||
1427 | index XXXXXXX..XXXXXXX 100644 | ||
1428 | --- a/target/riscv/cpu.c | ||
1429 | +++ b/target/riscv/cpu.c | ||
1430 | @@ -XXX,XX +XXX,XX @@ static const char *riscv_gdb_get_dynamic_xml(CPUState *cs, const char *xmlname) | ||
1431 | return NULL; | ||
1432 | } | ||
1433 | |||
1434 | +#include "hw/core/tcg-cpu-ops.h" | ||
1435 | + | ||
1436 | +static struct TCGCPUOps riscv_tcg_ops = { | ||
1437 | + .initialize = riscv_translate_init, | ||
1438 | + .synchronize_from_tb = riscv_cpu_synchronize_from_tb, | ||
1439 | + .cpu_exec_interrupt = riscv_cpu_exec_interrupt, | ||
1440 | + .tlb_fill = riscv_cpu_tlb_fill, | ||
1441 | + | ||
1442 | +#ifndef CONFIG_USER_ONLY | ||
1443 | + .do_interrupt = riscv_cpu_do_interrupt, | ||
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) | ||
1453 | |||
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; | ||
1471 | /* For now, mark unmigratable: */ | ||
1472 | cc->vmsd = &vmstate_riscv_cpu; | ||
1473 | #endif | ||
1474 | cc->gdb_arch_name = riscv_gdb_arch_name; | ||
1475 | cc->gdb_get_dynamic_xml = riscv_gdb_get_dynamic_xml; | ||
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 | ||
1483 | index XXXXXXX..XXXXXXX 100644 | ||
1484 | --- a/target/rx/cpu.c | ||
1485 | +++ b/target/rx/cpu.c | ||
1486 | @@ -XXX,XX +XXX,XX @@ static void rx_cpu_init(Object *obj) | ||
1487 | qdev_init_gpio_in(DEVICE(cpu), rx_cpu_set_irq, 2); | ||
1488 | } | ||
1489 | |||
1490 | +#include "hw/core/tcg-cpu-ops.h" | ||
1491 | + | ||
1492 | +static struct TCGCPUOps rx_tcg_ops = { | ||
1493 | + .initialize = rx_translate_init, | ||
1494 | + .synchronize_from_tb = rx_cpu_synchronize_from_tb, | ||
1495 | + .cpu_exec_interrupt = rx_cpu_exec_interrupt, | ||
1496 | + .tlb_fill = rx_cpu_tlb_fill, | ||
1497 | + | ||
1498 | +#ifndef CONFIG_USER_ONLY | ||
1499 | + .do_interrupt = rx_cpu_do_interrupt, | ||
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) | ||
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; | ||
1513 | cc->set_pc = rx_cpu_set_pc; | ||
1514 | - cc->tcg_ops.synchronize_from_tb = rx_cpu_synchronize_from_tb; | ||
1515 | + | ||
1516 | cc->gdb_read_register = rx_cpu_gdb_read_register; | ||
1517 | cc->gdb_write_register = rx_cpu_gdb_write_register; | ||
1518 | 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 | ||
1530 | index XXXXXXX..XXXXXXX 100644 | ||
1531 | --- a/target/s390x/cpu.c | ||
1532 | +++ b/target/s390x/cpu.c | ||
1533 | @@ -XXX,XX +XXX,XX @@ static void s390_cpu_reset_full(DeviceState *dev) | ||
1534 | return s390_cpu_reset(s, S390_CPU_RESET_CLEAR); | ||
1535 | } | ||
1536 | |||
1537 | +#ifdef CONFIG_TCG | ||
1538 | +#include "hw/core/tcg-cpu-ops.h" | ||
1539 | + | ||
1540 | +static struct TCGCPUOps s390_tcg_ops = { | ||
1541 | + .initialize = s390x_translate_init, | ||
1542 | + .tlb_fill = s390_cpu_tlb_fill, | ||
1543 | + | ||
1544 | +#if !defined(CONFIG_USER_ONLY) | ||
1545 | + .cpu_exec_interrupt = s390_cpu_exec_interrupt, | ||
1546 | + .do_interrupt = s390_cpu_do_interrupt, | ||
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) | ||
1557 | scc->reset = s390_cpu_reset; | ||
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; | ||
1569 | cc->write_elf64_note = s390_cpu_write_elf64_note; | ||
1570 | -#ifdef CONFIG_TCG | ||
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 | ||
1576 | 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; | ||
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 | ||
1595 | index XXXXXXX..XXXXXXX 100644 | ||
1596 | --- a/target/sh4/cpu.c | ||
1597 | +++ b/target/sh4/cpu.c | ||
1598 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_sh_cpu = { | ||
1599 | .unmigratable = 1, | ||
1600 | }; | ||
1601 | |||
1602 | +#include "hw/core/tcg-cpu-ops.h" | ||
1603 | + | ||
1604 | +static struct TCGCPUOps superh_tcg_ops = { | ||
1605 | + .initialize = sh4_translate_init, | ||
1606 | + .synchronize_from_tb = superh_cpu_synchronize_from_tb, | ||
1607 | + .cpu_exec_interrupt = superh_cpu_exec_interrupt, | ||
1608 | + .tlb_fill = superh_cpu_tlb_fill, | ||
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) | ||
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; | ||
1630 | - cc->tcg_ops.tlb_fill = superh_cpu_tlb_fill; | ||
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; | ||
1634 | #endif | ||
1635 | 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 | ||
1646 | index XXXXXXX..XXXXXXX 100644 | ||
1647 | --- a/target/sparc/cpu.c | ||
1648 | +++ b/target/sparc/cpu.c | ||
1649 | @@ -XXX,XX +XXX,XX @@ static Property sparc_cpu_properties[] = { | ||
1650 | DEFINE_PROP_END_OF_LIST() | ||
1651 | }; | ||
1652 | |||
1653 | +#ifdef CONFIG_TCG | ||
1654 | +#include "hw/core/tcg-cpu-ops.h" | ||
1655 | + | ||
1656 | +static struct TCGCPUOps sparc_tcg_ops = { | ||
1657 | + .initialize = sparc_tcg_init, | ||
1658 | + .synchronize_from_tb = sparc_cpu_synchronize_from_tb, | ||
1659 | + .cpu_exec_interrupt = sparc_cpu_exec_interrupt, | ||
1660 | + .tlb_fill = sparc_cpu_tlb_fill, | ||
1661 | + | ||
1662 | +#ifndef CONFIG_USER_ONLY | ||
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) | ||
1674 | cc->class_by_name = sparc_cpu_class_by_name; | ||
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; | ||
1692 | cc->vmsd = &vmstate_sparc_cpu; | ||
1693 | #endif | ||
1694 | cc->disas_set_info = cpu_sparc_disas_set_info; | ||
1695 | - cc->tcg_ops.initialize = sparc_tcg_init; | ||
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 | ||
1745 | index XXXXXXX..XXXXXXX 100644 | ||
1746 | --- a/target/tricore/cpu.c | ||
1747 | +++ b/target/tricore/cpu.c | ||
1748 | @@ -XXX,XX +XXX,XX @@ static void tc27x_initfn(Object *obj) | ||
1749 | set_feature(&cpu->env, TRICORE_FEATURE_161); | ||
1750 | } | ||
1751 | |||
1752 | +#include "hw/core/tcg-cpu-ops.h" | ||
1753 | + | ||
1754 | +static struct TCGCPUOps tricore_tcg_ops = { | ||
1755 | + .initialize = tricore_tcg_init, | ||
1756 | + .synchronize_from_tb = tricore_cpu_synchronize_from_tb, | ||
1757 | + .tlb_fill = tricore_cpu_tlb_fill, | ||
1758 | +}; | ||
1759 | + | ||
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) | ||
1764 | |||
1765 | cc->dump_state = tricore_cpu_dump_state; | ||
1766 | 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; | ||
1769 | - cc->tcg_ops.initialize = tricore_tcg_init; | ||
1770 | - cc->tcg_ops.tlb_fill = tricore_cpu_tlb_fill; | ||
1771 | + cc->tcg_ops = &tricore_tcg_ops; | ||
1772 | } | ||
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 | ||
1815 | index XXXXXXX..XXXXXXX 100644 | ||
1816 | --- a/target/xtensa/cpu.c | ||
1817 | +++ b/target/xtensa/cpu.c | ||
1818 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_xtensa_cpu = { | ||
1819 | .unmigratable = 1, | ||
1820 | }; | ||
1821 | |||
1822 | +#include "hw/core/tcg-cpu-ops.h" | ||
1823 | + | ||
1824 | +static struct TCGCPUOps xtensa_tcg_ops = { | ||
1825 | + .initialize = xtensa_translate_init, | ||
1826 | + .cpu_exec_interrupt = xtensa_cpu_exec_interrupt, | ||
1827 | + .tlb_fill = xtensa_cpu_tlb_fill, | ||
1828 | + .debug_excp_handler = xtensa_breakpoint_handler, | ||
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) | ||
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; | ||
1850 | cc->gdb_stop_before_watchpoint = true; | ||
1851 | - cc->tcg_ops.tlb_fill = xtensa_cpu_tlb_fill; | ||
1852 | #ifndef CONFIG_USER_ONLY | ||
1853 | - cc->tcg_ops.do_unaligned_access = xtensa_cpu_do_unaligned_access; | ||
1854 | 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; | ||
1861 | + cc->tcg_ops = &xtensa_tcg_ops; | ||
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 | -- | ||
1932 | 2.25.1 | ||
1933 | |||
1934 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Claudio Fontana <cfontana@suse.de> | ||
2 | 1 | ||
3 | Signed-off-by: Claudio Fontana <cfontana@suse.de> | ||
4 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | ||
5 | |||
6 | [claudio: rebased on Richard's splitwx work] | ||
7 | |||
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> | ||
11 | --- | ||
12 | include/hw/boards.h | 2 +- | ||
13 | include/{sysemu => qemu}/accel.h | 14 +++++---- | ||
14 | include/sysemu/hvf.h | 2 +- | ||
15 | include/sysemu/kvm.h | 2 +- | ||
16 | include/sysemu/kvm_int.h | 2 +- | ||
17 | target/i386/hvf/hvf-i386.h | 2 +- | ||
18 | accel/accel-common.c | 50 ++++++++++++++++++++++++++++++ | ||
19 | accel/{accel.c => accel-softmmu.c} | 27 ++-------------- | ||
20 | accel/accel-user.c | 24 ++++++++++++++ | ||
21 | accel/qtest/qtest.c | 2 +- | ||
22 | accel/tcg/tcg-all.c | 15 +++++++-- | ||
23 | accel/xen/xen-all.c | 2 +- | ||
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 | |||
42 | diff --git a/include/hw/boards.h b/include/hw/boards.h | ||
43 | index XXXXXXX..XXXXXXX 100644 | ||
44 | --- a/include/hw/boards.h | ||
45 | +++ b/include/hw/boards.h | ||
46 | @@ -XXX,XX +XXX,XX @@ | ||
47 | #include "exec/memory.h" | ||
48 | #include "sysemu/hostmem.h" | ||
49 | #include "sysemu/blockdev.h" | ||
50 | -#include "sysemu/accel.h" | ||
51 | +#include "qemu/accel.h" | ||
52 | #include "qapi/qapi-types-machine.h" | ||
53 | #include "qemu/module.h" | ||
54 | #include "qom/object.h" | ||
55 | diff --git a/include/sysemu/accel.h b/include/qemu/accel.h | ||
56 | similarity index 95% | ||
57 | rename from include/sysemu/accel.h | ||
58 | rename to include/qemu/accel.h | ||
59 | index XXXXXXX..XXXXXXX 100644 | ||
60 | --- a/include/sysemu/accel.h | ||
61 | +++ b/include/qemu/accel.h | ||
62 | @@ -XXX,XX +XXX,XX @@ | ||
63 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
64 | * THE SOFTWARE. | ||
65 | */ | ||
66 | -#ifndef HW_ACCEL_H | ||
67 | -#define HW_ACCEL_H | ||
68 | +#ifndef QEMU_ACCEL_H | ||
69 | +#define QEMU_ACCEL_H | ||
70 | |||
71 | #include "qom/object.h" | ||
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 | ||
102 | --- a/include/sysemu/hvf.h | ||
103 | +++ b/include/sysemu/hvf.h | ||
104 | @@ -XXX,XX +XXX,XX @@ | ||
105 | #ifndef HVF_H | ||
106 | #define HVF_H | ||
107 | |||
108 | -#include "sysemu/accel.h" | ||
109 | +#include "qemu/accel.h" | ||
110 | #include "qom/object.h" | ||
111 | |||
112 | #ifdef CONFIG_HVF | ||
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 | #include "qemu/queue.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" | ||
313 | #include "qemu/error-report.h" | ||
314 | -#include "hw/boards.h" | ||
315 | +#include "qemu/accel.h" | ||
316 | #include "qapi/qapi-builtin-visit.h" | ||
317 | + | ||
318 | +#ifndef CONFIG_USER_ONLY | ||
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 | ||
511 | index XXXXXXX..XXXXXXX 100644 | ||
512 | --- a/MAINTAINERS | ||
513 | +++ b/MAINTAINERS | ||
514 | @@ -XXX,XX +XXX,XX @@ Overall | ||
515 | M: Richard Henderson <richard.henderson@linaro.org> | ||
516 | R: Paolo Bonzini <pbonzini@redhat.com> | ||
517 | S: Maintained | ||
518 | -F: include/sysemu/accel.h | ||
519 | +F: include/qemu/accel.h | ||
520 | F: accel/accel.c | ||
521 | F: accel/Makefile.objs | ||
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 | -- | ||
555 | 2.25.1 | ||
556 | |||
557 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Claudio Fontana <cfontana@suse.de> | ||
2 | 1 | ||
3 | This will allow us to centralize the registration of | ||
4 | the cpus.c module accelerator operations (in accel/accel-softmmu.c), | ||
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 | |||
9 | Rename all tcg-cpus.c, kvm-cpus.c, etc to tcg-accel-ops.c, | ||
10 | kvm-accel-ops.c, etc, matching the object type names. | ||
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> | ||
15 | --- | ||
16 | accel/accel-softmmu.h | 15 ++++++ | ||
17 | accel/kvm/kvm-cpus.h | 2 - | ||
18 | ...g-cpus-icount.h => tcg-accel-ops-icount.h} | 2 + | ||
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 | |||
79 | diff --git a/accel/accel-softmmu.h b/accel/accel-softmmu.h | ||
80 | new file mode 100644 | ||
81 | index XXXXXXX..XXXXXXX | ||
82 | --- /dev/null | ||
83 | +++ b/accel/accel-softmmu.h | ||
84 | @@ -XXX,XX +XXX,XX @@ | ||
85 | +/* | ||
86 | + * QEMU System Emulation accel internal functions | ||
87 | + * | ||
88 | + * Copyright 2021 SUSE LLC | ||
89 | + * | ||
90 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
91 | + * See the COPYING file in the top-level directory. | ||
92 | + */ | ||
93 | + | ||
94 | +#ifndef ACCEL_SOFTMMU_H | ||
95 | +#define ACCEL_SOFTMMU_H | ||
96 | + | ||
97 | +void accel_init_ops_interfaces(AccelClass *ac); | ||
98 | + | ||
99 | +#endif /* ACCEL_SOFTMMU_H */ | ||
100 | diff --git a/accel/kvm/kvm-cpus.h b/accel/kvm/kvm-cpus.h | ||
101 | index XXXXXXX..XXXXXXX 100644 | ||
102 | --- a/accel/kvm/kvm-cpus.h | ||
103 | +++ b/accel/kvm/kvm-cpus.h | ||
104 | @@ -XXX,XX +XXX,XX @@ | ||
105 | |||
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 | } | ||
360 | |||
361 | +void accel_init_interfaces(AccelClass *ac) | ||
362 | +{ | ||
363 | +#ifndef CONFIG_USER_ONLY | ||
364 | + accel_init_ops_interfaces(ac); | ||
365 | +#endif /* !CONFIG_USER_ONLY */ | ||
366 | +} | ||
367 | + | ||
368 | static void register_accel_types(void) | ||
369 | { | ||
370 | type_register_static(&accel_type); | ||
371 | diff --git a/accel/accel-softmmu.c b/accel/accel-softmmu.c | ||
372 | index XXXXXXX..XXXXXXX 100644 | ||
373 | --- a/accel/accel-softmmu.c | ||
374 | +++ b/accel/accel-softmmu.c | ||
375 | @@ -XXX,XX +XXX,XX @@ | ||
376 | #include "qemu/osdep.h" | ||
377 | #include "qemu/accel.h" | ||
378 | #include "hw/boards.h" | ||
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 | { | ||
388 | @@ -XXX,XX +XXX,XX @@ void accel_setup_post(MachineState *ms) | ||
389 | acc->setup_post(ms, accel); | ||
390 | } | ||
391 | } | ||
392 | + | ||
393 | +/* initialize the arch-independent accel operation interfaces */ | ||
394 | +void accel_init_ops_interfaces(AccelClass *ac) | ||
395 | +{ | ||
396 | + const char *ac_name; | ||
397 | + char *ops_name; | ||
398 | + AccelOpsClass *ops; | ||
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 | } | ||
440 | |||
441 | -const CpusAccel kvm_cpus = { | ||
442 | - .create_vcpu_thread = kvm_start_vcpu_thread, | ||
443 | +static void kvm_accel_ops_class_init(ObjectClass *oc, void *data) | ||
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 | { | ||
499 | - cpus_register_accel(&qtest_cpus); | ||
500 | return 0; | ||
501 | } | ||
502 | |||
503 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo qtest_accel_type = { | ||
504 | .class_init = qtest_accel_class_init, | ||
505 | }; | ||
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 | { | ||
525 | type_register_static(&qtest_accel_type); | ||
526 | + type_register_static(&qtest_accel_ops_type); | ||
527 | } | ||
528 | |||
529 | type_init(qtest_type_init); | ||
530 | diff --git a/accel/tcg/tcg-cpus-icount.c b/accel/tcg/tcg-accel-ops-icount.c | ||
531 | similarity index 89% | ||
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 | { | ||
550 | @@ -XXX,XX +XXX,XX @@ void icount_prepare_for_run(CPUState *cpu) | ||
551 | /* | ||
552 | * These should always be cleared by icount_process_data after | ||
553 | * each vCPU execution. However u16.high can be raised | ||
554 | - * asynchronously by cpu_exit/cpu_interrupt/tcg_cpus_handle_interrupt | ||
555 | + * asynchronously by cpu_exit/cpu_interrupt/tcg_handle_interrupt | ||
556 | */ | ||
557 | g_assert(cpu_neg(cpu)->icount_decr.u16.low == 0); | ||
558 | g_assert(cpu->icount_extra == 0); | ||
559 | @@ -XXX,XX +XXX,XX @@ void icount_process_data(CPUState *cpu) | ||
560 | replay_mutex_unlock(); | ||
561 | } | ||
562 | |||
563 | -static void icount_handle_interrupt(CPUState *cpu, int mask) | ||
564 | +void icount_handle_interrupt(CPUState *cpu, int mask) | ||
565 | { | ||
566 | int old_mask = cpu->interrupt_request; | ||
567 | |||
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 | } | ||
576 | - | ||
577 | -const CpusAccel tcg_cpus_icount = { | ||
578 | - .create_vcpu_thread = rr_start_vcpu_thread, | ||
579 | - .kick_vcpu_thread = rr_kick_vcpu_thread, | ||
580 | - | ||
581 | - .handle_interrupt = icount_handle_interrupt, | ||
582 | - .get_virtual_clock = icount_get, | ||
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 | } | ||
605 | |||
606 | -static void mttcg_kick_vcpu_thread(CPUState *cpu) | ||
607 | +void mttcg_kick_vcpu_thread(CPUState *cpu) | ||
608 | { | ||
609 | cpu_exit(cpu); | ||
610 | } | ||
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 | -- | ||
1272 | 2.25.1 | ||
1273 | |||
1274 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Claudio Fontana <cfontana@suse.de> | ||
2 | 1 | ||
3 | add a new optional interface to CPUClass, which allows accelerators | ||
4 | to extend the CPUClass with additional accelerator-specific | ||
5 | initializations. | ||
6 | |||
7 | This will allow to separate the target cpu code that is specific | ||
8 | to each accelerator, and register it automatically with object | ||
9 | hierarchy lookup depending on accelerator code availability, | ||
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> | ||
15 | --- | ||
16 | include/hw/core/accel-cpu.h | 38 ++++++++++++++++++++++++++++++++ | ||
17 | include/hw/core/cpu.h | 4 ++++ | ||
18 | accel/accel-common.c | 44 +++++++++++++++++++++++++++++++++++++ | ||
19 | MAINTAINERS | 1 + | ||
20 | 4 files changed, 87 insertions(+) | ||
21 | create mode 100644 include/hw/core/accel-cpu.h | ||
22 | |||
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 | ||
68 | index XXXXXXX..XXXXXXX 100644 | ||
69 | --- a/include/hw/core/cpu.h | ||
70 | +++ b/include/hw/core/cpu.h | ||
71 | @@ -XXX,XX +XXX,XX @@ struct TranslationBlock; | ||
72 | /* see tcg-cpu-ops.h */ | ||
73 | struct TCGCPUOps; | ||
74 | |||
75 | +/* see accel-cpu.h */ | ||
76 | +struct AccelCPUClass; | ||
77 | + | ||
78 | /** | ||
79 | * CPUClass: | ||
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 | + } | ||
116 | +} | ||
117 | + | ||
118 | +/* initialize the arch-specific accel CpuClass interfaces */ | ||
119 | +static void accel_init_cpu_interfaces(AccelClass *ac) | ||
120 | +{ | ||
121 | + const char *ac_name; /* AccelClass name */ | ||
122 | + char *acc_name; /* AccelCPUClass name */ | ||
123 | + ObjectClass *acc; /* AccelCPUClass */ | ||
124 | + | ||
125 | + ac_name = object_class_get_name(OBJECT_CLASS(ac)); | ||
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 | +} | ||
137 | + | ||
138 | void accel_init_interfaces(AccelClass *ac) | ||
139 | { | ||
140 | #ifndef CONFIG_USER_ONLY | ||
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 | -- | ||
174 | 2.25.1 | ||
175 | |||
176 | diff view generated by jsdifflib |