1 | The following changes since commit e18e5501d8ac692d32657a3e1ef545b14e72b730: | 1 | The following changes since commit 41192db338588051f21501abc13743e62b0a5605: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/dgilbert-gitlab/tags/pull-virtiofs-20200210' into staging (2020-02-10 18:09:14 +0000) | 3 | Merge remote-tracking branch 'remotes/ehabkost-gl/tags/machine-next-pull-request' into staging (2021-01-01 22:57:15 +0000) |
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-20200212 | 7 | https://gitlab.com/rth7680/qemu.git tags/pull-tcg-20210104 |
8 | 8 | ||
9 | for you to fetch changes up to 2445971604c1cfd3ec484457159f4ac300fb04d2: | 9 | for you to fetch changes up to a66424ba17d661007dc13d78c9e3014ccbaf0efb: |
10 | 10 | ||
11 | tcg: Add tcg_gen_gvec_5_ptr (2020-02-12 14:58:36 -0800) | 11 | tcg: Add tcg_gen_bswap_tl alias (2021-01-04 06:32:58 -1000) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Fix breakpoint invalidation. | 14 | Fix vector clear issue. |
15 | Add support for tcg helpers with 7 arguments. | 15 | Fix riscv host shift issue. |
16 | Add support for gvec helpers with 5 arguments. | 16 | Add tcg_gen_bswap_tl. |
17 | 17 | ||
18 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
19 | Max Filippov (1): | 19 | Richard Henderson (2): |
20 | exec: flush CPU TB cache in breakpoint_invalidate | 20 | tcg: Use memset for large vector byte replication |
21 | tcg: Add tcg_gen_bswap_tl alias | ||
21 | 22 | ||
22 | Richard Henderson (1): | 23 | Zihao Yu (1): |
23 | tcg: Add tcg_gen_gvec_5_ptr | 24 | tcg/riscv: Fix illegal shift instructions |
24 | 25 | ||
25 | Taylor Simpson (1): | 26 | accel/tcg/tcg-runtime.h | 11 +++++++++++ |
26 | tcg: Add support for a helper with 7 arguments | 27 | include/exec/helper-proto.h | 4 ++++ |
28 | include/tcg/tcg-op.h | 2 ++ | ||
29 | tcg/tcg-op-gvec.c | 32 ++++++++++++++++++++++++++++++++ | ||
30 | tcg/riscv/tcg-target.c.inc | 12 ++++++------ | ||
31 | 5 files changed, 55 insertions(+), 6 deletions(-) | ||
27 | 32 | ||
28 | include/exec/helper-gen.h | 13 +++++++++++++ | ||
29 | include/exec/helper-head.h | 2 ++ | ||
30 | include/exec/helper-proto.h | 6 ++++++ | ||
31 | include/exec/helper-tcg.h | 7 +++++++ | ||
32 | include/tcg/tcg-op-gvec.h | 7 +++++++ | ||
33 | exec.c | 15 +++++++-------- | ||
34 | tcg/tcg-op-gvec.c | 32 ++++++++++++++++++++++++++++++++ | ||
35 | 7 files changed, 74 insertions(+), 8 deletions(-) | ||
36 | diff view generated by jsdifflib |
1 | From: Taylor Simpson <tsimpson@quicinc.com> | 1 | In f47db80cc07, we handled odd-sized tail clearing for |
---|---|---|---|
2 | the case of hosts that have vector operations, but did | ||
3 | not handle the case of hosts that do not have vector ops. | ||
2 | 4 | ||
3 | Currently, helpers can only take up to 6 arguments. This patch adds the | 5 | This was ok until e2e7168a214b, which changed the encoding |
4 | capability for up to 7 arguments. I have tested it with the Hexagon port | 6 | of simd_desc such that the odd sizes are impossible. |
5 | that I am preparing for submission. | ||
6 | 7 | ||
7 | Signed-off-by: Taylor Simpson <tsimpson@quicinc.com> | 8 | Add memset as a tcg helper, and use that for all out-of-line |
8 | Message-Id: <1580942510-2820-1-git-send-email-tsimpson@quicinc.com> | 9 | byte stores to vectors. This includes, but is not limited to, |
10 | the tail clearing operation in question. | ||
11 | |||
12 | Cc: qemu-stable@nongnu.org | ||
13 | Buglink: https://bugs.launchpad.net/bugs/1907817 | ||
14 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 15 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
10 | --- | 16 | --- |
11 | include/exec/helper-gen.h | 13 +++++++++++++ | 17 | accel/tcg/tcg-runtime.h | 11 +++++++++++ |
12 | include/exec/helper-head.h | 2 ++ | 18 | include/exec/helper-proto.h | 4 ++++ |
13 | include/exec/helper-proto.h | 6 ++++++ | 19 | tcg/tcg-op-gvec.c | 32 ++++++++++++++++++++++++++++++++ |
14 | include/exec/helper-tcg.h | 7 +++++++ | 20 | 3 files changed, 47 insertions(+) |
15 | 4 files changed, 28 insertions(+) | ||
16 | 21 | ||
17 | diff --git a/include/exec/helper-gen.h b/include/exec/helper-gen.h | 22 | diff --git a/accel/tcg/tcg-runtime.h b/accel/tcg/tcg-runtime.h |
18 | index XXXXXXX..XXXXXXX 100644 | 23 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/exec/helper-gen.h | 24 | --- a/accel/tcg/tcg-runtime.h |
20 | +++ b/include/exec/helper-gen.h | 25 | +++ b/accel/tcg/tcg-runtime.h |
21 | @@ -XXX,XX +XXX,XX @@ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \ | 26 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_1(lookup_tb_ptr, TCG_CALL_NO_WG_SE, ptr, env) |
22 | tcg_gen_callN(HELPER(name), dh_retvar(ret), 6, args); \ | 27 | |
23 | } | 28 | DEF_HELPER_FLAGS_1(exit_atomic, TCG_CALL_NO_WG, noreturn, env) |
24 | 29 | ||
25 | +#define DEF_HELPER_FLAGS_7(name, flags, ret, t1, t2, t3, t4, t5, t6, t7)\ | 30 | +#ifndef IN_HELPER_PROTO |
26 | +static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \ | 31 | +/* |
27 | + dh_arg_decl(t1, 1), dh_arg_decl(t2, 2), dh_arg_decl(t3, 3), \ | 32 | + * Pass calls to memset directly to libc, without a thunk in qemu. |
28 | + dh_arg_decl(t4, 4), dh_arg_decl(t5, 5), dh_arg_decl(t6, 6), \ | 33 | + * Do not re-declare memset, especially since we fudge the type here; |
29 | + dh_arg_decl(t7, 7)) \ | 34 | + * we assume sizeof(void *) == sizeof(size_t), which is true for |
30 | +{ \ | 35 | + * all supported hosts. |
31 | + TCGTemp *args[7] = { dh_arg(t1, 1), dh_arg(t2, 2), dh_arg(t3, 3), \ | 36 | + */ |
32 | + dh_arg(t4, 4), dh_arg(t5, 5), dh_arg(t6, 6), \ | 37 | +#define helper_memset memset |
33 | + dh_arg(t7, 7) }; \ | 38 | +DEF_HELPER_FLAGS_3(memset, TCG_CALL_NO_RWG, ptr, ptr, int, ptr) |
34 | + tcg_gen_callN(HELPER(name), dh_retvar(ret), 7, args); \ | 39 | +#endif /* IN_HELPER_PROTO */ |
35 | +} | ||
36 | + | 40 | + |
37 | #include "helper.h" | 41 | #ifdef CONFIG_SOFTMMU |
38 | #include "trace/generated-helpers.h" | 42 | |
39 | #include "trace/generated-helpers-wrappers.h" | 43 | DEF_HELPER_FLAGS_5(atomic_cmpxchgb, TCG_CALL_NO_WG, |
40 | @@ -XXX,XX +XXX,XX @@ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret) \ | ||
41 | #undef DEF_HELPER_FLAGS_4 | ||
42 | #undef DEF_HELPER_FLAGS_5 | ||
43 | #undef DEF_HELPER_FLAGS_6 | ||
44 | +#undef DEF_HELPER_FLAGS_7 | ||
45 | #undef GEN_HELPER | ||
46 | |||
47 | #endif /* HELPER_GEN_H */ | ||
48 | diff --git a/include/exec/helper-head.h b/include/exec/helper-head.h | ||
49 | index XXXXXXX..XXXXXXX 100644 | ||
50 | --- a/include/exec/helper-head.h | ||
51 | +++ b/include/exec/helper-head.h | ||
52 | @@ -XXX,XX +XXX,XX @@ | ||
53 | DEF_HELPER_FLAGS_5(name, 0, ret, t1, t2, t3, t4, t5) | ||
54 | #define DEF_HELPER_6(name, ret, t1, t2, t3, t4, t5, t6) \ | ||
55 | DEF_HELPER_FLAGS_6(name, 0, ret, t1, t2, t3, t4, t5, t6) | ||
56 | +#define DEF_HELPER_7(name, ret, t1, t2, t3, t4, t5, t6, t7) \ | ||
57 | + DEF_HELPER_FLAGS_7(name, 0, ret, t1, t2, t3, t4, t5, t6, t7) | ||
58 | |||
59 | /* MAX_OPC_PARAM_IARGS must be set to n if last entry is DEF_HELPER_FLAGS_n. */ | ||
60 | |||
61 | diff --git a/include/exec/helper-proto.h b/include/exec/helper-proto.h | 44 | diff --git a/include/exec/helper-proto.h b/include/exec/helper-proto.h |
62 | index XXXXXXX..XXXXXXX 100644 | 45 | index XXXXXXX..XXXXXXX 100644 |
63 | --- a/include/exec/helper-proto.h | 46 | --- a/include/exec/helper-proto.h |
64 | +++ b/include/exec/helper-proto.h | 47 | +++ b/include/exec/helper-proto.h |
65 | @@ -XXX,XX +XXX,XX @@ dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \ | 48 | @@ -XXX,XX +XXX,XX @@ dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \ |
66 | dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \ | 49 | dh_ctype(t4), dh_ctype(t5), dh_ctype(t6), \ |
67 | dh_ctype(t4), dh_ctype(t5), dh_ctype(t6)); | 50 | dh_ctype(t7)); |
68 | 51 | ||
69 | +#define DEF_HELPER_FLAGS_7(name, flags, ret, t1, t2, t3, t4, t5, t6, t7) \ | 52 | +#define IN_HELPER_PROTO |
70 | +dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \ | ||
71 | + dh_ctype(t4), dh_ctype(t5), dh_ctype(t6), \ | ||
72 | + dh_ctype(t7)); | ||
73 | + | 53 | + |
74 | #include "helper.h" | 54 | #include "helper.h" |
75 | #include "trace/generated-helpers.h" | 55 | #include "trace/generated-helpers.h" |
76 | #include "tcg-runtime.h" | 56 | #include "tcg-runtime.h" |
77 | @@ -XXX,XX +XXX,XX @@ dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \ | 57 | #include "plugin-helpers.h" |
78 | #undef DEF_HELPER_FLAGS_4 | 58 | |
79 | #undef DEF_HELPER_FLAGS_5 | 59 | +#undef IN_HELPER_PROTO |
80 | #undef DEF_HELPER_FLAGS_6 | 60 | + |
81 | +#undef DEF_HELPER_FLAGS_7 | 61 | #undef DEF_HELPER_FLAGS_0 |
82 | 62 | #undef DEF_HELPER_FLAGS_1 | |
83 | #endif /* HELPER_PROTO_H */ | 63 | #undef DEF_HELPER_FLAGS_2 |
84 | diff --git a/include/exec/helper-tcg.h b/include/exec/helper-tcg.h | 64 | diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c |
85 | index XXXXXXX..XXXXXXX 100644 | 65 | index XXXXXXX..XXXXXXX 100644 |
86 | --- a/include/exec/helper-tcg.h | 66 | --- a/tcg/tcg-op-gvec.c |
87 | +++ b/include/exec/helper-tcg.h | 67 | +++ b/tcg/tcg-op-gvec.c |
88 | @@ -XXX,XX +XXX,XX @@ | 68 | @@ -XXX,XX +XXX,XX @@ static void do_dup(unsigned vece, uint32_t dofs, uint32_t oprsz, |
89 | | dh_sizemask(t2, 2) | dh_sizemask(t3, 3) | dh_sizemask(t4, 4) \ | 69 | in_c = dup_const(vece, in_c); |
90 | | dh_sizemask(t5, 5) | dh_sizemask(t6, 6) }, | 70 | if (in_c == 0) { |
91 | 71 | oprsz = maxsz; | |
92 | +#define DEF_HELPER_FLAGS_7(NAME, FLAGS, ret, t1, t2, t3, t4, t5, t6, t7) \ | 72 | + vece = MO_8; |
93 | + { .func = HELPER(NAME), .name = str(NAME), .flags = FLAGS, \ | 73 | + } else if (in_c == dup_const(MO_8, in_c)) { |
94 | + .sizemask = dh_sizemask(ret, 0) | dh_sizemask(t1, 1) \ | 74 | + vece = MO_8; |
95 | + | dh_sizemask(t2, 2) | dh_sizemask(t3, 3) | dh_sizemask(t4, 4) \ | 75 | } |
96 | + | dh_sizemask(t5, 5) | dh_sizemask(t6, 6) | dh_sizemask(t7, 7) }, | 76 | } |
77 | |||
78 | @@ -XXX,XX +XXX,XX @@ static void do_dup(unsigned vece, uint32_t dofs, uint32_t oprsz, | ||
79 | /* Otherwise implement out of line. */ | ||
80 | t_ptr = tcg_temp_new_ptr(); | ||
81 | tcg_gen_addi_ptr(t_ptr, cpu_env, dofs); | ||
97 | + | 82 | + |
98 | #include "helper.h" | 83 | + /* |
99 | #include "trace/generated-helpers.h" | 84 | + * This may be expand_clr for the tail of an operation, e.g. |
100 | #include "tcg-runtime.h" | 85 | + * oprsz == 8 && maxsz == 64. The size of the clear is misaligned |
101 | @@ -XXX,XX +XXX,XX @@ | 86 | + * wrt simd_desc and will assert. Simply pass all replicated byte |
102 | #undef DEF_HELPER_FLAGS_4 | 87 | + * stores through to memset. |
103 | #undef DEF_HELPER_FLAGS_5 | 88 | + */ |
104 | #undef DEF_HELPER_FLAGS_6 | 89 | + if (oprsz == maxsz && vece == MO_8) { |
105 | +#undef DEF_HELPER_FLAGS_7 | 90 | + TCGv_ptr t_size = tcg_const_ptr(oprsz); |
106 | 91 | + TCGv_i32 t_val; | |
107 | #endif /* HELPER_TCG_H */ | 92 | + |
93 | + if (in_32) { | ||
94 | + t_val = in_32; | ||
95 | + } else if (in_64) { | ||
96 | + t_val = tcg_temp_new_i32(); | ||
97 | + tcg_gen_extrl_i64_i32(t_val, in_64); | ||
98 | + } else { | ||
99 | + t_val = tcg_const_i32(in_c); | ||
100 | + } | ||
101 | + gen_helper_memset(t_ptr, t_ptr, t_val, t_size); | ||
102 | + | ||
103 | + if (!in_32) { | ||
104 | + tcg_temp_free_i32(t_val); | ||
105 | + } | ||
106 | + tcg_temp_free_ptr(t_size); | ||
107 | + tcg_temp_free_ptr(t_ptr); | ||
108 | + return; | ||
109 | + } | ||
110 | + | ||
111 | t_desc = tcg_const_i32(simd_desc(oprsz, maxsz, 0)); | ||
112 | |||
113 | if (vece == MO_64) { | ||
108 | -- | 114 | -- |
109 | 2.20.1 | 115 | 2.25.1 |
110 | 116 | ||
111 | 117 | diff view generated by jsdifflib |
1 | Extend the vector generator infrastructure to handle | 1 | From: Zihao Yu <yuzihao@ict.ac.cn> |
---|---|---|---|
2 | 5 vector arguments. | ||
3 | 2 | ||
4 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 3 | Out-of-range shifts have undefined results, but must not trap. |
5 | Reviewed-by: Alex Bennée <alex.bennee@linaro.org> | 4 | Mask off immediate shift counts to solve this problem. |
6 | Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> | 5 | |
6 | This bug can be reproduced by running the following guest instructions: | ||
7 | |||
8 | xor %ecx,%ecx | ||
9 | sar %cl,%eax | ||
10 | cmovne %edi,%eax | ||
11 | |||
12 | After optimization, the tcg opcodes of the sar are | ||
13 | |||
14 | movi_i32 tmp3,$0xffffffffffffffff pref=all | ||
15 | sar_i32 tmp3,eax,tmp3 dead: 2 pref=all | ||
16 | mov_i32 cc_dst,eax sync: 0 dead: 1 pref=0xffc0300 | ||
17 | mov_i32 cc_src,tmp3 sync: 0 dead: 0 1 pref=all | ||
18 | movi_i32 cc_op,$0x31 sync: 0 dead: 0 pref=all | ||
19 | |||
20 | The sar_i32 opcode is a shift by -1, which unmasked generates | ||
21 | |||
22 | 0x200808d618: fffa5b9b illegal | ||
23 | |||
24 | Signed-off-by: Zihao Yu <yuzihao@ict.ac.cn> | ||
25 | Message-Id: <20201216081206.9628-1-yuzihao@ict.ac.cn> | ||
26 | [rth: Reworded the patch description.] | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 27 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | --- | 28 | --- |
9 | include/tcg/tcg-op-gvec.h | 7 +++++++ | 29 | tcg/riscv/tcg-target.c.inc | 12 ++++++------ |
10 | tcg/tcg-op-gvec.c | 32 ++++++++++++++++++++++++++++++++ | 30 | 1 file changed, 6 insertions(+), 6 deletions(-) |
11 | 2 files changed, 39 insertions(+) | ||
12 | 31 | ||
13 | diff --git a/include/tcg/tcg-op-gvec.h b/include/tcg/tcg-op-gvec.h | 32 | diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc |
14 | index XXXXXXX..XXXXXXX 100644 | 33 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/include/tcg/tcg-op-gvec.h | 34 | --- a/tcg/riscv/tcg-target.c.inc |
16 | +++ b/include/tcg/tcg-op-gvec.h | 35 | +++ b/tcg/riscv/tcg-target.c.inc |
17 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_gvec_4_ptr(uint32_t dofs, uint32_t aofs, uint32_t bofs, | 36 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, |
18 | uint32_t maxsz, int32_t data, | 37 | |
19 | gen_helper_gvec_4_ptr *fn); | 38 | case INDEX_op_shl_i32: |
20 | 39 | if (c2) { | |
21 | +typedef void gen_helper_gvec_5_ptr(TCGv_ptr, TCGv_ptr, TCGv_ptr, TCGv_ptr, | 40 | - tcg_out_opc_imm(s, OPC_SLLIW, a0, a1, a2); |
22 | + TCGv_ptr, TCGv_ptr, TCGv_i32); | 41 | + tcg_out_opc_imm(s, OPC_SLLIW, a0, a1, a2 & 0x1f); |
23 | +void tcg_gen_gvec_5_ptr(uint32_t dofs, uint32_t aofs, uint32_t bofs, | 42 | } else { |
24 | + uint32_t cofs, uint32_t eofs, TCGv_ptr ptr, | 43 | tcg_out_opc_reg(s, OPC_SLLW, a0, a1, a2); |
25 | + uint32_t oprsz, uint32_t maxsz, int32_t data, | 44 | } |
26 | + gen_helper_gvec_5_ptr *fn); | 45 | break; |
27 | + | 46 | case INDEX_op_shl_i64: |
28 | /* Expand a gvec operation. Either inline or out-of-line depending on | 47 | if (c2) { |
29 | the actual vector size and the operations supported by the host. */ | 48 | - tcg_out_opc_imm(s, OPC_SLLI, a0, a1, a2); |
30 | typedef struct { | 49 | + tcg_out_opc_imm(s, OPC_SLLI, a0, a1, a2 & 0x3f); |
31 | diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c | 50 | } else { |
32 | index XXXXXXX..XXXXXXX 100644 | 51 | tcg_out_opc_reg(s, OPC_SLL, a0, a1, a2); |
33 | --- a/tcg/tcg-op-gvec.c | 52 | } |
34 | +++ b/tcg/tcg-op-gvec.c | 53 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, |
35 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_gvec_4_ptr(uint32_t dofs, uint32_t aofs, uint32_t bofs, | 54 | |
36 | tcg_temp_free_i32(desc); | 55 | case INDEX_op_shr_i32: |
37 | } | 56 | if (c2) { |
38 | 57 | - tcg_out_opc_imm(s, OPC_SRLIW, a0, a1, a2); | |
39 | +/* Generate a call to a gvec-style helper with five vector operands | 58 | + tcg_out_opc_imm(s, OPC_SRLIW, a0, a1, a2 & 0x1f); |
40 | + and an extra pointer operand. */ | 59 | } else { |
41 | +void tcg_gen_gvec_5_ptr(uint32_t dofs, uint32_t aofs, uint32_t bofs, | 60 | tcg_out_opc_reg(s, OPC_SRLW, a0, a1, a2); |
42 | + uint32_t cofs, uint32_t eofs, TCGv_ptr ptr, | 61 | } |
43 | + uint32_t oprsz, uint32_t maxsz, int32_t data, | 62 | break; |
44 | + gen_helper_gvec_5_ptr *fn) | 63 | case INDEX_op_shr_i64: |
45 | +{ | 64 | if (c2) { |
46 | + TCGv_ptr a0, a1, a2, a3, a4; | 65 | - tcg_out_opc_imm(s, OPC_SRLI, a0, a1, a2); |
47 | + TCGv_i32 desc = tcg_const_i32(simd_desc(oprsz, maxsz, data)); | 66 | + tcg_out_opc_imm(s, OPC_SRLI, a0, a1, a2 & 0x3f); |
48 | + | 67 | } else { |
49 | + a0 = tcg_temp_new_ptr(); | 68 | tcg_out_opc_reg(s, OPC_SRL, a0, a1, a2); |
50 | + a1 = tcg_temp_new_ptr(); | 69 | } |
51 | + a2 = tcg_temp_new_ptr(); | 70 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_op(TCGContext *s, TCGOpcode opc, |
52 | + a3 = tcg_temp_new_ptr(); | 71 | |
53 | + a4 = tcg_temp_new_ptr(); | 72 | case INDEX_op_sar_i32: |
54 | + | 73 | if (c2) { |
55 | + tcg_gen_addi_ptr(a0, cpu_env, dofs); | 74 | - tcg_out_opc_imm(s, OPC_SRAIW, a0, a1, a2); |
56 | + tcg_gen_addi_ptr(a1, cpu_env, aofs); | 75 | + tcg_out_opc_imm(s, OPC_SRAIW, a0, a1, a2 & 0x1f); |
57 | + tcg_gen_addi_ptr(a2, cpu_env, bofs); | 76 | } else { |
58 | + tcg_gen_addi_ptr(a3, cpu_env, cofs); | 77 | tcg_out_opc_reg(s, OPC_SRAW, a0, a1, a2); |
59 | + tcg_gen_addi_ptr(a4, cpu_env, eofs); | 78 | } |
60 | + | 79 | break; |
61 | + fn(a0, a1, a2, a3, a4, ptr, desc); | 80 | case INDEX_op_sar_i64: |
62 | + | 81 | if (c2) { |
63 | + tcg_temp_free_ptr(a0); | 82 | - tcg_out_opc_imm(s, OPC_SRAI, a0, a1, a2); |
64 | + tcg_temp_free_ptr(a1); | 83 | + tcg_out_opc_imm(s, OPC_SRAI, a0, a1, a2 & 0x3f); |
65 | + tcg_temp_free_ptr(a2); | 84 | } else { |
66 | + tcg_temp_free_ptr(a3); | 85 | tcg_out_opc_reg(s, OPC_SRA, a0, a1, a2); |
67 | + tcg_temp_free_ptr(a4); | 86 | } |
68 | + tcg_temp_free_i32(desc); | ||
69 | +} | ||
70 | + | ||
71 | /* Return true if we want to implement something of OPRSZ bytes | ||
72 | in units of LNSZ. This limits the expansion of inline code. */ | ||
73 | static inline bool check_size_impl(uint32_t oprsz, uint32_t lnsz) | ||
74 | -- | 87 | -- |
75 | 2.20.1 | 88 | 2.25.1 |
76 | 89 | ||
77 | 90 | diff view generated by jsdifflib |
1 | From: Max Filippov <jcmvbkbc@gmail.com> | 1 | The alias is intended to indicate that the bswap is for the |
---|---|---|---|
2 | entire target_long. This should avoid ifdefs on some targets. | ||
2 | 3 | ||
3 | When a breakpoint is inserted at location for which there's currently no | 4 | Reviewed-by: Frank Chang <frank.chang@sifive.com> |
4 | virtual to physical translation no action is taken on CPU TB cache. If a | ||
5 | TB for that virtual address already exists but is not visible ATM the | ||
6 | breakpoint won't be hit next time an instruction at that address will be | ||
7 | executed. | ||
8 | |||
9 | Flush entire CPU TB cache in breakpoint_invalidate to force | ||
10 | re-translation of all TBs for the breakpoint address. | ||
11 | |||
12 | This change fixes the following scenario: | ||
13 | - linux user application is running | ||
14 | - a breakpoint is inserted from QEMU gdbstub for a user address that is | ||
15 | not currently present in the target CPU TLB | ||
16 | - an instruction at that address is executed, but the external debugger | ||
17 | doesn't get control. | ||
18 | |||
19 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
20 | Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> | ||
21 | Message-Id: <20191127220602.10827-2-jcmvbkbc@gmail.com> | ||
22 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
23 | --- | 6 | --- |
24 | exec.c | 15 +++++++-------- | 7 | include/tcg/tcg-op.h | 2 ++ |
25 | 1 file changed, 7 insertions(+), 8 deletions(-) | 8 | 1 file changed, 2 insertions(+) |
26 | 9 | ||
27 | diff --git a/exec.c b/exec.c | 10 | diff --git a/include/tcg/tcg-op.h b/include/tcg/tcg-op.h |
28 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
29 | --- a/exec.c | 12 | --- a/include/tcg/tcg-op.h |
30 | +++ b/exec.c | 13 | +++ b/include/tcg/tcg-op.h |
31 | @@ -XXX,XX +XXX,XX @@ void tb_invalidate_phys_addr(AddressSpace *as, hwaddr addr, MemTxAttrs attrs) | 14 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_stl_vec(TCGv_vec r, TCGv_ptr base, TCGArg offset, TCGType t); |
32 | 15 | #define tcg_gen_bswap16_tl tcg_gen_bswap16_i64 | |
33 | static void breakpoint_invalidate(CPUState *cpu, target_ulong pc) | 16 | #define tcg_gen_bswap32_tl tcg_gen_bswap32_i64 |
34 | { | 17 | #define tcg_gen_bswap64_tl tcg_gen_bswap64_i64 |
35 | - MemTxAttrs attrs; | 18 | +#define tcg_gen_bswap_tl tcg_gen_bswap64_i64 |
36 | - hwaddr phys = cpu_get_phys_page_attrs_debug(cpu, pc, &attrs); | 19 | #define tcg_gen_concat_tl_i64 tcg_gen_concat32_i64 |
37 | - int asidx = cpu_asidx_from_attrs(cpu, attrs); | 20 | #define tcg_gen_extr_i64_tl tcg_gen_extr32_i64 |
38 | - if (phys != -1) { | 21 | #define tcg_gen_andc_tl tcg_gen_andc_i64 |
39 | - /* Locks grabbed by tb_invalidate_phys_addr */ | 22 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_stl_vec(TCGv_vec r, TCGv_ptr base, TCGArg offset, TCGType t); |
40 | - tb_invalidate_phys_addr(cpu->cpu_ases[asidx].as, | 23 | #define tcg_gen_ext32s_tl tcg_gen_mov_i32 |
41 | - phys | (pc & ~TARGET_PAGE_MASK), attrs); | 24 | #define tcg_gen_bswap16_tl tcg_gen_bswap16_i32 |
42 | - } | 25 | #define tcg_gen_bswap32_tl tcg_gen_bswap32_i32 |
43 | + /* | 26 | +#define tcg_gen_bswap_tl tcg_gen_bswap32_i32 |
44 | + * There may not be a virtual to physical translation for the pc | 27 | #define tcg_gen_concat_tl_i64 tcg_gen_concat_i32_i64 |
45 | + * right now, but there may exist cached TB for this pc. | 28 | #define tcg_gen_extr_i64_tl tcg_gen_extr_i64_i32 |
46 | + * Flush the whole TB cache to force re-translation of such TBs. | 29 | #define tcg_gen_andc_tl tcg_gen_andc_i32 |
47 | + * This is heavyweight, but we're debugging anyway. | ||
48 | + */ | ||
49 | + tb_flush(cpu); | ||
50 | } | ||
51 | #endif | ||
52 | |||
53 | -- | 30 | -- |
54 | 2.20.1 | 31 | 2.25.1 |
55 | 32 | ||
56 | 33 | diff view generated by jsdifflib |