1
The following changes since commit 3dd23a4fb8fd72d2220a90a809f213999ffe7f3a:
1
The following changes since commit 05de778b5b8ab0b402996769117b88c7ea5c7c61:
2
2
3
Merge remote-tracking branch 'remotes/legoater/tags/pull-aspeed-20200901' into staging (2020-09-03 14:12:48 +0100)
3
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging (2021-07-09 14:30:01 +0100)
4
4
5
are available in the Git repository at:
5
are available in the Git repository at:
6
6
7
https://github.com/rth7680/qemu.git tags/pull-tcg-20200903
7
https://gitlab.com/rth7680/qemu.git tags/pull-tcg-20210710
8
8
9
for you to fetch changes up to fe4b0b5bfa96c38ad1cad0689a86cca9f307e353:
9
for you to fetch changes up to ad1a706f386c2281adb0b09257d892735e405834:
10
10
11
tcg: Implement 256-bit dup for tcg_gen_gvec_dup_mem (2020-09-03 13:13:58 -0700)
11
cpu: Add breakpoint tracepoints (2021-07-09 21:31:11 -0700)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
Improve inlining in cputlb.c.
14
Add translator_use_goto_tb.
15
Fix vector abs fallback.
15
Cleanups in prep of breakpoint fixes.
16
Only set parallel_cpus for SMP.
16
Misc fixes.
17
Add vector dupm for 256-bit elements.
18
17
19
----------------------------------------------------------------
18
----------------------------------------------------------------
20
Richard Henderson (4):
19
Liren Wei (2):
21
cputlb: Make store_helper less fragile to compiler optimizations
20
accel/tcg: Hoist tcg_tb_insert() up above tb_link_page()
22
softmmu/cpus: Only set parallel_cpus for SMP
21
tcg: Bake tb_destroy() into tcg_region_tree
23
tcg: Eliminate one store for in-place 128-bit dup_mem
24
tcg: Implement 256-bit dup for tcg_gen_gvec_dup_mem
25
22
26
Stephen Long (1):
23
Philippe Mathieu-Daudé (1):
27
tcg: Fix tcg gen for vectorized absolute value
24
tcg: Avoid including 'trace-tcg.h' in target translate.c
28
25
29
accel/tcg/cputlb.c | 138 ++++++++++++++++++++++++++++++-----------------------
26
Richard Henderson (38):
30
softmmu/cpus.c | 11 ++++-
27
tcg: Add separator in INDEX_op_call dump
31
tcg/tcg-op-gvec.c | 61 ++++++++++++++++++++---
28
tcg: Move tb_phys_invalidate_count to tb_ctx
32
3 files changed, 143 insertions(+), 67 deletions(-)
29
accel/tcg: Introduce translator_use_goto_tb
30
target/alpha: Remove use_exit_tb
31
target/alpha: Remove in_superpage
32
target/alpha: Use translator_use_goto_tb
33
target/arm: Use DISAS_TOO_MANY for ISB and SB
34
target/arm: Use translator_use_goto_tb for aarch64
35
target/arm: Use translator_use_goto_tb for aarch32
36
target/avr: Use translator_use_goto_tb
37
target/avr: Mark some helpers noreturn
38
target/cris: Use translator_use_goto_tb
39
target/hppa: Use translator_use_goto_tb
40
target/i386: Use translator_use_goto_tb
41
target/m68k: Use translator_use_goto_tb
42
target/microblaze: Use translator_use_goto_tb
43
target/mips: Use translator_use_goto_tb
44
target/mips: Fix missing else in gen_goto_tb
45
target/nios2: Use translator_use_goto_tb
46
target/openrisc: Use translator_use_goto_tb
47
target/ppc: Use translator_use_goto_tb
48
target/riscv: Use translator_use_goto_tb
49
target/rx: Use translator_use_goto_tb
50
target/s390x: Use translator_use_goto_tb
51
target/s390x: Remove use_exit_tb
52
target/sh4: Use translator_use_goto_tb
53
target/sparc: Use translator_use_goto_tb
54
target/tricore: Use translator_use_goto_tb
55
target/tricore: Use tcg_gen_lookup_and_goto_ptr
56
target/xtensa: Use translator_use_goto_tb
57
tcg: Fix prologue disassembly
58
target/i386: Use cpu_breakpoint_test in breakpoint_handler
59
accel/tcg: Move helper_lookup_tb_ptr to cpu-exec.c
60
accel/tcg: Move tb_lookup to cpu-exec.c
61
accel/tcg: Split out log_cpu_exec
62
accel/tcg: Log tb->cflags with -d exec
63
tcg: Remove TCG_TARGET_HAS_goto_ptr
64
cpu: Add breakpoint tracepoints
33
65
66
accel/tcg/tb-context.h | 1 +
67
accel/tcg/tb-lookup.h | 49 ----------------
68
include/exec/translator.h | 10 ++++
69
include/tcg/tcg-opc.h | 3 +-
70
include/tcg/tcg.h | 4 --
71
target/avr/helper.h | 8 +--
72
tcg/aarch64/tcg-target.h | 1 -
73
tcg/arm/tcg-target.h | 1 -
74
tcg/i386/tcg-target.h | 1 -
75
tcg/mips/tcg-target.h | 1 -
76
tcg/ppc/tcg-target.h | 1 -
77
tcg/riscv/tcg-target.h | 1 -
78
tcg/s390/tcg-target.h | 1 -
79
tcg/sparc/tcg-target.h | 1 -
80
tcg/tci/tcg-target.h | 1 -
81
accel/tcg/cpu-exec.c | 112 ++++++++++++++++++++++++++++--------
82
accel/tcg/tcg-runtime.c | 22 -------
83
accel/tcg/translate-all.c | 23 ++++----
84
accel/tcg/translator.c | 11 ++++
85
cpu.c | 13 +++--
86
target/alpha/translate.c | 47 ++-------------
87
target/arm/translate-a64.c | 26 ++-------
88
target/arm/translate-sve.c | 1 -
89
target/arm/translate.c | 17 +-----
90
target/avr/translate.c | 9 ++-
91
target/cris/translate.c | 6 +-
92
target/hppa/translate.c | 6 +-
93
target/i386/tcg/sysemu/bpt_helper.c | 12 +---
94
target/i386/tcg/translate.c | 15 +----
95
target/m68k/translate.c | 13 +----
96
target/microblaze/translate.c | 12 +---
97
target/mips/tcg/translate.c | 21 ++-----
98
target/nios2/translate.c | 15 +----
99
target/openrisc/translate.c | 16 +++---
100
target/ppc/translate.c | 11 +---
101
target/riscv/translate.c | 20 +------
102
target/rx/translate.c | 12 +---
103
target/s390x/translate.c | 19 +-----
104
target/sh4/translate.c | 12 +---
105
target/sparc/translate.c | 20 ++-----
106
target/tricore/translate.c | 20 ++-----
107
target/xtensa/translate.c | 7 +--
108
tcg/region.c | 33 +++--------
109
tcg/tcg-op.c | 2 +-
110
tcg/tcg.c | 14 ++---
111
trace-events | 5 ++
112
46 files changed, 217 insertions(+), 439 deletions(-)
113
delete mode 100644 accel/tcg/tb-lookup.h
114
diff view generated by jsdifflib
New patch
1
We lost the ',' following the called function name.
1
2
3
Fixes: 3e92aa34434
4
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
tcg/tcg.c | 2 +-
8
1 file changed, 1 insertion(+), 1 deletion(-)
9
10
diff --git a/tcg/tcg.c b/tcg/tcg.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/tcg/tcg.c
13
+++ b/tcg/tcg.c
14
@@ -XXX,XX +XXX,XX @@ static void tcg_dump_ops(TCGContext *s, bool have_prefs)
15
col += qemu_log("plugin(%p)", func);
16
}
17
18
- col += qemu_log("$0x%x,$%d", info->flags, nb_oargs);
19
+ col += qemu_log(",$0x%x,$%d", info->flags, nb_oargs);
20
for (i = 0; i < nb_oargs; i++) {
21
col += qemu_log(",%s", tcg_get_arg_str(s, buf, sizeof(buf),
22
op->args[i]));
23
--
24
2.25.1
25
26
diff view generated by jsdifflib
New patch
1
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
3
The root trace-events only declares a single TCG event:
4
5
$ git grep -w tcg trace-events
6
trace-events:115:# tcg/tcg-op.c
7
trace-events:137:vcpu tcg guest_mem_before(TCGv vaddr, uint16_t info) "info=%d", "vaddr=0x%016"PRIx64" info=%d"
8
9
and only a tcg/tcg-op.c uses it:
10
11
$ git grep -l trace_guest_mem_before_tcg
12
tcg/tcg-op.c
13
14
therefore it is pointless to include "trace-tcg.h" in each target
15
(because it is not used). Remove it.
16
17
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
18
Message-Id: <20210629050935.2570721-1-f4bug@amsat.org>
19
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
20
---
21
target/alpha/translate.c | 1 -
22
target/arm/translate-a64.c | 1 -
23
target/arm/translate-sve.c | 1 -
24
target/arm/translate.c | 1 -
25
target/cris/translate.c | 1 -
26
target/hppa/translate.c | 1 -
27
target/i386/tcg/translate.c | 1 -
28
target/m68k/translate.c | 1 -
29
target/microblaze/translate.c | 1 -
30
target/mips/tcg/translate.c | 1 -
31
target/openrisc/translate.c | 1 -
32
target/ppc/translate.c | 1 -
33
target/rx/translate.c | 1 -
34
target/s390x/translate.c | 1 -
35
target/sh4/translate.c | 1 -
36
target/sparc/translate.c | 1 -
37
target/xtensa/translate.c | 1 -
38
17 files changed, 17 deletions(-)
39
40
diff --git a/target/alpha/translate.c b/target/alpha/translate.c
41
index XXXXXXX..XXXXXXX 100644
42
--- a/target/alpha/translate.c
43
+++ b/target/alpha/translate.c
44
@@ -XXX,XX +XXX,XX @@
45
#include "exec/cpu_ldst.h"
46
#include "exec/helper-proto.h"
47
#include "exec/helper-gen.h"
48
-#include "trace-tcg.h"
49
#include "exec/translator.h"
50
#include "exec/log.h"
51
52
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
53
index XXXXXXX..XXXXXXX 100644
54
--- a/target/arm/translate-a64.c
55
+++ b/target/arm/translate-a64.c
56
@@ -XXX,XX +XXX,XX @@
57
#include "exec/helper-gen.h"
58
#include "exec/log.h"
59
60
-#include "trace-tcg.h"
61
#include "translate-a64.h"
62
#include "qemu/atomic128.h"
63
64
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
65
index XXXXXXX..XXXXXXX 100644
66
--- a/target/arm/translate-sve.c
67
+++ b/target/arm/translate-sve.c
68
@@ -XXX,XX +XXX,XX @@
69
#include "exec/helper-proto.h"
70
#include "exec/helper-gen.h"
71
#include "exec/log.h"
72
-#include "trace-tcg.h"
73
#include "translate-a64.h"
74
#include "fpu/softfloat.h"
75
76
diff --git a/target/arm/translate.c b/target/arm/translate.c
77
index XXXXXXX..XXXXXXX 100644
78
--- a/target/arm/translate.c
79
+++ b/target/arm/translate.c
80
@@ -XXX,XX +XXX,XX @@
81
#include "exec/helper-proto.h"
82
#include "exec/helper-gen.h"
83
84
-#include "trace-tcg.h"
85
#include "exec/log.h"
86
87
88
diff --git a/target/cris/translate.c b/target/cris/translate.c
89
index XXXXXXX..XXXXXXX 100644
90
--- a/target/cris/translate.c
91
+++ b/target/cris/translate.c
92
@@ -XXX,XX +XXX,XX @@
93
94
#include "exec/helper-gen.h"
95
96
-#include "trace-tcg.h"
97
#include "exec/log.h"
98
99
100
diff --git a/target/hppa/translate.c b/target/hppa/translate.c
101
index XXXXXXX..XXXXXXX 100644
102
--- a/target/hppa/translate.c
103
+++ b/target/hppa/translate.c
104
@@ -XXX,XX +XXX,XX @@
105
#include "exec/helper-proto.h"
106
#include "exec/helper-gen.h"
107
#include "exec/translator.h"
108
-#include "trace-tcg.h"
109
#include "exec/log.h"
110
111
/* Since we have a distinction between register size and address size,
112
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
113
index XXXXXXX..XXXXXXX 100644
114
--- a/target/i386/tcg/translate.c
115
+++ b/target/i386/tcg/translate.c
116
@@ -XXX,XX +XXX,XX @@
117
#include "exec/helper-gen.h"
118
#include "helper-tcg.h"
119
120
-#include "trace-tcg.h"
121
#include "exec/log.h"
122
123
#define PREFIX_REPZ 0x01
124
diff --git a/target/m68k/translate.c b/target/m68k/translate.c
125
index XXXXXXX..XXXXXXX 100644
126
--- a/target/m68k/translate.c
127
+++ b/target/m68k/translate.c
128
@@ -XXX,XX +XXX,XX @@
129
#include "exec/helper-proto.h"
130
#include "exec/helper-gen.h"
131
132
-#include "trace-tcg.h"
133
#include "exec/log.h"
134
#include "fpu/softfloat.h"
135
136
diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c
137
index XXXXXXX..XXXXXXX 100644
138
--- a/target/microblaze/translate.c
139
+++ b/target/microblaze/translate.c
140
@@ -XXX,XX +XXX,XX @@
141
#include "exec/translator.h"
142
#include "qemu/qemu-print.h"
143
144
-#include "trace-tcg.h"
145
#include "exec/log.h"
146
147
#define EXTRACT_FIELD(src, start, end) \
148
diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c
149
index XXXXXXX..XXXXXXX 100644
150
--- a/target/mips/tcg/translate.c
151
+++ b/target/mips/tcg/translate.c
152
@@ -XXX,XX +XXX,XX @@
153
#include "semihosting/semihost.h"
154
155
#include "trace.h"
156
-#include "trace-tcg.h"
157
#include "exec/translator.h"
158
#include "exec/log.h"
159
#include "qemu/qemu-print.h"
160
diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c
161
index XXXXXXX..XXXXXXX 100644
162
--- a/target/openrisc/translate.c
163
+++ b/target/openrisc/translate.c
164
@@ -XXX,XX +XXX,XX @@
165
#include "exec/helper-gen.h"
166
#include "exec/gen-icount.h"
167
168
-#include "trace-tcg.h"
169
#include "exec/log.h"
170
171
/* is_jmp field values */
172
diff --git a/target/ppc/translate.c b/target/ppc/translate.c
173
index XXXXXXX..XXXXXXX 100644
174
--- a/target/ppc/translate.c
175
+++ b/target/ppc/translate.c
176
@@ -XXX,XX +XXX,XX @@
177
#include "exec/helper-proto.h"
178
#include "exec/helper-gen.h"
179
180
-#include "trace-tcg.h"
181
#include "exec/translator.h"
182
#include "exec/log.h"
183
#include "qemu/atomic128.h"
184
diff --git a/target/rx/translate.c b/target/rx/translate.c
185
index XXXXXXX..XXXXXXX 100644
186
--- a/target/rx/translate.c
187
+++ b/target/rx/translate.c
188
@@ -XXX,XX +XXX,XX @@
189
#include "exec/helper-proto.h"
190
#include "exec/helper-gen.h"
191
#include "exec/translator.h"
192
-#include "trace-tcg.h"
193
#include "exec/log.h"
194
195
typedef struct DisasContext {
196
diff --git a/target/s390x/translate.c b/target/s390x/translate.c
197
index XXXXXXX..XXXXXXX 100644
198
--- a/target/s390x/translate.c
199
+++ b/target/s390x/translate.c
200
@@ -XXX,XX +XXX,XX @@
201
#include "exec/helper-proto.h"
202
#include "exec/helper-gen.h"
203
204
-#include "trace-tcg.h"
205
#include "exec/translator.h"
206
#include "exec/log.h"
207
#include "qemu/atomic128.h"
208
diff --git a/target/sh4/translate.c b/target/sh4/translate.c
209
index XXXXXXX..XXXXXXX 100644
210
--- a/target/sh4/translate.c
211
+++ b/target/sh4/translate.c
212
@@ -XXX,XX +XXX,XX @@
213
#include "exec/helper-proto.h"
214
#include "exec/helper-gen.h"
215
#include "exec/translator.h"
216
-#include "trace-tcg.h"
217
#include "exec/log.h"
218
#include "qemu/qemu-print.h"
219
220
diff --git a/target/sparc/translate.c b/target/sparc/translate.c
221
index XXXXXXX..XXXXXXX 100644
222
--- a/target/sparc/translate.c
223
+++ b/target/sparc/translate.c
224
@@ -XXX,XX +XXX,XX @@
225
226
#include "exec/helper-gen.h"
227
228
-#include "trace-tcg.h"
229
#include "exec/translator.h"
230
#include "exec/log.h"
231
#include "asi.h"
232
diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c
233
index XXXXXXX..XXXXXXX 100644
234
--- a/target/xtensa/translate.c
235
+++ b/target/xtensa/translate.c
236
@@ -XXX,XX +XXX,XX @@
237
#include "exec/helper-proto.h"
238
#include "exec/helper-gen.h"
239
240
-#include "trace-tcg.h"
241
#include "exec/log.h"
242
243
244
--
245
2.25.1
246
247
diff view generated by jsdifflib
New patch
1
From: Liren Wei <lrwei@bupt.edu.cn>
1
2
3
TranslationBlocks not inserted into the corresponding region
4
tree shall be regarded as partially initialized objects, and
5
needs to be finalized first before inserting into QHT.
6
7
Signed-off-by: Liren Wei <lrwei@bupt.edu.cn>
8
Message-Id: <f9fc263f71e11b6308d8c1fbc0dd366bf4aeb532.1625404483.git.lrwei@bupt.edu.cn>
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
---
11
accel/tcg/translate-all.c | 9 ++++++++-
12
1 file changed, 8 insertions(+), 1 deletion(-)
13
14
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/accel/tcg/translate-all.c
17
+++ b/accel/tcg/translate-all.c
18
@@ -XXX,XX +XXX,XX @@ TranslationBlock *tb_gen_code(CPUState *cpu,
19
return tb;
20
}
21
22
+ /*
23
+ * Insert TB into the corresponding region tree before publishing it
24
+ * through QHT. Otherwise rewinding happened in the TB might fail to
25
+ * lookup itself using host PC.
26
+ */
27
+ tcg_tb_insert(tb);
28
+
29
/* check next page if needed */
30
virt_page2 = (pc + tb->size - 1) & TARGET_PAGE_MASK;
31
phys_page2 = -1;
32
@@ -XXX,XX +XXX,XX @@ TranslationBlock *tb_gen_code(CPUState *cpu,
33
orig_aligned -= ROUND_UP(sizeof(*tb), qemu_icache_linesize);
34
qatomic_set(&tcg_ctx->code_gen_ptr, (void *)orig_aligned);
35
tb_destroy(tb);
36
+ tcg_tb_remove(tb);
37
return existing_tb;
38
}
39
- tcg_tb_insert(tb);
40
return tb;
41
}
42
43
--
44
2.25.1
45
46
diff view generated by jsdifflib
New patch
1
From: Liren Wei <lrwei@bupt.edu.cn>
1
2
3
The function is called only at tcg_gen_code() when duplicated TBs
4
are translated by different threads, and when the tcg_region_tree
5
is reset. Bake it into the underlying GTree as its value destroy
6
function to unite these situations.
7
Also remove tcg_region_tree_traverse() which now becomes useless.
8
9
Signed-off-by: Liren Wei <lrwei@bupt.edu.cn>
10
Message-Id: <8dc352f08d038c4e7a1f5f56962398cdc700c3aa.1625404483.git.lrwei@bupt.edu.cn>
11
[rth: Name the new tb_tc_cmp parameter correctly.]
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
---
14
include/tcg/tcg.h | 1 -
15
accel/tcg/translate-all.c | 6 ------
16
tcg/region.c | 19 ++++++++-----------
17
3 files changed, 8 insertions(+), 18 deletions(-)
18
19
diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h
20
index XXXXXXX..XXXXXXX 100644
21
--- a/include/tcg/tcg.h
22
+++ b/include/tcg/tcg.h
23
@@ -XXX,XX +XXX,XX @@ void *tcg_malloc_internal(TCGContext *s, int size);
24
void tcg_pool_reset(TCGContext *s);
25
TranslationBlock *tcg_tb_alloc(TCGContext *s);
26
27
-void tb_destroy(TranslationBlock *tb);
28
void tcg_region_reset_all(void);
29
30
size_t tcg_code_size(void);
31
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
32
index XXXXXXX..XXXXXXX 100644
33
--- a/accel/tcg/translate-all.c
34
+++ b/accel/tcg/translate-all.c
35
@@ -XXX,XX +XXX,XX @@ static int cpu_restore_state_from_tb(CPUState *cpu, TranslationBlock *tb,
36
return 0;
37
}
38
39
-void tb_destroy(TranslationBlock *tb)
40
-{
41
- qemu_spin_destroy(&tb->jmp_lock);
42
-}
43
-
44
bool cpu_restore_state(CPUState *cpu, uintptr_t host_pc, bool will_exit)
45
{
46
/*
47
@@ -XXX,XX +XXX,XX @@ TranslationBlock *tb_gen_code(CPUState *cpu,
48
49
orig_aligned -= ROUND_UP(sizeof(*tb), qemu_icache_linesize);
50
qatomic_set(&tcg_ctx->code_gen_ptr, (void *)orig_aligned);
51
- tb_destroy(tb);
52
tcg_tb_remove(tb);
53
return existing_tb;
54
}
55
diff --git a/tcg/region.c b/tcg/region.c
56
index XXXXXXX..XXXXXXX 100644
57
--- a/tcg/region.c
58
+++ b/tcg/region.c
59
@@ -XXX,XX +XXX,XX @@ static int ptr_cmp_tb_tc(const void *ptr, const struct tb_tc *s)
60
return 0;
61
}
62
63
-static gint tb_tc_cmp(gconstpointer ap, gconstpointer bp)
64
+static gint tb_tc_cmp(gconstpointer ap, gconstpointer bp, gpointer userdata)
65
{
66
const struct tb_tc *a = ap;
67
const struct tb_tc *b = bp;
68
@@ -XXX,XX +XXX,XX @@ static gint tb_tc_cmp(gconstpointer ap, gconstpointer bp)
69
return ptr_cmp_tb_tc(b->ptr, a);
70
}
71
72
+static void tb_destroy(gpointer value)
73
+{
74
+ TranslationBlock *tb = value;
75
+ qemu_spin_destroy(&tb->jmp_lock);
76
+}
77
+
78
static void tcg_region_trees_init(void)
79
{
80
size_t i;
81
@@ -XXX,XX +XXX,XX @@ static void tcg_region_trees_init(void)
82
struct tcg_region_tree *rt = region_trees + i * tree_size;
83
84
qemu_mutex_init(&rt->lock);
85
- rt->tree = g_tree_new(tb_tc_cmp);
86
+ rt->tree = g_tree_new_full(tb_tc_cmp, NULL, NULL, tb_destroy);
87
}
88
}
89
90
@@ -XXX,XX +XXX,XX @@ size_t tcg_nb_tbs(void)
91
return nb_tbs;
92
}
93
94
-static gboolean tcg_region_tree_traverse(gpointer k, gpointer v, gpointer data)
95
-{
96
- TranslationBlock *tb = v;
97
-
98
- tb_destroy(tb);
99
- return FALSE;
100
-}
101
-
102
static void tcg_region_tree_reset_all(void)
103
{
104
size_t i;
105
@@ -XXX,XX +XXX,XX @@ static void tcg_region_tree_reset_all(void)
106
for (i = 0; i < region.n; i++) {
107
struct tcg_region_tree *rt = region_trees + i * tree_size;
108
109
- g_tree_foreach(rt->tree, tcg_region_tree_traverse, NULL);
110
/* Increment the refcount first so that destroy acts as a reset */
111
g_tree_ref(rt->tree);
112
g_tree_destroy(rt->tree);
113
--
114
2.25.1
115
116
diff view generated by jsdifflib
New patch
1
We can call do_tb_phys_invalidate from an iocontext, which has
2
no per-thread tcg_ctx. Move this to tb_ctx, which is global.
3
The actual update still takes place with a lock held, so only
4
an atomic set is required, not an atomic increment.
1
5
6
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/457
7
Tested-by: Viktor Ashirov <vashirov@redhat.com>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
---
10
accel/tcg/tb-context.h | 1 +
11
include/tcg/tcg.h | 3 ---
12
accel/tcg/translate-all.c | 8 ++++----
13
tcg/region.c | 14 --------------
14
4 files changed, 5 insertions(+), 21 deletions(-)
15
16
diff --git a/accel/tcg/tb-context.h b/accel/tcg/tb-context.h
17
index XXXXXXX..XXXXXXX 100644
18
--- a/accel/tcg/tb-context.h
19
+++ b/accel/tcg/tb-context.h
20
@@ -XXX,XX +XXX,XX @@ struct TBContext {
21
22
/* statistics */
23
unsigned tb_flush_count;
24
+ unsigned tb_phys_invalidate_count;
25
};
26
27
extern TBContext tb_ctx;
28
diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h
29
index XXXXXXX..XXXXXXX 100644
30
--- a/include/tcg/tcg.h
31
+++ b/include/tcg/tcg.h
32
@@ -XXX,XX +XXX,XX @@ struct TCGContext {
33
/* Threshold to flush the translated code buffer. */
34
void *code_gen_highwater;
35
36
- size_t tb_phys_invalidate_count;
37
-
38
/* Track which vCPU triggers events */
39
CPUState *cpu; /* *_trans */
40
41
@@ -XXX,XX +XXX,XX @@ size_t tcg_code_capacity(void);
42
43
void tcg_tb_insert(TranslationBlock *tb);
44
void tcg_tb_remove(TranslationBlock *tb);
45
-size_t tcg_tb_phys_invalidate_count(void);
46
TranslationBlock *tcg_tb_lookup(uintptr_t tc_ptr);
47
void tcg_tb_foreach(GTraverseFunc func, gpointer user_data);
48
size_t tcg_nb_tbs(void);
49
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
50
index XXXXXXX..XXXXXXX 100644
51
--- a/accel/tcg/translate-all.c
52
+++ b/accel/tcg/translate-all.c
53
@@ -XXX,XX +XXX,XX @@ static void do_tb_phys_invalidate(TranslationBlock *tb, bool rm_from_page_list)
54
/* suppress any remaining jumps to this TB */
55
tb_jmp_unlink(tb);
56
57
- qatomic_set(&tcg_ctx->tb_phys_invalidate_count,
58
- tcg_ctx->tb_phys_invalidate_count + 1);
59
+ qatomic_set(&tb_ctx.tb_phys_invalidate_count,
60
+ tb_ctx.tb_phys_invalidate_count + 1);
61
}
62
63
static void tb_phys_invalidate__locked(TranslationBlock *tb)
64
@@ -XXX,XX +XXX,XX @@ void dump_exec_info(void)
65
qemu_printf("\nStatistics:\n");
66
qemu_printf("TB flush count %u\n",
67
qatomic_read(&tb_ctx.tb_flush_count));
68
- qemu_printf("TB invalidate count %zu\n",
69
- tcg_tb_phys_invalidate_count());
70
+ qemu_printf("TB invalidate count %u\n",
71
+ qatomic_read(&tb_ctx.tb_phys_invalidate_count));
72
73
tlb_flush_counts(&flush_full, &flush_part, &flush_elide);
74
qemu_printf("TLB full flushes %zu\n", flush_full);
75
diff --git a/tcg/region.c b/tcg/region.c
76
index XXXXXXX..XXXXXXX 100644
77
--- a/tcg/region.c
78
+++ b/tcg/region.c
79
@@ -XXX,XX +XXX,XX @@ size_t tcg_code_capacity(void)
80
81
return capacity;
82
}
83
-
84
-size_t tcg_tb_phys_invalidate_count(void)
85
-{
86
- unsigned int n_ctxs = qatomic_read(&tcg_cur_ctxs);
87
- unsigned int i;
88
- size_t total = 0;
89
-
90
- for (i = 0; i < n_ctxs; i++) {
91
- const TCGContext *s = qatomic_read(&tcg_ctxs[i]);
92
-
93
- total += qatomic_read(&s->tb_phys_invalidate_count);
94
- }
95
- return total;
96
-}
97
--
98
2.25.1
99
100
diff view generated by jsdifflib
1
This has no functional change.
1
Add a generic version of the common use_goto_tb test.
2
2
3
The current function structure is:
3
Various targets avoid the page crossing test for CONFIG_USER_ONLY,
4
but that is wrong: mmap and mprotect can change page permissions.
4
5
5
inline QEMU_ALWAYSINLINE
6
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
6
store_memop() {
7
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
switch () {
8
...
9
default:
10
qemu_build_not_reached();
11
}
12
}
13
inline QEMU_ALWAYSINLINE
14
store_helper() {
15
...
16
if (span_two_pages_or_io) {
17
...
18
helper_ret_stb_mmu();
19
}
20
store_memop();
21
}
22
helper_ret_stb_mmu() {
23
store_helper();
24
}
25
26
Whereas GCC will generate an error at compile-time when an always_inline
27
function is not inlined, Clang does not. Nor does Clang prioritize the
28
inlining of always_inline functions. Both of these are arguably bugs.
29
30
Both `store_memop` and `store_helper` need to be inlined and allow
31
constant propogations to eliminate the `qemu_build_not_reached` call.
32
33
However, if the compiler instead chooses to inline helper_ret_stb_mmu
34
into store_helper, then store_helper is now self-recursive and the
35
compiler is no longer able to propagate the constant in the same way.
36
37
This does not produce at current QEMU head, but was reproducible
38
at v4.2.0 with `clang-10 -O2 -fexperimental-new-pass-manager`.
39
40
The inline recursion problem can be fixed solely by marking
41
helper_ret_stb_mmu as noinline, so the compiler does not make an
42
incorrect decision about which functions to inline.
43
44
In addition, extract store_helper_unaligned as a noinline subroutine
45
that can be shared by all of the helpers. This saves about 6k code
46
size in an optimized x86_64 build.
47
48
Reported-by: Shu-Chun Weng <scw@google.com>
49
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
50
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
51
---
9
---
52
accel/tcg/cputlb.c | 138 ++++++++++++++++++++++++++-------------------
10
include/exec/translator.h | 10 ++++++++++
53
1 file changed, 79 insertions(+), 59 deletions(-)
11
accel/tcg/translator.c | 11 +++++++++++
12
2 files changed, 21 insertions(+)
54
13
55
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
14
diff --git a/include/exec/translator.h b/include/exec/translator.h
56
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
57
--- a/accel/tcg/cputlb.c
16
--- a/include/exec/translator.h
58
+++ b/accel/tcg/cputlb.c
17
+++ b/include/exec/translator.h
59
@@ -XXX,XX +XXX,XX @@ store_memop(void *haddr, uint64_t val, MemOp op)
18
@@ -XXX,XX +XXX,XX @@ void translator_loop(const TranslatorOps *ops, DisasContextBase *db,
19
20
void translator_loop_temp_check(DisasContextBase *db);
21
22
+/**
23
+ * translator_use_goto_tb
24
+ * @db: Disassembly context
25
+ * @dest: target pc of the goto
26
+ *
27
+ * Return true if goto_tb is allowed between the current TB
28
+ * and the destination PC.
29
+ */
30
+bool translator_use_goto_tb(DisasContextBase *db, target_ulong dest);
31
+
32
/*
33
* Translator Load Functions
34
*
35
diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c
36
index XXXXXXX..XXXXXXX 100644
37
--- a/accel/tcg/translator.c
38
+++ b/accel/tcg/translator.c
39
@@ -XXX,XX +XXX,XX @@ void translator_loop_temp_check(DisasContextBase *db)
60
}
40
}
61
}
41
}
62
42
63
+static void __attribute__((noinline))
43
+bool translator_use_goto_tb(DisasContextBase *db, target_ulong dest)
64
+store_helper_unaligned(CPUArchState *env, target_ulong addr, uint64_t val,
65
+ uintptr_t retaddr, size_t size, uintptr_t mmu_idx,
66
+ bool big_endian)
67
+{
44
+{
68
+ const size_t tlb_off = offsetof(CPUTLBEntry, addr_write);
45
+ /* Suppress goto_tb in the case of single-steping. */
69
+ uintptr_t index, index2;
46
+ if (db->singlestep_enabled || singlestep) {
70
+ CPUTLBEntry *entry, *entry2;
47
+ return false;
71
+ target_ulong page2, tlb_addr, tlb_addr2;
72
+ TCGMemOpIdx oi;
73
+ size_t size2;
74
+ int i;
75
+
76
+ /*
77
+ * Ensure the second page is in the TLB. Note that the first page
78
+ * is already guaranteed to be filled, and that the second page
79
+ * cannot evict the first.
80
+ */
81
+ page2 = (addr + size) & TARGET_PAGE_MASK;
82
+ size2 = (addr + size) & ~TARGET_PAGE_MASK;
83
+ index2 = tlb_index(env, mmu_idx, page2);
84
+ entry2 = tlb_entry(env, mmu_idx, page2);
85
+
86
+ tlb_addr2 = tlb_addr_write(entry2);
87
+ if (!tlb_hit_page(tlb_addr2, page2)) {
88
+ if (!victim_tlb_hit(env, mmu_idx, index2, tlb_off, page2)) {
89
+ tlb_fill(env_cpu(env), page2, size2, MMU_DATA_STORE,
90
+ mmu_idx, retaddr);
91
+ index2 = tlb_index(env, mmu_idx, page2);
92
+ entry2 = tlb_entry(env, mmu_idx, page2);
93
+ }
94
+ tlb_addr2 = tlb_addr_write(entry2);
95
+ }
48
+ }
96
+
49
+
97
+ index = tlb_index(env, mmu_idx, addr);
50
+ /* Check for the dest on the same page as the start of the TB. */
98
+ entry = tlb_entry(env, mmu_idx, addr);
51
+ return ((db->pc_first ^ dest) & TARGET_PAGE_MASK) == 0;
99
+ tlb_addr = tlb_addr_write(entry);
100
+
101
+ /*
102
+ * Handle watchpoints. Since this may trap, all checks
103
+ * must happen before any store.
104
+ */
105
+ if (unlikely(tlb_addr & TLB_WATCHPOINT)) {
106
+ cpu_check_watchpoint(env_cpu(env), addr, size - size2,
107
+ env_tlb(env)->d[mmu_idx].iotlb[index].attrs,
108
+ BP_MEM_WRITE, retaddr);
109
+ }
110
+ if (unlikely(tlb_addr2 & TLB_WATCHPOINT)) {
111
+ cpu_check_watchpoint(env_cpu(env), page2, size2,
112
+ env_tlb(env)->d[mmu_idx].iotlb[index2].attrs,
113
+ BP_MEM_WRITE, retaddr);
114
+ }
115
+
116
+ /*
117
+ * XXX: not efficient, but simple.
118
+ * This loop must go in the forward direction to avoid issues
119
+ * with self-modifying code in Windows 64-bit.
120
+ */
121
+ oi = make_memop_idx(MO_UB, mmu_idx);
122
+ if (big_endian) {
123
+ for (i = 0; i < size; ++i) {
124
+ /* Big-endian extract. */
125
+ uint8_t val8 = val >> (((size - 1) * 8) - (i * 8));
126
+ helper_ret_stb_mmu(env, addr + i, val8, oi, retaddr);
127
+ }
128
+ } else {
129
+ for (i = 0; i < size; ++i) {
130
+ /* Little-endian extract. */
131
+ uint8_t val8 = val >> (i * 8);
132
+ helper_ret_stb_mmu(env, addr + i, val8, oi, retaddr);
133
+ }
134
+ }
135
+}
52
+}
136
+
53
+
137
static inline void QEMU_ALWAYS_INLINE
54
void translator_loop(const TranslatorOps *ops, DisasContextBase *db,
138
store_helper(CPUArchState *env, target_ulong addr, uint64_t val,
55
CPUState *cpu, TranslationBlock *tb, int max_insns)
139
TCGMemOpIdx oi, uintptr_t retaddr, MemOp op)
140
@@ -XXX,XX +XXX,XX @@ store_helper(CPUArchState *env, target_ulong addr, uint64_t val,
141
if (size > 1
142
&& unlikely((addr & ~TARGET_PAGE_MASK) + size - 1
143
>= TARGET_PAGE_SIZE)) {
144
- int i;
145
- uintptr_t index2;
146
- CPUTLBEntry *entry2;
147
- target_ulong page2, tlb_addr2;
148
- size_t size2;
149
-
150
do_unaligned_access:
151
- /*
152
- * Ensure the second page is in the TLB. Note that the first page
153
- * is already guaranteed to be filled, and that the second page
154
- * cannot evict the first.
155
- */
156
- page2 = (addr + size) & TARGET_PAGE_MASK;
157
- size2 = (addr + size) & ~TARGET_PAGE_MASK;
158
- index2 = tlb_index(env, mmu_idx, page2);
159
- entry2 = tlb_entry(env, mmu_idx, page2);
160
- tlb_addr2 = tlb_addr_write(entry2);
161
- if (!tlb_hit_page(tlb_addr2, page2)) {
162
- if (!victim_tlb_hit(env, mmu_idx, index2, tlb_off, page2)) {
163
- tlb_fill(env_cpu(env), page2, size2, MMU_DATA_STORE,
164
- mmu_idx, retaddr);
165
- index2 = tlb_index(env, mmu_idx, page2);
166
- entry2 = tlb_entry(env, mmu_idx, page2);
167
- }
168
- tlb_addr2 = tlb_addr_write(entry2);
169
- }
170
-
171
- /*
172
- * Handle watchpoints. Since this may trap, all checks
173
- * must happen before any store.
174
- */
175
- if (unlikely(tlb_addr & TLB_WATCHPOINT)) {
176
- cpu_check_watchpoint(env_cpu(env), addr, size - size2,
177
- env_tlb(env)->d[mmu_idx].iotlb[index].attrs,
178
- BP_MEM_WRITE, retaddr);
179
- }
180
- if (unlikely(tlb_addr2 & TLB_WATCHPOINT)) {
181
- cpu_check_watchpoint(env_cpu(env), page2, size2,
182
- env_tlb(env)->d[mmu_idx].iotlb[index2].attrs,
183
- BP_MEM_WRITE, retaddr);
184
- }
185
-
186
- /*
187
- * XXX: not efficient, but simple.
188
- * This loop must go in the forward direction to avoid issues
189
- * with self-modifying code in Windows 64-bit.
190
- */
191
- for (i = 0; i < size; ++i) {
192
- uint8_t val8;
193
- if (memop_big_endian(op)) {
194
- /* Big-endian extract. */
195
- val8 = val >> (((size - 1) * 8) - (i * 8));
196
- } else {
197
- /* Little-endian extract. */
198
- val8 = val >> (i * 8);
199
- }
200
- helper_ret_stb_mmu(env, addr + i, val8, oi, retaddr);
201
- }
202
+ store_helper_unaligned(env, addr, val, retaddr, size,
203
+ mmu_idx, memop_big_endian(op));
204
return;
205
}
206
207
@@ -XXX,XX +XXX,XX @@ store_helper(CPUArchState *env, target_ulong addr, uint64_t val,
208
store_memop(haddr, val, op);
209
}
210
211
-void helper_ret_stb_mmu(CPUArchState *env, target_ulong addr, uint8_t val,
212
- TCGMemOpIdx oi, uintptr_t retaddr)
213
+void __attribute__((noinline))
214
+helper_ret_stb_mmu(CPUArchState *env, target_ulong addr, uint8_t val,
215
+ TCGMemOpIdx oi, uintptr_t retaddr)
216
{
56
{
217
store_helper(env, addr, val, oi, retaddr, MO_UB);
218
}
219
--
57
--
220
2.25.1
58
2.25.1
221
59
222
60
diff view generated by jsdifflib
New patch
1
We have not needed to end a TB for I/O since ba3e7926691
2
("icount: clean up cpu_can_io at the entry to the block").
3
We do not need to use exit_tb for singlestep, which only
4
means generate one insn per TB.
1
5
6
Which leaves only singlestep_enabled, which means raise a
7
debug trap after every TB, which does not use exit_tb,
8
which would leave the function mis-named.
9
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12
---
13
target/alpha/translate.c | 15 ++-------------
14
1 file changed, 2 insertions(+), 13 deletions(-)
15
16
diff --git a/target/alpha/translate.c b/target/alpha/translate.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/alpha/translate.c
19
+++ b/target/alpha/translate.c
20
@@ -XXX,XX +XXX,XX @@ static bool in_superpage(DisasContext *ctx, int64_t addr)
21
#endif
22
}
23
24
-static bool use_exit_tb(DisasContext *ctx)
25
-{
26
- return ((tb_cflags(ctx->base.tb) & CF_LAST_IO)
27
- || ctx->base.singlestep_enabled
28
- || singlestep);
29
-}
30
-
31
static bool use_goto_tb(DisasContext *ctx, uint64_t dest)
32
{
33
- /* Suppress goto_tb in the case of single-steping and IO. */
34
- if (unlikely(use_exit_tb(ctx))) {
35
- return false;
36
- }
37
#ifndef CONFIG_USER_ONLY
38
/* If the destination is in the superpage, the page perms can't change. */
39
if (in_superpage(ctx, dest)) {
40
@@ -XXX,XX +XXX,XX @@ static DisasJumpType gen_call_pal(DisasContext *ctx, int palcode)
41
need the page permissions check. We'll see the existence of
42
the page when we create the TB, and we'll flush all TBs if
43
we change the PAL base register. */
44
- if (!use_exit_tb(ctx)) {
45
+ if (!ctx->base.singlestep_enabled) {
46
tcg_gen_goto_tb(0);
47
tcg_gen_movi_i64(cpu_pc, entry);
48
tcg_gen_exit_tb(ctx->base.tb, 0);
49
@@ -XXX,XX +XXX,XX @@ static void alpha_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
50
tcg_gen_movi_i64(cpu_pc, ctx->base.pc_next);
51
/* FALLTHRU */
52
case DISAS_PC_UPDATED:
53
- if (!use_exit_tb(ctx)) {
54
+ if (!ctx->base.singlestep_enabled) {
55
tcg_gen_lookup_and_goto_ptr();
56
break;
57
}
58
--
59
2.25.1
60
61
diff view generated by jsdifflib
New patch
1
The number of links across (normal) pages using this is low,
2
and it will shortly violate the contract for breakpoints.
1
3
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
target/alpha/translate.c | 24 ++----------------------
8
1 file changed, 2 insertions(+), 22 deletions(-)
9
10
diff --git a/target/alpha/translate.c b/target/alpha/translate.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/alpha/translate.c
13
+++ b/target/alpha/translate.c
14
@@ -XXX,XX +XXX,XX @@ static DisasJumpType gen_store_conditional(DisasContext *ctx, int ra, int rb,
15
return DISAS_NEXT;
16
}
17
18
-static bool in_superpage(DisasContext *ctx, int64_t addr)
19
-{
20
-#ifndef CONFIG_USER_ONLY
21
- return ((ctx->tbflags & ENV_FLAG_PS_USER) == 0
22
- && addr >> TARGET_VIRT_ADDR_SPACE_BITS == -1
23
- && ((addr >> 41) & 3) == 2);
24
-#else
25
- return false;
26
-#endif
27
-}
28
-
29
static bool use_goto_tb(DisasContext *ctx, uint64_t dest)
30
{
31
#ifndef CONFIG_USER_ONLY
32
- /* If the destination is in the superpage, the page perms can't change. */
33
- if (in_superpage(ctx, dest)) {
34
- return true;
35
- }
36
/* Check for the dest on the same page as the start of the TB. */
37
return ((ctx->base.tb->pc ^ dest) & TARGET_PAGE_MASK) == 0;
38
#else
39
@@ -XXX,XX +XXX,XX @@ static void alpha_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu)
40
{
41
DisasContext *ctx = container_of(dcbase, DisasContext, base);
42
CPUAlphaState *env = cpu->env_ptr;
43
- int64_t bound, mask;
44
+ int64_t bound;
45
46
ctx->tbflags = ctx->base.tb->flags;
47
ctx->mem_idx = cpu_mmu_index(env, false);
48
@@ -XXX,XX +XXX,XX @@ static void alpha_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu)
49
ctx->lit = NULL;
50
51
/* Bound the number of insns to execute to those left on the page. */
52
- if (in_superpage(ctx, ctx->base.pc_first)) {
53
- mask = -1ULL << 41;
54
- } else {
55
- mask = TARGET_PAGE_MASK;
56
- }
57
- bound = -(ctx->base.pc_first | mask) / 4;
58
+ bound = -(ctx->base.pc_first | TARGET_PAGE_MASK) / 4;
59
ctx->base.max_insns = MIN(ctx->base.max_insns, bound);
60
}
61
62
--
63
2.25.1
64
65
diff view generated by jsdifflib
New patch
1
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3
---
4
target/alpha/translate.c | 7 +------
5
1 file changed, 1 insertion(+), 6 deletions(-)
1
6
7
diff --git a/target/alpha/translate.c b/target/alpha/translate.c
8
index XXXXXXX..XXXXXXX 100644
9
--- a/target/alpha/translate.c
10
+++ b/target/alpha/translate.c
11
@@ -XXX,XX +XXX,XX @@ static DisasJumpType gen_store_conditional(DisasContext *ctx, int ra, int rb,
12
13
static bool use_goto_tb(DisasContext *ctx, uint64_t dest)
14
{
15
-#ifndef CONFIG_USER_ONLY
16
- /* Check for the dest on the same page as the start of the TB. */
17
- return ((ctx->base.tb->pc ^ dest) & TARGET_PAGE_MASK) == 0;
18
-#else
19
- return true;
20
-#endif
21
+ return translator_use_goto_tb(&ctx->base, dest);
22
}
23
24
static DisasJumpType gen_bdirect(DisasContext *ctx, int ra, int32_t disp)
25
--
26
2.25.1
27
28
diff view generated by jsdifflib
New patch
1
Using gen_goto_tb directly misses the single-step check.
2
Let the branch or debug exception be emitted by arm_tr_tb_stop.
1
3
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
target/arm/translate.c | 4 ++--
8
1 file changed, 2 insertions(+), 2 deletions(-)
9
10
diff --git a/target/arm/translate.c b/target/arm/translate.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/arm/translate.c
13
+++ b/target/arm/translate.c
14
@@ -XXX,XX +XXX,XX @@ static bool trans_ISB(DisasContext *s, arg_ISB *a)
15
* self-modifying code correctly and also to take
16
* any pending interrupts immediately.
17
*/
18
- gen_goto_tb(s, 0, s->base.pc_next);
19
+ s->base.is_jmp = DISAS_TOO_MANY;
20
return true;
21
}
22
23
@@ -XXX,XX +XXX,XX @@ static bool trans_SB(DisasContext *s, arg_SB *a)
24
* for TCG; MB and end the TB instead.
25
*/
26
tcg_gen_mb(TCG_MO_ALL | TCG_BAR_SC);
27
- gen_goto_tb(s, 0, s->base.pc_next);
28
+ s->base.is_jmp = DISAS_TOO_MANY;
29
return true;
30
}
31
32
--
33
2.25.1
34
35
diff view generated by jsdifflib
New patch
1
We have not needed to end a TB for I/O since ba3e7926691
2
("icount: clean up cpu_can_io at the entry to the block"),
3
and gdbstub singlestep is handled by the generic function.
1
4
5
Drop the unused 'n' argument to use_goto_tb.
6
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
---
10
target/arm/translate-a64.c | 25 +++++--------------------
11
1 file changed, 5 insertions(+), 20 deletions(-)
12
13
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/translate-a64.c
16
+++ b/target/arm/translate-a64.c
17
@@ -XXX,XX +XXX,XX @@ static void gen_step_complete_exception(DisasContext *s)
18
s->base.is_jmp = DISAS_NORETURN;
19
}
20
21
-static inline bool use_goto_tb(DisasContext *s, int n, uint64_t dest)
22
+static inline bool use_goto_tb(DisasContext *s, uint64_t dest)
23
{
24
- /* No direct tb linking with singlestep (either QEMU's or the ARM
25
- * debug architecture kind) or deterministic io
26
- */
27
- if (s->base.singlestep_enabled || s->ss_active ||
28
- (tb_cflags(s->base.tb) & CF_LAST_IO)) {
29
+ if (s->ss_active) {
30
return false;
31
}
32
-
33
-#ifndef CONFIG_USER_ONLY
34
- /* Only link tbs from inside the same guest page */
35
- if ((s->base.tb->pc & TARGET_PAGE_MASK) != (dest & TARGET_PAGE_MASK)) {
36
- return false;
37
- }
38
-#endif
39
-
40
- return true;
41
+ return translator_use_goto_tb(&s->base, dest);
42
}
43
44
static inline void gen_goto_tb(DisasContext *s, int n, uint64_t dest)
45
{
46
- const TranslationBlock *tb;
47
-
48
- tb = s->base.tb;
49
- if (use_goto_tb(s, n, dest)) {
50
+ if (use_goto_tb(s, dest)) {
51
tcg_gen_goto_tb(n);
52
gen_a64_set_pc_im(dest);
53
- tcg_gen_exit_tb(tb, n);
54
+ tcg_gen_exit_tb(s->base.tb, n);
55
s->base.is_jmp = DISAS_NORETURN;
56
} else {
57
gen_a64_set_pc_im(dest);
58
--
59
2.25.1
60
61
diff view generated by jsdifflib
New patch
1
Just use translator_use_goto_tb directly at the one call site,
2
rather than maintaining a local wrapper.
1
3
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
target/arm/translate.c | 12 +-----------
8
1 file changed, 1 insertion(+), 11 deletions(-)
9
10
diff --git a/target/arm/translate.c b/target/arm/translate.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/arm/translate.c
13
+++ b/target/arm/translate.c
14
@@ -XXX,XX +XXX,XX @@ static int disas_dsp_insn(DisasContext *s, uint32_t insn)
15
return 1;
16
}
17
18
-static inline bool use_goto_tb(DisasContext *s, target_ulong dest)
19
-{
20
-#ifndef CONFIG_USER_ONLY
21
- return (s->base.tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK) ||
22
- ((s->base.pc_next - 1) & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
23
-#else
24
- return true;
25
-#endif
26
-}
27
-
28
static void gen_goto_ptr(void)
29
{
30
tcg_gen_lookup_and_goto_ptr();
31
@@ -XXX,XX +XXX,XX @@ static void gen_goto_ptr(void)
32
*/
33
static void gen_goto_tb(DisasContext *s, int n, target_ulong dest)
34
{
35
- if (use_goto_tb(s, dest)) {
36
+ if (translator_use_goto_tb(&s->base, dest)) {
37
tcg_gen_goto_tb(n);
38
gen_set_pc_im(s, dest);
39
tcg_gen_exit_tb(s->base.tb, n);
40
--
41
2.25.1
42
43
diff view generated by jsdifflib
1
From: Stephen Long <steplong@quicinc.com>
1
Single stepping is not the only reason not to use goto_tb.
2
If goto_tb is disallowed, and single-stepping is not enabled,
3
then use tcg_gen_lookup_and_goto_tb to indirectly chain.
2
4
3
The fallback inline expansion for vectorized absolute value,
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
4
when the host doesn't support such an insn was flawed.
5
6
E.g. when a vector of bytes has all elements negative, mask
7
will be 0xffff_ffff_ffff_ffff. Subtracting mask only adds 1
8
to the low element instead of all elements becase -mask is 1
9
and not 0x0101_0101_0101_0101.
10
11
Signed-off-by: Stephen Long <steplong@quicinc.com>
12
Message-Id: <20200813161818.190-1-steplong@quicinc.com>
13
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
14
---
7
---
15
tcg/tcg-op-gvec.c | 5 +++--
8
target/avr/translate.c | 9 ++++++---
16
1 file changed, 3 insertions(+), 2 deletions(-)
9
1 file changed, 6 insertions(+), 3 deletions(-)
17
10
18
diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c
11
diff --git a/target/avr/translate.c b/target/avr/translate.c
19
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
20
--- a/tcg/tcg-op-gvec.c
13
--- a/target/avr/translate.c
21
+++ b/tcg/tcg-op-gvec.c
14
+++ b/target/avr/translate.c
22
@@ -XXX,XX +XXX,XX @@ static void gen_absv_mask(TCGv_i64 d, TCGv_i64 b, unsigned vece)
15
@@ -XXX,XX +XXX,XX @@ static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
23
tcg_gen_muli_i64(t, t, (1 << nbit) - 1);
16
{
24
17
const TranslationBlock *tb = ctx->base.tb;
25
/*
18
26
- * Invert (via xor -1) and add one (via sub -1).
19
- if (!ctx->base.singlestep_enabled) {
27
+ * Invert (via xor -1) and add one.
20
+ if (translator_use_goto_tb(&ctx->base, dest)) {
28
* Because of the ordering the msb is cleared,
21
tcg_gen_goto_tb(n);
29
* so we never have carry into the next element.
22
tcg_gen_movi_i32(cpu_pc, dest);
30
*/
23
tcg_gen_exit_tb(tb, n);
31
tcg_gen_xor_i64(d, b, t);
24
} else {
32
- tcg_gen_sub_i64(d, d, t);
25
tcg_gen_movi_i32(cpu_pc, dest);
33
+ tcg_gen_andi_i64(t, t, dup_const(vece, 1));
26
- gen_helper_debug(cpu_env);
34
+ tcg_gen_add_i64(d, d, t);
27
- tcg_gen_exit_tb(NULL, 0);
35
28
+ if (ctx->base.singlestep_enabled) {
36
tcg_temp_free_i64(t);
29
+ gen_helper_debug(cpu_env);
30
+ } else {
31
+ tcg_gen_lookup_and_goto_ptr();
32
+ }
33
}
34
ctx->base.is_jmp = DISAS_NORETURN;
37
}
35
}
38
--
36
--
39
2.25.1
37
2.25.1
40
38
41
39
diff view generated by jsdifflib
New patch
1
All of these helpers end with cpu_loop_exit.
1
2
3
Reviewed-by: Michael Rolnik <mrolnik@gmail.com>
4
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
target/avr/helper.h | 8 ++++----
8
1 file changed, 4 insertions(+), 4 deletions(-)
9
10
diff --git a/target/avr/helper.h b/target/avr/helper.h
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/avr/helper.h
13
+++ b/target/avr/helper.h
14
@@ -XXX,XX +XXX,XX @@
15
*/
16
17
DEF_HELPER_1(wdr, void, env)
18
-DEF_HELPER_1(debug, void, env)
19
-DEF_HELPER_1(break, void, env)
20
-DEF_HELPER_1(sleep, void, env)
21
-DEF_HELPER_1(unsupported, void, env)
22
+DEF_HELPER_1(debug, noreturn, env)
23
+DEF_HELPER_1(break, noreturn, env)
24
+DEF_HELPER_1(sleep, noreturn, env)
25
+DEF_HELPER_1(unsupported, noreturn, env)
26
DEF_HELPER_3(outb, void, env, i32, i32)
27
DEF_HELPER_2(inb, tl, env, i32)
28
DEF_HELPER_3(fullwr, void, env, i32, i32)
29
--
30
2.25.1
31
32
diff view generated by jsdifflib
New patch
1
The test for singlestepping is done in translator_use_goto_tb,
2
so we may elide it from cris_tr_tb_stop.
1
3
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
target/cris/translate.c | 5 ++---
8
1 file changed, 2 insertions(+), 3 deletions(-)
9
10
diff --git a/target/cris/translate.c b/target/cris/translate.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/cris/translate.c
13
+++ b/target/cris/translate.c
14
@@ -XXX,XX +XXX,XX @@ static void t_gen_swapr(TCGv d, TCGv s)
15
16
static bool use_goto_tb(DisasContext *dc, target_ulong dest)
17
{
18
- return ((dest ^ dc->base.pc_first) & TARGET_PAGE_MASK) == 0;
19
+ return translator_use_goto_tb(&dc->base, dest);
20
}
21
22
static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest)
23
@@ -XXX,XX +XXX,XX @@ static void cris_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu)
24
* Use a conditional branch if either taken or not-taken path
25
* can use goto_tb. If neither can, then treat it as indirect.
26
*/
27
- if (likely(!dc->base.singlestep_enabled)
28
- && likely(!dc->cpustate_changed)
29
+ if (likely(!dc->cpustate_changed)
30
&& (use_goto_tb(dc, dc->jmp_pc) || use_goto_tb(dc, npc))) {
31
TCGLabel *not_taken = gen_new_label();
32
33
--
34
2.25.1
35
36
diff view generated by jsdifflib
New patch
1
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3
---
4
target/hppa/translate.c | 5 +----
5
1 file changed, 1 insertion(+), 4 deletions(-)
1
6
7
diff --git a/target/hppa/translate.c b/target/hppa/translate.c
8
index XXXXXXX..XXXXXXX 100644
9
--- a/target/hppa/translate.c
10
+++ b/target/hppa/translate.c
11
@@ -XXX,XX +XXX,XX @@ static bool gen_illegal(DisasContext *ctx)
12
13
static bool use_goto_tb(DisasContext *ctx, target_ureg dest)
14
{
15
- /* Suppress goto_tb for page crossing, IO, or single-steping. */
16
- return !(((ctx->base.pc_first ^ dest) & TARGET_PAGE_MASK)
17
- || (tb_cflags(ctx->base.tb) & CF_LAST_IO)
18
- || ctx->base.singlestep_enabled);
19
+ return translator_use_goto_tb(&ctx->base, dest);
20
}
21
22
/* If the next insn is to be nullified, and it's on the same page,
23
--
24
2.25.1
25
26
diff view generated by jsdifflib
New patch
1
Just use translator_use_goto_tb directly at the one call site,
2
rather than maintaining a local wrapper.
1
3
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
target/i386/tcg/translate.c | 14 ++------------
8
1 file changed, 2 insertions(+), 12 deletions(-)
9
10
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/i386/tcg/translate.c
13
+++ b/target/i386/tcg/translate.c
14
@@ -XXX,XX +XXX,XX @@ static inline int insn_const_size(MemOp ot)
15
}
16
}
17
18
-static inline bool use_goto_tb(DisasContext *s, target_ulong pc)
19
-{
20
-#ifndef CONFIG_USER_ONLY
21
- return (pc & TARGET_PAGE_MASK) == (s->base.tb->pc & TARGET_PAGE_MASK) ||
22
- (pc & TARGET_PAGE_MASK) == (s->pc_start & TARGET_PAGE_MASK);
23
-#else
24
- return true;
25
-#endif
26
-}
27
-
28
-static inline void gen_goto_tb(DisasContext *s, int tb_num, target_ulong eip)
29
+static void gen_goto_tb(DisasContext *s, int tb_num, target_ulong eip)
30
{
31
target_ulong pc = s->cs_base + eip;
32
33
- if (use_goto_tb(s, pc)) {
34
+ if (translator_use_goto_tb(&s->base, pc)) {
35
/* jump to same page: we can use a direct jump */
36
tcg_gen_goto_tb(tb_num);
37
gen_jmp_im(s, eip);
38
--
39
2.25.1
40
41
diff view generated by jsdifflib
New patch
1
Just use translator_use_goto_tb directly at the one call site,
2
rather than maintaining a local wrapper.
1
3
4
Acked-by: Laurent Vivier <laurent@vivier.eu>
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
---
8
target/m68k/translate.c | 12 +-----------
9
1 file changed, 1 insertion(+), 11 deletions(-)
10
11
diff --git a/target/m68k/translate.c b/target/m68k/translate.c
12
index XXXXXXX..XXXXXXX 100644
13
--- a/target/m68k/translate.c
14
+++ b/target/m68k/translate.c
15
@@ -XXX,XX +XXX,XX @@ static void gen_exit_tb(DisasContext *s)
16
} \
17
} while (0)
18
19
-static inline bool use_goto_tb(DisasContext *s, uint32_t dest)
20
-{
21
-#ifndef CONFIG_USER_ONLY
22
- return (s->base.pc_first & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK)
23
- || (s->base.pc_next & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
24
-#else
25
- return true;
26
-#endif
27
-}
28
-
29
/* Generate a jump to an immediate address. */
30
static void gen_jmp_tb(DisasContext *s, int n, uint32_t dest)
31
{
32
@@ -XXX,XX +XXX,XX @@ static void gen_jmp_tb(DisasContext *s, int n, uint32_t dest)
33
update_cc_op(s);
34
tcg_gen_movi_i32(QREG_PC, dest);
35
gen_singlestep_exception(s);
36
- } else if (use_goto_tb(s, dest)) {
37
+ } else if (translator_use_goto_tb(&s->base, dest)) {
38
tcg_gen_goto_tb(n);
39
tcg_gen_movi_i32(QREG_PC, dest);
40
tcg_gen_exit_tb(s->base.tb, n);
41
--
42
2.25.1
43
44
diff view generated by jsdifflib
New patch
1
Just use translator_use_goto_tb directly at the one call site,
2
rather than maintaining a local wrapper.
1
3
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
target/microblaze/translate.c | 11 +----------
8
1 file changed, 1 insertion(+), 10 deletions(-)
9
10
diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/microblaze/translate.c
13
+++ b/target/microblaze/translate.c
14
@@ -XXX,XX +XXX,XX @@ static void gen_raise_hw_excp(DisasContext *dc, uint32_t esr_ec)
15
gen_raise_exception_sync(dc, EXCP_HW_EXCP);
16
}
17
18
-static inline bool use_goto_tb(DisasContext *dc, target_ulong dest)
19
-{
20
-#ifndef CONFIG_USER_ONLY
21
- return (dc->base.pc_first & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
22
-#else
23
- return true;
24
-#endif
25
-}
26
-
27
static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest)
28
{
29
if (dc->base.singlestep_enabled) {
30
@@ -XXX,XX +XXX,XX @@ static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest)
31
tcg_gen_movi_i32(cpu_pc, dest);
32
gen_helper_raise_exception(cpu_env, tmp);
33
tcg_temp_free_i32(tmp);
34
- } else if (use_goto_tb(dc, dest)) {
35
+ } else if (translator_use_goto_tb(&dc->base, dest)) {
36
tcg_gen_goto_tb(n);
37
tcg_gen_movi_i32(cpu_pc, dest);
38
tcg_gen_exit_tb(dc->base.tb, n);
39
--
40
2.25.1
41
42
diff view generated by jsdifflib
New patch
1
Just use translator_use_goto_tb directly at the one call site,
2
rather than maintaining a local wrapper.
1
3
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
target/mips/tcg/translate.c | 17 ++---------------
8
1 file changed, 2 insertions(+), 15 deletions(-)
9
10
diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/mips/tcg/translate.c
13
+++ b/target/mips/tcg/translate.c
14
@@ -XXX,XX +XXX,XX @@ static void gen_trap(DisasContext *ctx, uint32_t opc,
15
tcg_temp_free(t1);
16
}
17
18
-static inline bool use_goto_tb(DisasContext *ctx, target_ulong dest)
19
+static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
20
{
21
- if (unlikely(ctx->base.singlestep_enabled)) {
22
- return false;
23
- }
24
-
25
-#ifndef CONFIG_USER_ONLY
26
- return (ctx->base.tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
27
-#else
28
- return true;
29
-#endif
30
-}
31
-
32
-static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
33
-{
34
- if (use_goto_tb(ctx, dest)) {
35
+ if (translator_use_goto_tb(&ctx->base, dest)) {
36
tcg_gen_goto_tb(n);
37
gen_save_pc(dest);
38
tcg_gen_exit_tb(ctx->base.tb, n);
39
--
40
2.25.1
41
42
diff view generated by jsdifflib
1
We already support duplication of 128-bit blocks. This extends
1
Do not emit dead code for the singlestep_enabled case,
2
that support to 256-bit blocks. This will be needed by SVE2.
2
after having exited the TB with a debug exception.
3
3
4
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
4
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
6
---
7
tcg/tcg-op-gvec.c | 52 ++++++++++++++++++++++++++++++++++++++++++++---
7
target/mips/tcg/translate.c | 3 ++-
8
1 file changed, 49 insertions(+), 3 deletions(-)
8
1 file changed, 2 insertions(+), 1 deletion(-)
9
9
10
diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c
10
diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c
11
index XXXXXXX..XXXXXXX 100644
11
index XXXXXXX..XXXXXXX 100644
12
--- a/tcg/tcg-op-gvec.c
12
--- a/target/mips/tcg/translate.c
13
+++ b/tcg/tcg-op-gvec.c
13
+++ b/target/mips/tcg/translate.c
14
@@ -XXX,XX +XXX,XX @@ void tcg_gen_gvec_dup_mem(unsigned vece, uint32_t dofs, uint32_t aofs,
14
@@ -XXX,XX +XXX,XX @@ static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
15
do_dup(vece, dofs, oprsz, maxsz, NULL, in, 0);
15
if (ctx->base.singlestep_enabled) {
16
tcg_temp_free_i64(in);
16
save_cpu_state(ctx, 0);
17
gen_helper_raise_exception_debug(cpu_env);
18
+ } else {
19
+ tcg_gen_lookup_and_goto_ptr();
17
}
20
}
18
- } else {
21
- tcg_gen_lookup_and_goto_ptr();
19
+ } else if (vece == 4) {
20
/* 128-bit duplicate. */
21
- /* ??? Dup to 256-bit vector. */
22
int i;
23
24
- tcg_debug_assert(vece == 4);
25
tcg_debug_assert(oprsz >= 16);
26
if (TCG_TARGET_HAS_v128) {
27
TCGv_vec in = tcg_temp_new_vec(TCG_TYPE_V128);
28
@@ -XXX,XX +XXX,XX @@ void tcg_gen_gvec_dup_mem(unsigned vece, uint32_t dofs, uint32_t aofs,
29
if (oprsz < maxsz) {
30
expand_clr(dofs + oprsz, maxsz - oprsz);
31
}
32
+ } else if (vece == 5) {
33
+ /* 256-bit duplicate. */
34
+ int i;
35
+
36
+ tcg_debug_assert(oprsz >= 32);
37
+ tcg_debug_assert(oprsz % 32 == 0);
38
+ if (TCG_TARGET_HAS_v256) {
39
+ TCGv_vec in = tcg_temp_new_vec(TCG_TYPE_V256);
40
+
41
+ tcg_gen_ld_vec(in, cpu_env, aofs);
42
+ for (i = (aofs == dofs) * 32; i < oprsz; i += 32) {
43
+ tcg_gen_st_vec(in, cpu_env, dofs + i);
44
+ }
45
+ tcg_temp_free_vec(in);
46
+ } else if (TCG_TARGET_HAS_v128) {
47
+ TCGv_vec in0 = tcg_temp_new_vec(TCG_TYPE_V128);
48
+ TCGv_vec in1 = tcg_temp_new_vec(TCG_TYPE_V128);
49
+
50
+ tcg_gen_ld_vec(in0, cpu_env, aofs);
51
+ tcg_gen_ld_vec(in1, cpu_env, aofs + 16);
52
+ for (i = (aofs == dofs) * 32; i < oprsz; i += 32) {
53
+ tcg_gen_st_vec(in0, cpu_env, dofs + i);
54
+ tcg_gen_st_vec(in1, cpu_env, dofs + i + 16);
55
+ }
56
+ tcg_temp_free_vec(in0);
57
+ tcg_temp_free_vec(in1);
58
+ } else {
59
+ TCGv_i64 in[4];
60
+ int j;
61
+
62
+ for (j = 0; j < 4; ++j) {
63
+ in[j] = tcg_temp_new_i64();
64
+ tcg_gen_ld_i64(in[j], cpu_env, aofs + j * 8);
65
+ }
66
+ for (i = (aofs == dofs) * 32; i < oprsz; i += 32) {
67
+ for (j = 0; j < 4; ++j) {
68
+ tcg_gen_st_i64(in[j], cpu_env, dofs + i + j * 8);
69
+ }
70
+ }
71
+ for (j = 0; j < 4; ++j) {
72
+ tcg_temp_free_i64(in[j]);
73
+ }
74
+ }
75
+ if (oprsz < maxsz) {
76
+ expand_clr(dofs + oprsz, maxsz - oprsz);
77
+ }
78
+ } else {
79
+ g_assert_not_reached();
80
}
22
}
81
}
23
}
82
24
83
--
25
--
84
2.25.1
26
2.25.1
85
27
86
28
diff view generated by jsdifflib
New patch
1
Just use translator_use_goto_tb directly at the one call site,
2
rather than maintaining a local wrapper.
1
3
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
target/nios2/translate.c | 15 +--------------
8
1 file changed, 1 insertion(+), 14 deletions(-)
9
10
diff --git a/target/nios2/translate.c b/target/nios2/translate.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/nios2/translate.c
13
+++ b/target/nios2/translate.c
14
@@ -XXX,XX +XXX,XX @@ static void t_gen_helper_raise_exception(DisasContext *dc,
15
dc->base.is_jmp = DISAS_NORETURN;
16
}
17
18
-static bool use_goto_tb(DisasContext *dc, uint32_t dest)
19
-{
20
- if (unlikely(dc->base.singlestep_enabled)) {
21
- return false;
22
- }
23
-
24
-#ifndef CONFIG_USER_ONLY
25
- return (dc->base.pc_first & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
26
-#else
27
- return true;
28
-#endif
29
-}
30
-
31
static void gen_goto_tb(DisasContext *dc, int n, uint32_t dest)
32
{
33
const TranslationBlock *tb = dc->base.tb;
34
35
- if (use_goto_tb(dc, dest)) {
36
+ if (translator_use_goto_tb(&dc->base, dest)) {
37
tcg_gen_goto_tb(n);
38
tcg_gen_movi_tl(cpu_R[R_PC], dest);
39
tcg_gen_exit_tb(tb, n);
40
--
41
2.25.1
42
43
diff view generated by jsdifflib
New patch
1
Reorder the control statements to allow using the page boundary
2
check from translator_use_goto_tb().
1
3
4
Reviewed-by: Stafford Horne <shorne@gmail.com>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
target/openrisc/translate.c | 15 ++++++++-------
8
1 file changed, 8 insertions(+), 7 deletions(-)
9
10
diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/openrisc/translate.c
13
+++ b/target/openrisc/translate.c
14
@@ -XXX,XX +XXX,XX @@ static void openrisc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
15
/* fallthru */
16
17
case DISAS_TOO_MANY:
18
- if (unlikely(dc->base.singlestep_enabled)) {
19
- tcg_gen_movi_tl(cpu_pc, jmp_dest);
20
- gen_exception(dc, EXCP_DEBUG);
21
- } else if ((dc->base.pc_first ^ jmp_dest) & TARGET_PAGE_MASK) {
22
- tcg_gen_movi_tl(cpu_pc, jmp_dest);
23
- tcg_gen_lookup_and_goto_ptr();
24
- } else {
25
+ if (translator_use_goto_tb(&dc->base, jmp_dest)) {
26
tcg_gen_goto_tb(0);
27
tcg_gen_movi_tl(cpu_pc, jmp_dest);
28
tcg_gen_exit_tb(dc->base.tb, 0);
29
+ break;
30
+ }
31
+ tcg_gen_movi_tl(cpu_pc, jmp_dest);
32
+ if (unlikely(dc->base.singlestep_enabled)) {
33
+ gen_exception(dc, EXCP_DEBUG);
34
+ } else {
35
+ tcg_gen_lookup_and_goto_ptr();
36
}
37
break;
38
39
--
40
2.25.1
41
42
diff view generated by jsdifflib
New patch
1
Reviewed-by: Luis Pires <luis.pires@eldorado.org.br>
2
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3
---
4
target/ppc/translate.c | 10 +---------
5
1 file changed, 1 insertion(+), 9 deletions(-)
1
6
7
diff --git a/target/ppc/translate.c b/target/ppc/translate.c
8
index XXXXXXX..XXXXXXX 100644
9
--- a/target/ppc/translate.c
10
+++ b/target/ppc/translate.c
11
@@ -XXX,XX +XXX,XX @@ static inline void gen_update_cfar(DisasContext *ctx, target_ulong nip)
12
13
static inline bool use_goto_tb(DisasContext *ctx, target_ulong dest)
14
{
15
- if (unlikely(ctx->singlestep_enabled)) {
16
- return false;
17
- }
18
-
19
-#ifndef CONFIG_USER_ONLY
20
- return (ctx->base.tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
21
-#else
22
- return true;
23
-#endif
24
+ return translator_use_goto_tb(&ctx->base, dest);
25
}
26
27
static void gen_lookup_and_goto_ptr(DisasContext *ctx)
28
--
29
2.25.1
30
31
diff view generated by jsdifflib
New patch
1
Just use translator_use_goto_tb directly at the one call site,
2
rather than maintaining a local wrapper.
1
3
4
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
target/riscv/translate.c | 20 +-------------------
8
1 file changed, 1 insertion(+), 19 deletions(-)
9
10
diff --git a/target/riscv/translate.c b/target/riscv/translate.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/riscv/translate.c
13
+++ b/target/riscv/translate.c
14
@@ -XXX,XX +XXX,XX @@ static void gen_exception_inst_addr_mis(DisasContext *ctx)
15
generate_exception_mtval(ctx, RISCV_EXCP_INST_ADDR_MIS);
16
}
17
18
-static inline bool use_goto_tb(DisasContext *ctx, target_ulong dest)
19
-{
20
- if (unlikely(ctx->base.singlestep_enabled)) {
21
- return false;
22
- }
23
-
24
-#ifndef CONFIG_USER_ONLY
25
- return (ctx->base.tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
26
-#else
27
- return true;
28
-#endif
29
-}
30
-
31
static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
32
{
33
- if (use_goto_tb(ctx, dest)) {
34
- /* chaining is only allowed when the jump is to the same page */
35
+ if (translator_use_goto_tb(&ctx->base, dest)) {
36
tcg_gen_goto_tb(n);
37
tcg_gen_movi_tl(cpu_pc, dest);
38
-
39
- /* No need to check for single stepping here as use_goto_tb() will
40
- * return false in case of single stepping.
41
- */
42
tcg_gen_exit_tb(ctx->base.tb, n);
43
} else {
44
tcg_gen_movi_tl(cpu_pc, dest);
45
--
46
2.25.1
47
48
diff view generated by jsdifflib
New patch
1
Just use translator_use_goto_tb directly at the one call site,
2
rather than maintaining a local wrapper.
1
3
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
target/rx/translate.c | 11 +----------
8
1 file changed, 1 insertion(+), 10 deletions(-)
9
10
diff --git a/target/rx/translate.c b/target/rx/translate.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/rx/translate.c
13
+++ b/target/rx/translate.c
14
@@ -XXX,XX +XXX,XX @@ void rx_cpu_dump_state(CPUState *cs, FILE *f, int flags)
15
}
16
}
17
18
-static bool use_goto_tb(DisasContext *dc, target_ulong dest)
19
-{
20
- if (unlikely(dc->base.singlestep_enabled)) {
21
- return false;
22
- } else {
23
- return true;
24
- }
25
-}
26
-
27
static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest)
28
{
29
- if (use_goto_tb(dc, dest)) {
30
+ if (translator_use_goto_tb(&dc->base, dest)) {
31
tcg_gen_goto_tb(n);
32
tcg_gen_movi_i32(cpu_pc, dest);
33
tcg_gen_exit_tb(dc->base.tb, n);
34
--
35
2.25.1
36
37
diff view generated by jsdifflib
New patch
1
Reviewed-by: David Hildenbrand <david@redhat.com>
2
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3
---
4
target/s390x/translate.c | 7 +------
5
1 file changed, 1 insertion(+), 6 deletions(-)
1
6
7
diff --git a/target/s390x/translate.c b/target/s390x/translate.c
8
index XXXXXXX..XXXXXXX 100644
9
--- a/target/s390x/translate.c
10
+++ b/target/s390x/translate.c
11
@@ -XXX,XX +XXX,XX @@ static bool use_goto_tb(DisasContext *s, uint64_t dest)
12
if (unlikely(use_exit_tb(s))) {
13
return false;
14
}
15
-#ifndef CONFIG_USER_ONLY
16
- return (dest & TARGET_PAGE_MASK) == (s->base.tb->pc & TARGET_PAGE_MASK) ||
17
- (dest & TARGET_PAGE_MASK) == (s->base.pc_next & TARGET_PAGE_MASK);
18
-#else
19
- return true;
20
-#endif
21
+ return translator_use_goto_tb(&s->base, dest);
22
}
23
24
static void account_noninline_branch(DisasContext *s, int cc_op)
25
--
26
2.25.1
27
28
diff view generated by jsdifflib
New patch
1
We have not needed to end a TB for I/O since ba3e7926691
2
("icount: clean up cpu_can_io at the entry to the block").
1
3
4
In use_goto_tb, the check for singlestep_enabled is in the
5
generic translator_use_goto_tb. In s390x_tr_tb_stop, the
6
check for singlestep_enabled is in the preceding do_debug test.
7
8
Which leaves only FLAG_MASK_PER: fold that test alone into
9
the two callers of use_exit tb.
10
11
Reviewed-by: David Hildenbrand <david@redhat.com>
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
---
14
target/s390x/translate.c | 11 ++---------
15
1 file changed, 2 insertions(+), 9 deletions(-)
16
17
diff --git a/target/s390x/translate.c b/target/s390x/translate.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/target/s390x/translate.c
20
+++ b/target/s390x/translate.c
21
@@ -XXX,XX +XXX,XX @@ static void gen_op_calc_cc(DisasContext *s)
22
set_cc_static(s);
23
}
24
25
-static bool use_exit_tb(DisasContext *s)
26
-{
27
- return s->base.singlestep_enabled ||
28
- (tb_cflags(s->base.tb) & CF_LAST_IO) ||
29
- (s->base.tb->flags & FLAG_MASK_PER);
30
-}
31
-
32
static bool use_goto_tb(DisasContext *s, uint64_t dest)
33
{
34
- if (unlikely(use_exit_tb(s))) {
35
+ if (unlikely(s->base.tb->flags & FLAG_MASK_PER)) {
36
return false;
37
}
38
return translator_use_goto_tb(&s->base, dest);
39
@@ -XXX,XX +XXX,XX @@ static void s390x_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs)
40
/* Exit the TB, either by raising a debug exception or by return. */
41
if (dc->do_debug) {
42
gen_exception(EXCP_DEBUG);
43
- } else if (use_exit_tb(dc) ||
44
+ } else if ((dc->base.tb->flags & FLAG_MASK_PER) ||
45
dc->base.is_jmp == DISAS_PC_STALE_NOCHAIN) {
46
tcg_gen_exit_tb(NULL, 0);
47
} else {
48
--
49
2.25.1
50
51
diff view generated by jsdifflib
New patch
1
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3
---
4
target/sh4/translate.c | 11 +++--------
5
1 file changed, 3 insertions(+), 8 deletions(-)
1
6
7
diff --git a/target/sh4/translate.c b/target/sh4/translate.c
8
index XXXXXXX..XXXXXXX 100644
9
--- a/target/sh4/translate.c
10
+++ b/target/sh4/translate.c
11
@@ -XXX,XX +XXX,XX @@ static inline bool use_exit_tb(DisasContext *ctx)
12
return (ctx->tbflags & GUSA_EXCLUSIVE) != 0;
13
}
14
15
-static inline bool use_goto_tb(DisasContext *ctx, target_ulong dest)
16
+static bool use_goto_tb(DisasContext *ctx, target_ulong dest)
17
{
18
- /* Use a direct jump if in same page and singlestep not enabled */
19
- if (unlikely(ctx->base.singlestep_enabled || use_exit_tb(ctx))) {
20
+ if (use_exit_tb(ctx)) {
21
return false;
22
}
23
-#ifndef CONFIG_USER_ONLY
24
- return (ctx->base.tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
25
-#else
26
- return true;
27
-#endif
28
+ return translator_use_goto_tb(&ctx->base, dest);
29
}
30
31
static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
32
--
33
2.25.1
34
35
diff view generated by jsdifflib
New patch
1
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
2
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3
---
4
target/sparc/translate.c | 19 +++++--------------
5
1 file changed, 5 insertions(+), 14 deletions(-)
1
6
7
diff --git a/target/sparc/translate.c b/target/sparc/translate.c
8
index XXXXXXX..XXXXXXX 100644
9
--- a/target/sparc/translate.c
10
+++ b/target/sparc/translate.c
11
@@ -XXX,XX +XXX,XX @@ static inline TCGv gen_dest_gpr(DisasContext *dc, int reg)
12
}
13
}
14
15
-static inline bool use_goto_tb(DisasContext *s, target_ulong pc,
16
- target_ulong npc)
17
+static bool use_goto_tb(DisasContext *s, target_ulong pc, target_ulong npc)
18
{
19
- if (unlikely(s->base.singlestep_enabled || singlestep)) {
20
- return false;
21
- }
22
-
23
-#ifndef CONFIG_USER_ONLY
24
- return (pc & TARGET_PAGE_MASK) == (s->base.tb->pc & TARGET_PAGE_MASK) &&
25
- (npc & TARGET_PAGE_MASK) == (s->base.tb->pc & TARGET_PAGE_MASK);
26
-#else
27
- return true;
28
-#endif
29
+ return translator_use_goto_tb(&s->base, pc) &&
30
+ translator_use_goto_tb(&s->base, npc);
31
}
32
33
-static inline void gen_goto_tb(DisasContext *s, int tb_num,
34
- target_ulong pc, target_ulong npc)
35
+static void gen_goto_tb(DisasContext *s, int tb_num,
36
+ target_ulong pc, target_ulong npc)
37
{
38
if (use_goto_tb(s, pc, npc)) {
39
/* jump to same page: we can use a direct jump */
40
--
41
2.25.1
42
43
diff view generated by jsdifflib
New patch
1
Just use translator_use_goto_tb directly at the one call site,
2
rather than maintaining a local wrapper.
1
3
4
Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
target/tricore/translate.c | 17 ++---------------
8
1 file changed, 2 insertions(+), 15 deletions(-)
9
10
diff --git a/target/tricore/translate.c b/target/tricore/translate.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/tricore/translate.c
13
+++ b/target/tricore/translate.c
14
@@ -XXX,XX +XXX,XX @@ static inline void gen_save_pc(target_ulong pc)
15
tcg_gen_movi_tl(cpu_PC, pc);
16
}
17
18
-static inline bool use_goto_tb(DisasContext *ctx, target_ulong dest)
19
-{
20
- if (unlikely(ctx->base.singlestep_enabled)) {
21
- return false;
22
- }
23
-
24
-#ifndef CONFIG_USER_ONLY
25
- return (ctx->base.tb->pc & TARGET_PAGE_MASK) == (dest & TARGET_PAGE_MASK);
26
-#else
27
- return true;
28
-#endif
29
-}
30
-
31
static void generate_qemu_excp(DisasContext *ctx, int excp)
32
{
33
TCGv_i32 tmp = tcg_const_i32(excp);
34
@@ -XXX,XX +XXX,XX @@ static void generate_qemu_excp(DisasContext *ctx, int excp)
35
tcg_temp_free(tmp);
36
}
37
38
-static inline void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
39
+static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
40
{
41
- if (use_goto_tb(ctx, dest)) {
42
+ if (translator_use_goto_tb(&ctx->base, dest)) {
43
tcg_gen_goto_tb(n);
44
gen_save_pc(dest);
45
tcg_gen_exit_tb(ctx->base.tb, n);
46
--
47
2.25.1
48
49
diff view generated by jsdifflib
New patch
1
The non-single-step case of gen_goto_tb may use
2
tcg_gen_lookup_and_goto_ptr to indirectly chain.
1
3
4
Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
target/tricore/translate.c | 3 ++-
8
1 file changed, 2 insertions(+), 1 deletion(-)
9
10
diff --git a/target/tricore/translate.c b/target/tricore/translate.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/tricore/translate.c
13
+++ b/target/tricore/translate.c
14
@@ -XXX,XX +XXX,XX @@ static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest)
15
gen_save_pc(dest);
16
if (ctx->base.singlestep_enabled) {
17
generate_qemu_excp(ctx, EXCP_DEBUG);
18
+ } else {
19
+ tcg_gen_lookup_and_goto_ptr();
20
}
21
- tcg_gen_exit_tb(NULL, 0);
22
}
23
}
24
25
--
26
2.25.1
27
28
diff view generated by jsdifflib
New patch
1
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
2
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3
---
4
target/xtensa/translate.c | 6 +-----
5
1 file changed, 1 insertion(+), 5 deletions(-)
1
6
7
diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c
8
index XXXXXXX..XXXXXXX 100644
9
--- a/target/xtensa/translate.c
10
+++ b/target/xtensa/translate.c
11
@@ -XXX,XX +XXX,XX @@ static void gen_jump(DisasContext *dc, TCGv dest)
12
13
static int adjust_jump_slot(DisasContext *dc, uint32_t dest, int slot)
14
{
15
- if (((dc->base.pc_first ^ dest) & TARGET_PAGE_MASK) != 0) {
16
- return -1;
17
- } else {
18
- return slot;
19
- }
20
+ return translator_use_goto_tb(&dc->base, dest) ? slot : -1;
21
}
22
23
static void gen_jumpi(DisasContext *dc, uint32_t dest, int slot)
24
--
25
2.25.1
26
27
diff view generated by jsdifflib
New patch
1
In tcg_region_prologue_set, we reset TCGContext.code_gen_ptr.
2
So do that after we've used it to dump the prologue contents.
1
3
4
Fixes: b0a0794a0f16
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
tcg/tcg.c | 4 ++--
8
1 file changed, 2 insertions(+), 2 deletions(-)
9
10
diff --git a/tcg/tcg.c b/tcg/tcg.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/tcg/tcg.c
13
+++ b/tcg/tcg.c
14
@@ -XXX,XX +XXX,XX @@ void tcg_prologue_init(TCGContext *s)
15
(uintptr_t)s->code_buf, prologue_size);
16
#endif
17
18
- tcg_region_prologue_set(s);
19
-
20
#ifdef DEBUG_DISAS
21
if (qemu_loglevel_mask(CPU_LOG_TB_OUT_ASM)) {
22
FILE *logfile = qemu_log_lock();
23
@@ -XXX,XX +XXX,XX @@ void tcg_prologue_init(TCGContext *s)
24
tcg_debug_assert(tcg_code_gen_epilogue != NULL);
25
}
26
#endif
27
+
28
+ tcg_region_prologue_set(s);
29
}
30
31
void tcg_func_start(TCGContext *s)
32
--
33
2.25.1
34
35
diff view generated by jsdifflib
New patch
1
The loop is performing a simple boolean test for the existence
2
of a BP_CPU breakpoint at EIP. Plus it gets the iteration wrong,
3
if we happen to have a BP_GDB breakpoint at the same address.
1
4
5
We have a function for this: cpu_breakpoint_test.
6
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
9
Message-Id: <20210620062317.1399034-1-richard.henderson@linaro.org>
10
---
11
target/i386/tcg/sysemu/bpt_helper.c | 12 +++---------
12
1 file changed, 3 insertions(+), 9 deletions(-)
13
14
diff --git a/target/i386/tcg/sysemu/bpt_helper.c b/target/i386/tcg/sysemu/bpt_helper.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/i386/tcg/sysemu/bpt_helper.c
17
+++ b/target/i386/tcg/sysemu/bpt_helper.c
18
@@ -XXX,XX +XXX,XX @@ void breakpoint_handler(CPUState *cs)
19
{
20
X86CPU *cpu = X86_CPU(cs);
21
CPUX86State *env = &cpu->env;
22
- CPUBreakpoint *bp;
23
24
if (cs->watchpoint_hit) {
25
if (cs->watchpoint_hit->flags & BP_CPU) {
26
@@ -XXX,XX +XXX,XX @@ void breakpoint_handler(CPUState *cs)
27
}
28
}
29
} else {
30
- QTAILQ_FOREACH(bp, &cs->breakpoints, entry) {
31
- if (bp->pc == env->eip) {
32
- if (bp->flags & BP_CPU) {
33
- check_hw_breakpoints(env, true);
34
- raise_exception(env, EXCP01_DB);
35
- }
36
- break;
37
- }
38
+ if (cpu_breakpoint_test(cs, env->eip, BP_CPU)) {
39
+ check_hw_breakpoints(env, true);
40
+ raise_exception(env, EXCP01_DB);
41
}
42
}
43
}
44
--
45
2.25.1
46
47
diff view generated by jsdifflib
New patch
1
This will allow additional code sharing.
2
No functional change.
1
3
4
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
7
accel/tcg/cpu-exec.c | 30 ++++++++++++++++++++++++++++++
8
accel/tcg/tcg-runtime.c | 22 ----------------------
9
2 files changed, 30 insertions(+), 22 deletions(-)
10
11
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
12
index XXXXXXX..XXXXXXX 100644
13
--- a/accel/tcg/cpu-exec.c
14
+++ b/accel/tcg/cpu-exec.c
15
@@ -XXX,XX +XXX,XX @@
16
#include "exec/cpu-all.h"
17
#include "sysemu/cpu-timers.h"
18
#include "sysemu/replay.h"
19
+#include "exec/helper-proto.h"
20
#include "tb-hash.h"
21
#include "tb-lookup.h"
22
#include "tb-context.h"
23
@@ -XXX,XX +XXX,XX @@ static void init_delay_params(SyncClocks *sc, const CPUState *cpu)
24
}
25
#endif /* CONFIG USER ONLY */
26
27
+/**
28
+ * helper_lookup_tb_ptr: quick check for next tb
29
+ * @env: current cpu state
30
+ *
31
+ * Look for an existing TB matching the current cpu state.
32
+ * If found, return the code pointer. If not found, return
33
+ * the tcg epilogue so that we return into cpu_tb_exec.
34
+ */
35
+const void *HELPER(lookup_tb_ptr)(CPUArchState *env)
36
+{
37
+ CPUState *cpu = env_cpu(env);
38
+ TranslationBlock *tb;
39
+ target_ulong cs_base, pc;
40
+ uint32_t flags;
41
+
42
+ cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags);
43
+
44
+ tb = tb_lookup(cpu, pc, cs_base, flags, curr_cflags(cpu));
45
+ if (tb == NULL) {
46
+ return tcg_code_gen_epilogue;
47
+ }
48
+ qemu_log_mask_and_addr(CPU_LOG_EXEC, pc,
49
+ "Chain %d: %p ["
50
+ TARGET_FMT_lx "/" TARGET_FMT_lx "/%#x] %s\n",
51
+ cpu->cpu_index, tb->tc.ptr, cs_base, pc, flags,
52
+ lookup_symbol(pc));
53
+ return tb->tc.ptr;
54
+}
55
+
56
/* Execute a TB, and fix up the CPU state afterwards if necessary */
57
/*
58
* Disable CFI checks.
59
diff --git a/accel/tcg/tcg-runtime.c b/accel/tcg/tcg-runtime.c
60
index XXXXXXX..XXXXXXX 100644
61
--- a/accel/tcg/tcg-runtime.c
62
+++ b/accel/tcg/tcg-runtime.c
63
@@ -XXX,XX +XXX,XX @@
64
#include "disas/disas.h"
65
#include "exec/log.h"
66
#include "tcg/tcg.h"
67
-#include "tb-lookup.h"
68
69
/* 32-bit helpers */
70
71
@@ -XXX,XX +XXX,XX @@ uint64_t HELPER(ctpop_i64)(uint64_t arg)
72
return ctpop64(arg);
73
}
74
75
-const void *HELPER(lookup_tb_ptr)(CPUArchState *env)
76
-{
77
- CPUState *cpu = env_cpu(env);
78
- TranslationBlock *tb;
79
- target_ulong cs_base, pc;
80
- uint32_t flags;
81
-
82
- cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags);
83
-
84
- tb = tb_lookup(cpu, pc, cs_base, flags, curr_cflags(cpu));
85
- if (tb == NULL) {
86
- return tcg_code_gen_epilogue;
87
- }
88
- qemu_log_mask_and_addr(CPU_LOG_EXEC, pc,
89
- "Chain %d: %p ["
90
- TARGET_FMT_lx "/" TARGET_FMT_lx "/%#x] %s\n",
91
- cpu->cpu_index, tb->tc.ptr, cs_base, pc, flags,
92
- lookup_symbol(pc));
93
- return tb->tc.ptr;
94
-}
95
-
96
void HELPER(exit_atomic)(CPUArchState *env)
97
{
98
cpu_loop_exit_atomic(env_cpu(env), GETPC());
99
--
100
2.25.1
101
102
diff view generated by jsdifflib
1
Do not store back to the exact memory from which we just loaded.
1
Now that we've moved helper_lookup_tb_ptr, the only user
2
of tb-lookup.h is cpu-exec.c; merge the contents in.
2
3
3
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
4
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
4
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
---
6
---
6
tcg/tcg-op-gvec.c | 4 ++--
7
accel/tcg/tb-lookup.h | 49 -------------------------------------------
7
1 file changed, 2 insertions(+), 2 deletions(-)
8
accel/tcg/cpu-exec.c | 31 ++++++++++++++++++++++++++-
9
2 files changed, 30 insertions(+), 50 deletions(-)
10
delete mode 100644 accel/tcg/tb-lookup.h
8
11
9
diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c
12
diff --git a/accel/tcg/tb-lookup.h b/accel/tcg/tb-lookup.h
13
deleted file mode 100644
14
index XXXXXXX..XXXXXXX
15
--- a/accel/tcg/tb-lookup.h
16
+++ /dev/null
17
@@ -XXX,XX +XXX,XX @@
18
-/*
19
- * Copyright (C) 2017, Emilio G. Cota <cota@braap.org>
20
- *
21
- * License: GNU GPL, version 2 or later.
22
- * See the COPYING file in the top-level directory.
23
- */
24
-#ifndef EXEC_TB_LOOKUP_H
25
-#define EXEC_TB_LOOKUP_H
26
-
27
-#ifdef NEED_CPU_H
28
-#include "cpu.h"
29
-#else
30
-#include "exec/poison.h"
31
-#endif
32
-
33
-#include "exec/exec-all.h"
34
-#include "tb-hash.h"
35
-
36
-/* Might cause an exception, so have a longjmp destination ready */
37
-static inline TranslationBlock *tb_lookup(CPUState *cpu, target_ulong pc,
38
- target_ulong cs_base,
39
- uint32_t flags, uint32_t cflags)
40
-{
41
- TranslationBlock *tb;
42
- uint32_t hash;
43
-
44
- /* we should never be trying to look up an INVALID tb */
45
- tcg_debug_assert(!(cflags & CF_INVALID));
46
-
47
- hash = tb_jmp_cache_hash_func(pc);
48
- tb = qatomic_rcu_read(&cpu->tb_jmp_cache[hash]);
49
-
50
- if (likely(tb &&
51
- tb->pc == pc &&
52
- tb->cs_base == cs_base &&
53
- tb->flags == flags &&
54
- tb->trace_vcpu_dstate == *cpu->trace_dstate &&
55
- tb_cflags(tb) == cflags)) {
56
- return tb;
57
- }
58
- tb = tb_htable_lookup(cpu, pc, cs_base, flags, cflags);
59
- if (tb == NULL) {
60
- return NULL;
61
- }
62
- qatomic_set(&cpu->tb_jmp_cache[hash], tb);
63
- return tb;
64
-}
65
-
66
-#endif /* EXEC_TB_LOOKUP_H */
67
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
10
index XXXXXXX..XXXXXXX 100644
68
index XXXXXXX..XXXXXXX 100644
11
--- a/tcg/tcg-op-gvec.c
69
--- a/accel/tcg/cpu-exec.c
12
+++ b/tcg/tcg-op-gvec.c
70
+++ b/accel/tcg/cpu-exec.c
13
@@ -XXX,XX +XXX,XX @@ void tcg_gen_gvec_dup_mem(unsigned vece, uint32_t dofs, uint32_t aofs,
71
@@ -XXX,XX +XXX,XX @@
14
TCGv_vec in = tcg_temp_new_vec(TCG_TYPE_V128);
72
#include "sysemu/replay.h"
15
73
#include "exec/helper-proto.h"
16
tcg_gen_ld_vec(in, cpu_env, aofs);
74
#include "tb-hash.h"
17
- for (i = 0; i < oprsz; i += 16) {
75
-#include "tb-lookup.h"
18
+ for (i = (aofs == dofs) * 16; i < oprsz; i += 16) {
76
#include "tb-context.h"
19
tcg_gen_st_vec(in, cpu_env, dofs + i);
77
#include "internal.h"
20
}
78
21
tcg_temp_free_vec(in);
79
@@ -XXX,XX +XXX,XX @@ static void init_delay_params(SyncClocks *sc, const CPUState *cpu)
22
@@ -XXX,XX +XXX,XX @@ void tcg_gen_gvec_dup_mem(unsigned vece, uint32_t dofs, uint32_t aofs,
80
}
23
81
#endif /* CONFIG USER ONLY */
24
tcg_gen_ld_i64(in0, cpu_env, aofs);
82
25
tcg_gen_ld_i64(in1, cpu_env, aofs + 8);
83
+/* Might cause an exception, so have a longjmp destination ready */
26
- for (i = 0; i < oprsz; i += 16) {
84
+static inline TranslationBlock *tb_lookup(CPUState *cpu, target_ulong pc,
27
+ for (i = (aofs == dofs) * 16; i < oprsz; i += 16) {
85
+ target_ulong cs_base,
28
tcg_gen_st_i64(in0, cpu_env, dofs + i);
86
+ uint32_t flags, uint32_t cflags)
29
tcg_gen_st_i64(in1, cpu_env, dofs + i + 8);
87
+{
30
}
88
+ TranslationBlock *tb;
89
+ uint32_t hash;
90
+
91
+ /* we should never be trying to look up an INVALID tb */
92
+ tcg_debug_assert(!(cflags & CF_INVALID));
93
+
94
+ hash = tb_jmp_cache_hash_func(pc);
95
+ tb = qatomic_rcu_read(&cpu->tb_jmp_cache[hash]);
96
+
97
+ if (likely(tb &&
98
+ tb->pc == pc &&
99
+ tb->cs_base == cs_base &&
100
+ tb->flags == flags &&
101
+ tb->trace_vcpu_dstate == *cpu->trace_dstate &&
102
+ tb_cflags(tb) == cflags)) {
103
+ return tb;
104
+ }
105
+ tb = tb_htable_lookup(cpu, pc, cs_base, flags, cflags);
106
+ if (tb == NULL) {
107
+ return NULL;
108
+ }
109
+ qatomic_set(&cpu->tb_jmp_cache[hash], tb);
110
+ return tb;
111
+}
112
+
113
/**
114
* helper_lookup_tb_ptr: quick check for next tb
115
* @env: current cpu state
31
--
116
--
32
2.25.1
117
2.25.1
33
118
34
119
diff view generated by jsdifflib
New patch
1
Split out CPU_LOG_EXEC and CPU_LOG_TB_CPU logging from
2
cpu_tb_exec to a new function. Perform only one pc
3
range check after a combined mask check.
1
4
5
Use the new function in lookup_tb_ptr. This enables
6
CPU_LOG_TB_CPU between indirectly chained tbs.
7
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
---
10
accel/tcg/cpu-exec.c | 61 ++++++++++++++++++++++++--------------------
11
1 file changed, 34 insertions(+), 27 deletions(-)
12
13
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/accel/tcg/cpu-exec.c
16
+++ b/accel/tcg/cpu-exec.c
17
@@ -XXX,XX +XXX,XX @@ static inline TranslationBlock *tb_lookup(CPUState *cpu, target_ulong pc,
18
return tb;
19
}
20
21
+static inline void log_cpu_exec(target_ulong pc, CPUState *cpu,
22
+ const TranslationBlock *tb)
23
+{
24
+ if (unlikely(qemu_loglevel_mask(CPU_LOG_TB_CPU | CPU_LOG_EXEC))
25
+ && qemu_log_in_addr_range(pc)) {
26
+
27
+ qemu_log_mask(CPU_LOG_EXEC,
28
+ "Trace %d: %p [" TARGET_FMT_lx
29
+ "/" TARGET_FMT_lx "/%#x] %s\n",
30
+ cpu->cpu_index, tb->tc.ptr, tb->cs_base, pc, tb->flags,
31
+ lookup_symbol(pc));
32
+
33
+#if defined(DEBUG_DISAS)
34
+ if (qemu_loglevel_mask(CPU_LOG_TB_CPU)) {
35
+ FILE *logfile = qemu_log_lock();
36
+ int flags = 0;
37
+
38
+ if (qemu_loglevel_mask(CPU_LOG_TB_FPU)) {
39
+ flags |= CPU_DUMP_FPU;
40
+ }
41
+#if defined(TARGET_I386)
42
+ flags |= CPU_DUMP_CCOP;
43
+#endif
44
+ log_cpu_state(cpu, flags);
45
+ qemu_log_unlock(logfile);
46
+ }
47
+#endif /* DEBUG_DISAS */
48
+ }
49
+}
50
+
51
/**
52
* helper_lookup_tb_ptr: quick check for next tb
53
* @env: current cpu state
54
@@ -XXX,XX +XXX,XX @@ const void *HELPER(lookup_tb_ptr)(CPUArchState *env)
55
if (tb == NULL) {
56
return tcg_code_gen_epilogue;
57
}
58
- qemu_log_mask_and_addr(CPU_LOG_EXEC, pc,
59
- "Chain %d: %p ["
60
- TARGET_FMT_lx "/" TARGET_FMT_lx "/%#x] %s\n",
61
- cpu->cpu_index, tb->tc.ptr, cs_base, pc, flags,
62
- lookup_symbol(pc));
63
+
64
+ log_cpu_exec(pc, cpu, tb);
65
+
66
return tb->tc.ptr;
67
}
68
69
@@ -XXX,XX +XXX,XX @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit)
70
TranslationBlock *last_tb;
71
const void *tb_ptr = itb->tc.ptr;
72
73
- qemu_log_mask_and_addr(CPU_LOG_EXEC, itb->pc,
74
- "Trace %d: %p ["
75
- TARGET_FMT_lx "/" TARGET_FMT_lx "/%#x] %s\n",
76
- cpu->cpu_index, itb->tc.ptr,
77
- itb->cs_base, itb->pc, itb->flags,
78
- lookup_symbol(itb->pc));
79
-
80
-#if defined(DEBUG_DISAS)
81
- if (qemu_loglevel_mask(CPU_LOG_TB_CPU)
82
- && qemu_log_in_addr_range(itb->pc)) {
83
- FILE *logfile = qemu_log_lock();
84
- int flags = 0;
85
- if (qemu_loglevel_mask(CPU_LOG_TB_FPU)) {
86
- flags |= CPU_DUMP_FPU;
87
- }
88
-#if defined(TARGET_I386)
89
- flags |= CPU_DUMP_CCOP;
90
-#endif
91
- log_cpu_state(cpu, flags);
92
- qemu_log_unlock(logfile);
93
- }
94
-#endif /* DEBUG_DISAS */
95
+ log_cpu_exec(itb->pc, cpu, itb);
96
97
qemu_thread_jit_execute();
98
ret = tcg_qemu_tb_exec(env, tb_ptr);
99
--
100
2.25.1
101
102
diff view generated by jsdifflib
New patch
1
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3
---
4
accel/tcg/cpu-exec.c | 6 +++---
5
1 file changed, 3 insertions(+), 3 deletions(-)
1
6
7
diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c
8
index XXXXXXX..XXXXXXX 100644
9
--- a/accel/tcg/cpu-exec.c
10
+++ b/accel/tcg/cpu-exec.c
11
@@ -XXX,XX +XXX,XX @@ static inline void log_cpu_exec(target_ulong pc, CPUState *cpu,
12
13
qemu_log_mask(CPU_LOG_EXEC,
14
"Trace %d: %p [" TARGET_FMT_lx
15
- "/" TARGET_FMT_lx "/%#x] %s\n",
16
- cpu->cpu_index, tb->tc.ptr, tb->cs_base, pc, tb->flags,
17
- lookup_symbol(pc));
18
+ "/" TARGET_FMT_lx "/%08x/%08x] %s\n",
19
+ cpu->cpu_index, tb->tc.ptr, tb->cs_base, pc,
20
+ tb->flags, tb->cflags, lookup_symbol(pc));
21
22
#if defined(DEBUG_DISAS)
23
if (qemu_loglevel_mask(CPU_LOG_TB_CPU)) {
24
--
25
2.25.1
26
27
diff view generated by jsdifflib
1
Do not set parallel_cpus if there is only one cpu instantiated.
1
Since 6eea04347eb6, all tcg backends support goto_ptr.
2
This will allow tcg to use serial code to implement atomics.
2
Remove the conditional, making support mandatory.
3
3
4
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
4
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
---
6
---
7
softmmu/cpus.c | 11 ++++++++++-
7
include/tcg/tcg-opc.h | 3 +--
8
1 file changed, 10 insertions(+), 1 deletion(-)
8
tcg/aarch64/tcg-target.h | 1 -
9
tcg/arm/tcg-target.h | 1 -
10
tcg/i386/tcg-target.h | 1 -
11
tcg/mips/tcg-target.h | 1 -
12
tcg/ppc/tcg-target.h | 1 -
13
tcg/riscv/tcg-target.h | 1 -
14
tcg/s390/tcg-target.h | 1 -
15
tcg/sparc/tcg-target.h | 1 -
16
tcg/tci/tcg-target.h | 1 -
17
tcg/tcg-op.c | 2 +-
18
tcg/tcg.c | 8 ++------
19
12 files changed, 4 insertions(+), 18 deletions(-)
9
20
10
diff --git a/softmmu/cpus.c b/softmmu/cpus.c
21
diff --git a/include/tcg/tcg-opc.h b/include/tcg/tcg-opc.h
11
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
12
--- a/softmmu/cpus.c
23
--- a/include/tcg/tcg-opc.h
13
+++ b/softmmu/cpus.c
24
+++ b/include/tcg/tcg-opc.h
14
@@ -XXX,XX +XXX,XX @@ static void qemu_tcg_init_vcpu(CPUState *cpu)
25
@@ -XXX,XX +XXX,XX @@ DEF(insn_start, 0, 0, TLADDR_ARGS * TARGET_INSN_START_WORDS,
15
if (!tcg_region_inited) {
26
TCG_OPF_NOT_PRESENT)
16
tcg_region_inited = 1;
27
DEF(exit_tb, 0, 0, 1, TCG_OPF_BB_EXIT | TCG_OPF_BB_END)
17
tcg_region_init();
28
DEF(goto_tb, 0, 0, 1, TCG_OPF_BB_EXIT | TCG_OPF_BB_END)
18
+ /*
29
-DEF(goto_ptr, 0, 1, 0,
19
+ * If MTTCG, and we will create multiple cpus,
30
- TCG_OPF_BB_EXIT | TCG_OPF_BB_END | IMPL(TCG_TARGET_HAS_goto_ptr))
20
+ * then we will have cpus running in parallel.
31
+DEF(goto_ptr, 0, 1, 0, TCG_OPF_BB_EXIT | TCG_OPF_BB_END)
21
+ */
32
22
+ if (qemu_tcg_mttcg_enabled()) {
33
DEF(plugin_cb_start, 0, 0, 3, TCG_OPF_NOT_PRESENT)
23
+ MachineState *ms = MACHINE(qdev_get_machine());
34
DEF(plugin_cb_end, 0, 0, 0, TCG_OPF_NOT_PRESENT)
24
+ if (ms->smp.max_cpus > 1) {
35
diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h
25
+ parallel_cpus = true;
36
index XXXXXXX..XXXXXXX 100644
26
+ }
37
--- a/tcg/aarch64/tcg-target.h
27
+ }
38
+++ b/tcg/aarch64/tcg-target.h
28
}
39
@@ -XXX,XX +XXX,XX @@ typedef enum {
29
40
#define TCG_TARGET_HAS_mulsh_i32 0
30
if (qemu_tcg_mttcg_enabled() || !single_tcg_cpu_thread) {
41
#define TCG_TARGET_HAS_extrl_i64_i32 0
31
@@ -XXX,XX +XXX,XX @@ static void qemu_tcg_init_vcpu(CPUState *cpu)
42
#define TCG_TARGET_HAS_extrh_i64_i32 0
32
43
-#define TCG_TARGET_HAS_goto_ptr 1
33
if (qemu_tcg_mttcg_enabled()) {
44
#define TCG_TARGET_HAS_qemu_st8_i32 0
34
/* create a thread per vCPU with TCG (MTTCG) */
45
35
- parallel_cpus = true;
46
#define TCG_TARGET_HAS_div_i64 1
36
snprintf(thread_name, VCPU_THREAD_NAME_SIZE, "CPU %d/TCG",
47
diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h
37
cpu->cpu_index);
48
index XXXXXXX..XXXXXXX 100644
38
49
--- a/tcg/arm/tcg-target.h
50
+++ b/tcg/arm/tcg-target.h
51
@@ -XXX,XX +XXX,XX @@ extern bool use_neon_instructions;
52
#define TCG_TARGET_HAS_mulsh_i32 0
53
#define TCG_TARGET_HAS_div_i32 use_idiv_instructions
54
#define TCG_TARGET_HAS_rem_i32 0
55
-#define TCG_TARGET_HAS_goto_ptr 1
56
#define TCG_TARGET_HAS_direct_jump 0
57
#define TCG_TARGET_HAS_qemu_st8_i32 0
58
59
diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h
60
index XXXXXXX..XXXXXXX 100644
61
--- a/tcg/i386/tcg-target.h
62
+++ b/tcg/i386/tcg-target.h
63
@@ -XXX,XX +XXX,XX @@ extern bool have_movbe;
64
#define TCG_TARGET_HAS_muls2_i32 1
65
#define TCG_TARGET_HAS_muluh_i32 0
66
#define TCG_TARGET_HAS_mulsh_i32 0
67
-#define TCG_TARGET_HAS_goto_ptr 1
68
#define TCG_TARGET_HAS_direct_jump 1
69
70
#if TCG_TARGET_REG_BITS == 64
71
diff --git a/tcg/mips/tcg-target.h b/tcg/mips/tcg-target.h
72
index XXXXXXX..XXXXXXX 100644
73
--- a/tcg/mips/tcg-target.h
74
+++ b/tcg/mips/tcg-target.h
75
@@ -XXX,XX +XXX,XX @@ extern bool use_mips32r2_instructions;
76
#define TCG_TARGET_HAS_muluh_i32 1
77
#define TCG_TARGET_HAS_mulsh_i32 1
78
#define TCG_TARGET_HAS_bswap32_i32 1
79
-#define TCG_TARGET_HAS_goto_ptr 1
80
#define TCG_TARGET_HAS_direct_jump 1
81
82
#if TCG_TARGET_REG_BITS == 64
83
diff --git a/tcg/ppc/tcg-target.h b/tcg/ppc/tcg-target.h
84
index XXXXXXX..XXXXXXX 100644
85
--- a/tcg/ppc/tcg-target.h
86
+++ b/tcg/ppc/tcg-target.h
87
@@ -XXX,XX +XXX,XX @@ extern bool have_vsx;
88
#define TCG_TARGET_HAS_muls2_i32 0
89
#define TCG_TARGET_HAS_muluh_i32 1
90
#define TCG_TARGET_HAS_mulsh_i32 1
91
-#define TCG_TARGET_HAS_goto_ptr 1
92
#define TCG_TARGET_HAS_direct_jump 1
93
#define TCG_TARGET_HAS_qemu_st8_i32 0
94
95
diff --git a/tcg/riscv/tcg-target.h b/tcg/riscv/tcg-target.h
96
index XXXXXXX..XXXXXXX 100644
97
--- a/tcg/riscv/tcg-target.h
98
+++ b/tcg/riscv/tcg-target.h
99
@@ -XXX,XX +XXX,XX @@ typedef enum {
100
#define TCG_TARGET_CALL_STACK_OFFSET 0
101
102
/* optional instructions */
103
-#define TCG_TARGET_HAS_goto_ptr 1
104
#define TCG_TARGET_HAS_movcond_i32 0
105
#define TCG_TARGET_HAS_div_i32 1
106
#define TCG_TARGET_HAS_rem_i32 1
107
diff --git a/tcg/s390/tcg-target.h b/tcg/s390/tcg-target.h
108
index XXXXXXX..XXXXXXX 100644
109
--- a/tcg/s390/tcg-target.h
110
+++ b/tcg/s390/tcg-target.h
111
@@ -XXX,XX +XXX,XX @@ extern uint64_t s390_facilities;
112
#define TCG_TARGET_HAS_mulsh_i32 0
113
#define TCG_TARGET_HAS_extrl_i64_i32 0
114
#define TCG_TARGET_HAS_extrh_i64_i32 0
115
-#define TCG_TARGET_HAS_goto_ptr 1
116
#define TCG_TARGET_HAS_direct_jump (s390_facilities & FACILITY_GEN_INST_EXT)
117
#define TCG_TARGET_HAS_qemu_st8_i32 0
118
119
diff --git a/tcg/sparc/tcg-target.h b/tcg/sparc/tcg-target.h
120
index XXXXXXX..XXXXXXX 100644
121
--- a/tcg/sparc/tcg-target.h
122
+++ b/tcg/sparc/tcg-target.h
123
@@ -XXX,XX +XXX,XX @@ extern bool use_vis3_instructions;
124
#define TCG_TARGET_HAS_muls2_i32 1
125
#define TCG_TARGET_HAS_muluh_i32 0
126
#define TCG_TARGET_HAS_mulsh_i32 0
127
-#define TCG_TARGET_HAS_goto_ptr 1
128
#define TCG_TARGET_HAS_direct_jump 1
129
#define TCG_TARGET_HAS_qemu_st8_i32 0
130
131
diff --git a/tcg/tci/tcg-target.h b/tcg/tci/tcg-target.h
132
index XXXXXXX..XXXXXXX 100644
133
--- a/tcg/tci/tcg-target.h
134
+++ b/tcg/tci/tcg-target.h
135
@@ -XXX,XX +XXX,XX @@
136
#define TCG_TARGET_HAS_muls2_i32 1
137
#define TCG_TARGET_HAS_muluh_i32 0
138
#define TCG_TARGET_HAS_mulsh_i32 0
139
-#define TCG_TARGET_HAS_goto_ptr 1
140
#define TCG_TARGET_HAS_direct_jump 0
141
#define TCG_TARGET_HAS_qemu_st8_i32 0
142
143
diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c
144
index XXXXXXX..XXXXXXX 100644
145
--- a/tcg/tcg-op.c
146
+++ b/tcg/tcg-op.c
147
@@ -XXX,XX +XXX,XX @@ void tcg_gen_goto_tb(unsigned idx)
148
149
void tcg_gen_lookup_and_goto_ptr(void)
150
{
151
- if (TCG_TARGET_HAS_goto_ptr && !qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) {
152
+ if (!qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) {
153
TCGv_ptr ptr;
154
155
plugin_gen_disable_mem_helpers();
156
diff --git a/tcg/tcg.c b/tcg/tcg.c
157
index XXXXXXX..XXXXXXX 100644
158
--- a/tcg/tcg.c
159
+++ b/tcg/tcg.c
160
@@ -XXX,XX +XXX,XX @@ void tcg_prologue_init(TCGContext *s)
161
* For tci, we use NULL as the signal to return from the interpreter,
162
* so skip this check.
163
*/
164
- if (TCG_TARGET_HAS_goto_ptr) {
165
- tcg_debug_assert(tcg_code_gen_epilogue != NULL);
166
- }
167
+ tcg_debug_assert(tcg_code_gen_epilogue != NULL);
168
#endif
169
170
tcg_region_prologue_set(s);
171
@@ -XXX,XX +XXX,XX @@ bool tcg_op_supported(TCGOpcode op)
172
case INDEX_op_insn_start:
173
case INDEX_op_exit_tb:
174
case INDEX_op_goto_tb:
175
+ case INDEX_op_goto_ptr:
176
case INDEX_op_qemu_ld_i32:
177
case INDEX_op_qemu_st_i32:
178
case INDEX_op_qemu_ld_i64:
179
@@ -XXX,XX +XXX,XX @@ bool tcg_op_supported(TCGOpcode op)
180
case INDEX_op_qemu_st8_i32:
181
return TCG_TARGET_HAS_qemu_st8_i32;
182
183
- case INDEX_op_goto_ptr:
184
- return TCG_TARGET_HAS_goto_ptr;
185
-
186
case INDEX_op_mov_i32:
187
case INDEX_op_setcond_i32:
188
case INDEX_op_brcond_i32:
39
--
189
--
40
2.25.1
190
2.25.1
41
191
42
192
diff view generated by jsdifflib
New patch
1
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
3
---
4
cpu.c | 13 +++++++++----
5
trace-events | 5 +++++
6
2 files changed, 14 insertions(+), 4 deletions(-)
1
7
8
diff --git a/cpu.c b/cpu.c
9
index XXXXXXX..XXXXXXX 100644
10
--- a/cpu.c
11
+++ b/cpu.c
12
@@ -XXX,XX +XXX,XX @@
13
#include "exec/translate-all.h"
14
#include "exec/log.h"
15
#include "hw/core/accel-cpu.h"
16
+#include "trace/trace-root.h"
17
18
uintptr_t qemu_host_page_size;
19
intptr_t qemu_host_page_mask;
20
@@ -XXX,XX +XXX,XX @@ int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags,
21
if (breakpoint) {
22
*breakpoint = bp;
23
}
24
+
25
+ trace_breakpoint_insert(cpu->cpu_index, pc, flags);
26
return 0;
27
}
28
29
@@ -XXX,XX +XXX,XX @@ int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, int flags)
30
}
31
32
/* Remove a specific breakpoint by reference. */
33
-void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *breakpoint)
34
+void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *bp)
35
{
36
- QTAILQ_REMOVE(&cpu->breakpoints, breakpoint, entry);
37
+ QTAILQ_REMOVE(&cpu->breakpoints, bp, entry);
38
39
- breakpoint_invalidate(cpu, breakpoint->pc);
40
+ breakpoint_invalidate(cpu, bp->pc);
41
42
- g_free(breakpoint);
43
+ trace_breakpoint_remove(cpu->cpu_index, bp->pc, bp->flags);
44
+ g_free(bp);
45
}
46
47
/* Remove all matching breakpoints. */
48
@@ -XXX,XX +XXX,XX @@ void cpu_single_step(CPUState *cpu, int enabled)
49
/* XXX: only flush what is necessary */
50
tb_flush(cpu);
51
}
52
+ trace_breakpoint_singlestep(cpu->cpu_index, enabled);
53
}
54
}
55
56
diff --git a/trace-events b/trace-events
57
index XXXXXXX..XXXXXXX 100644
58
--- a/trace-events
59
+++ b/trace-events
60
@@ -XXX,XX +XXX,XX @@
61
#
62
# The <format-string> should be a sprintf()-compatible format string.
63
64
+# cpu.c
65
+breakpoint_insert(int cpu_index, uint64_t pc, int flags) "cpu=%d pc=0x%" PRIx64 " flags=0x%x"
66
+breakpoint_remove(int cpu_index, uint64_t pc, int flags) "cpu=%d pc=0x%" PRIx64 " flags=0x%x"
67
+breakpoint_singlestep(int cpu_index, int enabled) "cpu=%d enable=%d"
68
+
69
# dma-helpers.c
70
dma_blk_io(void *dbs, void *bs, int64_t offset, bool to_dev) "dbs=%p bs=%p offset=%" PRId64 " to_dev=%d"
71
dma_aio_cancel(void *dbs) "dbs=%p"
72
--
73
2.25.1
74
75
diff view generated by jsdifflib