1 | Note that I've extended the expiration date of my gpg key | 1 | Version 3: Rebase and fix a minor patch conflict. |
---|---|---|---|
2 | and have uploaded it to keyserver.ubuntu.com. | ||
3 | 2 | ||
4 | 3 | ||
5 | r~ | 4 | r~ |
6 | 5 | ||
7 | 6 | ||
8 | The following changes since commit 99c44988d5ba1866a411450c877ed818b1b70081: | 7 | The following changes since commit c6f5e042d89e79206cd1ce5525d3df219f13c3cc: |
9 | 8 | ||
10 | Merge remote-tracking branch 'remotes/bsdimp/tags/pull-bsd-user-20210910' into staging (2021-09-11 14:00:39 +0100) | 9 | Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20210913-3' into staging (2021-09-13 21:06:15 +0100) |
11 | 10 | ||
12 | are available in the Git repository at: | 11 | are available in the Git repository at: |
13 | 12 | ||
14 | https://gitlab.com/rth7680/qemu.git tags/pull-tcg-20210912 | 13 | https://gitlab.com/rth7680/qemu.git tags/pull-tcg-20210914 |
15 | 14 | ||
16 | for you to fetch changes up to 267a3ec3e2a8fb3e06a9d46d09fcfc57dfefd118: | 15 | for you to fetch changes up to a5b759b6dca7daf87fa5007a7f5784bf22f3830f: |
17 | 16 | ||
18 | tcg/arm: Fix tcg_out_vec_op function signature (2021-09-12 05:07:36 -0700) | 17 | tcg/arm: More use of the TCGReg enum (2021-09-14 07:59:43 -0700) |
19 | 18 | ||
20 | ---------------------------------------------------------------- | 19 | ---------------------------------------------------------------- |
21 | Fix translation race condition for user-only. | 20 | Fix translation race condition for user-only. |
22 | Fix tcg/i386 encoding for VPSLLVQ, VPSRLVQ. | 21 | Fix tcg/i386 encoding for VPSLLVQ, VPSRLVQ. |
23 | Fix tcg/arm tcg_out_vec_op signature. | 22 | Fix tcg/arm tcg_out_vec_op signature. |
24 | Fix tcg/ppc (32bit) build with clang. | 23 | Fix tcg/ppc (32bit) build with clang. |
25 | Remove dupluate TCG_KICK_PERIOD definition. | 24 | Remove dupluate TCG_KICK_PERIOD definition. |
26 | Remove unused tcg_global_reg_new. | 25 | Remove unused tcg_global_reg_new. |
27 | Use __builtin_bswap*. | 26 | Restrict cpu_exec_interrupt and its callees to sysemu. |
27 | Cleanups for tcg/arm. | ||
28 | 28 | ||
29 | ---------------------------------------------------------------- | 29 | ---------------------------------------------------------------- |
30 | Bin Meng (1): | 30 | Bin Meng (1): |
31 | tcg: Remove tcg_global_reg_new defines | 31 | tcg: Remove tcg_global_reg_new defines |
32 | 32 | ||
33 | Ilya Leoshkevich (2): | 33 | Ilya Leoshkevich (3): |
34 | accel/tcg: Add DisasContextBase argument to translator_ld* | 34 | accel/tcg: Add DisasContextBase argument to translator_ld* |
35 | accel/tcg: Clear PAGE_WRITE before translation | 35 | accel/tcg: Clear PAGE_WRITE before translation |
36 | accel/tcg/user-exec: Fix read-modify-write of code on s390 hosts | ||
36 | 37 | ||
37 | Jose R. Ziviani (1): | 38 | Jose R. Ziviani (1): |
38 | tcg/arm: Fix tcg_out_vec_op function signature | 39 | tcg/arm: Fix tcg_out_vec_op function signature |
39 | 40 | ||
40 | Luc Michel (1): | 41 | Luc Michel (1): |
41 | accel/tcg: remove redundant TCG_KICK_PERIOD define | 42 | accel/tcg: remove redundant TCG_KICK_PERIOD define |
42 | 43 | ||
43 | Richard Henderson (4): | 44 | Philippe Mathieu-Daudé (25): |
45 | target/avr: Remove pointless use of CONFIG_USER_ONLY definition | ||
46 | target/i386: Restrict sysemu-only fpu_helper helpers | ||
47 | target/i386: Simplify TARGET_X86_64 #ifdef'ry | ||
48 | target/xtensa: Restrict do_transaction_failed() to sysemu | ||
49 | accel/tcg: Rename user-mode do_interrupt hack as fake_user_interrupt | ||
50 | target/alpha: Restrict cpu_exec_interrupt() handler to sysemu | ||
51 | target/arm: Restrict cpu_exec_interrupt() handler to sysemu | ||
52 | target/cris: Restrict cpu_exec_interrupt() handler to sysemu | ||
53 | target/hppa: Restrict cpu_exec_interrupt() handler to sysemu | ||
54 | target/i386: Restrict cpu_exec_interrupt() handler to sysemu | ||
55 | target/i386: Move x86_cpu_exec_interrupt() under sysemu/ folder | ||
56 | target/m68k: Restrict cpu_exec_interrupt() handler to sysemu | ||
57 | target/microblaze: Restrict cpu_exec_interrupt() handler to sysemu | ||
58 | target/mips: Restrict cpu_exec_interrupt() handler to sysemu | ||
59 | target/nios2: Restrict cpu_exec_interrupt() handler to sysemu | ||
60 | target/openrisc: Restrict cpu_exec_interrupt() handler to sysemu | ||
61 | target/ppc: Restrict cpu_exec_interrupt() handler to sysemu | ||
62 | target/riscv: Restrict cpu_exec_interrupt() handler to sysemu | ||
63 | target/sh4: Restrict cpu_exec_interrupt() handler to sysemu | ||
64 | target/sparc: Restrict cpu_exec_interrupt() handler to sysemu | ||
65 | target/rx: Restrict cpu_exec_interrupt() handler to sysemu | ||
66 | target/xtensa: Restrict cpu_exec_interrupt() handler to sysemu | ||
67 | accel/tcg: Restrict TCGCPUOps::cpu_exec_interrupt() to sysemu | ||
68 | user: Remove cpu_get_pic_interrupt() stubs | ||
69 | user: Mark cpu_loop() with noreturn attribute | ||
70 | |||
71 | Richard Henderson (13): | ||
44 | tcg/i386: Split P_VEXW from P_REXW | 72 | tcg/i386: Split P_VEXW from P_REXW |
45 | include/qemu: Use builtins for bswap | ||
46 | tcg/ppc: Replace TCG_TARGET_CALL_DARWIN with _CALL_DARWIN | 73 | tcg/ppc: Replace TCG_TARGET_CALL_DARWIN with _CALL_DARWIN |
47 | tcg/ppc: Ensure _CALL_SYSV is set for 32-bit ELF | 74 | tcg/ppc: Ensure _CALL_SYSV is set for 32-bit ELF |
75 | tcg/arm: Remove fallback definition of __ARM_ARCH | ||
76 | tcg/arm: Standardize on tcg_out_<branch>_{reg,imm} | ||
77 | tcg/arm: Simplify use_armv5t_instructions | ||
78 | tcg/arm: Support armv4t in tcg_out_goto and tcg_out_call | ||
79 | tcg/arm: Split out tcg_out_ldstm | ||
80 | tcg/arm: Simplify usage of encode_imm | ||
81 | tcg/arm: Drop inline markers | ||
82 | tcg/arm: Give enum arm_cond_code_e a typedef and use it | ||
83 | tcg/arm: More use of the ARMInsn enum | ||
84 | tcg/arm: More use of the TCGReg enum | ||
48 | 85 | ||
49 | meson.build | 6 ---- | 86 | bsd-user/qemu.h | 2 +- |
50 | include/exec/translate-all.h | 1 + | 87 | include/exec/translate-all.h | 1 + |
51 | include/exec/translator.h | 44 +++++++++++++---------- | 88 | include/exec/translator.h | 44 +-- |
52 | include/qemu/bswap.h | 53 ++------------------------- | 89 | include/hw/core/tcg-cpu-ops.h | 26 +- |
53 | include/tcg/tcg-op.h | 2 -- | 90 | include/tcg/tcg-op.h | 2 - |
54 | target/arm/arm_ldst.h | 12 +++---- | 91 | linux-user/qemu.h | 2 +- |
55 | accel/tcg/tcg-accel-ops-rr.c | 2 -- | 92 | target/alpha/cpu.h | 2 +- |
56 | accel/tcg/translate-all.c | 59 ++++++++++++++++++------------- | 93 | target/arm/arm_ldst.h | 12 +- |
57 | accel/tcg/translator.c | 39 ++++++++++++++++++++ | 94 | target/arm/cpu.h | 3 +- |
58 | target/alpha/translate.c | 2 +- | 95 | target/cris/cpu.h | 2 +- |
59 | target/arm/translate-a64.c | 2 +- | 96 | target/hppa/cpu.h | 4 +- |
60 | target/arm/translate.c | 9 ++--- | 97 | target/i386/cpu.h | 3 + |
61 | target/hexagon/translate.c | 3 +- | 98 | target/i386/tcg/helper-tcg.h | 2 + |
62 | target/hppa/translate.c | 5 +-- | 99 | target/m68k/cpu.h | 2 + |
63 | target/i386/tcg/translate.c | 10 +++--- | 100 | target/microblaze/cpu.h | 2 + |
64 | target/m68k/translate.c | 2 +- | 101 | target/mips/tcg/tcg-internal.h | 5 +- |
65 | target/mips/tcg/translate.c | 8 ++--- | 102 | target/openrisc/cpu.h | 5 +- |
66 | target/openrisc/translate.c | 2 +- | 103 | target/ppc/cpu.h | 4 +- |
67 | target/ppc/translate.c | 5 +-- | 104 | target/riscv/cpu.h | 2 +- |
68 | target/riscv/translate.c | 5 +-- | 105 | target/rx/cpu.h | 2 + |
69 | target/s390x/tcg/translate.c | 16 +++++---- | 106 | target/sh4/cpu.h | 4 +- |
70 | target/sh4/translate.c | 4 +-- | 107 | target/xtensa/cpu.h | 2 + |
71 | target/sparc/translate.c | 2 +- | 108 | tcg/arm/tcg-target.h | 27 +- |
72 | target/xtensa/translate.c | 5 +-- | 109 | accel/tcg/cpu-exec.c | 14 +- |
73 | target/mips/tcg/micromips_translate.c.inc | 2 +- | 110 | accel/tcg/tcg-accel-ops-rr.c | 2 - |
74 | target/mips/tcg/mips16e_translate.c.inc | 4 +-- | 111 | accel/tcg/translate-all.c | 59 ++-- |
75 | target/mips/tcg/nanomips_translate.c.inc | 4 +-- | 112 | accel/tcg/translator.c | 39 +++ |
76 | tcg/arm/tcg-target.c.inc | 3 +- | 113 | accel/tcg/user-exec.c | 48 ++- |
77 | tcg/i386/tcg-target.c.inc | 13 +++---- | 114 | bsd-user/i386/target_arch_cpu.c | 5 - |
78 | tcg/ppc/tcg-target.c.inc | 25 ++++++++++--- | 115 | bsd-user/x86_64/target_arch_cpu.c | 5 - |
79 | 30 files changed, 185 insertions(+), 164 deletions(-) | 116 | linux-user/main.c | 7 - |
117 | target/alpha/cpu.c | 2 +- | ||
118 | target/alpha/helper.c | 5 +- | ||
119 | target/alpha/translate.c | 2 +- | ||
120 | target/arm/cpu.c | 7 +- | ||
121 | target/arm/cpu_tcg.c | 6 +- | ||
122 | target/arm/translate-a64.c | 2 +- | ||
123 | target/arm/translate.c | 9 +- | ||
124 | target/avr/cpu.c | 3 - | ||
125 | target/cris/cpu.c | 4 +- | ||
126 | target/cris/helper.c | 17 +- | ||
127 | target/hexagon/translate.c | 3 +- | ||
128 | target/hppa/cpu.c | 2 +- | ||
129 | target/hppa/int_helper.c | 7 +- | ||
130 | target/hppa/translate.c | 5 +- | ||
131 | target/i386/tcg/seg_helper.c | 74 +---- | ||
132 | target/i386/tcg/sysemu/seg_helper.c | 62 ++++ | ||
133 | target/i386/tcg/tcg-cpu.c | 8 +- | ||
134 | target/i386/tcg/translate.c | 10 +- | ||
135 | target/m68k/cpu.c | 2 +- | ||
136 | target/m68k/op_helper.c | 16 +- | ||
137 | target/m68k/translate.c | 2 +- | ||
138 | target/microblaze/cpu.c | 2 +- | ||
139 | target/microblaze/helper.c | 13 +- | ||
140 | target/mips/cpu.c | 2 +- | ||
141 | target/mips/tcg/exception.c | 18 -- | ||
142 | target/mips/tcg/sysemu/tlb_helper.c | 18 ++ | ||
143 | target/mips/tcg/translate.c | 8 +- | ||
144 | target/mips/tcg/user/tlb_helper.c | 5 - | ||
145 | target/nios2/cpu.c | 5 +- | ||
146 | target/openrisc/cpu.c | 2 +- | ||
147 | target/openrisc/interrupt.c | 2 - | ||
148 | target/openrisc/translate.c | 2 +- | ||
149 | target/ppc/cpu_init.c | 2 +- | ||
150 | target/ppc/excp_helper.c | 21 +- | ||
151 | target/ppc/translate.c | 5 +- | ||
152 | target/riscv/cpu.c | 2 +- | ||
153 | target/riscv/cpu_helper.c | 5 - | ||
154 | target/riscv/translate.c | 5 +- | ||
155 | target/rx/cpu.c | 2 +- | ||
156 | target/rx/helper.c | 4 + | ||
157 | target/s390x/tcg/translate.c | 16 +- | ||
158 | target/sh4/cpu.c | 2 +- | ||
159 | target/sh4/helper.c | 9 +- | ||
160 | target/sh4/translate.c | 4 +- | ||
161 | target/sparc/cpu.c | 4 +- | ||
162 | target/sparc/translate.c | 2 +- | ||
163 | target/xtensa/cpu.c | 2 +- | ||
164 | target/xtensa/exc_helper.c | 7 +- | ||
165 | target/xtensa/translate.c | 5 +- | ||
166 | target/mips/tcg/micromips_translate.c.inc | 2 +- | ||
167 | target/mips/tcg/mips16e_translate.c.inc | 4 +- | ||
168 | target/mips/tcg/nanomips_translate.c.inc | 4 +- | ||
169 | tcg/arm/tcg-target.c.inc | 517 ++++++++++++++++-------------- | ||
170 | tcg/i386/tcg-target.c.inc | 13 +- | ||
171 | tcg/ppc/tcg-target.c.inc | 25 +- | ||
172 | target/openrisc/meson.build | 6 +- | ||
173 | 87 files changed, 702 insertions(+), 630 deletions(-) | ||
80 | 174 | diff view generated by jsdifflib |
... | ... | ||
---|---|---|---|
103 | ctx->base.is_jmp = translate_one(ctx, insn); | 103 | ctx->base.is_jmp = translate_one(ctx, insn); |
104 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c | 104 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
105 | index XXXXXXX..XXXXXXX 100644 | 105 | index XXXXXXX..XXXXXXX 100644 |
106 | --- a/target/arm/translate-a64.c | 106 | --- a/target/arm/translate-a64.c |
107 | +++ b/target/arm/translate-a64.c | 107 | +++ b/target/arm/translate-a64.c |
108 | @@ -XXX,XX +XXX,XX @@ static void disas_a64_insn(CPUARMState *env, DisasContext *s) | 108 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) |
109 | uint32_t insn; | 109 | } |
110 | 110 | ||
111 | s->pc_curr = s->base.pc_next; | 111 | s->pc_curr = s->base.pc_next; |
112 | - insn = arm_ldl_code(env, s->base.pc_next, s->sctlr_b); | 112 | - insn = arm_ldl_code(env, s->base.pc_next, s->sctlr_b); |
113 | + insn = arm_ldl_code(env, &s->base, s->base.pc_next, s->sctlr_b); | 113 | + insn = arm_ldl_code(env, &s->base, s->base.pc_next, s->sctlr_b); |
114 | s->insn = insn; | 114 | s->insn = insn; |
... | ... | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Ilya Leoshkevich <iii@linux.ibm.com> | ||
2 | 1 | ||
3 | translate_insn() implementations fetch instruction bytes piecemeal, | ||
4 | which can cause qemu-user to generate inconsistent translations if | ||
5 | another thread modifies them concurrently [1]. | ||
6 | |||
7 | Fix by making pages containing translated instruction non-writable | ||
8 | right before loading instruction bytes from them. | ||
9 | |||
10 | [1] https://lists.nongnu.org/archive/html/qemu-devel/2021-08/msg00644.html | ||
11 | |||
12 | Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> | ||
13 | Message-Id: <20210805204835.158918-1-iii@linux.ibm.com> | ||
14 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
15 | --- | ||
16 | include/exec/translate-all.h | 1 + | ||
17 | include/exec/translator.h | 39 ++++++++++++++---------- | ||
18 | accel/tcg/translate-all.c | 59 +++++++++++++++++++++--------------- | ||
19 | accel/tcg/translator.c | 39 ++++++++++++++++++++++++ | ||
20 | 4 files changed, 97 insertions(+), 41 deletions(-) | ||
21 | |||
22 | diff --git a/include/exec/translate-all.h b/include/exec/translate-all.h | ||
23 | index XXXXXXX..XXXXXXX 100644 | ||
24 | --- a/include/exec/translate-all.h | ||
25 | +++ b/include/exec/translate-all.h | ||
26 | @@ -XXX,XX +XXX,XX @@ void tb_invalidate_phys_page_range(tb_page_addr_t start, tb_page_addr_t end); | ||
27 | void tb_check_watchpoint(CPUState *cpu, uintptr_t retaddr); | ||
28 | |||
29 | #ifdef CONFIG_USER_ONLY | ||
30 | +void page_protect(tb_page_addr_t page_addr); | ||
31 | int page_unprotect(target_ulong address, uintptr_t pc); | ||
32 | #endif | ||
33 | |||
34 | diff --git a/include/exec/translator.h b/include/exec/translator.h | ||
35 | index XXXXXXX..XXXXXXX 100644 | ||
36 | --- a/include/exec/translator.h | ||
37 | +++ b/include/exec/translator.h | ||
38 | @@ -XXX,XX +XXX,XX @@ | ||
39 | #include "exec/exec-all.h" | ||
40 | #include "exec/cpu_ldst.h" | ||
41 | #include "exec/plugin-gen.h" | ||
42 | +#include "exec/translate-all.h" | ||
43 | #include "tcg/tcg.h" | ||
44 | |||
45 | |||
46 | @@ -XXX,XX +XXX,XX @@ typedef struct DisasContextBase { | ||
47 | int num_insns; | ||
48 | int max_insns; | ||
49 | bool singlestep_enabled; | ||
50 | +#ifdef CONFIG_USER_ONLY | ||
51 | + /* | ||
52 | + * Guest address of the last byte of the last protected page. | ||
53 | + * | ||
54 | + * Pages containing the translated instructions are made non-writable in | ||
55 | + * order to achieve consistency in case another thread is modifying the | ||
56 | + * code while translate_insn() fetches the instruction bytes piecemeal. | ||
57 | + * Such writer threads are blocked on mmap_lock() in page_unprotect(). | ||
58 | + */ | ||
59 | + target_ulong page_protect_end; | ||
60 | +#endif | ||
61 | } DisasContextBase; | ||
62 | |||
63 | /** | ||
64 | @@ -XXX,XX +XXX,XX @@ bool translator_use_goto_tb(DisasContextBase *db, target_ulong dest); | ||
65 | */ | ||
66 | |||
67 | #define GEN_TRANSLATOR_LD(fullname, type, load_fn, swap_fn) \ | ||
68 | - static inline type \ | ||
69 | - fullname ## _swap(CPUArchState *env, DisasContextBase *dcbase, \ | ||
70 | - abi_ptr pc, bool do_swap) \ | ||
71 | - { \ | ||
72 | - type ret = load_fn(env, pc); \ | ||
73 | - if (do_swap) { \ | ||
74 | - ret = swap_fn(ret); \ | ||
75 | - } \ | ||
76 | - plugin_insn_append(&ret, sizeof(ret)); \ | ||
77 | - return ret; \ | ||
78 | - } \ | ||
79 | + type fullname ## _swap(CPUArchState *env, DisasContextBase *dcbase, \ | ||
80 | + abi_ptr pc, bool do_swap); \ | ||
81 | static inline type fullname(CPUArchState *env, \ | ||
82 | DisasContextBase *dcbase, abi_ptr pc) \ | ||
83 | { \ | ||
84 | return fullname ## _swap(env, dcbase, pc, false); \ | ||
85 | } | ||
86 | |||
87 | -GEN_TRANSLATOR_LD(translator_ldub, uint8_t, cpu_ldub_code, /* no swap */) | ||
88 | -GEN_TRANSLATOR_LD(translator_ldsw, int16_t, cpu_ldsw_code, bswap16) | ||
89 | -GEN_TRANSLATOR_LD(translator_lduw, uint16_t, cpu_lduw_code, bswap16) | ||
90 | -GEN_TRANSLATOR_LD(translator_ldl, uint32_t, cpu_ldl_code, bswap32) | ||
91 | -GEN_TRANSLATOR_LD(translator_ldq, uint64_t, cpu_ldq_code, bswap64) | ||
92 | +#define FOR_EACH_TRANSLATOR_LD(F) \ | ||
93 | + F(translator_ldub, uint8_t, cpu_ldub_code, /* no swap */) \ | ||
94 | + F(translator_ldsw, int16_t, cpu_ldsw_code, bswap16) \ | ||
95 | + F(translator_lduw, uint16_t, cpu_lduw_code, bswap16) \ | ||
96 | + F(translator_ldl, uint32_t, cpu_ldl_code, bswap32) \ | ||
97 | + F(translator_ldq, uint64_t, cpu_ldq_code, bswap64) | ||
98 | + | ||
99 | +FOR_EACH_TRANSLATOR_LD(GEN_TRANSLATOR_LD) | ||
100 | + | ||
101 | #undef GEN_TRANSLATOR_LD | ||
102 | |||
103 | #endif /* EXEC__TRANSLATOR_H */ | ||
104 | diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c | ||
105 | index XXXXXXX..XXXXXXX 100644 | ||
106 | --- a/accel/tcg/translate-all.c | ||
107 | +++ b/accel/tcg/translate-all.c | ||
108 | @@ -XXX,XX +XXX,XX @@ static inline void tb_page_add(PageDesc *p, TranslationBlock *tb, | ||
109 | invalidate_page_bitmap(p); | ||
110 | |||
111 | #if defined(CONFIG_USER_ONLY) | ||
112 | - if (p->flags & PAGE_WRITE) { | ||
113 | - target_ulong addr; | ||
114 | - PageDesc *p2; | ||
115 | - int prot; | ||
116 | - | ||
117 | - /* force the host page as non writable (writes will have a | ||
118 | - page fault + mprotect overhead) */ | ||
119 | - page_addr &= qemu_host_page_mask; | ||
120 | - prot = 0; | ||
121 | - for (addr = page_addr; addr < page_addr + qemu_host_page_size; | ||
122 | - addr += TARGET_PAGE_SIZE) { | ||
123 | - | ||
124 | - p2 = page_find(addr >> TARGET_PAGE_BITS); | ||
125 | - if (!p2) { | ||
126 | - continue; | ||
127 | - } | ||
128 | - prot |= p2->flags; | ||
129 | - p2->flags &= ~PAGE_WRITE; | ||
130 | - } | ||
131 | - mprotect(g2h_untagged(page_addr), qemu_host_page_size, | ||
132 | - (prot & PAGE_BITS) & ~PAGE_WRITE); | ||
133 | - if (DEBUG_TB_INVALIDATE_GATE) { | ||
134 | - printf("protecting code page: 0x" TB_PAGE_ADDR_FMT "\n", page_addr); | ||
135 | - } | ||
136 | - } | ||
137 | + /* translator_loop() must have made all TB pages non-writable */ | ||
138 | + assert(!(p->flags & PAGE_WRITE)); | ||
139 | #else | ||
140 | /* if some code is already present, then the pages are already | ||
141 | protected. So we handle the case where only the first TB is | ||
142 | @@ -XXX,XX +XXX,XX @@ int page_check_range(target_ulong start, target_ulong len, int flags) | ||
143 | return 0; | ||
144 | } | ||
145 | |||
146 | +void page_protect(tb_page_addr_t page_addr) | ||
147 | +{ | ||
148 | + target_ulong addr; | ||
149 | + PageDesc *p; | ||
150 | + int prot; | ||
151 | + | ||
152 | + p = page_find(page_addr >> TARGET_PAGE_BITS); | ||
153 | + if (p && (p->flags & PAGE_WRITE)) { | ||
154 | + /* | ||
155 | + * Force the host page as non writable (writes will have a page fault + | ||
156 | + * mprotect overhead). | ||
157 | + */ | ||
158 | + page_addr &= qemu_host_page_mask; | ||
159 | + prot = 0; | ||
160 | + for (addr = page_addr; addr < page_addr + qemu_host_page_size; | ||
161 | + addr += TARGET_PAGE_SIZE) { | ||
162 | + | ||
163 | + p = page_find(addr >> TARGET_PAGE_BITS); | ||
164 | + if (!p) { | ||
165 | + continue; | ||
166 | + } | ||
167 | + prot |= p->flags; | ||
168 | + p->flags &= ~PAGE_WRITE; | ||
169 | + } | ||
170 | + mprotect(g2h_untagged(page_addr), qemu_host_page_size, | ||
171 | + (prot & PAGE_BITS) & ~PAGE_WRITE); | ||
172 | + if (DEBUG_TB_INVALIDATE_GATE) { | ||
173 | + printf("protecting code page: 0x" TB_PAGE_ADDR_FMT "\n", page_addr); | ||
174 | + } | ||
175 | + } | ||
176 | +} | ||
177 | + | ||
178 | /* called from signal handler: invalidate the code and unprotect the | ||
179 | * page. Return 0 if the fault was not handled, 1 if it was handled, | ||
180 | * and 2 if it was handled but the caller must cause the TB to be | ||
181 | diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c | ||
182 | index XXXXXXX..XXXXXXX 100644 | ||
183 | --- a/accel/tcg/translator.c | ||
184 | +++ b/accel/tcg/translator.c | ||
185 | @@ -XXX,XX +XXX,XX @@ bool translator_use_goto_tb(DisasContextBase *db, target_ulong dest) | ||
186 | return ((db->pc_first ^ dest) & TARGET_PAGE_MASK) == 0; | ||
187 | } | ||
188 | |||
189 | +static inline void translator_page_protect(DisasContextBase *dcbase, | ||
190 | + target_ulong pc) | ||
191 | +{ | ||
192 | +#ifdef CONFIG_USER_ONLY | ||
193 | + dcbase->page_protect_end = pc | ~TARGET_PAGE_MASK; | ||
194 | + page_protect(pc); | ||
195 | +#endif | ||
196 | +} | ||
197 | + | ||
198 | void translator_loop(const TranslatorOps *ops, DisasContextBase *db, | ||
199 | CPUState *cpu, TranslationBlock *tb, int max_insns) | ||
200 | { | ||
201 | @@ -XXX,XX +XXX,XX @@ void translator_loop(const TranslatorOps *ops, DisasContextBase *db, | ||
202 | db->num_insns = 0; | ||
203 | db->max_insns = max_insns; | ||
204 | db->singlestep_enabled = cflags & CF_SINGLE_STEP; | ||
205 | + translator_page_protect(db, db->pc_next); | ||
206 | |||
207 | ops->init_disas_context(db, cpu); | ||
208 | tcg_debug_assert(db->is_jmp == DISAS_NEXT); /* no early exit */ | ||
209 | @@ -XXX,XX +XXX,XX @@ void translator_loop(const TranslatorOps *ops, DisasContextBase *db, | ||
210 | } | ||
211 | #endif | ||
212 | } | ||
213 | + | ||
214 | +static inline void translator_maybe_page_protect(DisasContextBase *dcbase, | ||
215 | + target_ulong pc, size_t len) | ||
216 | +{ | ||
217 | +#ifdef CONFIG_USER_ONLY | ||
218 | + target_ulong end = pc + len - 1; | ||
219 | + | ||
220 | + if (end > dcbase->page_protect_end) { | ||
221 | + translator_page_protect(dcbase, end); | ||
222 | + } | ||
223 | +#endif | ||
224 | +} | ||
225 | + | ||
226 | +#define GEN_TRANSLATOR_LD(fullname, type, load_fn, swap_fn) \ | ||
227 | + type fullname ## _swap(CPUArchState *env, DisasContextBase *dcbase, \ | ||
228 | + abi_ptr pc, bool do_swap) \ | ||
229 | + { \ | ||
230 | + translator_maybe_page_protect(dcbase, pc, sizeof(type)); \ | ||
231 | + type ret = load_fn(env, pc); \ | ||
232 | + if (do_swap) { \ | ||
233 | + ret = swap_fn(ret); \ | ||
234 | + } \ | ||
235 | + plugin_insn_append(&ret, sizeof(ret)); \ | ||
236 | + return ret; \ | ||
237 | + } | ||
238 | + | ||
239 | +FOR_EACH_TRANSLATOR_LD(GEN_TRANSLATOR_LD) | ||
240 | + | ||
241 | +#undef GEN_TRANSLATOR_LD | ||
242 | -- | ||
243 | 2.25.1 | ||
244 | |||
245 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | We need to be able to represent VEX.W on a 32-bit host, where REX.W | ||
2 | will always be zero. Fixes the encoding for VPSLLVQ and VPSRLVQ. | ||
3 | 1 | ||
4 | Fixes: a2ce146a068 ("tcg/i386: Support vector variable shift opcodes") | ||
5 | Resolves: https://gitlab.com/qemu-project/qemu/-/issues/385 | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | --- | ||
8 | tcg/i386/tcg-target.c.inc | 13 +++++++------ | ||
9 | 1 file changed, 7 insertions(+), 6 deletions(-) | ||
10 | |||
11 | diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/tcg/i386/tcg-target.c.inc | ||
14 | +++ b/tcg/i386/tcg-target.c.inc | ||
15 | @@ -XXX,XX +XXX,XX @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct) | ||
16 | #define P_EXT 0x100 /* 0x0f opcode prefix */ | ||
17 | #define P_EXT38 0x200 /* 0x0f 0x38 opcode prefix */ | ||
18 | #define P_DATA16 0x400 /* 0x66 opcode prefix */ | ||
19 | +#define P_VEXW 0x1000 /* Set VEX.W = 1 */ | ||
20 | #if TCG_TARGET_REG_BITS == 64 | ||
21 | -# define P_REXW 0x1000 /* Set REX.W = 1 */ | ||
22 | +# define P_REXW P_VEXW /* Set REX.W = 1; match VEXW */ | ||
23 | # define P_REXB_R 0x2000 /* REG field as byte register */ | ||
24 | # define P_REXB_RM 0x4000 /* R/M field as byte register */ | ||
25 | # define P_GS 0x8000 /* gs segment override */ | ||
26 | @@ -XXX,XX +XXX,XX @@ static bool tcg_target_const_match(int64_t val, TCGType type, int ct) | ||
27 | #define OPC_VPBROADCASTW (0x79 | P_EXT38 | P_DATA16) | ||
28 | #define OPC_VPBROADCASTD (0x58 | P_EXT38 | P_DATA16) | ||
29 | #define OPC_VPBROADCASTQ (0x59 | P_EXT38 | P_DATA16) | ||
30 | -#define OPC_VPERMQ (0x00 | P_EXT3A | P_DATA16 | P_REXW) | ||
31 | +#define OPC_VPERMQ (0x00 | P_EXT3A | P_DATA16 | P_VEXW) | ||
32 | #define OPC_VPERM2I128 (0x46 | P_EXT3A | P_DATA16 | P_VEXL) | ||
33 | #define OPC_VPSLLVD (0x47 | P_EXT38 | P_DATA16) | ||
34 | -#define OPC_VPSLLVQ (0x47 | P_EXT38 | P_DATA16 | P_REXW) | ||
35 | +#define OPC_VPSLLVQ (0x47 | P_EXT38 | P_DATA16 | P_VEXW) | ||
36 | #define OPC_VPSRAVD (0x46 | P_EXT38 | P_DATA16) | ||
37 | #define OPC_VPSRLVD (0x45 | P_EXT38 | P_DATA16) | ||
38 | -#define OPC_VPSRLVQ (0x45 | P_EXT38 | P_DATA16 | P_REXW) | ||
39 | +#define OPC_VPSRLVQ (0x45 | P_EXT38 | P_DATA16 | P_VEXW) | ||
40 | #define OPC_VZEROUPPER (0x77 | P_EXT) | ||
41 | #define OPC_XCHG_ax_r32 (0x90) | ||
42 | |||
43 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_vex_opc(TCGContext *s, int opc, int r, int v, | ||
44 | |||
45 | /* Use the two byte form if possible, which cannot encode | ||
46 | VEX.W, VEX.B, VEX.X, or an m-mmmm field other than P_EXT. */ | ||
47 | - if ((opc & (P_EXT | P_EXT38 | P_EXT3A | P_REXW)) == P_EXT | ||
48 | + if ((opc & (P_EXT | P_EXT38 | P_EXT3A | P_VEXW)) == P_EXT | ||
49 | && ((rm | index) & 8) == 0) { | ||
50 | /* Two byte VEX prefix. */ | ||
51 | tcg_out8(s, 0xc5); | ||
52 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_vex_opc(TCGContext *s, int opc, int r, int v, | ||
53 | tmp |= (rm & 8 ? 0 : 0x20); /* VEX.B */ | ||
54 | tcg_out8(s, tmp); | ||
55 | |||
56 | - tmp = (opc & P_REXW ? 0x80 : 0); /* VEX.W */ | ||
57 | + tmp = (opc & P_VEXW ? 0x80 : 0); /* VEX.W */ | ||
58 | } | ||
59 | |||
60 | tmp |= (opc & P_VEXL ? 0x04 : 0); /* VEX.L */ | ||
61 | -- | ||
62 | 2.25.1 | ||
63 | |||
64 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Luc Michel <lmichel@kalray.eu> | ||
2 | 1 | ||
3 | The TCG_KICK_PERIOD macro is already defined in tcg-accel-ops-rr.h. | ||
4 | Remove it from tcg-accel-ops-rr.c. | ||
5 | |||
6 | Signed-off-by: Luc Michel <lmichel@kalray.eu> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Message-Id: <20210811141229.12470-1-lmichel@kalray.eu> | ||
10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | --- | ||
12 | accel/tcg/tcg-accel-ops-rr.c | 2 -- | ||
13 | 1 file changed, 2 deletions(-) | ||
14 | |||
15 | diff --git a/accel/tcg/tcg-accel-ops-rr.c b/accel/tcg/tcg-accel-ops-rr.c | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/accel/tcg/tcg-accel-ops-rr.c | ||
18 | +++ b/accel/tcg/tcg-accel-ops-rr.c | ||
19 | @@ -XXX,XX +XXX,XX @@ void rr_kick_vcpu_thread(CPUState *unused) | ||
20 | static QEMUTimer *rr_kick_vcpu_timer; | ||
21 | static CPUState *rr_current_cpu; | ||
22 | |||
23 | -#define TCG_KICK_PERIOD (NANOSECONDS_PER_SECOND / 10) | ||
24 | - | ||
25 | static inline int64_t rr_next_kick_time(void) | ||
26 | { | ||
27 | return qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + TCG_KICK_PERIOD; | ||
28 | -- | ||
29 | 2.25.1 | ||
30 | |||
31 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: Bin Meng <bmeng.cn@gmail.com> | ||
2 | 1 | ||
3 | Since commit 1c2adb958fc0 ("tcg: Initialize cpu_env generically"), | ||
4 | these tcg_global_reg_new_ macros are not used anywhere. | ||
5 | |||
6 | Signed-off-by: Bin Meng <bmeng.cn@gmail.com> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Message-Id: <20210816143507.11200-1-bmeng.cn@gmail.com> | ||
9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | --- | ||
11 | include/tcg/tcg-op.h | 2 -- | ||
12 | target/hppa/translate.c | 3 --- | ||
13 | 2 files changed, 5 deletions(-) | ||
14 | |||
15 | diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/include/tcg/tcg-op.h | ||
18 | +++ b/include/tcg/tcg-op.h | ||
19 | @@ -XXX,XX +XXX,XX @@ static inline void tcg_gen_plugin_cb_end(void) | ||
20 | |||
21 | #if TARGET_LONG_BITS == 32 | ||
22 | #define tcg_temp_new() tcg_temp_new_i32() | ||
23 | -#define tcg_global_reg_new tcg_global_reg_new_i32 | ||
24 | #define tcg_global_mem_new tcg_global_mem_new_i32 | ||
25 | #define tcg_temp_local_new() tcg_temp_local_new_i32() | ||
26 | #define tcg_temp_free tcg_temp_free_i32 | ||
27 | @@ -XXX,XX +XXX,XX @@ static inline void tcg_gen_plugin_cb_end(void) | ||
28 | #define tcg_gen_qemu_st_tl tcg_gen_qemu_st_i32 | ||
29 | #else | ||
30 | #define tcg_temp_new() tcg_temp_new_i64() | ||
31 | -#define tcg_global_reg_new tcg_global_reg_new_i64 | ||
32 | #define tcg_global_mem_new tcg_global_mem_new_i64 | ||
33 | #define tcg_temp_local_new() tcg_temp_local_new_i64() | ||
34 | #define tcg_temp_free tcg_temp_free_i64 | ||
35 | diff --git a/target/hppa/translate.c b/target/hppa/translate.c | ||
36 | index XXXXXXX..XXXXXXX 100644 | ||
37 | --- a/target/hppa/translate.c | ||
38 | +++ b/target/hppa/translate.c | ||
39 | @@ -XXX,XX +XXX,XX @@ | ||
40 | |||
41 | #undef TCGv | ||
42 | #undef tcg_temp_new | ||
43 | -#undef tcg_global_reg_new | ||
44 | #undef tcg_global_mem_new | ||
45 | #undef tcg_temp_local_new | ||
46 | #undef tcg_temp_free | ||
47 | @@ -XXX,XX +XXX,XX @@ | ||
48 | #define TCGv_reg TCGv_i64 | ||
49 | |||
50 | #define tcg_temp_new tcg_temp_new_i64 | ||
51 | -#define tcg_global_reg_new tcg_global_reg_new_i64 | ||
52 | #define tcg_global_mem_new tcg_global_mem_new_i64 | ||
53 | #define tcg_temp_local_new tcg_temp_local_new_i64 | ||
54 | #define tcg_temp_free tcg_temp_free_i64 | ||
55 | @@ -XXX,XX +XXX,XX @@ | ||
56 | #else | ||
57 | #define TCGv_reg TCGv_i32 | ||
58 | #define tcg_temp_new tcg_temp_new_i32 | ||
59 | -#define tcg_global_reg_new tcg_global_reg_new_i32 | ||
60 | #define tcg_global_mem_new tcg_global_mem_new_i32 | ||
61 | #define tcg_temp_local_new tcg_temp_local_new_i32 | ||
62 | #define tcg_temp_free tcg_temp_free_i32 | ||
63 | -- | ||
64 | 2.25.1 | ||
65 | |||
66 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | All supported compilers have builtins for this. | ||
2 | Drop all of the complicated system detection stuff. | ||
3 | 1 | ||
4 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
5 | Message-Id: <20210708181743.750220-1-richard.henderson@linaro.org> | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | --- | ||
8 | meson.build | 6 ----- | ||
9 | include/qemu/bswap.h | 53 +++----------------------------------------- | ||
10 | 2 files changed, 3 insertions(+), 56 deletions(-) | ||
11 | |||
12 | diff --git a/meson.build b/meson.build | ||
13 | index XXXXXXX..XXXXXXX 100644 | ||
14 | --- a/meson.build | ||
15 | +++ b/meson.build | ||
16 | @@ -XXX,XX +XXX,XX @@ config_host_data.set('HAVE_STRCHRNUL', cc.has_function('strchrnul')) | ||
17 | config_host_data.set('HAVE_SYSTEM_FUNCTION', cc.has_function('system', prefix: '#include <stdlib.h>')) | ||
18 | |||
19 | # has_header_symbol | ||
20 | -config_host_data.set('CONFIG_BYTESWAP_H', | ||
21 | - cc.has_header_symbol('byteswap.h', 'bswap_32')) | ||
22 | config_host_data.set('CONFIG_EPOLL_CREATE1', | ||
23 | cc.has_header_symbol('sys/epoll.h', 'epoll_create1')) | ||
24 | config_host_data.set('CONFIG_HAS_ENVIRON', | ||
25 | @@ -XXX,XX +XXX,XX @@ config_host_data.set('CONFIG_INOTIFY', | ||
26 | cc.has_header_symbol('sys/inotify.h', 'inotify_init')) | ||
27 | config_host_data.set('CONFIG_INOTIFY1', | ||
28 | cc.has_header_symbol('sys/inotify.h', 'inotify_init1')) | ||
29 | -config_host_data.set('CONFIG_MACHINE_BSWAP_H', | ||
30 | - cc.has_header_symbol('machine/bswap.h', 'bswap32', | ||
31 | - prefix: '''#include <sys/endian.h> | ||
32 | - #include <sys/types.h>''')) | ||
33 | config_host_data.set('CONFIG_PRCTL_PR_SET_TIMERSLACK', | ||
34 | cc.has_header_symbol('sys/prctl.h', 'PR_SET_TIMERSLACK')) | ||
35 | config_host_data.set('CONFIG_RTNETLINK', | ||
36 | diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h | ||
37 | index XXXXXXX..XXXXXXX 100644 | ||
38 | --- a/include/qemu/bswap.h | ||
39 | +++ b/include/qemu/bswap.h | ||
40 | @@ -XXX,XX +XXX,XX @@ | ||
41 | #ifndef BSWAP_H | ||
42 | #define BSWAP_H | ||
43 | |||
44 | -#ifdef CONFIG_MACHINE_BSWAP_H | ||
45 | -# include <sys/endian.h> | ||
46 | -# include <machine/bswap.h> | ||
47 | -#elif defined(__FreeBSD__) | ||
48 | -# include <sys/endian.h> | ||
49 | -#elif defined(__HAIKU__) | ||
50 | -# include <endian.h> | ||
51 | -#elif defined(CONFIG_BYTESWAP_H) | ||
52 | -# include <byteswap.h> | ||
53 | -#define BSWAP_FROM_BYTESWAP | ||
54 | -# else | ||
55 | -#define BSWAP_FROM_FALLBACKS | ||
56 | -#endif /* ! CONFIG_MACHINE_BSWAP_H */ | ||
57 | - | ||
58 | #ifdef __cplusplus | ||
59 | extern "C" { | ||
60 | #endif | ||
61 | |||
62 | #include "fpu/softfloat-types.h" | ||
63 | |||
64 | -#ifdef BSWAP_FROM_BYTESWAP | ||
65 | static inline uint16_t bswap16(uint16_t x) | ||
66 | { | ||
67 | - return bswap_16(x); | ||
68 | + return __builtin_bswap16(x); | ||
69 | } | ||
70 | |||
71 | static inline uint32_t bswap32(uint32_t x) | ||
72 | { | ||
73 | - return bswap_32(x); | ||
74 | + return __builtin_bswap32(x); | ||
75 | } | ||
76 | |||
77 | static inline uint64_t bswap64(uint64_t x) | ||
78 | { | ||
79 | - return bswap_64(x); | ||
80 | + return __builtin_bswap64(x); | ||
81 | } | ||
82 | -#endif | ||
83 | - | ||
84 | -#ifdef BSWAP_FROM_FALLBACKS | ||
85 | -static inline uint16_t bswap16(uint16_t x) | ||
86 | -{ | ||
87 | - return (((x & 0x00ff) << 8) | | ||
88 | - ((x & 0xff00) >> 8)); | ||
89 | -} | ||
90 | - | ||
91 | -static inline uint32_t bswap32(uint32_t x) | ||
92 | -{ | ||
93 | - return (((x & 0x000000ffU) << 24) | | ||
94 | - ((x & 0x0000ff00U) << 8) | | ||
95 | - ((x & 0x00ff0000U) >> 8) | | ||
96 | - ((x & 0xff000000U) >> 24)); | ||
97 | -} | ||
98 | - | ||
99 | -static inline uint64_t bswap64(uint64_t x) | ||
100 | -{ | ||
101 | - return (((x & 0x00000000000000ffULL) << 56) | | ||
102 | - ((x & 0x000000000000ff00ULL) << 40) | | ||
103 | - ((x & 0x0000000000ff0000ULL) << 24) | | ||
104 | - ((x & 0x00000000ff000000ULL) << 8) | | ||
105 | - ((x & 0x000000ff00000000ULL) >> 8) | | ||
106 | - ((x & 0x0000ff0000000000ULL) >> 24) | | ||
107 | - ((x & 0x00ff000000000000ULL) >> 40) | | ||
108 | - ((x & 0xff00000000000000ULL) >> 56)); | ||
109 | -} | ||
110 | -#endif | ||
111 | - | ||
112 | -#undef BSWAP_FROM_BYTESWAP | ||
113 | -#undef BSWAP_FROM_FALLBACKS | ||
114 | |||
115 | static inline void bswap16s(uint16_t *s) | ||
116 | { | ||
117 | -- | ||
118 | 2.25.1 | ||
119 | |||
120 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | If __APPLE__, ensure that _CALL_DARWIN is set, then remove | ||
2 | our local TCG_TARGET_CALL_DARWIN. | ||
3 | 1 | ||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | --- | ||
6 | tcg/ppc/tcg-target.c.inc | 8 ++++---- | ||
7 | 1 file changed, 4 insertions(+), 4 deletions(-) | ||
8 | |||
9 | diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc | ||
10 | index XXXXXXX..XXXXXXX 100644 | ||
11 | --- a/tcg/ppc/tcg-target.c.inc | ||
12 | +++ b/tcg/ppc/tcg-target.c.inc | ||
13 | @@ -XXX,XX +XXX,XX @@ | ||
14 | #include "elf.h" | ||
15 | #include "../tcg-pool.c.inc" | ||
16 | |||
17 | -#if defined _CALL_DARWIN || defined __APPLE__ | ||
18 | -#define TCG_TARGET_CALL_DARWIN | ||
19 | +#if !defined _CALL_DARWIN && defined __APPLE__ | ||
20 | +#define _CALL_DARWIN 1 | ||
21 | #endif | ||
22 | #ifdef _CALL_SYSV | ||
23 | # define TCG_TARGET_CALL_ALIGN_ARGS 1 | ||
24 | @@ -XXX,XX +XXX,XX @@ static const int tcg_target_call_oarg_regs[] = { | ||
25 | }; | ||
26 | |||
27 | static const int tcg_target_callee_save_regs[] = { | ||
28 | -#ifdef TCG_TARGET_CALL_DARWIN | ||
29 | +#ifdef _CALL_DARWIN | ||
30 | TCG_REG_R11, | ||
31 | #endif | ||
32 | TCG_REG_R14, | ||
33 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_nop_fill(tcg_insn_unit *p, int count) | ||
34 | # define LINK_AREA_SIZE (6 * SZR) | ||
35 | # define LR_OFFSET (1 * SZR) | ||
36 | # define TCG_TARGET_CALL_STACK_OFFSET (LINK_AREA_SIZE + 8 * SZR) | ||
37 | -#elif defined(TCG_TARGET_CALL_DARWIN) | ||
38 | +#elif defined(_CALL_DARWIN) | ||
39 | # define LINK_AREA_SIZE (6 * SZR) | ||
40 | # define LR_OFFSET (2 * SZR) | ||
41 | #elif TCG_TARGET_REG_BITS == 64 | ||
42 | -- | ||
43 | 2.25.1 | ||
44 | |||
45 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | Clang only sets _CALL_ELF for ppc64, and nothing at all to specify | ||
2 | the ABI for ppc32. Make a good guess based on other symbols. | ||
3 | 1 | ||
4 | Reported-by: Brad Smith <brad@comstyle.com> | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | --- | ||
7 | tcg/ppc/tcg-target.c.inc | 21 ++++++++++++++++++--- | ||
8 | 1 file changed, 18 insertions(+), 3 deletions(-) | ||
9 | |||
10 | diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc | ||
11 | index XXXXXXX..XXXXXXX 100644 | ||
12 | --- a/tcg/ppc/tcg-target.c.inc | ||
13 | +++ b/tcg/ppc/tcg-target.c.inc | ||
14 | @@ -XXX,XX +XXX,XX @@ | ||
15 | #include "elf.h" | ||
16 | #include "../tcg-pool.c.inc" | ||
17 | |||
18 | -#if !defined _CALL_DARWIN && defined __APPLE__ | ||
19 | -#define _CALL_DARWIN 1 | ||
20 | -#endif | ||
21 | +/* | ||
22 | + * Standardize on the _CALL_FOO symbols used by GCC: | ||
23 | + * Apple XCode does not define _CALL_DARWIN. | ||
24 | + * Clang defines _CALL_ELF (64-bit) but not _CALL_SYSV (32-bit). | ||
25 | + */ | ||
26 | +#if !defined(_CALL_SYSV) && \ | ||
27 | + !defined(_CALL_DARWIN) && \ | ||
28 | + !defined(_CALL_AIX) && \ | ||
29 | + !defined(_CALL_ELF) | ||
30 | +# if defined(__APPLE__) | ||
31 | +# define _CALL_DARWIN | ||
32 | +# elif defined(__ELF__) && TCG_TARGET_REG_BITS == 32 | ||
33 | +# define _CALL_SYSV | ||
34 | +# else | ||
35 | +# error "Unknown ABI" | ||
36 | +# endif | ||
37 | +#endif | ||
38 | + | ||
39 | #ifdef _CALL_SYSV | ||
40 | # define TCG_TARGET_CALL_ALIGN_ARGS 1 | ||
41 | #endif | ||
42 | -- | ||
43 | 2.25.1 | ||
44 | |||
45 | diff view generated by jsdifflib |
Deleted patch | |||
---|---|---|---|
1 | From: "Jose R. Ziviani" <jziviani@suse.de> | ||
2 | 1 | ||
3 | Commit 5e8892db93 fixed several function signatures but tcg_out_vec_op | ||
4 | for arm is missing. It causes a build error on armv6 and armv7: | ||
5 | |||
6 | tcg-target.c.inc:2718:42: error: argument 5 of type 'const TCGArg *' | ||
7 | {aka 'const unsigned int *'} declared as a pointer [-Werror=array-parameter=] | ||
8 | const TCGArg *args, const int *const_args) | ||
9 | ~~~~~~~~~~~~~~^~~~ | ||
10 | ../tcg/tcg.c:120:41: note: previously declared as an array 'const TCGArg[16]' | ||
11 | {aka 'const unsigned int[16]'} | ||
12 | const TCGArg args[TCG_MAX_OP_ARGS], | ||
13 | ~~~~~~~~~~~~~~^~~~ | ||
14 | |||
15 | Signed-off-by: Jose R. Ziviani <jziviani@suse.de> | ||
16 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
17 | Message-Id: <20210908185338.7927-1-jziviani@suse.de> | ||
18 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
19 | --- | ||
20 | tcg/arm/tcg-target.c.inc | 3 ++- | ||
21 | 1 file changed, 2 insertions(+), 1 deletion(-) | ||
22 | |||
23 | diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc | ||
24 | index XXXXXXX..XXXXXXX 100644 | ||
25 | --- a/tcg/arm/tcg-target.c.inc | ||
26 | +++ b/tcg/arm/tcg-target.c.inc | ||
27 | @@ -XXX,XX +XXX,XX @@ static const ARMInsn vec_cmp0_insn[16] = { | ||
28 | |||
29 | static void tcg_out_vec_op(TCGContext *s, TCGOpcode opc, | ||
30 | unsigned vecl, unsigned vece, | ||
31 | - const TCGArg *args, const int *const_args) | ||
32 | + const TCGArg args[TCG_MAX_OP_ARGS], | ||
33 | + const int const_args[TCG_MAX_OP_ARGS]) | ||
34 | { | ||
35 | TCGType type = vecl + TCG_TYPE_V64; | ||
36 | unsigned q = vecl; | ||
37 | -- | ||
38 | 2.25.1 | ||
39 | |||
40 | diff view generated by jsdifflib |