1
The following changes since commit bad76ac319556dab2497429d473b49a237672e1c:
1
The following changes since commit 67e41fe0cfb62e6cdfa659f0155417d17e5274ea:
2
2
3
Merge remote-tracking branch 'remotes/vivier2/tags/trivial-branch-pull-request' into staging (2019-10-25 14:17:08 +0100)
3
Merge tag 'pull-ppc-20220104' of https://github.com/legoater/qemu into staging (2022-01-04 07:23:27 -0800)
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-20191025
7
https://gitlab.com/rth7680/qemu.git tags/pull-tcg-20220104
8
8
9
for you to fetch changes up to 0ed1bfb046b740b70eed2cf3581e01768703b185:
9
for you to fetch changes up to d7478d4229f0a2b2817a55487e6b17081099fae4:
10
10
11
translate-all: Remove tb_alloc (2019-10-25 10:15:25 -0400)
11
common-user: Fix tail calls to safe_syscall_set_errno_tail (2022-01-04 15:41:03 -0800)
12
12
13
----------------------------------------------------------------
13
----------------------------------------------------------------
14
Improvements for TARGET_PAGE_BITS_VARY
14
Fix for safe_syscall_base.
15
Fix for TCI ld16u_i64.
15
Fix for folding of vector add/sub.
16
Fix for segv on icount execute from i/o memory.
16
Fix build on loongarch64 with gcc 8.
17
Two misc cleanups.
17
Remove decl for qemu_run_machine_init_done_notifiers.
18
18
19
----------------------------------------------------------------
19
----------------------------------------------------------------
20
Alex Bennée (1):
20
Philippe Mathieu-Daudé (1):
21
cputlb: ensure _cmmu helper functions follow the naming standard
21
linux-user: Fix trivial build error on loongarch64 hosts
22
22
23
Clement Deschamps (1):
23
Richard Henderson (2):
24
translate-all: fix uninitialized tb->orig_tb
24
tcg/optimize: Fix folding of vector ops
25
common-user: Fix tail calls to safe_syscall_set_errno_tail
25
26
26
Richard Henderson (8):
27
Xiaoyao Li (1):
27
exec: Split out variable page size support to exec-vary.c
28
sysemu: Cleanup qemu_run_machine_init_done_notifiers()
28
configure: Detect compiler support for __attribute__((alias))
29
exec: Use const alias for TARGET_PAGE_BITS_VARY
30
exec: Restrict TARGET_PAGE_BITS_VARY assert to CONFIG_DEBUG_TCG
31
exec: Promote TARGET_PAGE_MASK to target_long
32
exec: Cache TARGET_PAGE_MASK for TARGET_PAGE_BITS_VARY
33
cputlb: Fix tlb_vaddr_to_host
34
translate-all: Remove tb_alloc
35
29
36
Stefan Weil (1):
30
include/sysemu/sysemu.h | 1 -
37
tci: Add implementation for INDEX_op_ld16u_i64
31
linux-user/host/loongarch64/host-signal.h | 4 +--
32
tcg/optimize.c | 49 +++++++++++++++++++++++-------
33
common-user/host/i386/safe-syscall.inc.S | 1 +
34
common-user/host/mips/safe-syscall.inc.S | 1 +
35
common-user/host/x86_64/safe-syscall.inc.S | 1 +
36
6 files changed, 42 insertions(+), 15 deletions(-)
38
37
39
Wei Yang (1):
40
cpu: use ROUND_UP() to define xxx_PAGE_ALIGN
41
42
Makefile.target | 2 +-
43
include/exec/cpu-all.h | 33 +++++++++----
44
include/exec/cpu_ldst_template.h | 4 +-
45
include/qemu-common.h | 6 +++
46
tcg/tcg.h | 20 +++++---
47
accel/tcg/cputlb.c | 26 ++++++++--
48
accel/tcg/translate-all.c | 21 ++------
49
exec-vary.c | 102 +++++++++++++++++++++++++++++++++++++++
50
exec.c | 34 -------------
51
target/cris/translate_v10.inc.c | 3 +-
52
tcg/tci.c | 15 ++++++
53
configure | 19 ++++++++
54
12 files changed, 208 insertions(+), 77 deletions(-)
55
create mode 100644 exec-vary.c
56
diff view generated by jsdifflib
Deleted patch
1
From: Stefan Weil <sw@weilnetz.de>
2
1
3
This fixes "make check-tcg" on a Debian x86_64 host.
4
5
Signed-off-by: Stefan Weil <sw@weilnetz.de>
6
Tested-by: Thomas Huth <thuth@redhat.com>
7
Message-Id: <20190410194838.10123-1-sw@weilnetz.de>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
---
10
tcg/tci.c | 15 +++++++++++++++
11
1 file changed, 15 insertions(+)
12
13
diff --git a/tcg/tci.c b/tcg/tci.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/tcg/tci.c
16
+++ b/tcg/tci.c
17
@@ -XXX,XX +XXX,XX @@ static void tci_write_reg8(tcg_target_ulong *regs, TCGReg index, uint8_t value)
18
tci_write_reg(regs, index, value);
19
}
20
21
+static void
22
+tci_write_reg16(tcg_target_ulong *regs, TCGReg index, uint16_t value)
23
+{
24
+ tci_write_reg(regs, index, value);
25
+}
26
+
27
static void
28
tci_write_reg32(tcg_target_ulong *regs, TCGReg index, uint32_t value)
29
{
30
@@ -XXX,XX +XXX,XX @@ uintptr_t tcg_qemu_tb_exec(CPUArchState *env, uint8_t *tb_ptr)
31
tci_write_reg8(regs, t0, *(uint8_t *)(t1 + t2));
32
break;
33
case INDEX_op_ld8s_i32:
34
+ TODO();
35
+ break;
36
case INDEX_op_ld16u_i32:
37
TODO();
38
break;
39
@@ -XXX,XX +XXX,XX @@ uintptr_t tcg_qemu_tb_exec(CPUArchState *env, uint8_t *tb_ptr)
40
tci_write_reg8(regs, t0, *(uint8_t *)(t1 + t2));
41
break;
42
case INDEX_op_ld8s_i64:
43
+ TODO();
44
+ break;
45
case INDEX_op_ld16u_i64:
46
+ t0 = *tb_ptr++;
47
+ t1 = tci_read_r(regs, &tb_ptr);
48
+ t2 = tci_read_s32(&tb_ptr);
49
+ tci_write_reg16(regs, t0, *(uint16_t *)(t1 + t2));
50
+ break;
51
case INDEX_op_ld16s_i64:
52
TODO();
53
break;
54
--
55
2.17.1
56
57
diff view generated by jsdifflib
1
From: Alex Bennée <alex.bennee@linaro.org>
1
Bitwise operations are easy to fold, because the operation is
2
identical regardless of element size. But add and sub need
3
extra element size info that is not currently propagated.
2
4
3
We document this in docs/devel/load-stores.rst so lets follow it. The
5
Fixes: 2f9f08ba43d
4
32 bit and 64 bit access functions have historically not included the
6
Cc: qemu-stable@nongnu.org
5
sign so we leave those as is. We also introduce some signed helpers
7
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/799
6
which are used for loading immediate values in the translator.
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
8
Fixes: 282dffc8
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
11
Message-Id: <20191021150910.23216-1-alex.bennee@linaro.org>
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
---
10
---
14
include/exec/cpu_ldst_template.h | 4 ++--
11
tcg/optimize.c | 49 ++++++++++++++++++++++++++++++++++++++-----------
15
tcg/tcg.h | 20 ++++++++++++++------
12
1 file changed, 38 insertions(+), 11 deletions(-)
16
accel/tcg/cputlb.c | 24 +++++++++++++++++++++---
17
target/cris/translate_v10.inc.c | 3 +--
18
4 files changed, 38 insertions(+), 13 deletions(-)
19
13
20
diff --git a/include/exec/cpu_ldst_template.h b/include/exec/cpu_ldst_template.h
14
diff --git a/tcg/optimize.c b/tcg/optimize.c
21
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
22
--- a/include/exec/cpu_ldst_template.h
16
--- a/tcg/optimize.c
23
+++ b/include/exec/cpu_ldst_template.h
17
+++ b/tcg/optimize.c
24
@@ -XXX,XX +XXX,XX @@
18
@@ -XXX,XX +XXX,XX @@ static uint64_t do_constant_folding_2(TCGOpcode op, uint64_t x, uint64_t y)
25
#ifdef SOFTMMU_CODE_ACCESS
19
CASE_OP_32_64(mul):
26
#define ADDR_READ addr_code
20
return x * y;
27
#define MMUSUFFIX _cmmu
21
28
-#define URETSUFFIX SUFFIX
22
- CASE_OP_32_64(and):
29
-#define SRETSUFFIX SUFFIX
23
+ CASE_OP_32_64_VEC(and):
30
+#define URETSUFFIX USUFFIX
24
return x & y;
31
+#define SRETSUFFIX glue(s, SUFFIX)
25
32
#else
26
- CASE_OP_32_64(or):
33
#define ADDR_READ addr_read
27
+ CASE_OP_32_64_VEC(or):
34
#define MMUSUFFIX _mmu
28
return x | y;
35
diff --git a/tcg/tcg.h b/tcg/tcg.h
29
36
index XXXXXXX..XXXXXXX 100644
30
- CASE_OP_32_64(xor):
37
--- a/tcg/tcg.h
31
+ CASE_OP_32_64_VEC(xor):
38
+++ b/tcg/tcg.h
32
return x ^ y;
39
@@ -XXX,XX +XXX,XX @@ void helper_be_stl_mmu(CPUArchState *env, target_ulong addr, uint32_t val,
33
40
void helper_be_stq_mmu(CPUArchState *env, target_ulong addr, uint64_t val,
34
case INDEX_op_shl_i32:
41
TCGMemOpIdx oi, uintptr_t retaddr);
35
@@ -XXX,XX +XXX,XX @@ static uint64_t do_constant_folding_2(TCGOpcode op, uint64_t x, uint64_t y)
42
36
case INDEX_op_rotl_i64:
43
-uint8_t helper_ret_ldb_cmmu(CPUArchState *env, target_ulong addr,
37
return rol64(x, y & 63);
44
+uint8_t helper_ret_ldub_cmmu(CPUArchState *env, target_ulong addr,
38
45
TCGMemOpIdx oi, uintptr_t retaddr);
39
- CASE_OP_32_64(not):
46
-uint16_t helper_le_ldw_cmmu(CPUArchState *env, target_ulong addr,
40
+ CASE_OP_32_64_VEC(not):
47
+int8_t helper_ret_ldsb_cmmu(CPUArchState *env, target_ulong addr,
41
return ~x;
48
TCGMemOpIdx oi, uintptr_t retaddr);
42
49
+uint16_t helper_le_lduw_cmmu(CPUArchState *env, target_ulong addr,
43
CASE_OP_32_64(neg):
50
+ TCGMemOpIdx oi, uintptr_t retaddr);
44
return -x;
51
+int16_t helper_le_ldsw_cmmu(CPUArchState *env, target_ulong addr,
45
52
+ TCGMemOpIdx oi, uintptr_t retaddr);
46
- CASE_OP_32_64(andc):
53
uint32_t helper_le_ldl_cmmu(CPUArchState *env, target_ulong addr,
47
+ CASE_OP_32_64_VEC(andc):
54
TCGMemOpIdx oi, uintptr_t retaddr);
48
return x & ~y;
55
uint64_t helper_le_ldq_cmmu(CPUArchState *env, target_ulong addr,
49
56
TCGMemOpIdx oi, uintptr_t retaddr);
50
- CASE_OP_32_64(orc):
57
-uint16_t helper_be_ldw_cmmu(CPUArchState *env, target_ulong addr,
51
+ CASE_OP_32_64_VEC(orc):
58
- TCGMemOpIdx oi, uintptr_t retaddr);
52
return x | ~y;
59
+uint16_t helper_be_lduw_cmmu(CPUArchState *env, target_ulong addr,
53
60
+ TCGMemOpIdx oi, uintptr_t retaddr);
54
CASE_OP_32_64(eqv):
61
+int16_t helper_be_ldsw_cmmu(CPUArchState *env, target_ulong addr,
55
@@ -XXX,XX +XXX,XX @@ static bool fold_const2(OptContext *ctx, TCGOp *op)
62
+ TCGMemOpIdx oi, uintptr_t retaddr);
56
return false;
63
uint32_t helper_be_ldl_cmmu(CPUArchState *env, target_ulong addr,
64
TCGMemOpIdx oi, uintptr_t retaddr);
65
uint64_t helper_be_ldq_cmmu(CPUArchState *env, target_ulong addr,
66
@@ -XXX,XX +XXX,XX @@ uint64_t helper_be_ldq_cmmu(CPUArchState *env, target_ulong addr,
67
# define helper_ret_stw_mmu helper_be_stw_mmu
68
# define helper_ret_stl_mmu helper_be_stl_mmu
69
# define helper_ret_stq_mmu helper_be_stq_mmu
70
-# define helper_ret_ldw_cmmu helper_be_ldw_cmmu
71
+# define helper_ret_lduw_cmmu helper_be_lduw_cmmu
72
+# define helper_ret_ldsw_cmmu helper_be_ldsw_cmmu
73
# define helper_ret_ldl_cmmu helper_be_ldl_cmmu
74
# define helper_ret_ldq_cmmu helper_be_ldq_cmmu
75
#else
76
@@ -XXX,XX +XXX,XX @@ uint64_t helper_be_ldq_cmmu(CPUArchState *env, target_ulong addr,
77
# define helper_ret_stw_mmu helper_le_stw_mmu
78
# define helper_ret_stl_mmu helper_le_stl_mmu
79
# define helper_ret_stq_mmu helper_le_stq_mmu
80
-# define helper_ret_ldw_cmmu helper_le_ldw_cmmu
81
+# define helper_ret_lduw_cmmu helper_le_lduw_cmmu
82
+# define helper_ret_ldsw_cmmu helper_le_ldsw_cmmu
83
# define helper_ret_ldl_cmmu helper_le_ldl_cmmu
84
# define helper_ret_ldq_cmmu helper_le_ldq_cmmu
85
#endif
86
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
87
index XXXXXXX..XXXXXXX 100644
88
--- a/accel/tcg/cputlb.c
89
+++ b/accel/tcg/cputlb.c
90
@@ -XXX,XX +XXX,XX @@ static uint64_t full_ldub_cmmu(CPUArchState *env, target_ulong addr,
91
return load_helper(env, addr, oi, retaddr, MO_8, true, full_ldub_cmmu);
92
}
57
}
93
58
94
-uint8_t helper_ret_ldb_cmmu(CPUArchState *env, target_ulong addr,
59
+static bool fold_commutative(OptContext *ctx, TCGOp *op)
95
+uint8_t helper_ret_ldub_cmmu(CPUArchState *env, target_ulong addr,
96
TCGMemOpIdx oi, uintptr_t retaddr)
97
{
98
return full_ldub_cmmu(env, addr, oi, retaddr);
99
}
100
101
+int8_t helper_ret_ldsb_cmmu(CPUArchState *env, target_ulong addr,
102
+ TCGMemOpIdx oi, uintptr_t retaddr)
103
+{
60
+{
104
+ return (int8_t) full_ldub_cmmu(env, addr, oi, retaddr);
61
+ swap_commutative(op->args[0], &op->args[1], &op->args[2]);
62
+ return false;
105
+}
63
+}
106
+
64
+
107
static uint64_t full_le_lduw_cmmu(CPUArchState *env, target_ulong addr,
65
static bool fold_const2_commutative(OptContext *ctx, TCGOp *op)
108
TCGMemOpIdx oi, uintptr_t retaddr)
109
{
66
{
110
@@ -XXX,XX +XXX,XX @@ static uint64_t full_le_lduw_cmmu(CPUArchState *env, target_ulong addr,
67
swap_commutative(op->args[0], &op->args[1], &op->args[2]);
111
full_le_lduw_cmmu);
68
@@ -XXX,XX +XXX,XX @@ static bool fold_add(OptContext *ctx, TCGOp *op)
69
return false;
112
}
70
}
113
71
114
-uint16_t helper_le_ldw_cmmu(CPUArchState *env, target_ulong addr,
72
+/* We cannot as yet do_constant_folding with vectors. */
115
+uint16_t helper_le_lduw_cmmu(CPUArchState *env, target_ulong addr,
73
+static bool fold_add_vec(OptContext *ctx, TCGOp *op)
116
TCGMemOpIdx oi, uintptr_t retaddr)
117
{
118
return full_le_lduw_cmmu(env, addr, oi, retaddr);
119
}
120
121
+int16_t helper_le_ldsw_cmmu(CPUArchState *env, target_ulong addr,
122
+ TCGMemOpIdx oi, uintptr_t retaddr)
123
+{
74
+{
124
+ return (int16_t) full_le_lduw_cmmu(env, addr, oi, retaddr);
75
+ if (fold_commutative(ctx, op) ||
76
+ fold_xi_to_x(ctx, op, 0)) {
77
+ return true;
78
+ }
79
+ return false;
125
+}
80
+}
126
+
81
+
127
static uint64_t full_be_lduw_cmmu(CPUArchState *env, target_ulong addr,
82
static bool fold_addsub2(OptContext *ctx, TCGOp *op, bool add)
128
TCGMemOpIdx oi, uintptr_t retaddr)
129
{
83
{
130
@@ -XXX,XX +XXX,XX @@ static uint64_t full_be_lduw_cmmu(CPUArchState *env, target_ulong addr,
84
if (arg_is_const(op->args[2]) && arg_is_const(op->args[3]) &&
131
full_be_lduw_cmmu);
85
@@ -XXX,XX +XXX,XX @@ static bool fold_sub_to_neg(OptContext *ctx, TCGOp *op)
86
return false;
132
}
87
}
133
88
134
-uint16_t helper_be_ldw_cmmu(CPUArchState *env, target_ulong addr,
89
-static bool fold_sub(OptContext *ctx, TCGOp *op)
135
+uint16_t helper_be_lduw_cmmu(CPUArchState *env, target_ulong addr,
90
+/* We cannot as yet do_constant_folding with vectors. */
136
TCGMemOpIdx oi, uintptr_t retaddr)
91
+static bool fold_sub_vec(OptContext *ctx, TCGOp *op)
137
{
92
{
138
return full_be_lduw_cmmu(env, addr, oi, retaddr);
93
- if (fold_const2(ctx, op) ||
94
- fold_xx_to_i(ctx, op, 0) ||
95
+ if (fold_xx_to_i(ctx, op, 0) ||
96
fold_xi_to_x(ctx, op, 0) ||
97
fold_sub_to_neg(ctx, op)) {
98
return true;
99
@@ -XXX,XX +XXX,XX @@ static bool fold_sub(OptContext *ctx, TCGOp *op)
100
return false;
139
}
101
}
140
102
141
+int16_t helper_be_ldsw_cmmu(CPUArchState *env, target_ulong addr,
103
+static bool fold_sub(OptContext *ctx, TCGOp *op)
142
+ TCGMemOpIdx oi, uintptr_t retaddr)
143
+{
104
+{
144
+ return (int16_t) full_be_lduw_cmmu(env, addr, oi, retaddr);
105
+ return fold_const2(ctx, op) || fold_sub_vec(ctx, op);
145
+}
106
+}
146
+
107
+
147
static uint64_t full_le_ldul_cmmu(CPUArchState *env, target_ulong addr,
108
static bool fold_sub2(OptContext *ctx, TCGOp *op)
148
TCGMemOpIdx oi, uintptr_t retaddr)
149
{
109
{
150
diff --git a/target/cris/translate_v10.inc.c b/target/cris/translate_v10.inc.c
110
return fold_addsub2(ctx, op, false);
151
index XXXXXXX..XXXXXXX 100644
111
@@ -XXX,XX +XXX,XX @@ void tcg_optimize(TCGContext *s)
152
--- a/target/cris/translate_v10.inc.c
112
* Sorted alphabetically by opcode as much as possible.
153
+++ b/target/cris/translate_v10.inc.c
113
*/
154
@@ -XXX,XX +XXX,XX @@ static unsigned int dec10_ind(CPUCRISState *env, DisasContext *dc)
114
switch (opc) {
155
case CRISV10_IND_BCC_M:
115
- CASE_OP_32_64_VEC(add):
156
116
+ CASE_OP_32_64(add):
157
cris_cc_mask(dc, 0);
117
done = fold_add(&ctx, op);
158
- imm = cpu_ldsw_code(env, dc->pc + 2);
118
break;
159
- simm = (int16_t)imm;
119
+ case INDEX_op_add_vec:
160
+ simm = cpu_ldsw_code(env, dc->pc + 2);
120
+ done = fold_add_vec(&ctx, op);
161
simm += 4;
121
+ break;
162
122
CASE_OP_32_64(add2):
163
LOG_DIS("bcc_m: b%s %x\n", cc_name(dc->cond), dc->pc + simm);
123
done = fold_add2(&ctx, op);
124
break;
125
@@ -XXX,XX +XXX,XX @@ void tcg_optimize(TCGContext *s)
126
CASE_OP_32_64(sextract):
127
done = fold_sextract(&ctx, op);
128
break;
129
- CASE_OP_32_64_VEC(sub):
130
+ CASE_OP_32_64(sub):
131
done = fold_sub(&ctx, op);
132
break;
133
+ case INDEX_op_sub_vec:
134
+ done = fold_sub_vec(&ctx, op);
135
+ break;
136
CASE_OP_32_64(sub2):
137
done = fold_sub2(&ctx, op);
138
break;
164
--
139
--
165
2.17.1
140
2.25.1
166
141
167
142
diff view generated by jsdifflib
Deleted patch
1
From: Wei Yang <richardw.yang@linux.intel.com>
2
1
3
Use ROUND_UP() to define, which is a little bit easy to read.
4
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
7
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
8
Reviewed-by: Juan Quintela <quintela@redhat.com>
9
Signed-off-by: Wei Yang <richardw.yang@linux.intel.com>
10
Message-Id: <20191013021145.16011-2-richardw.yang@linux.intel.com>
11
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12
---
13
include/exec/cpu-all.h | 7 +++----
14
1 file changed, 3 insertions(+), 4 deletions(-)
15
16
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
17
index XXXXXXX..XXXXXXX 100644
18
--- a/include/exec/cpu-all.h
19
+++ b/include/exec/cpu-all.h
20
@@ -XXX,XX +XXX,XX @@ extern int target_page_bits;
21
22
#define TARGET_PAGE_SIZE (1 << TARGET_PAGE_BITS)
23
#define TARGET_PAGE_MASK ~(TARGET_PAGE_SIZE - 1)
24
-#define TARGET_PAGE_ALIGN(addr) (((addr) + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK)
25
+#define TARGET_PAGE_ALIGN(addr) ROUND_UP((addr), TARGET_PAGE_SIZE)
26
27
/* Using intptr_t ensures that qemu_*_page_mask is sign-extended even
28
* when intptr_t is 32-bit and we are aligning a long long.
29
@@ -XXX,XX +XXX,XX @@ extern int target_page_bits;
30
extern uintptr_t qemu_host_page_size;
31
extern intptr_t qemu_host_page_mask;
32
33
-#define HOST_PAGE_ALIGN(addr) (((addr) + qemu_host_page_size - 1) & qemu_host_page_mask)
34
-#define REAL_HOST_PAGE_ALIGN(addr) (((addr) + qemu_real_host_page_size - 1) & \
35
- qemu_real_host_page_mask)
36
+#define HOST_PAGE_ALIGN(addr) ROUND_UP((addr), qemu_host_page_size)
37
+#define REAL_HOST_PAGE_ALIGN(addr) ROUND_UP((addr), qemu_real_host_page_size)
38
39
/* same as PROT_xxx */
40
#define PAGE_READ 0x0001
41
--
42
2.17.1
43
44
diff view generated by jsdifflib
Deleted patch
1
The next patch will play a trick with "const" that will
2
confuse the compiler about the uses of target_page_bits
3
within exec.c. Moving everything to a new file prevents
4
this confusion.
5
1
6
No functional change so far.
7
8
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
9
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
10
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
11
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12
---
13
Makefile.target | 2 +-
14
include/qemu-common.h | 6 +++++
15
exec-vary.c | 57 +++++++++++++++++++++++++++++++++++++++++++
16
exec.c | 34 --------------------------
17
4 files changed, 64 insertions(+), 35 deletions(-)
18
create mode 100644 exec-vary.c
19
20
diff --git a/Makefile.target b/Makefile.target
21
index XXXXXXX..XXXXXXX 100644
22
--- a/Makefile.target
23
+++ b/Makefile.target
24
@@ -XXX,XX +XXX,XX @@ obj-y += trace/
25
26
#########################################################
27
# cpu emulator library
28
-obj-y += exec.o
29
+obj-y += exec.o exec-vary.o
30
obj-y += accel/
31
obj-$(CONFIG_TCG) += tcg/tcg.o tcg/tcg-op.o tcg/tcg-op-vec.o tcg/tcg-op-gvec.o
32
obj-$(CONFIG_TCG) += tcg/tcg-common.o tcg/optimize.o
33
diff --git a/include/qemu-common.h b/include/qemu-common.h
34
index XXXXXXX..XXXXXXX 100644
35
--- a/include/qemu-common.h
36
+++ b/include/qemu-common.h
37
@@ -XXX,XX +XXX,XX @@ void cpu_exec_step_atomic(CPUState *cpu);
38
*/
39
bool set_preferred_target_page_bits(int bits);
40
41
+/**
42
+ * finalize_target_page_bits:
43
+ * Commit the final value set by set_preferred_target_page_bits.
44
+ */
45
+void finalize_target_page_bits(void);
46
+
47
/**
48
* Sends a (part of) iovec down a socket, yielding when the socket is full, or
49
* Receives data into a (part of) iovec from a socket,
50
diff --git a/exec-vary.c b/exec-vary.c
51
new file mode 100644
52
index XXXXXXX..XXXXXXX
53
--- /dev/null
54
+++ b/exec-vary.c
55
@@ -XXX,XX +XXX,XX @@
56
+/*
57
+ * Variable page size handling
58
+ *
59
+ * Copyright (c) 2003 Fabrice Bellard
60
+ *
61
+ * This library is free software; you can redistribute it and/or
62
+ * modify it under the terms of the GNU Lesser General Public
63
+ * License as published by the Free Software Foundation; either
64
+ * version 2 of the License, or (at your option) any later version.
65
+ *
66
+ * This library is distributed in the hope that it will be useful,
67
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
68
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
69
+ * Lesser General Public License for more details.
70
+ *
71
+ * You should have received a copy of the GNU Lesser General Public
72
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
73
+ */
74
+
75
+#include "qemu/osdep.h"
76
+#include "qemu-common.h"
77
+#include "exec/exec-all.h"
78
+
79
+#ifdef TARGET_PAGE_BITS_VARY
80
+int target_page_bits;
81
+bool target_page_bits_decided;
82
+#endif
83
+
84
+bool set_preferred_target_page_bits(int bits)
85
+{
86
+ /*
87
+ * The target page size is the lowest common denominator for all
88
+ * the CPUs in the system, so we can only make it smaller, never
89
+ * larger. And we can't make it smaller once we've committed to
90
+ * a particular size.
91
+ */
92
+#ifdef TARGET_PAGE_BITS_VARY
93
+ assert(bits >= TARGET_PAGE_BITS_MIN);
94
+ if (target_page_bits == 0 || target_page_bits > bits) {
95
+ if (target_page_bits_decided) {
96
+ return false;
97
+ }
98
+ target_page_bits = bits;
99
+ }
100
+#endif
101
+ return true;
102
+}
103
+
104
+void finalize_target_page_bits(void)
105
+{
106
+#ifdef TARGET_PAGE_BITS_VARY
107
+ if (target_page_bits == 0) {
108
+ target_page_bits = TARGET_PAGE_BITS_MIN;
109
+ }
110
+ target_page_bits_decided = true;
111
+#endif
112
+}
113
diff --git a/exec.c b/exec.c
114
index XXXXXXX..XXXXXXX 100644
115
--- a/exec.c
116
+++ b/exec.c
117
@@ -XXX,XX +XXX,XX @@ AddressSpace address_space_memory;
118
static MemoryRegion io_mem_unassigned;
119
#endif
120
121
-#ifdef TARGET_PAGE_BITS_VARY
122
-int target_page_bits;
123
-bool target_page_bits_decided;
124
-#endif
125
-
126
CPUTailQ cpus = QTAILQ_HEAD_INITIALIZER(cpus);
127
128
/* current CPU in the current thread. It is only valid inside
129
@@ -XXX,XX +XXX,XX @@ int use_icount;
130
uintptr_t qemu_host_page_size;
131
intptr_t qemu_host_page_mask;
132
133
-bool set_preferred_target_page_bits(int bits)
134
-{
135
- /* The target page size is the lowest common denominator for all
136
- * the CPUs in the system, so we can only make it smaller, never
137
- * larger. And we can't make it smaller once we've committed to
138
- * a particular size.
139
- */
140
-#ifdef TARGET_PAGE_BITS_VARY
141
- assert(bits >= TARGET_PAGE_BITS_MIN);
142
- if (target_page_bits == 0 || target_page_bits > bits) {
143
- if (target_page_bits_decided) {
144
- return false;
145
- }
146
- target_page_bits = bits;
147
- }
148
-#endif
149
- return true;
150
-}
151
-
152
#if !defined(CONFIG_USER_ONLY)
153
154
-static void finalize_target_page_bits(void)
155
-{
156
-#ifdef TARGET_PAGE_BITS_VARY
157
- if (target_page_bits == 0) {
158
- target_page_bits = TARGET_PAGE_BITS_MIN;
159
- }
160
- target_page_bits_decided = true;
161
-#endif
162
-}
163
-
164
typedef struct PhysPageEntry PhysPageEntry;
165
166
struct PhysPageEntry {
167
--
168
2.17.1
169
170
diff view generated by jsdifflib
Deleted patch
1
Such support is present almost everywhere, except for Xcode 9.
2
It is added in Xcode 10, but travis uses xcode9 by default,
3
so we should support it for a while yet.
4
1
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
---
8
configure | 19 +++++++++++++++++++
9
1 file changed, 19 insertions(+)
10
11
diff --git a/configure b/configure
12
index XXXXXXX..XXXXXXX 100755
13
--- a/configure
14
+++ b/configure
15
@@ -XXX,XX +XXX,XX @@ if compile_prog "" "" ; then
16
vector16=yes
17
fi
18
19
+########################################
20
+# See if __attribute__((alias)) is supported.
21
+# This false for Xcode 9, but has been remedied for Xcode 10.
22
+# Unfortunately, travis uses Xcode 9 by default.
23
+
24
+attralias=no
25
+cat > $TMPC << EOF
26
+int x = 1;
27
+extern const int y __attribute__((alias("x")));
28
+int main(void) { return 0; }
29
+EOF
30
+if compile_prog "" "" ; then
31
+ attralias=yes
32
+fi
33
+
34
########################################
35
# check if getauxval is available.
36
37
@@ -XXX,XX +XXX,XX @@ if test "$vector16" = "yes" ; then
38
echo "CONFIG_VECTOR16=y" >> $config_host_mak
39
fi
40
41
+if test "$attralias" = "yes" ; then
42
+ echo "CONFIG_ATTRIBUTE_ALIAS=y" >> $config_host_mak
43
+fi
44
+
45
if test "$getauxval" = "yes" ; then
46
echo "CONFIG_GETAUXVAL=y" >> $config_host_mak
47
fi
48
--
49
2.17.1
50
51
diff view generated by jsdifflib
Deleted patch
1
Using a variable that is declared "const" for this tells the
2
compiler that it may read the value once and assume that it
3
does not change across function calls.
4
1
5
For target_page_size, this means we have only one assert per
6
function, and one read of the variable.
7
8
This reduces the size of qemu-system-aarch64 by 8k.
9
10
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
11
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
---
14
include/exec/cpu-all.h | 14 +++++++---
15
exec-vary.c | 60 ++++++++++++++++++++++++++++++++++++------
16
2 files changed, 62 insertions(+), 12 deletions(-)
17
18
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
19
index XXXXXXX..XXXXXXX 100644
20
--- a/include/exec/cpu-all.h
21
+++ b/include/exec/cpu-all.h
22
@@ -XXX,XX +XXX,XX @@ static inline void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t val
23
/* page related stuff */
24
25
#ifdef TARGET_PAGE_BITS_VARY
26
-extern bool target_page_bits_decided;
27
-extern int target_page_bits;
28
-#define TARGET_PAGE_BITS ({ assert(target_page_bits_decided); \
29
- target_page_bits; })
30
+typedef struct {
31
+ bool decided;
32
+ int bits;
33
+} TargetPageBits;
34
+# if defined(CONFIG_ATTRIBUTE_ALIAS) || !defined(IN_EXEC_VARY)
35
+extern const TargetPageBits target_page;
36
+#else
37
+extern TargetPageBits target_page;
38
+# endif
39
+#define TARGET_PAGE_BITS (assert(target_page.decided), target_page.bits)
40
#else
41
#define TARGET_PAGE_BITS_MIN TARGET_PAGE_BITS
42
#endif
43
diff --git a/exec-vary.c b/exec-vary.c
44
index XXXXXXX..XXXXXXX 100644
45
--- a/exec-vary.c
46
+++ b/exec-vary.c
47
@@ -XXX,XX +XXX,XX @@
48
49
#include "qemu/osdep.h"
50
#include "qemu-common.h"
51
+
52
+#define IN_EXEC_VARY 1
53
+
54
#include "exec/exec-all.h"
55
56
#ifdef TARGET_PAGE_BITS_VARY
57
-int target_page_bits;
58
-bool target_page_bits_decided;
59
+# ifdef CONFIG_ATTRIBUTE_ALIAS
60
+/*
61
+ * We want to declare the "target_page" variable as const, which tells
62
+ * the compiler that it can cache any value that it reads across calls.
63
+ * This avoids multiple assertions and multiple reads within any one user.
64
+ *
65
+ * This works because we initialize the target_page data very early, in a
66
+ * location far removed from the functions that require the final results.
67
+ *
68
+ * This also requires that we have a non-constant symbol by which we can
69
+ * perform the actual initialization, and which forces the data to be
70
+ * allocated within writable memory. Thus "init_target_page", and we use
71
+ * that symbol exclusively in the two functions that initialize this value.
72
+ *
73
+ * The "target_page" symbol is created as an alias of "init_target_page".
74
+ */
75
+static TargetPageBits init_target_page;
76
+
77
+/*
78
+ * Note that this is *not* a redundant decl, this is the definition of
79
+ * the "target_page" symbol. The syntax for this definition requires
80
+ * the use of the extern keyword. This seems to be a GCC bug in
81
+ * either the syntax for the alias attribute or in -Wredundant-decls.
82
+ *
83
+ * See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91765
84
+ */
85
+# pragma GCC diagnostic push
86
+# pragma GCC diagnostic ignored "-Wredundant-decls"
87
+
88
+extern const TargetPageBits target_page
89
+ __attribute__((alias("init_target_page")));
90
+
91
+# pragma GCC diagnostic pop
92
+# else
93
+/*
94
+ * When aliases are not supported then we force two different declarations,
95
+ * by way of suppressing the header declaration with IN_EXEC_VARY.
96
+ * We assume that on such an old compiler, LTO cannot be used, and so the
97
+ * compiler cannot not detect the mismatched declarations, and all is well.
98
+ */
99
+TargetPageBits target_page;
100
+# define init_target_page target_page
101
+# endif
102
#endif
103
104
bool set_preferred_target_page_bits(int bits)
105
@@ -XXX,XX +XXX,XX @@ bool set_preferred_target_page_bits(int bits)
106
*/
107
#ifdef TARGET_PAGE_BITS_VARY
108
assert(bits >= TARGET_PAGE_BITS_MIN);
109
- if (target_page_bits == 0 || target_page_bits > bits) {
110
- if (target_page_bits_decided) {
111
+ if (init_target_page.bits == 0 || init_target_page.bits > bits) {
112
+ if (init_target_page.decided) {
113
return false;
114
}
115
- target_page_bits = bits;
116
+ init_target_page.bits = bits;
117
}
118
#endif
119
return true;
120
@@ -XXX,XX +XXX,XX @@ bool set_preferred_target_page_bits(int bits)
121
void finalize_target_page_bits(void)
122
{
123
#ifdef TARGET_PAGE_BITS_VARY
124
- if (target_page_bits == 0) {
125
- target_page_bits = TARGET_PAGE_BITS_MIN;
126
+ if (init_target_page.bits == 0) {
127
+ init_target_page.bits = TARGET_PAGE_BITS_MIN;
128
}
129
- target_page_bits_decided = true;
130
+ init_target_page.decided = true;
131
#endif
132
}
133
--
134
2.17.1
135
136
diff view generated by jsdifflib
Deleted patch
1
This reduces the size of a release build by about 10k.
2
Noticably, within the tlb miss helpers.
3
1
4
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
6
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
---
9
include/exec/cpu-all.h | 6 +++++-
10
1 file changed, 5 insertions(+), 1 deletion(-)
11
12
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
13
index XXXXXXX..XXXXXXX 100644
14
--- a/include/exec/cpu-all.h
15
+++ b/include/exec/cpu-all.h
16
@@ -XXX,XX +XXX,XX @@ extern const TargetPageBits target_page;
17
#else
18
extern TargetPageBits target_page;
19
# endif
20
-#define TARGET_PAGE_BITS (assert(target_page.decided), target_page.bits)
21
+# ifdef CONFIG_DEBUG_TCG
22
+# define TARGET_PAGE_BITS (assert(target_page.decided), target_page.bits)
23
+# else
24
+# define TARGET_PAGE_BITS target_page.bits
25
+# endif
26
#else
27
#define TARGET_PAGE_BITS_MIN TARGET_PAGE_BITS
28
#endif
29
--
30
2.17.1
31
32
diff view generated by jsdifflib
Deleted patch
1
There are some uint64_t uses that expect TARGET_PAGE_MASK to
2
extend for a 32-bit, so this must continue to be a signed type.
3
Define based on TARGET_PAGE_BITS not TARGET_PAGE_SIZE; this
4
will make a following patch more clear.
5
1
6
This should not have a functional effect so far.
7
8
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
9
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11
---
12
include/exec/cpu-all.h | 2 +-
13
1 file changed, 1 insertion(+), 1 deletion(-)
14
15
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
16
index XXXXXXX..XXXXXXX 100644
17
--- a/include/exec/cpu-all.h
18
+++ b/include/exec/cpu-all.h
19
@@ -XXX,XX +XXX,XX @@ extern TargetPageBits target_page;
20
#endif
21
22
#define TARGET_PAGE_SIZE (1 << TARGET_PAGE_BITS)
23
-#define TARGET_PAGE_MASK ~(TARGET_PAGE_SIZE - 1)
24
+#define TARGET_PAGE_MASK ((target_long)-1 << TARGET_PAGE_BITS)
25
#define TARGET_PAGE_ALIGN(addr) ROUND_UP((addr), TARGET_PAGE_SIZE)
26
27
/* Using intptr_t ensures that qemu_*_page_mask is sign-extended even
28
--
29
2.17.1
30
31
diff view generated by jsdifflib
Deleted patch
1
This eliminates a set of runtime shifts. It turns out that we
2
require TARGET_PAGE_MASK more often than TARGET_PAGE_SIZE, so
3
redefine TARGET_PAGE_SIZE based on TARGET_PAGE_MASK instead of
4
the other way around.
5
1
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
Reviewed-by: David Hildenbrand <david@redhat.com>
8
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
---
11
include/exec/cpu-all.h | 8 ++++++--
12
exec-vary.c | 1 +
13
2 files changed, 7 insertions(+), 2 deletions(-)
14
15
diff --git a/include/exec/cpu-all.h b/include/exec/cpu-all.h
16
index XXXXXXX..XXXXXXX 100644
17
--- a/include/exec/cpu-all.h
18
+++ b/include/exec/cpu-all.h
19
@@ -XXX,XX +XXX,XX @@ static inline void stl_phys_notdirty(AddressSpace *as, hwaddr addr, uint32_t val
20
typedef struct {
21
bool decided;
22
int bits;
23
+ target_long mask;
24
} TargetPageBits;
25
# if defined(CONFIG_ATTRIBUTE_ALIAS) || !defined(IN_EXEC_VARY)
26
extern const TargetPageBits target_page;
27
@@ -XXX,XX +XXX,XX @@ extern TargetPageBits target_page;
28
# endif
29
# ifdef CONFIG_DEBUG_TCG
30
# define TARGET_PAGE_BITS (assert(target_page.decided), target_page.bits)
31
+# define TARGET_PAGE_MASK (assert(target_page.decided), target_page.mask)
32
# else
33
# define TARGET_PAGE_BITS target_page.bits
34
+# define TARGET_PAGE_MASK target_page.mask
35
# endif
36
+# define TARGET_PAGE_SIZE (-(int)TARGET_PAGE_MASK)
37
#else
38
#define TARGET_PAGE_BITS_MIN TARGET_PAGE_BITS
39
+#define TARGET_PAGE_SIZE (1 << TARGET_PAGE_BITS)
40
+#define TARGET_PAGE_MASK ((target_long)-1 << TARGET_PAGE_BITS)
41
#endif
42
43
-#define TARGET_PAGE_SIZE (1 << TARGET_PAGE_BITS)
44
-#define TARGET_PAGE_MASK ((target_long)-1 << TARGET_PAGE_BITS)
45
#define TARGET_PAGE_ALIGN(addr) ROUND_UP((addr), TARGET_PAGE_SIZE)
46
47
/* Using intptr_t ensures that qemu_*_page_mask is sign-extended even
48
diff --git a/exec-vary.c b/exec-vary.c
49
index XXXXXXX..XXXXXXX 100644
50
--- a/exec-vary.c
51
+++ b/exec-vary.c
52
@@ -XXX,XX +XXX,XX @@ void finalize_target_page_bits(void)
53
init_target_page.bits = TARGET_PAGE_BITS_MIN;
54
}
55
init_target_page.decided = true;
56
+ init_target_page.mask = (target_long)-1 << init_target_page.bits;
57
#endif
58
}
59
--
60
2.17.1
61
62
diff view generated by jsdifflib
1
Since 2ac01d6dafab, this function does only two things: assert a
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
2
lock is held, and call tcg_tb_alloc. It is used exactly once,
3
and its user has already done the assert.
4
2
5
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
3
When building using GCC 8.3.0 on loongarch64 (Loongnix) we get:
6
Reviewed-by: Clement Deschamps <clement.deschamps@greensocs.com>
4
5
In file included from ../linux-user/signal.c:33:
6
../linux-user/host/loongarch64/host-signal.h: In function ‘host_signal_write’:
7
../linux-user/host/loongarch64/host-signal.h:57:9: error: a label can only be part of a statement and a declaration is not a statement
8
uint32_t sel = (insn >> 15) & 0b11111111111;
9
^~~~~~~~
10
11
We don't use the 'sel' variable more than once, so drop it.
12
13
Meson output for the record:
14
15
Host machine cpu family: loongarch64
16
Host machine cpu: loongarch64
17
C compiler for the host machine: cc (gcc 8.3.0 "cc (Loongnix 8.3.0-6.lnd.vec.27) 8.3.0")
18
C linker for the host machine: cc ld.bfd 2.31.1-system
19
20
Fixes: ad812c3bd65 ("linux-user: Implement CPU-specific signal handler for loongarch64 hosts")
21
Reported-by: Song Gao <gaosong@loongson.cn>
22
Suggested-by: Song Gao <gaosong@loongson.cn>
23
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
24
Reviewed-by: WANG Xuerui <git@xen0n.name>
25
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
26
Message-Id: <20220104215027.2180972-1-f4bug@amsat.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
27
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
---
28
---
9
accel/tcg/translate-all.c | 20 ++------------------
29
linux-user/host/loongarch64/host-signal.h | 4 +---
10
1 file changed, 2 insertions(+), 18 deletions(-)
30
1 file changed, 1 insertion(+), 3 deletions(-)
11
31
12
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
32
diff --git a/linux-user/host/loongarch64/host-signal.h b/linux-user/host/loongarch64/host-signal.h
13
index XXXXXXX..XXXXXXX 100644
33
index XXXXXXX..XXXXXXX 100644
14
--- a/accel/tcg/translate-all.c
34
--- a/linux-user/host/loongarch64/host-signal.h
15
+++ b/accel/tcg/translate-all.c
35
+++ b/linux-user/host/loongarch64/host-signal.h
16
@@ -XXX,XX +XXX,XX @@ void tcg_exec_init(unsigned long tb_size)
36
@@ -XXX,XX +XXX,XX @@ static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc)
17
#endif
37
}
18
}
38
break;
19
39
case 0b001110: /* indexed, atomic, bounds-checking memory operations */
20
-/*
40
- uint32_t sel = (insn >> 15) & 0b11111111111;
21
- * Allocate a new translation block. Flush the translation buffer if
22
- * too many translation blocks or too much generated code.
23
- */
24
-static TranslationBlock *tb_alloc(target_ulong pc)
25
-{
26
- TranslationBlock *tb;
27
-
41
-
28
- assert_memory_lock();
42
- switch (sel) {
29
-
43
+ switch ((insn >> 15) & 0b11111111111) {
30
- tb = tcg_tb_alloc(tcg_ctx);
44
case 0b00000100000: /* stx.b */
31
- if (unlikely(tb == NULL)) {
45
case 0b00000101000: /* stx.h */
32
- return NULL;
46
case 0b00000110000: /* stx.w */
33
- }
34
- return tb;
35
-}
36
-
37
/* call with @p->lock held */
38
static inline void invalidate_page_bitmap(PageDesc *p)
39
{
40
@@ -XXX,XX +XXX,XX @@ TranslationBlock *tb_gen_code(CPUState *cpu,
41
TCGProfile *prof = &tcg_ctx->prof;
42
int64_t ti;
43
#endif
44
+
45
assert_memory_lock();
46
47
phys_pc = get_page_addr_code(env, pc);
48
@@ -XXX,XX +XXX,XX @@ TranslationBlock *tb_gen_code(CPUState *cpu,
49
}
50
51
buffer_overflow:
52
- tb = tb_alloc(pc);
53
+ tb = tcg_tb_alloc(tcg_ctx);
54
if (unlikely(!tb)) {
55
/* flush must be done */
56
tb_flush(cpu);
57
--
47
--
58
2.17.1
48
2.25.1
59
49
60
50
diff view generated by jsdifflib
1
From: Clement Deschamps <clement.deschamps@greensocs.com>
1
From: Xiaoyao Li <xiaoyao.li@intel.com>
2
2
3
This fixes a segmentation fault in icount mode when executing
3
Remove qemu_run_machine_init_done_notifiers() since no implementation
4
from an IO region.
4
and user.
5
5
6
TB is marked as CF_NOCACHE but tb->orig_tb is not initialized
6
Fixes: f66dc8737c9 ("vl: move all generic initialization out of vl.c")
7
(equals previous value in code_gen_buffer).
7
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
8
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
The issue happens in cpu_io_recompile() when it tries to invalidate orig_tb.
9
Message-Id: <20220104024136.1433545-1-xiaoyao.li@intel.com>
10
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
Signed-off-by: Clement Deschamps <clement.deschamps@greensocs.com>
13
Message-Id: <20191022140016.918371-1-clement.deschamps@greensocs.com>
14
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
15
---
11
---
16
accel/tcg/translate-all.c | 1 +
12
include/sysemu/sysemu.h | 1 -
17
1 file changed, 1 insertion(+)
13
1 file changed, 1 deletion(-)
18
14
19
diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c
15
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
20
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
21
--- a/accel/tcg/translate-all.c
17
--- a/include/sysemu/sysemu.h
22
+++ b/accel/tcg/translate-all.c
18
+++ b/include/sysemu/sysemu.h
23
@@ -XXX,XX +XXX,XX @@ TranslationBlock *tb_gen_code(CPUState *cpu,
19
@@ -XXX,XX +XXX,XX @@ extern bool qemu_uuid_set;
24
tb->cs_base = cs_base;
20
void qemu_add_exit_notifier(Notifier *notify);
25
tb->flags = flags;
21
void qemu_remove_exit_notifier(Notifier *notify);
26
tb->cflags = cflags;
22
27
+ tb->orig_tb = NULL;
23
-void qemu_run_machine_init_done_notifiers(void);
28
tb->trace_vcpu_dstate = *cpu->trace_dstate;
24
void qemu_add_machine_init_done_notifier(Notifier *notify);
29
tcg_ctx->tb_cflags = cflags;
25
void qemu_remove_machine_init_done_notifier(Notifier *notify);
30
tb_overflow:
26
31
--
27
--
32
2.17.1
28
2.25.1
33
29
34
30
diff view generated by jsdifflib
1
Using uintptr_t instead of target_ulong meant that, for 64-bit guest
1
For the ABIs in which the syscall return register is not
2
and 32-bit host, we truncated the guest address comparator and so may
2
also the first function argument register, move the errno
3
not hit the tlb when we should.
3
value into the correct place.
4
4
5
Fixes: 4811e9095c0
5
Fixes: a3310c0397e2 ("linux-user: Move syscall error detection into safe_syscall_base")
6
Reviewed-by: David Hildenbrand <david@redhat.com>
6
Reported-by: Laurent Vivier <laurent@vivier.eu>
7
Tested-by: Laurent Vivier <laurent@vivier.eu>
8
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-Id: <20220104190454.542225-1-richard.henderson@linaro.org>
8
---
11
---
9
accel/tcg/cputlb.c | 2 +-
12
common-user/host/i386/safe-syscall.inc.S | 1 +
10
1 file changed, 1 insertion(+), 1 deletion(-)
13
common-user/host/mips/safe-syscall.inc.S | 1 +
14
common-user/host/x86_64/safe-syscall.inc.S | 1 +
15
3 files changed, 3 insertions(+)
11
16
12
diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c
17
diff --git a/common-user/host/i386/safe-syscall.inc.S b/common-user/host/i386/safe-syscall.inc.S
13
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
14
--- a/accel/tcg/cputlb.c
19
--- a/common-user/host/i386/safe-syscall.inc.S
15
+++ b/accel/tcg/cputlb.c
20
+++ b/common-user/host/i386/safe-syscall.inc.S
16
@@ -XXX,XX +XXX,XX @@ void *tlb_vaddr_to_host(CPUArchState *env, abi_ptr addr,
21
@@ -XXX,XX +XXX,XX @@ safe_syscall_end:
17
MMUAccessType access_type, int mmu_idx)
22
pop %ebp
18
{
23
.cfi_adjust_cfa_offset -4
19
CPUTLBEntry *entry = tlb_entry(env, mmu_idx, addr);
24
.cfi_restore ebp
20
- uintptr_t tlb_addr, page;
25
+ mov %eax, (%esp)
21
+ target_ulong tlb_addr, page;
26
jmp safe_syscall_set_errno_tail
22
size_t elt_ofs;
27
23
28
.cfi_endproc
24
switch (access_type) {
29
diff --git a/common-user/host/mips/safe-syscall.inc.S b/common-user/host/mips/safe-syscall.inc.S
30
index XXXXXXX..XXXXXXX 100644
31
--- a/common-user/host/mips/safe-syscall.inc.S
32
+++ b/common-user/host/mips/safe-syscall.inc.S
33
@@ -XXX,XX +XXX,XX @@ safe_syscall_end:
34
1: USE_ALT_CP(t0)
35
SETUP_GPX(t1)
36
SETUP_GPX64(t0, t1)
37
+ move a0, v0
38
PTR_LA t9, safe_syscall_set_errno_tail
39
jr t9
40
41
diff --git a/common-user/host/x86_64/safe-syscall.inc.S b/common-user/host/x86_64/safe-syscall.inc.S
42
index XXXXXXX..XXXXXXX 100644
43
--- a/common-user/host/x86_64/safe-syscall.inc.S
44
+++ b/common-user/host/x86_64/safe-syscall.inc.S
45
@@ -XXX,XX +XXX,XX @@ safe_syscall_end:
46
1: pop %rbp
47
.cfi_def_cfa_offset 8
48
.cfi_restore rbp
49
+ mov %eax, %edi
50
jmp safe_syscall_set_errno_tail
51
.cfi_endproc
52
25
--
53
--
26
2.17.1
54
2.25.1
27
55
28
56
diff view generated by jsdifflib