1 | v2: Fix FreeBSD build error in patch 18. | 1 | v3: One more try to fix macos issues. |
---|---|---|---|
2 | |||
2 | 3 | ||
3 | r~ | 4 | r~ |
4 | 5 | ||
5 | 6 | ||
6 | The following changes since commit 0d239e513e0117e66fa739fb71a43b9383a108ff: | ||
7 | 7 | ||
8 | Merge tag 'pull-lu-20231018' of https://gitlab.com/rth7680/qemu into staging (2023-10-19 10:20:57 -0700) | 8 | The following changes since commit e0209297cddd5e10a07e15fac5cca7aa1a8e0e59: |
9 | |||
10 | Merge tag 'pull-ufs-20250217' of https://gitlab.com/jeuk20.kim/qemu into staging (2025-02-18 10:58:48 +0800) | ||
9 | 11 | ||
10 | are available in the Git repository at: | 12 | are available in the Git repository at: |
11 | 13 | ||
12 | https://gitlab.com/rth7680/qemu.git tags/pull-tcg-20231018-2 | 14 | https://gitlab.com/rth7680/qemu.git tags/pull-tcg-20250215-3 |
13 | 15 | ||
14 | for you to fetch changes up to a75f704d972b9408f5e2843784b3add48c724c52: | 16 | for you to fetch changes up to e726f65867087d86436de05e9f372a86ec1381a6: |
15 | 17 | ||
16 | target/i386: Use i128 for 128 and 256-bit loads and stores (2023-10-19 21:11:44 -0700) | 18 | tcg: Remove TCG_TARGET_HAS_{br,set}cond2 from riscv and loongarch64 (2025-02-18 08:29:03 -0800) |
17 | 19 | ||
18 | ---------------------------------------------------------------- | 20 | ---------------------------------------------------------------- |
19 | tcg: Drop unused tcg_temp_free define | 21 | tcg: Remove last traces of TCG_TARGET_NEED_POOL_LABELS |
20 | tcg: Introduce tcg_use_softmmu | 22 | tcg: Cleanups after disallowing 64-on-32 |
21 | tcg: Optimize past conditional branches | 23 | tcg: Introduce constraint for zero register |
22 | tcg: Use constant zero when expanding with divu2 | 24 | tcg: Remove TCG_TARGET_HAS_{br,set}cond2 from riscv and loongarch64 |
23 | tcg/ppc: Enable direct branching tcg_out_goto_tb with TCG_REG_TB | 25 | tcg/i386: Use tcg_{high,unsigned}_cond in tcg_out_brcond2 |
24 | tcg/ppc: Use ADDPCIS for power9 | 26 | linux-user: Move TARGET_SA_RESTORER out of generic/signal.h |
25 | tcg/ppc: Use prefixed instructions for power10 | 27 | linux-user: Fix alignment when unmapping excess reservation |
26 | tcg/ppc: Disable TCG_REG_TB for Power9/Power10 | 28 | target/sparc: Fix register selection for all F*TOx and FxTO* instructions |
29 | target/sparc: Fix gdbstub incorrectly handling registers f32-f62 | ||
30 | target/sparc: fake UltraSPARC T1 PCR and PIC registers | ||
27 | 31 | ||
28 | ---------------------------------------------------------------- | 32 | ---------------------------------------------------------------- |
29 | Jordan Niethe (1): | 33 | Andreas Schwab (1): |
30 | tcg/ppc: Enable direct branching tcg_out_goto_tb with TCG_REG_TB | 34 | linux-user: Move TARGET_SA_RESTORER out of generic/signal.h |
31 | 35 | ||
32 | Mike Frysinger (1): | 36 | Artyom Tarasenko (1): |
33 | tcg: drop unused tcg_temp_free define | 37 | target/sparc: fake UltraSPARC T1 PCR and PIC registers |
34 | 38 | ||
35 | Richard Henderson (27): | 39 | Fabiano Rosas (1): |
36 | tcg/ppc: Untabify tcg-target.c.inc | 40 | elfload: Fix alignment when unmapping excess reservation |
37 | tcg/ppc: Reinterpret tb-relative to TB+4 | ||
38 | tcg/ppc: Use ADDPCIS in tcg_out_tb_start | ||
39 | tcg/ppc: Use ADDPCIS in tcg_out_movi_int | ||
40 | tcg/ppc: Use ADDPCIS for the constant pool | ||
41 | tcg/ppc: Use ADDPCIS in tcg_out_goto_tb | ||
42 | tcg/ppc: Use PADDI in tcg_out_movi | ||
43 | tcg/ppc: Use prefixed instructions in tcg_out_mem_long | ||
44 | tcg/ppc: Use PLD in tcg_out_movi for constant pool | ||
45 | tcg/ppc: Use prefixed instructions in tcg_out_dupi_vec | ||
46 | tcg/ppc: Use PLD in tcg_out_goto_tb | ||
47 | tcg/ppc: Disable TCG_REG_TB for Power9/Power10 | ||
48 | tcg: Introduce tcg_use_softmmu | ||
49 | tcg: Provide guest_base fallback for system mode | ||
50 | tcg/arm: Use tcg_use_softmmu | ||
51 | tcg/aarch64: Use tcg_use_softmmu | ||
52 | tcg/i386: Use tcg_use_softmmu | ||
53 | tcg/loongarch64: Use tcg_use_softmmu | ||
54 | tcg/mips: Use tcg_use_softmmu | ||
55 | tcg/ppc: Use tcg_use_softmmu | ||
56 | tcg/riscv: Do not reserve TCG_GUEST_BASE_REG for guest_base zero | ||
57 | tcg/riscv: Use tcg_use_softmmu | ||
58 | tcg/s390x: Use tcg_use_softmmu | ||
59 | tcg: Use constant zero when expanding with divu2 | ||
60 | tcg: Optimize past conditional branches | ||
61 | tcg: Add tcg_gen_{ld,st}_i128 | ||
62 | target/i386: Use i128 for 128 and 256-bit loads and stores | ||
63 | 41 | ||
64 | include/tcg/tcg-op-common.h | 3 + | 42 | Mikael Szreder (2): |
65 | include/tcg/tcg-op.h | 2 - | 43 | target/sparc: Fix register selection for all F*TOx and FxTO* instructions |
66 | include/tcg/tcg.h | 8 +- | 44 | target/sparc: Fix gdbstub incorrectly handling registers f32-f62 |
67 | target/i386/tcg/translate.c | 63 ++--- | 45 | |
68 | tcg/optimize.c | 8 +- | 46 | Richard Henderson (23): |
69 | tcg/tcg-op-ldst.c | 14 +- | 47 | tcg: Remove last traces of TCG_TARGET_NEED_POOL_LABELS |
70 | tcg/tcg-op.c | 38 ++- | 48 | tcg: Remove TCG_OVERSIZED_GUEST |
71 | tcg/tcg.c | 13 +- | 49 | tcg: Drop support for two address registers in gen_ldst |
72 | tcg/aarch64/tcg-target.c.inc | 177 ++++++------ | 50 | tcg: Merge INDEX_op_qemu_*_{a32,a64}_* |
73 | tcg/arm/tcg-target.c.inc | 203 +++++++------- | 51 | tcg/arm: Drop addrhi from prepare_host_addr |
74 | tcg/i386/tcg-target.c.inc | 198 +++++++------- | 52 | tcg/i386: Drop addrhi from prepare_host_addr |
75 | tcg/loongarch64/tcg-target.c.inc | 126 +++++---- | 53 | tcg/mips: Drop addrhi from prepare_host_addr |
76 | tcg/mips/tcg-target.c.inc | 231 ++++++++-------- | 54 | tcg/ppc: Drop addrhi from prepare_host_addr |
77 | tcg/ppc/tcg-target.c.inc | 561 ++++++++++++++++++++++++++------------- | 55 | tcg: Replace addr{lo,hi}_reg with addr_reg in TCGLabelQemuLdst |
78 | tcg/riscv/tcg-target.c.inc | 189 ++++++------- | 56 | plugins: Fix qemu_plugin_read_memory_vaddr parameters |
79 | tcg/s390x/tcg-target.c.inc | 161 ++++++----- | 57 | accel/tcg: Fix tlb_set_page_with_attrs, tlb_set_page |
80 | 16 files changed, 1102 insertions(+), 893 deletions(-) | 58 | target/loongarch: Use VADDR_PRIx for logging pc_next |
59 | target/mips: Use VADDR_PRIx for logging pc_next | ||
60 | include/exec: Change vaddr to uintptr_t | ||
61 | include/exec: Use uintptr_t in CPUTLBEntry | ||
62 | tcg: Introduce the 'z' constraint for a hardware zero register | ||
63 | tcg/aarch64: Use 'z' constraint | ||
64 | tcg/loongarch64: Use 'z' constraint | ||
65 | tcg/mips: Use 'z' constraint | ||
66 | tcg/riscv: Use 'z' constraint | ||
67 | tcg/sparc64: Use 'z' constraint | ||
68 | tcg/i386: Use tcg_{high,unsigned}_cond in tcg_out_brcond2 | ||
69 | tcg: Remove TCG_TARGET_HAS_{br,set}cond2 from riscv and loongarch64 | ||
70 | |||
71 | include/exec/tlb-common.h | 10 +- | ||
72 | include/exec/vaddr.h | 16 +- | ||
73 | include/qemu/atomic.h | 18 +- | ||
74 | include/tcg/oversized-guest.h | 23 --- | ||
75 | include/tcg/tcg-opc.h | 28 +-- | ||
76 | include/tcg/tcg.h | 3 +- | ||
77 | linux-user/aarch64/target_signal.h | 2 + | ||
78 | linux-user/arm/target_signal.h | 2 + | ||
79 | linux-user/generic/signal.h | 1 - | ||
80 | linux-user/i386/target_signal.h | 2 + | ||
81 | linux-user/m68k/target_signal.h | 1 + | ||
82 | linux-user/microblaze/target_signal.h | 2 + | ||
83 | linux-user/ppc/target_signal.h | 2 + | ||
84 | linux-user/s390x/target_signal.h | 2 + | ||
85 | linux-user/sh4/target_signal.h | 2 + | ||
86 | linux-user/x86_64/target_signal.h | 2 + | ||
87 | linux-user/xtensa/target_signal.h | 2 + | ||
88 | tcg/aarch64/tcg-target-con-set.h | 12 +- | ||
89 | tcg/aarch64/tcg-target.h | 2 + | ||
90 | tcg/loongarch64/tcg-target-con-set.h | 15 +- | ||
91 | tcg/loongarch64/tcg-target-con-str.h | 1 - | ||
92 | tcg/loongarch64/tcg-target-has.h | 2 - | ||
93 | tcg/loongarch64/tcg-target.h | 2 + | ||
94 | tcg/mips/tcg-target-con-set.h | 26 +-- | ||
95 | tcg/mips/tcg-target-con-str.h | 1 - | ||
96 | tcg/mips/tcg-target.h | 2 + | ||
97 | tcg/riscv/tcg-target-con-set.h | 10 +- | ||
98 | tcg/riscv/tcg-target-con-str.h | 1 - | ||
99 | tcg/riscv/tcg-target-has.h | 2 - | ||
100 | tcg/riscv/tcg-target.h | 2 + | ||
101 | tcg/sparc64/tcg-target-con-set.h | 12 +- | ||
102 | tcg/sparc64/tcg-target-con-str.h | 1 - | ||
103 | tcg/sparc64/tcg-target.h | 3 +- | ||
104 | tcg/tci/tcg-target.h | 1 - | ||
105 | accel/tcg/cputlb.c | 32 +--- | ||
106 | accel/tcg/tcg-all.c | 9 +- | ||
107 | linux-user/elfload.c | 4 +- | ||
108 | plugins/api.c | 2 +- | ||
109 | target/arm/ptw.c | 34 ---- | ||
110 | target/loongarch/tcg/translate.c | 2 +- | ||
111 | target/mips/tcg/octeon_translate.c | 4 +- | ||
112 | target/riscv/cpu_helper.c | 13 +- | ||
113 | target/sparc/gdbstub.c | 18 +- | ||
114 | target/sparc/translate.c | 19 +++ | ||
115 | tcg/optimize.c | 21 +-- | ||
116 | tcg/tcg-op-ldst.c | 103 +++-------- | ||
117 | tcg/tcg.c | 97 +++++------ | ||
118 | tcg/tci.c | 119 +++---------- | ||
119 | docs/devel/multi-thread-tcg.rst | 1 - | ||
120 | docs/devel/tcg-ops.rst | 4 +- | ||
121 | target/loongarch/tcg/insn_trans/trans_atomic.c.inc | 2 +- | ||
122 | target/sparc/insns.decode | 19 ++- | ||
123 | tcg/aarch64/tcg-target.c.inc | 86 ++++------ | ||
124 | tcg/arm/tcg-target.c.inc | 114 ++++--------- | ||
125 | tcg/i386/tcg-target.c.inc | 190 +++++---------------- | ||
126 | tcg/loongarch64/tcg-target.c.inc | 72 +++----- | ||
127 | tcg/mips/tcg-target.c.inc | 169 ++++++------------ | ||
128 | tcg/ppc/tcg-target.c.inc | 164 +++++------------- | ||
129 | tcg/riscv/tcg-target.c.inc | 56 +++--- | ||
130 | tcg/s390x/tcg-target.c.inc | 40 ++--- | ||
131 | tcg/sparc64/tcg-target.c.inc | 45 ++--- | ||
132 | tcg/tci/tcg-target.c.inc | 60 ++----- | ||
133 | 62 files changed, 550 insertions(+), 1162 deletions(-) | ||
134 | delete mode 100644 include/tcg/oversized-guest.h | diff view generated by jsdifflib |
1 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | 1 | DisasContextBase.pc_next has type vaddr; use the correct log format. |
---|---|---|---|
2 | |||
3 | Fixes: 85c19af63e7 ("include/exec: Use vaddr in DisasContextBase for virtual addresses") | ||
2 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
3 | --- | 5 | --- |
4 | tcg/i386/tcg-target.c.inc | 198 +++++++++++++++++++------------------- | 6 | target/mips/tcg/octeon_translate.c | 4 ++-- |
5 | 1 file changed, 98 insertions(+), 100 deletions(-) | 7 | 1 file changed, 2 insertions(+), 2 deletions(-) |
6 | 8 | ||
7 | diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc | 9 | diff --git a/target/mips/tcg/octeon_translate.c b/target/mips/tcg/octeon_translate.c |
8 | index XXXXXXX..XXXXXXX 100644 | 10 | index XXXXXXX..XXXXXXX 100644 |
9 | --- a/tcg/i386/tcg-target.c.inc | 11 | --- a/target/mips/tcg/octeon_translate.c |
10 | +++ b/tcg/i386/tcg-target.c.inc | 12 | +++ b/target/mips/tcg/octeon_translate.c |
11 | @@ -XXX,XX +XXX,XX @@ static TCGReg tcg_target_call_oarg_reg(TCGCallReturnKind kind, int slot) | 13 | @@ -XXX,XX +XXX,XX @@ static bool trans_BBIT(DisasContext *ctx, arg_BBIT *a) |
12 | # define ALL_VECTOR_REGS 0x00ff0000u | 14 | TCGv p; |
13 | # define ALL_BYTEL_REGS 0x0000000fu | 15 | |
14 | #endif | 16 | if (ctx->hflags & MIPS_HFLAG_BMASK) { |
15 | -#ifdef CONFIG_SOFTMMU | 17 | - LOG_DISAS("Branch in delay / forbidden slot at PC 0x" |
16 | -# define SOFTMMU_RESERVE_REGS ((1 << TCG_REG_L0) | (1 << TCG_REG_L1)) | 18 | - TARGET_FMT_lx "\n", ctx->base.pc_next); |
17 | -#else | 19 | + LOG_DISAS("Branch in delay / forbidden slot at PC 0x%" VADDR_PRIx "\n", |
18 | -# define SOFTMMU_RESERVE_REGS 0 | 20 | + ctx->base.pc_next); |
19 | -#endif | 21 | generate_exception_end(ctx, EXCP_RI); |
20 | +#define SOFTMMU_RESERVE_REGS \ | 22 | return true; |
21 | + (tcg_use_softmmu ? (1 << TCG_REG_L0) | (1 << TCG_REG_L1) : 0) | ||
22 | |||
23 | /* For 64-bit, we always know that CMOV is available. */ | ||
24 | #if TCG_TARGET_REG_BITS == 64 | ||
25 | @@ -XXX,XX +XXX,XX @@ static bool tcg_out_qemu_st_slow_path(TCGContext *s, TCGLabelQemuLdst *l) | ||
26 | return true; | ||
27 | } | ||
28 | |||
29 | -#ifndef CONFIG_SOFTMMU | ||
30 | +#ifdef CONFIG_USER_ONLY | ||
31 | static HostAddress x86_guest_base = { | ||
32 | .index = -1 | ||
33 | }; | ||
34 | @@ -XXX,XX +XXX,XX @@ static inline int setup_guest_base_seg(void) | ||
35 | } | 23 | } |
36 | return 0; | ||
37 | } | ||
38 | +#define setup_guest_base_seg setup_guest_base_seg | ||
39 | #elif defined(__x86_64__) && \ | ||
40 | (defined (__FreeBSD__) || defined (__FreeBSD_kernel__)) | ||
41 | # include <machine/sysarch.h> | ||
42 | @@ -XXX,XX +XXX,XX @@ static inline int setup_guest_base_seg(void) | ||
43 | } | ||
44 | return 0; | ||
45 | } | ||
46 | +#define setup_guest_base_seg setup_guest_base_seg | ||
47 | +#endif | ||
48 | #else | ||
49 | -static inline int setup_guest_base_seg(void) | ||
50 | -{ | ||
51 | - return 0; | ||
52 | -} | ||
53 | -#endif /* setup_guest_base_seg */ | ||
54 | -#endif /* !SOFTMMU */ | ||
55 | +# define x86_guest_base (*(HostAddress *)({ qemu_build_not_reached(); NULL; })) | ||
56 | +#endif /* CONFIG_USER_ONLY */ | ||
57 | +#ifndef setup_guest_base_seg | ||
58 | +# define setup_guest_base_seg() 0 | ||
59 | +#endif | ||
60 | |||
61 | #define MIN_TLB_MASK_TABLE_OFS INT_MIN | ||
62 | |||
63 | @@ -XXX,XX +XXX,XX @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, | ||
64 | MemOp s_bits = opc & MO_SIZE; | ||
65 | unsigned a_mask; | ||
66 | |||
67 | -#ifdef CONFIG_SOFTMMU | ||
68 | - h->index = TCG_REG_L0; | ||
69 | - h->ofs = 0; | ||
70 | - h->seg = 0; | ||
71 | -#else | ||
72 | - *h = x86_guest_base; | ||
73 | -#endif | ||
74 | + if (tcg_use_softmmu) { | ||
75 | + h->index = TCG_REG_L0; | ||
76 | + h->ofs = 0; | ||
77 | + h->seg = 0; | ||
78 | + } else { | ||
79 | + *h = x86_guest_base; | ||
80 | + } | ||
81 | h->base = addrlo; | ||
82 | h->aa = atom_and_align_for_opc(s, opc, MO_ATOM_IFALIGN, s_bits == MO_128); | ||
83 | a_mask = (1 << h->aa.align) - 1; | ||
84 | |||
85 | -#ifdef CONFIG_SOFTMMU | ||
86 | - int cmp_ofs = is_ld ? offsetof(CPUTLBEntry, addr_read) | ||
87 | - : offsetof(CPUTLBEntry, addr_write); | ||
88 | - TCGType ttype = TCG_TYPE_I32; | ||
89 | - TCGType tlbtype = TCG_TYPE_I32; | ||
90 | - int trexw = 0, hrexw = 0, tlbrexw = 0; | ||
91 | - unsigned mem_index = get_mmuidx(oi); | ||
92 | - unsigned s_mask = (1 << s_bits) - 1; | ||
93 | - int fast_ofs = tlb_mask_table_ofs(s, mem_index); | ||
94 | - int tlb_mask; | ||
95 | + if (tcg_use_softmmu) { | ||
96 | + int cmp_ofs = is_ld ? offsetof(CPUTLBEntry, addr_read) | ||
97 | + : offsetof(CPUTLBEntry, addr_write); | ||
98 | + TCGType ttype = TCG_TYPE_I32; | ||
99 | + TCGType tlbtype = TCG_TYPE_I32; | ||
100 | + int trexw = 0, hrexw = 0, tlbrexw = 0; | ||
101 | + unsigned mem_index = get_mmuidx(oi); | ||
102 | + unsigned s_mask = (1 << s_bits) - 1; | ||
103 | + int fast_ofs = tlb_mask_table_ofs(s, mem_index); | ||
104 | + int tlb_mask; | ||
105 | |||
106 | - ldst = new_ldst_label(s); | ||
107 | - ldst->is_ld = is_ld; | ||
108 | - ldst->oi = oi; | ||
109 | - ldst->addrlo_reg = addrlo; | ||
110 | - ldst->addrhi_reg = addrhi; | ||
111 | + ldst = new_ldst_label(s); | ||
112 | + ldst->is_ld = is_ld; | ||
113 | + ldst->oi = oi; | ||
114 | + ldst->addrlo_reg = addrlo; | ||
115 | + ldst->addrhi_reg = addrhi; | ||
116 | |||
117 | - if (TCG_TARGET_REG_BITS == 64) { | ||
118 | - ttype = s->addr_type; | ||
119 | - trexw = (ttype == TCG_TYPE_I32 ? 0 : P_REXW); | ||
120 | - if (TCG_TYPE_PTR == TCG_TYPE_I64) { | ||
121 | - hrexw = P_REXW; | ||
122 | - if (s->page_bits + s->tlb_dyn_max_bits > 32) { | ||
123 | - tlbtype = TCG_TYPE_I64; | ||
124 | - tlbrexw = P_REXW; | ||
125 | + if (TCG_TARGET_REG_BITS == 64) { | ||
126 | + ttype = s->addr_type; | ||
127 | + trexw = (ttype == TCG_TYPE_I32 ? 0 : P_REXW); | ||
128 | + if (TCG_TYPE_PTR == TCG_TYPE_I64) { | ||
129 | + hrexw = P_REXW; | ||
130 | + if (s->page_bits + s->tlb_dyn_max_bits > 32) { | ||
131 | + tlbtype = TCG_TYPE_I64; | ||
132 | + tlbrexw = P_REXW; | ||
133 | + } | ||
134 | } | ||
135 | } | ||
136 | - } | ||
137 | |||
138 | - tcg_out_mov(s, tlbtype, TCG_REG_L0, addrlo); | ||
139 | - tcg_out_shifti(s, SHIFT_SHR + tlbrexw, TCG_REG_L0, | ||
140 | - s->page_bits - CPU_TLB_ENTRY_BITS); | ||
141 | + tcg_out_mov(s, tlbtype, TCG_REG_L0, addrlo); | ||
142 | + tcg_out_shifti(s, SHIFT_SHR + tlbrexw, TCG_REG_L0, | ||
143 | + s->page_bits - CPU_TLB_ENTRY_BITS); | ||
144 | |||
145 | - tcg_out_modrm_offset(s, OPC_AND_GvEv + trexw, TCG_REG_L0, TCG_AREG0, | ||
146 | - fast_ofs + offsetof(CPUTLBDescFast, mask)); | ||
147 | + tcg_out_modrm_offset(s, OPC_AND_GvEv + trexw, TCG_REG_L0, TCG_AREG0, | ||
148 | + fast_ofs + offsetof(CPUTLBDescFast, mask)); | ||
149 | |||
150 | - tcg_out_modrm_offset(s, OPC_ADD_GvEv + hrexw, TCG_REG_L0, TCG_AREG0, | ||
151 | - fast_ofs + offsetof(CPUTLBDescFast, table)); | ||
152 | + tcg_out_modrm_offset(s, OPC_ADD_GvEv + hrexw, TCG_REG_L0, TCG_AREG0, | ||
153 | + fast_ofs + offsetof(CPUTLBDescFast, table)); | ||
154 | |||
155 | - /* | ||
156 | - * If the required alignment is at least as large as the access, simply | ||
157 | - * copy the address and mask. For lesser alignments, check that we don't | ||
158 | - * cross pages for the complete access. | ||
159 | - */ | ||
160 | - if (a_mask >= s_mask) { | ||
161 | - tcg_out_mov(s, ttype, TCG_REG_L1, addrlo); | ||
162 | - } else { | ||
163 | - tcg_out_modrm_offset(s, OPC_LEA + trexw, TCG_REG_L1, | ||
164 | - addrlo, s_mask - a_mask); | ||
165 | - } | ||
166 | - tlb_mask = s->page_mask | a_mask; | ||
167 | - tgen_arithi(s, ARITH_AND + trexw, TCG_REG_L1, tlb_mask, 0); | ||
168 | + /* | ||
169 | + * If the required alignment is at least as large as the access, | ||
170 | + * simply copy the address and mask. For lesser alignments, | ||
171 | + * check that we don't cross pages for the complete access. | ||
172 | + */ | ||
173 | + if (a_mask >= s_mask) { | ||
174 | + tcg_out_mov(s, ttype, TCG_REG_L1, addrlo); | ||
175 | + } else { | ||
176 | + tcg_out_modrm_offset(s, OPC_LEA + trexw, TCG_REG_L1, | ||
177 | + addrlo, s_mask - a_mask); | ||
178 | + } | ||
179 | + tlb_mask = s->page_mask | a_mask; | ||
180 | + tgen_arithi(s, ARITH_AND + trexw, TCG_REG_L1, tlb_mask, 0); | ||
181 | |||
182 | - /* cmp 0(TCG_REG_L0), TCG_REG_L1 */ | ||
183 | - tcg_out_modrm_offset(s, OPC_CMP_GvEv + trexw, | ||
184 | - TCG_REG_L1, TCG_REG_L0, cmp_ofs); | ||
185 | - | ||
186 | - /* jne slow_path */ | ||
187 | - tcg_out_opc(s, OPC_JCC_long + JCC_JNE, 0, 0, 0); | ||
188 | - ldst->label_ptr[0] = s->code_ptr; | ||
189 | - s->code_ptr += 4; | ||
190 | - | ||
191 | - if (TCG_TARGET_REG_BITS == 32 && s->addr_type == TCG_TYPE_I64) { | ||
192 | - /* cmp 4(TCG_REG_L0), addrhi */ | ||
193 | - tcg_out_modrm_offset(s, OPC_CMP_GvEv, addrhi, TCG_REG_L0, cmp_ofs + 4); | ||
194 | + /* cmp 0(TCG_REG_L0), TCG_REG_L1 */ | ||
195 | + tcg_out_modrm_offset(s, OPC_CMP_GvEv + trexw, | ||
196 | + TCG_REG_L1, TCG_REG_L0, cmp_ofs); | ||
197 | |||
198 | /* jne slow_path */ | ||
199 | tcg_out_opc(s, OPC_JCC_long + JCC_JNE, 0, 0, 0); | ||
200 | - ldst->label_ptr[1] = s->code_ptr; | ||
201 | + ldst->label_ptr[0] = s->code_ptr; | ||
202 | s->code_ptr += 4; | ||
203 | - } | ||
204 | |||
205 | - /* TLB Hit. */ | ||
206 | - tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_L0, TCG_REG_L0, | ||
207 | - offsetof(CPUTLBEntry, addend)); | ||
208 | -#else | ||
209 | - if (a_mask) { | ||
210 | + if (TCG_TARGET_REG_BITS == 32 && s->addr_type == TCG_TYPE_I64) { | ||
211 | + /* cmp 4(TCG_REG_L0), addrhi */ | ||
212 | + tcg_out_modrm_offset(s, OPC_CMP_GvEv, addrhi, | ||
213 | + TCG_REG_L0, cmp_ofs + 4); | ||
214 | + | ||
215 | + /* jne slow_path */ | ||
216 | + tcg_out_opc(s, OPC_JCC_long + JCC_JNE, 0, 0, 0); | ||
217 | + ldst->label_ptr[1] = s->code_ptr; | ||
218 | + s->code_ptr += 4; | ||
219 | + } | ||
220 | + | ||
221 | + /* TLB Hit. */ | ||
222 | + tcg_out_ld(s, TCG_TYPE_PTR, TCG_REG_L0, TCG_REG_L0, | ||
223 | + offsetof(CPUTLBEntry, addend)); | ||
224 | + } else if (a_mask) { | ||
225 | ldst = new_ldst_label(s); | ||
226 | |||
227 | ldst->is_ld = is_ld; | ||
228 | @@ -XXX,XX +XXX,XX @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, | ||
229 | ldst->label_ptr[0] = s->code_ptr; | ||
230 | s->code_ptr += 4; | ||
231 | } | ||
232 | -#endif | ||
233 | |||
234 | return ldst; | ||
235 | } | ||
236 | @@ -XXX,XX +XXX,XX @@ static void tcg_target_qemu_prologue(TCGContext *s) | ||
237 | tcg_out_push(s, tcg_target_callee_save_regs[i]); | ||
238 | } | ||
239 | |||
240 | -#if TCG_TARGET_REG_BITS == 32 | ||
241 | - tcg_out_ld(s, TCG_TYPE_PTR, TCG_AREG0, TCG_REG_ESP, | ||
242 | - (ARRAY_SIZE(tcg_target_callee_save_regs) + 1) * 4); | ||
243 | - tcg_out_addi(s, TCG_REG_ESP, -stack_addend); | ||
244 | - /* jmp *tb. */ | ||
245 | - tcg_out_modrm_offset(s, OPC_GRP5, EXT5_JMPN_Ev, TCG_REG_ESP, | ||
246 | - (ARRAY_SIZE(tcg_target_callee_save_regs) + 2) * 4 | ||
247 | - + stack_addend); | ||
248 | -#else | ||
249 | -# if !defined(CONFIG_SOFTMMU) | ||
250 | - if (guest_base) { | ||
251 | + if (!tcg_use_softmmu && guest_base) { | ||
252 | int seg = setup_guest_base_seg(); | ||
253 | if (seg != 0) { | ||
254 | x86_guest_base.seg = seg; | ||
255 | } else if (guest_base == (int32_t)guest_base) { | ||
256 | x86_guest_base.ofs = guest_base; | ||
257 | } else { | ||
258 | + assert(TCG_TARGET_REG_BITS == 64); | ||
259 | /* Choose R12 because, as a base, it requires a SIB byte. */ | ||
260 | x86_guest_base.index = TCG_REG_R12; | ||
261 | tcg_out_movi(s, TCG_TYPE_PTR, x86_guest_base.index, guest_base); | ||
262 | tcg_regset_set_reg(s->reserved_regs, x86_guest_base.index); | ||
263 | } | ||
264 | } | ||
265 | -# endif | ||
266 | - tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, tcg_target_call_iarg_regs[0]); | ||
267 | - tcg_out_addi(s, TCG_REG_ESP, -stack_addend); | ||
268 | - /* jmp *tb. */ | ||
269 | - tcg_out_modrm(s, OPC_GRP5, EXT5_JMPN_Ev, tcg_target_call_iarg_regs[1]); | ||
270 | -#endif | ||
271 | + | ||
272 | + if (TCG_TARGET_REG_BITS == 32) { | ||
273 | + tcg_out_ld(s, TCG_TYPE_PTR, TCG_AREG0, TCG_REG_ESP, | ||
274 | + (ARRAY_SIZE(tcg_target_callee_save_regs) + 1) * 4); | ||
275 | + tcg_out_addi(s, TCG_REG_ESP, -stack_addend); | ||
276 | + /* jmp *tb. */ | ||
277 | + tcg_out_modrm_offset(s, OPC_GRP5, EXT5_JMPN_Ev, TCG_REG_ESP, | ||
278 | + (ARRAY_SIZE(tcg_target_callee_save_regs) + 2) * 4 | ||
279 | + + stack_addend); | ||
280 | + } else { | ||
281 | + tcg_out_mov(s, TCG_TYPE_PTR, TCG_AREG0, tcg_target_call_iarg_regs[0]); | ||
282 | + tcg_out_addi(s, TCG_REG_ESP, -stack_addend); | ||
283 | + /* jmp *tb. */ | ||
284 | + tcg_out_modrm(s, OPC_GRP5, EXT5_JMPN_Ev, tcg_target_call_iarg_regs[1]); | ||
285 | + } | ||
286 | |||
287 | /* | ||
288 | * Return path for goto_ptr. Set return value to 0, a-la exit_tb, | ||
289 | -- | 24 | -- |
290 | 2.34.1 | 25 | 2.43.0 |
291 | |||
292 | diff view generated by jsdifflib |