1 | The following changes since commit 6eeea6725a70e6fcb5abba0764496bdab07ddfb3: | 1 | The following changes since commit 6587b0c1331d427b0939c37e763842550ed581db: |
---|---|---|---|
2 | 2 | ||
3 | Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2020-10-06' into staging (2020-10-06 21:13:34 +0100) | 3 | Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2021-10-15' into staging (2021-10-15 14:16:28 -0700) |
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-20201008 | 7 | https://gitlab.com/rth7680/qemu.git tags/pull-tcg-20211016 |
8 | 8 | ||
9 | for you to fetch changes up to 62475e9d007d83db4d0a6ccebcda8914f392e9c9: | 9 | for you to fetch changes up to 995b87dedc78b0467f5f18bbc3546072ba97516a: |
10 | 10 | ||
11 | accel/tcg: Fix computing of is_write for MIPS (2020-10-08 05:57:32 -0500) | 11 | Revert "cpu: Move cpu_common_props to hw/core/cpu.c" (2021-10-15 16:39:15 -0700) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Extend maximum gvec vector size | 14 | Move gdb singlestep to generic code |
15 | Fix i386 avx2 dupi | 15 | Fix cpu_common_props |
16 | Fix mips host user-only write detection | ||
17 | Misc cleanups. | ||
18 | 16 | ||
19 | ---------------------------------------------------------------- | 17 | ---------------------------------------------------------------- |
20 | Kele Huang (1): | 18 | Richard Henderson (24): |
21 | accel/tcg: Fix computing of is_write for MIPS | 19 | accel/tcg: Handle gdb singlestep in cpu_tb_exec |
20 | target/alpha: Drop checks for singlestep_enabled | ||
21 | target/avr: Drop checks for singlestep_enabled | ||
22 | target/cris: Drop checks for singlestep_enabled | ||
23 | target/hexagon: Drop checks for singlestep_enabled | ||
24 | target/arm: Drop checks for singlestep_enabled | ||
25 | target/hppa: Drop checks for singlestep_enabled | ||
26 | target/i386: Check CF_NO_GOTO_TB for dc->jmp_opt | ||
27 | target/i386: Drop check for singlestep_enabled | ||
28 | target/m68k: Drop checks for singlestep_enabled | ||
29 | target/microblaze: Check CF_NO_GOTO_TB for DISAS_JUMP | ||
30 | target/microblaze: Drop checks for singlestep_enabled | ||
31 | target/mips: Fix single stepping | ||
32 | target/mips: Drop exit checks for singlestep_enabled | ||
33 | target/openrisc: Drop checks for singlestep_enabled | ||
34 | target/ppc: Drop exit checks for singlestep_enabled | ||
35 | target/riscv: Remove dead code after exception | ||
36 | target/riscv: Remove exit_tb and lookup_and_goto_ptr | ||
37 | target/rx: Drop checks for singlestep_enabled | ||
38 | target/s390x: Drop check for singlestep_enabled | ||
39 | target/sh4: Drop check for singlestep_enabled | ||
40 | target/tricore: Drop check for singlestep_enabled | ||
41 | target/xtensa: Drop check for singlestep_enabled | ||
42 | Revert "cpu: Move cpu_common_props to hw/core/cpu.c" | ||
22 | 43 | ||
23 | Richard Henderson (10): | 44 | include/hw/core/cpu.h | 1 + |
24 | tcg: Adjust simd_desc size encoding | 45 | target/i386/helper.h | 1 - |
25 | tcg: Drop union from TCGArgConstraint | 46 | target/rx/helper.h | 1 - |
26 | tcg: Move sorted_args into TCGArgConstraint.sort_index | 47 | target/sh4/helper.h | 1 - |
27 | tcg: Remove TCG_CT_REG | 48 | target/tricore/helper.h | 1 - |
28 | tcg: Move some TCG_CT_* bits to TCGArgConstraint bitfields | 49 | accel/tcg/cpu-exec.c | 11 ++++ |
29 | tcg: Remove TCGOpDef.used | 50 | cpu.c | 21 ++++++++ |
30 | tcg/i386: Fix dupi for avx2 32-bit hosts | 51 | hw/core/cpu-common.c | 17 +----- |
31 | tcg: Fix generation of dupi_vec for 32-bit host | 52 | target/alpha/translate.c | 13 ++--- |
32 | tcg/optimize: Fold dup2_vec | 53 | target/arm/translate-a64.c | 10 +--- |
33 | tcg: Remove TCG_TARGET_HAS_cmp_vec | 54 | target/arm/translate.c | 36 +++---------- |
55 | target/avr/translate.c | 19 ++----- | ||
56 | target/cris/translate.c | 16 ------ | ||
57 | target/hexagon/translate.c | 12 +---- | ||
58 | target/hppa/translate.c | 17 ++---- | ||
59 | target/i386/tcg/misc_helper.c | 8 --- | ||
60 | target/i386/tcg/translate.c | 9 ++-- | ||
61 | target/m68k/translate.c | 44 ++++----------- | ||
62 | target/microblaze/translate.c | 18 ++----- | ||
63 | target/mips/tcg/translate.c | 75 ++++++++++++-------------- | ||
64 | target/openrisc/translate.c | 18 ++----- | ||
65 | target/ppc/translate.c | 38 +++---------- | ||
66 | target/riscv/translate.c | 27 +--------- | ||
67 | target/rx/op_helper.c | 8 --- | ||
68 | target/rx/translate.c | 12 +---- | ||
69 | target/s390x/tcg/translate.c | 8 +-- | ||
70 | target/sh4/op_helper.c | 5 -- | ||
71 | target/sh4/translate.c | 14 ++--- | ||
72 | target/tricore/op_helper.c | 7 --- | ||
73 | target/tricore/translate.c | 14 +---- | ||
74 | target/xtensa/translate.c | 25 +++------ | ||
75 | target/riscv/insn_trans/trans_privileged.c.inc | 10 ++-- | ||
76 | target/riscv/insn_trans/trans_rvi.c.inc | 8 ++- | ||
77 | target/riscv/insn_trans/trans_rvv.c.inc | 2 +- | ||
78 | 34 files changed, 141 insertions(+), 386 deletions(-) | ||
34 | 79 | ||
35 | include/tcg/tcg-gvec-desc.h | 38 ++++++++++++------ | ||
36 | include/tcg/tcg.h | 22 ++++------ | ||
37 | tcg/aarch64/tcg-target.h | 1 - | ||
38 | tcg/i386/tcg-target.h | 1 - | ||
39 | tcg/ppc/tcg-target.h | 1 - | ||
40 | accel/tcg/user-exec.c | 43 ++++++++++++++++++-- | ||
41 | tcg/optimize.c | 15 +++++++ | ||
42 | tcg/tcg-op-gvec.c | 35 ++++++++++++---- | ||
43 | tcg/tcg-op-vec.c | 12 ++++-- | ||
44 | tcg/tcg.c | 96 +++++++++++++++++++------------------------- | ||
45 | tcg/aarch64/tcg-target.c.inc | 17 ++++---- | ||
46 | tcg/arm/tcg-target.c.inc | 29 ++++++------- | ||
47 | tcg/i386/tcg-target.c.inc | 39 +++++++----------- | ||
48 | tcg/mips/tcg-target.c.inc | 21 +++++----- | ||
49 | tcg/ppc/tcg-target.c.inc | 29 ++++++------- | ||
50 | tcg/riscv/tcg-target.c.inc | 16 ++++---- | ||
51 | tcg/s390/tcg-target.c.inc | 22 +++++----- | ||
52 | tcg/sparc/tcg-target.c.inc | 21 ++++------ | ||
53 | tcg/tci/tcg-target.c.inc | 3 +- | ||
54 | 19 files changed, 244 insertions(+), 217 deletions(-) | ||
55 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Currently the change in cpu_tb_exec is masked by the debug exception | ||
2 | being raised by the translators. But this allows us to remove that code. | ||
1 | 3 | ||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | --- | ||
6 | accel/tcg/cpu-exec.c | 11 +++++++++++ | ||
7 | 1 file changed, 11 insertions(+) | ||
8 | |||
9 | diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c | ||
10 | index XXXXXXX..XXXXXXX 100644 | ||
11 | --- a/accel/tcg/cpu-exec.c | ||
12 | +++ b/accel/tcg/cpu-exec.c | ||
13 | @@ -XXX,XX +XXX,XX @@ cpu_tb_exec(CPUState *cpu, TranslationBlock *itb, int *tb_exit) | ||
14 | cc->set_pc(cpu, last_tb->pc); | ||
15 | } | ||
16 | } | ||
17 | + | ||
18 | + /* | ||
19 | + * If gdb single-step, and we haven't raised another exception, | ||
20 | + * raise a debug exception. Single-step with another exception | ||
21 | + * is handled in cpu_handle_exception. | ||
22 | + */ | ||
23 | + if (unlikely(cpu->singlestep_enabled) && cpu->exception_index == -1) { | ||
24 | + cpu->exception_index = EXCP_DEBUG; | ||
25 | + cpu_loop_exit(cpu); | ||
26 | + } | ||
27 | + | ||
28 | return last_tb; | ||
29 | } | ||
30 | |||
31 | -- | ||
32 | 2.25.1 | ||
33 | |||
34 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | GDB single-stepping is now handled generically. | ||
1 | 2 | ||
3 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | --- | ||
6 | target/alpha/translate.c | 13 +++---------- | ||
7 | 1 file changed, 3 insertions(+), 10 deletions(-) | ||
8 | |||
9 | diff --git a/target/alpha/translate.c b/target/alpha/translate.c | ||
10 | index XXXXXXX..XXXXXXX 100644 | ||
11 | --- a/target/alpha/translate.c | ||
12 | +++ b/target/alpha/translate.c | ||
13 | @@ -XXX,XX +XXX,XX @@ static void alpha_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) | ||
14 | tcg_gen_movi_i64(cpu_pc, ctx->base.pc_next); | ||
15 | /* FALLTHRU */ | ||
16 | case DISAS_PC_UPDATED: | ||
17 | - if (!ctx->base.singlestep_enabled) { | ||
18 | - tcg_gen_lookup_and_goto_ptr(); | ||
19 | - break; | ||
20 | - } | ||
21 | - /* FALLTHRU */ | ||
22 | + tcg_gen_lookup_and_goto_ptr(); | ||
23 | + break; | ||
24 | case DISAS_PC_UPDATED_NOCHAIN: | ||
25 | - if (ctx->base.singlestep_enabled) { | ||
26 | - gen_excp_1(EXCP_DEBUG, 0); | ||
27 | - } else { | ||
28 | - tcg_gen_exit_tb(NULL, 0); | ||
29 | - } | ||
30 | + tcg_gen_exit_tb(NULL, 0); | ||
31 | break; | ||
32 | default: | ||
33 | g_assert_not_reached(); | ||
34 | -- | ||
35 | 2.25.1 | ||
36 | |||
37 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | GDB single-stepping is now handled generically. | ||
1 | 2 | ||
3 | Tested-by: Michael Rolnik <mrolnik@gmail.com> | ||
4 | Reviewed-by: Michael Rolnik <mrolnik@gmail.com> | ||
5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | --- | ||
8 | target/avr/translate.c | 19 ++++--------------- | ||
9 | 1 file changed, 4 insertions(+), 15 deletions(-) | ||
10 | |||
11 | diff --git a/target/avr/translate.c b/target/avr/translate.c | ||
12 | index XXXXXXX..XXXXXXX 100644 | ||
13 | --- a/target/avr/translate.c | ||
14 | +++ b/target/avr/translate.c | ||
15 | @@ -XXX,XX +XXX,XX @@ static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest) | ||
16 | tcg_gen_exit_tb(tb, n); | ||
17 | } else { | ||
18 | tcg_gen_movi_i32(cpu_pc, dest); | ||
19 | - if (ctx->base.singlestep_enabled) { | ||
20 | - gen_helper_debug(cpu_env); | ||
21 | - } else { | ||
22 | - tcg_gen_lookup_and_goto_ptr(); | ||
23 | - } | ||
24 | + tcg_gen_lookup_and_goto_ptr(); | ||
25 | } | ||
26 | ctx->base.is_jmp = DISAS_NORETURN; | ||
27 | } | ||
28 | @@ -XXX,XX +XXX,XX @@ static void avr_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) | ||
29 | tcg_gen_movi_tl(cpu_pc, ctx->npc); | ||
30 | /* fall through */ | ||
31 | case DISAS_LOOKUP: | ||
32 | - if (!ctx->base.singlestep_enabled) { | ||
33 | - tcg_gen_lookup_and_goto_ptr(); | ||
34 | - break; | ||
35 | - } | ||
36 | - /* fall through */ | ||
37 | + tcg_gen_lookup_and_goto_ptr(); | ||
38 | + break; | ||
39 | case DISAS_EXIT: | ||
40 | - if (ctx->base.singlestep_enabled) { | ||
41 | - gen_helper_debug(cpu_env); | ||
42 | - } else { | ||
43 | - tcg_gen_exit_tb(NULL, 0); | ||
44 | - } | ||
45 | + tcg_gen_exit_tb(NULL, 0); | ||
46 | break; | ||
47 | default: | ||
48 | g_assert_not_reached(); | ||
49 | -- | ||
50 | 2.25.1 | ||
51 | |||
52 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | GDB single-stepping is now handled generically. | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | --- | ||
5 | target/cris/translate.c | 16 ---------------- | ||
6 | 1 file changed, 16 deletions(-) | ||
7 | |||
8 | diff --git a/target/cris/translate.c b/target/cris/translate.c | ||
9 | index XXXXXXX..XXXXXXX 100644 | ||
10 | --- a/target/cris/translate.c | ||
11 | +++ b/target/cris/translate.c | ||
12 | @@ -XXX,XX +XXX,XX @@ static void cris_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) | ||
13 | } | ||
14 | } | ||
15 | |||
16 | - if (unlikely(dc->base.singlestep_enabled)) { | ||
17 | - switch (is_jmp) { | ||
18 | - case DISAS_TOO_MANY: | ||
19 | - case DISAS_UPDATE_NEXT: | ||
20 | - tcg_gen_movi_tl(env_pc, npc); | ||
21 | - /* fall through */ | ||
22 | - case DISAS_JUMP: | ||
23 | - case DISAS_UPDATE: | ||
24 | - t_gen_raise_exception(EXCP_DEBUG); | ||
25 | - return; | ||
26 | - default: | ||
27 | - break; | ||
28 | - } | ||
29 | - g_assert_not_reached(); | ||
30 | - } | ||
31 | - | ||
32 | switch (is_jmp) { | ||
33 | case DISAS_TOO_MANY: | ||
34 | gen_goto_tb(dc, 0, npc); | ||
35 | -- | ||
36 | 2.25.1 | ||
37 | |||
38 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | GDB single-stepping is now handled generically. | ||
1 | 2 | ||
3 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | --- | ||
6 | target/hexagon/translate.c | 12 ++---------- | ||
7 | 1 file changed, 2 insertions(+), 10 deletions(-) | ||
8 | |||
9 | diff --git a/target/hexagon/translate.c b/target/hexagon/translate.c | ||
10 | index XXXXXXX..XXXXXXX 100644 | ||
11 | --- a/target/hexagon/translate.c | ||
12 | +++ b/target/hexagon/translate.c | ||
13 | @@ -XXX,XX +XXX,XX @@ static void gen_end_tb(DisasContext *ctx) | ||
14 | { | ||
15 | gen_exec_counters(ctx); | ||
16 | tcg_gen_mov_tl(hex_gpr[HEX_REG_PC], hex_next_PC); | ||
17 | - if (ctx->base.singlestep_enabled) { | ||
18 | - gen_exception_raw(EXCP_DEBUG); | ||
19 | - } else { | ||
20 | - tcg_gen_exit_tb(NULL, 0); | ||
21 | - } | ||
22 | + tcg_gen_exit_tb(NULL, 0); | ||
23 | ctx->base.is_jmp = DISAS_NORETURN; | ||
24 | } | ||
25 | |||
26 | @@ -XXX,XX +XXX,XX @@ static void hexagon_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) | ||
27 | case DISAS_TOO_MANY: | ||
28 | gen_exec_counters(ctx); | ||
29 | tcg_gen_movi_tl(hex_gpr[HEX_REG_PC], ctx->base.pc_next); | ||
30 | - if (ctx->base.singlestep_enabled) { | ||
31 | - gen_exception_raw(EXCP_DEBUG); | ||
32 | - } else { | ||
33 | - tcg_gen_exit_tb(NULL, 0); | ||
34 | - } | ||
35 | + tcg_gen_exit_tb(NULL, 0); | ||
36 | break; | ||
37 | case DISAS_NORETURN: | ||
38 | break; | ||
39 | -- | ||
40 | 2.25.1 | ||
41 | |||
42 | diff view generated by jsdifflib |
1 | This uses an existing hole in the TCGArgConstraint structure | 1 | GDB single-stepping is now handled generically. |
---|---|---|---|
2 | and will be convenient for keeping the data in one place. | ||
3 | 2 | ||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
5 | --- | 4 | --- |
6 | include/tcg/tcg.h | 2 +- | 5 | target/arm/translate-a64.c | 10 ++-------- |
7 | tcg/tcg.c | 35 +++++++++++++++++------------------ | 6 | target/arm/translate.c | 36 ++++++------------------------------ |
8 | 2 files changed, 18 insertions(+), 19 deletions(-) | 7 | 2 files changed, 8 insertions(+), 38 deletions(-) |
9 | 8 | ||
10 | diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h | 9 | diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c |
11 | index XXXXXXX..XXXXXXX 100644 | 10 | index XXXXXXX..XXXXXXX 100644 |
12 | --- a/include/tcg/tcg.h | 11 | --- a/target/arm/translate-a64.c |
13 | +++ b/include/tcg/tcg.h | 12 | +++ b/target/arm/translate-a64.c |
14 | @@ -XXX,XX +XXX,XX @@ void tcg_dump_op_count(void); | 13 | @@ -XXX,XX +XXX,XX @@ static inline void gen_goto_tb(DisasContext *s, int n, uint64_t dest) |
15 | typedef struct TCGArgConstraint { | 14 | gen_a64_set_pc_im(dest); |
16 | uint16_t ct; | 15 | if (s->ss_active) { |
17 | uint8_t alias_index; | 16 | gen_step_complete_exception(s); |
18 | + uint8_t sort_index; | 17 | - } else if (s->base.singlestep_enabled) { |
19 | TCGRegSet regs; | 18 | - gen_exception_internal(EXCP_DEBUG); |
20 | } TCGArgConstraint; | 19 | } else { |
21 | 20 | tcg_gen_lookup_and_goto_ptr(); | |
22 | @@ -XXX,XX +XXX,XX @@ typedef struct TCGOpDef { | 21 | s->base.is_jmp = DISAS_NORETURN; |
23 | uint8_t nb_oargs, nb_iargs, nb_cargs, nb_args; | 22 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) |
24 | uint8_t flags; | 23 | { |
25 | TCGArgConstraint *args_ct; | 24 | DisasContext *dc = container_of(dcbase, DisasContext, base); |
26 | - int *sorted_args; | 25 | |
27 | #if defined(CONFIG_DEBUG_TCG) | 26 | - if (unlikely(dc->base.singlestep_enabled || dc->ss_active)) { |
28 | int used; | 27 | + if (unlikely(dc->ss_active)) { |
29 | #endif | 28 | /* Note that this means single stepping WFI doesn't halt the CPU. |
30 | diff --git a/tcg/tcg.c b/tcg/tcg.c | 29 | * For conditional branch insns this is harmless unreachable code as |
30 | * gen_goto_tb() has already handled emitting the debug exception | ||
31 | @@ -XXX,XX +XXX,XX @@ static void aarch64_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) | ||
32 | /* fall through */ | ||
33 | case DISAS_EXIT: | ||
34 | case DISAS_JUMP: | ||
35 | - if (dc->base.singlestep_enabled) { | ||
36 | - gen_exception_internal(EXCP_DEBUG); | ||
37 | - } else { | ||
38 | - gen_step_complete_exception(dc); | ||
39 | - } | ||
40 | + gen_step_complete_exception(dc); | ||
41 | break; | ||
42 | case DISAS_NORETURN: | ||
43 | break; | ||
44 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
31 | index XXXXXXX..XXXXXXX 100644 | 45 | index XXXXXXX..XXXXXXX 100644 |
32 | --- a/tcg/tcg.c | 46 | --- a/target/arm/translate.c |
33 | +++ b/tcg/tcg.c | 47 | +++ b/target/arm/translate.c |
34 | @@ -XXX,XX +XXX,XX @@ void tcg_context_init(TCGContext *s) | 48 | @@ -XXX,XX +XXX,XX @@ static void gen_exception_internal(int excp) |
35 | int op, total_args, n, i; | 49 | tcg_temp_free_i32(tcg_excp); |
36 | TCGOpDef *def; | 50 | } |
37 | TCGArgConstraint *args_ct; | 51 | |
38 | - int *sorted_args; | 52 | -static void gen_step_complete_exception(DisasContext *s) |
39 | TCGTemp *ts; | 53 | +static void gen_singlestep_exception(DisasContext *s) |
40 | 54 | { | |
41 | memset(s, 0, sizeof(*s)); | 55 | /* We just completed step of an insn. Move from Active-not-pending |
42 | @@ -XXX,XX +XXX,XX @@ void tcg_context_init(TCGContext *s) | 56 | * to Active-pending, and then also take the swstep exception. |
57 | @@ -XXX,XX +XXX,XX @@ static void gen_step_complete_exception(DisasContext *s) | ||
58 | s->base.is_jmp = DISAS_NORETURN; | ||
59 | } | ||
60 | |||
61 | -static void gen_singlestep_exception(DisasContext *s) | ||
62 | -{ | ||
63 | - /* Generate the right kind of exception for singlestep, which is | ||
64 | - * either the architectural singlestep or EXCP_DEBUG for QEMU's | ||
65 | - * gdb singlestepping. | ||
66 | - */ | ||
67 | - if (s->ss_active) { | ||
68 | - gen_step_complete_exception(s); | ||
69 | - } else { | ||
70 | - gen_exception_internal(EXCP_DEBUG); | ||
71 | - } | ||
72 | -} | ||
73 | - | ||
74 | -static inline bool is_singlestepping(DisasContext *s) | ||
75 | -{ | ||
76 | - /* Return true if we are singlestepping either because of | ||
77 | - * architectural singlestep or QEMU gdbstub singlestep. This does | ||
78 | - * not include the command line '-singlestep' mode which is rather | ||
79 | - * misnamed as it only means "one instruction per TB" and doesn't | ||
80 | - * affect the code we generate. | ||
81 | - */ | ||
82 | - return s->base.singlestep_enabled || s->ss_active; | ||
83 | -} | ||
84 | - | ||
85 | void clear_eci_state(DisasContext *s) | ||
86 | { | ||
87 | /* | ||
88 | @@ -XXX,XX +XXX,XX @@ static inline void gen_bx_excret_final_code(DisasContext *s) | ||
89 | /* Is the new PC value in the magic range indicating exception return? */ | ||
90 | tcg_gen_brcondi_i32(TCG_COND_GEU, cpu_R[15], min_magic, excret_label); | ||
91 | /* No: end the TB as we would for a DISAS_JMP */ | ||
92 | - if (is_singlestepping(s)) { | ||
93 | + if (s->ss_active) { | ||
94 | gen_singlestep_exception(s); | ||
95 | } else { | ||
96 | tcg_gen_exit_tb(NULL, 0); | ||
97 | @@ -XXX,XX +XXX,XX @@ static void gen_goto_tb(DisasContext *s, int n, target_ulong dest) | ||
98 | /* Jump, specifying which TB number to use if we gen_goto_tb() */ | ||
99 | static inline void gen_jmp_tb(DisasContext *s, uint32_t dest, int tbno) | ||
100 | { | ||
101 | - if (unlikely(is_singlestepping(s))) { | ||
102 | + if (unlikely(s->ss_active)) { | ||
103 | /* An indirect jump so that we still trigger the debug exception. */ | ||
104 | gen_set_pc_im(s, dest); | ||
105 | s->base.is_jmp = DISAS_JUMP; | ||
106 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) | ||
107 | dc->page_start = dc->base.pc_first & TARGET_PAGE_MASK; | ||
108 | |||
109 | /* If architectural single step active, limit to 1. */ | ||
110 | - if (is_singlestepping(dc)) { | ||
111 | + if (dc->ss_active) { | ||
112 | dc->base.max_insns = 1; | ||
43 | } | 113 | } |
44 | 114 | ||
45 | args_ct = g_malloc(sizeof(TCGArgConstraint) * total_args); | 115 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) |
46 | - sorted_args = g_malloc(sizeof(int) * total_args); | 116 | * insn codepath itself. |
47 | 117 | */ | |
48 | for(op = 0; op < NB_OPS; op++) { | 118 | gen_bx_excret_final_code(dc); |
49 | def = &tcg_op_defs[op]; | 119 | - } else if (unlikely(is_singlestepping(dc))) { |
50 | def->args_ct = args_ct; | 120 | + } else if (unlikely(dc->ss_active)) { |
51 | - def->sorted_args = sorted_args; | 121 | /* Unconditional and "condition passed" instruction codepath. */ |
52 | n = def->nb_iargs + def->nb_oargs; | 122 | switch (dc->base.is_jmp) { |
53 | - sorted_args += n; | 123 | case DISAS_SWI: |
54 | args_ct += n; | 124 | @@ -XXX,XX +XXX,XX @@ static void arm_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) |
55 | } | 125 | /* "Condition failed" instruction codepath for the branch/trap insn */ |
56 | 126 | gen_set_label(dc->condlabel); | |
57 | @@ -XXX,XX +XXX,XX @@ static int get_constraint_priority(const TCGOpDef *def, int k) | 127 | gen_set_condexec(dc); |
58 | /* sort from highest priority to lowest */ | 128 | - if (unlikely(is_singlestepping(dc))) { |
59 | static void sort_constraints(TCGOpDef *def, int start, int n) | 129 | + if (unlikely(dc->ss_active)) { |
60 | { | 130 | gen_set_pc_im(dc, dc->base.pc_next); |
61 | - int i, j, p1, p2, tmp; | 131 | gen_singlestep_exception(dc); |
62 | + int i, j; | 132 | } else { |
63 | + TCGArgConstraint *a = def->args_ct; | ||
64 | |||
65 | - for(i = 0; i < n; i++) | ||
66 | - def->sorted_args[start + i] = start + i; | ||
67 | - if (n <= 1) | ||
68 | + for (i = 0; i < n; i++) { | ||
69 | + a[start + i].sort_index = start + i; | ||
70 | + } | ||
71 | + if (n <= 1) { | ||
72 | return; | ||
73 | - for(i = 0; i < n - 1; i++) { | ||
74 | - for(j = i + 1; j < n; j++) { | ||
75 | - p1 = get_constraint_priority(def, def->sorted_args[start + i]); | ||
76 | - p2 = get_constraint_priority(def, def->sorted_args[start + j]); | ||
77 | + } | ||
78 | + for (i = 0; i < n - 1; i++) { | ||
79 | + for (j = i + 1; j < n; j++) { | ||
80 | + int p1 = get_constraint_priority(def, a[start + i].sort_index); | ||
81 | + int p2 = get_constraint_priority(def, a[start + j].sort_index); | ||
82 | if (p1 < p2) { | ||
83 | - tmp = def->sorted_args[start + i]; | ||
84 | - def->sorted_args[start + i] = def->sorted_args[start + j]; | ||
85 | - def->sorted_args[start + j] = tmp; | ||
86 | + int tmp = a[start + i].sort_index; | ||
87 | + a[start + i].sort_index = a[start + j].sort_index; | ||
88 | + a[start + j].sort_index = tmp; | ||
89 | } | ||
90 | } | ||
91 | } | ||
92 | @@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) | ||
93 | for (k = 0; k < nb_iargs; k++) { | ||
94 | TCGRegSet i_preferred_regs, o_preferred_regs; | ||
95 | |||
96 | - i = def->sorted_args[nb_oargs + k]; | ||
97 | + i = def->args_ct[nb_oargs + k].sort_index; | ||
98 | arg = op->args[i]; | ||
99 | arg_ct = &def->args_ct[i]; | ||
100 | ts = arg_temp(arg); | ||
101 | @@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) | ||
102 | int k2, i2; | ||
103 | reg = ts->reg; | ||
104 | for (k2 = 0 ; k2 < k ; k2++) { | ||
105 | - i2 = def->sorted_args[nb_oargs + k2]; | ||
106 | + i2 = def->args_ct[nb_oargs + k2].sort_index; | ||
107 | if ((def->args_ct[i2].ct & TCG_CT_IALIAS) && | ||
108 | reg == new_args[i2]) { | ||
109 | goto allocate_in_reg; | ||
110 | @@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) | ||
111 | |||
112 | /* satisfy the output constraints */ | ||
113 | for(k = 0; k < nb_oargs; k++) { | ||
114 | - i = def->sorted_args[k]; | ||
115 | + i = def->args_ct[k].sort_index; | ||
116 | arg = op->args[i]; | ||
117 | arg_ct = &def->args_ct[i]; | ||
118 | ts = arg_temp(arg); | ||
119 | -- | 133 | -- |
120 | 2.25.1 | 134 | 2.25.1 |
121 | 135 | ||
122 | 136 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | GDB single-stepping is now handled generically. | ||
1 | 2 | ||
3 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | --- | ||
6 | target/hppa/translate.c | 17 ++++------------- | ||
7 | 1 file changed, 4 insertions(+), 13 deletions(-) | ||
8 | |||
9 | diff --git a/target/hppa/translate.c b/target/hppa/translate.c | ||
10 | index XXXXXXX..XXXXXXX 100644 | ||
11 | --- a/target/hppa/translate.c | ||
12 | +++ b/target/hppa/translate.c | ||
13 | @@ -XXX,XX +XXX,XX @@ static void gen_goto_tb(DisasContext *ctx, int which, | ||
14 | } else { | ||
15 | copy_iaoq_entry(cpu_iaoq_f, f, cpu_iaoq_b); | ||
16 | copy_iaoq_entry(cpu_iaoq_b, b, ctx->iaoq_n_var); | ||
17 | - if (ctx->base.singlestep_enabled) { | ||
18 | - gen_excp_1(EXCP_DEBUG); | ||
19 | - } else { | ||
20 | - tcg_gen_lookup_and_goto_ptr(); | ||
21 | - } | ||
22 | + tcg_gen_lookup_and_goto_ptr(); | ||
23 | } | ||
24 | } | ||
25 | |||
26 | @@ -XXX,XX +XXX,XX @@ static bool do_rfi(DisasContext *ctx, bool rfi_r) | ||
27 | gen_helper_rfi(cpu_env); | ||
28 | } | ||
29 | /* Exit the TB to recognize new interrupts. */ | ||
30 | - if (ctx->base.singlestep_enabled) { | ||
31 | - gen_excp_1(EXCP_DEBUG); | ||
32 | - } else { | ||
33 | - tcg_gen_exit_tb(NULL, 0); | ||
34 | - } | ||
35 | + tcg_gen_exit_tb(NULL, 0); | ||
36 | ctx->base.is_jmp = DISAS_NORETURN; | ||
37 | |||
38 | return nullify_end(ctx); | ||
39 | @@ -XXX,XX +XXX,XX @@ static void hppa_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) | ||
40 | nullify_save(ctx); | ||
41 | /* FALLTHRU */ | ||
42 | case DISAS_IAQ_N_UPDATED: | ||
43 | - if (ctx->base.singlestep_enabled) { | ||
44 | - gen_excp_1(EXCP_DEBUG); | ||
45 | - } else if (is_jmp != DISAS_IAQ_N_STALE_EXIT) { | ||
46 | + if (is_jmp != DISAS_IAQ_N_STALE_EXIT) { | ||
47 | tcg_gen_lookup_and_goto_ptr(); | ||
48 | + break; | ||
49 | } | ||
50 | /* FALLTHRU */ | ||
51 | case DISAS_EXIT: | ||
52 | -- | ||
53 | 2.25.1 | ||
54 | |||
55 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | We were using singlestep_enabled as a proxy for whether | ||
2 | translator_use_goto_tb would always return false. | ||
1 | 3 | ||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | --- | ||
6 | target/i386/tcg/translate.c | 5 +++-- | ||
7 | 1 file changed, 3 insertions(+), 2 deletions(-) | ||
8 | |||
9 | diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c | ||
10 | index XXXXXXX..XXXXXXX 100644 | ||
11 | --- a/target/i386/tcg/translate.c | ||
12 | +++ b/target/i386/tcg/translate.c | ||
13 | @@ -XXX,XX +XXX,XX @@ static void i386_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu) | ||
14 | DisasContext *dc = container_of(dcbase, DisasContext, base); | ||
15 | CPUX86State *env = cpu->env_ptr; | ||
16 | uint32_t flags = dc->base.tb->flags; | ||
17 | + uint32_t cflags = tb_cflags(dc->base.tb); | ||
18 | int cpl = (flags >> HF_CPL_SHIFT) & 3; | ||
19 | int iopl = (flags >> IOPL_SHIFT) & 3; | ||
20 | |||
21 | @@ -XXX,XX +XXX,XX @@ static void i386_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu) | ||
22 | dc->cpuid_ext3_features = env->features[FEAT_8000_0001_ECX]; | ||
23 | dc->cpuid_7_0_ebx_features = env->features[FEAT_7_0_EBX]; | ||
24 | dc->cpuid_xsave_features = env->features[FEAT_XSAVE]; | ||
25 | - dc->jmp_opt = !(dc->base.singlestep_enabled || | ||
26 | + dc->jmp_opt = !((cflags & CF_NO_GOTO_TB) || | ||
27 | (flags & (HF_TF_MASK | HF_INHIBIT_IRQ_MASK))); | ||
28 | /* | ||
29 | * If jmp_opt, we want to handle each string instruction individually. | ||
30 | * For icount also disable repz optimization so that each iteration | ||
31 | * is accounted separately. | ||
32 | */ | ||
33 | - dc->repz_opt = !dc->jmp_opt && !(tb_cflags(dc->base.tb) & CF_USE_ICOUNT); | ||
34 | + dc->repz_opt = !dc->jmp_opt && !(cflags & CF_USE_ICOUNT); | ||
35 | |||
36 | dc->T0 = tcg_temp_new(); | ||
37 | dc->T1 = tcg_temp_new(); | ||
38 | -- | ||
39 | 2.25.1 | ||
40 | |||
41 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | GDB single-stepping is now handled generically. | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | --- | ||
5 | target/i386/helper.h | 1 - | ||
6 | target/i386/tcg/misc_helper.c | 8 -------- | ||
7 | target/i386/tcg/translate.c | 4 +--- | ||
8 | 3 files changed, 1 insertion(+), 12 deletions(-) | ||
9 | |||
10 | diff --git a/target/i386/helper.h b/target/i386/helper.h | ||
11 | index XXXXXXX..XXXXXXX 100644 | ||
12 | --- a/target/i386/helper.h | ||
13 | +++ b/target/i386/helper.h | ||
14 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_2(syscall, void, env, int) | ||
15 | DEF_HELPER_2(sysret, void, env, int) | ||
16 | #endif | ||
17 | DEF_HELPER_FLAGS_2(pause, TCG_CALL_NO_WG, noreturn, env, int) | ||
18 | -DEF_HELPER_FLAGS_1(debug, TCG_CALL_NO_WG, noreturn, env) | ||
19 | DEF_HELPER_1(reset_rf, void, env) | ||
20 | DEF_HELPER_FLAGS_3(raise_interrupt, TCG_CALL_NO_WG, noreturn, env, int, int) | ||
21 | DEF_HELPER_FLAGS_2(raise_exception, TCG_CALL_NO_WG, noreturn, env, int) | ||
22 | diff --git a/target/i386/tcg/misc_helper.c b/target/i386/tcg/misc_helper.c | ||
23 | index XXXXXXX..XXXXXXX 100644 | ||
24 | --- a/target/i386/tcg/misc_helper.c | ||
25 | +++ b/target/i386/tcg/misc_helper.c | ||
26 | @@ -XXX,XX +XXX,XX @@ void QEMU_NORETURN helper_pause(CPUX86State *env, int next_eip_addend) | ||
27 | do_pause(env); | ||
28 | } | ||
29 | |||
30 | -void QEMU_NORETURN helper_debug(CPUX86State *env) | ||
31 | -{ | ||
32 | - CPUState *cs = env_cpu(env); | ||
33 | - | ||
34 | - cs->exception_index = EXCP_DEBUG; | ||
35 | - cpu_loop_exit(cs); | ||
36 | -} | ||
37 | - | ||
38 | uint64_t helper_rdpkru(CPUX86State *env, uint32_t ecx) | ||
39 | { | ||
40 | if ((env->cr[4] & CR4_PKE_MASK) == 0) { | ||
41 | diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c | ||
42 | index XXXXXXX..XXXXXXX 100644 | ||
43 | --- a/target/i386/tcg/translate.c | ||
44 | +++ b/target/i386/tcg/translate.c | ||
45 | @@ -XXX,XX +XXX,XX @@ do_gen_eob_worker(DisasContext *s, bool inhibit, bool recheck_tf, bool jr) | ||
46 | if (s->base.tb->flags & HF_RF_MASK) { | ||
47 | gen_helper_reset_rf(cpu_env); | ||
48 | } | ||
49 | - if (s->base.singlestep_enabled) { | ||
50 | - gen_helper_debug(cpu_env); | ||
51 | - } else if (recheck_tf) { | ||
52 | + if (recheck_tf) { | ||
53 | gen_helper_rechecking_single_step(cpu_env); | ||
54 | tcg_gen_exit_tb(NULL, 0); | ||
55 | } else if (s->flags & HF_TF_MASK) { | ||
56 | -- | ||
57 | 2.25.1 | ||
58 | |||
59 | diff view generated by jsdifflib |
1 | The previous change wrongly stated that 32-bit avx2 should have | 1 | GDB single-stepping is now handled generically. |
---|---|---|---|
2 | used VPBROADCASTW. But that's a 16-bit broadcast and we want a | ||
3 | 32-bit broadcast. | ||
4 | 2 | ||
5 | Fixes: 7b60ef3264e | 3 | Acked-by: Laurent Vivier <laurent@vivier.eu> |
6 | Cc: qemu-stable@nongnu.org | ||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | --- | 5 | --- |
9 | tcg/i386/tcg-target.c.inc | 2 +- | 6 | target/m68k/translate.c | 44 +++++++++-------------------------------- |
10 | 1 file changed, 1 insertion(+), 1 deletion(-) | 7 | 1 file changed, 9 insertions(+), 35 deletions(-) |
11 | 8 | ||
12 | diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc | 9 | diff --git a/target/m68k/translate.c b/target/m68k/translate.c |
13 | index XXXXXXX..XXXXXXX 100644 | 10 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/tcg/i386/tcg-target.c.inc | 11 | --- a/target/m68k/translate.c |
15 | +++ b/tcg/i386/tcg-target.c.inc | 12 | +++ b/target/m68k/translate.c |
16 | @@ -XXX,XX +XXX,XX @@ static void tcg_out_dupi_vec(TCGContext *s, TCGType type, | 13 | @@ -XXX,XX +XXX,XX @@ static void do_writebacks(DisasContext *s) |
17 | new_pool_label(s, arg, R_386_PC32, s->code_ptr - 4, -4); | 14 | } |
18 | } else { | 15 | } |
19 | if (have_avx2) { | 16 | |
20 | - tcg_out_vex_modrm_pool(s, OPC_VPBROADCASTW + vex_l, ret); | 17 | -static bool is_singlestepping(DisasContext *s) |
21 | + tcg_out_vex_modrm_pool(s, OPC_VPBROADCASTD + vex_l, ret); | 18 | -{ |
19 | - /* | ||
20 | - * Return true if we are singlestepping either because of | ||
21 | - * architectural singlestep or QEMU gdbstub singlestep. This does | ||
22 | - * not include the command line '-singlestep' mode which is rather | ||
23 | - * misnamed as it only means "one instruction per TB" and doesn't | ||
24 | - * affect the code we generate. | ||
25 | - */ | ||
26 | - return s->base.singlestep_enabled || s->ss_active; | ||
27 | -} | ||
28 | - | ||
29 | /* is_jmp field values */ | ||
30 | #define DISAS_JUMP DISAS_TARGET_0 /* only pc was modified dynamically */ | ||
31 | #define DISAS_EXIT DISAS_TARGET_1 /* cpu state was modified dynamically */ | ||
32 | @@ -XXX,XX +XXX,XX @@ static void gen_exception(DisasContext *s, uint32_t dest, int nr) | ||
33 | s->base.is_jmp = DISAS_NORETURN; | ||
34 | } | ||
35 | |||
36 | -static void gen_singlestep_exception(DisasContext *s) | ||
37 | -{ | ||
38 | - /* | ||
39 | - * Generate the right kind of exception for singlestep, which is | ||
40 | - * either the architectural singlestep or EXCP_DEBUG for QEMU's | ||
41 | - * gdb singlestepping. | ||
42 | - */ | ||
43 | - if (s->ss_active) { | ||
44 | - gen_raise_exception(EXCP_TRACE); | ||
45 | - } else { | ||
46 | - gen_raise_exception(EXCP_DEBUG); | ||
47 | - } | ||
48 | -} | ||
49 | - | ||
50 | static inline void gen_addr_fault(DisasContext *s) | ||
51 | { | ||
52 | gen_exception(s, s->base.pc_next, EXCP_ADDRESS); | ||
53 | @@ -XXX,XX +XXX,XX @@ static void gen_exit_tb(DisasContext *s) | ||
54 | /* Generate a jump to an immediate address. */ | ||
55 | static void gen_jmp_tb(DisasContext *s, int n, uint32_t dest) | ||
56 | { | ||
57 | - if (unlikely(is_singlestepping(s))) { | ||
58 | + if (unlikely(s->ss_active)) { | ||
59 | update_cc_op(s); | ||
60 | tcg_gen_movi_i32(QREG_PC, dest); | ||
61 | - gen_singlestep_exception(s); | ||
62 | + gen_raise_exception(EXCP_TRACE); | ||
63 | } else if (translator_use_goto_tb(&s->base, dest)) { | ||
64 | tcg_gen_goto_tb(n); | ||
65 | tcg_gen_movi_i32(QREG_PC, dest); | ||
66 | @@ -XXX,XX +XXX,XX @@ static void m68k_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cpu) | ||
67 | |||
68 | dc->ss_active = (M68K_SR_TRACE(env->sr) == M68K_SR_TRACE_ANY_INS); | ||
69 | /* If architectural single step active, limit to 1 */ | ||
70 | - if (is_singlestepping(dc)) { | ||
71 | + if (dc->ss_active) { | ||
72 | dc->base.max_insns = 1; | ||
73 | } | ||
74 | } | ||
75 | @@ -XXX,XX +XXX,XX @@ static void m68k_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) | ||
76 | break; | ||
77 | case DISAS_TOO_MANY: | ||
78 | update_cc_op(dc); | ||
79 | - if (is_singlestepping(dc)) { | ||
80 | + if (dc->ss_active) { | ||
81 | tcg_gen_movi_i32(QREG_PC, dc->pc); | ||
82 | - gen_singlestep_exception(dc); | ||
83 | + gen_raise_exception(EXCP_TRACE); | ||
22 | } else { | 84 | } else { |
23 | tcg_out_vex_modrm_pool(s, OPC_VBROADCASTSS, ret); | 85 | gen_jmp_tb(dc, 0, dc->pc); |
86 | } | ||
87 | break; | ||
88 | case DISAS_JUMP: | ||
89 | /* We updated CC_OP and PC in gen_jmp/gen_jmp_im. */ | ||
90 | - if (is_singlestepping(dc)) { | ||
91 | - gen_singlestep_exception(dc); | ||
92 | + if (dc->ss_active) { | ||
93 | + gen_raise_exception(EXCP_TRACE); | ||
94 | } else { | ||
95 | tcg_gen_lookup_and_goto_ptr(); | ||
96 | } | ||
97 | @@ -XXX,XX +XXX,XX @@ static void m68k_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) | ||
98 | * We updated CC_OP and PC in gen_exit_tb, but also modified | ||
99 | * other state that may require returning to the main loop. | ||
100 | */ | ||
101 | - if (is_singlestepping(dc)) { | ||
102 | - gen_singlestep_exception(dc); | ||
103 | + if (dc->ss_active) { | ||
104 | + gen_raise_exception(EXCP_TRACE); | ||
105 | } else { | ||
106 | tcg_gen_exit_tb(NULL, 0); | ||
24 | } | 107 | } |
25 | -- | 108 | -- |
26 | 2.25.1 | 109 | 2.25.1 |
27 | 110 | ||
28 | 111 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | We were using singlestep_enabled as a proxy for whether | ||
2 | translator_use_goto_tb would always return false. | ||
1 | 3 | ||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
5 | --- | ||
6 | target/microblaze/translate.c | 4 ++-- | ||
7 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
8 | |||
9 | diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c | ||
10 | index XXXXXXX..XXXXXXX 100644 | ||
11 | --- a/target/microblaze/translate.c | ||
12 | +++ b/target/microblaze/translate.c | ||
13 | @@ -XXX,XX +XXX,XX @@ static void mb_tr_tb_stop(DisasContextBase *dcb, CPUState *cs) | ||
14 | break; | ||
15 | |||
16 | case DISAS_JUMP: | ||
17 | - if (dc->jmp_dest != -1 && !cs->singlestep_enabled) { | ||
18 | + if (dc->jmp_dest != -1 && !(tb_cflags(dc->base.tb) & CF_NO_GOTO_TB)) { | ||
19 | /* Direct jump. */ | ||
20 | tcg_gen_discard_i32(cpu_btarget); | ||
21 | |||
22 | @@ -XXX,XX +XXX,XX @@ static void mb_tr_tb_stop(DisasContextBase *dcb, CPUState *cs) | ||
23 | return; | ||
24 | } | ||
25 | |||
26 | - /* Indirect jump (or direct jump w/ singlestep) */ | ||
27 | + /* Indirect jump (or direct jump w/ goto_tb disabled) */ | ||
28 | tcg_gen_mov_i32(cpu_pc, cpu_btarget); | ||
29 | tcg_gen_discard_i32(cpu_btarget); | ||
30 | |||
31 | -- | ||
32 | 2.25.1 | ||
33 | |||
34 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | GDB single-stepping is now handled generically. | ||
1 | 2 | ||
3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
4 | --- | ||
5 | target/microblaze/translate.c | 14 ++------------ | ||
6 | 1 file changed, 2 insertions(+), 12 deletions(-) | ||
7 | |||
8 | diff --git a/target/microblaze/translate.c b/target/microblaze/translate.c | ||
9 | index XXXXXXX..XXXXXXX 100644 | ||
10 | --- a/target/microblaze/translate.c | ||
11 | +++ b/target/microblaze/translate.c | ||
12 | @@ -XXX,XX +XXX,XX @@ static void gen_raise_hw_excp(DisasContext *dc, uint32_t esr_ec) | ||
13 | |||
14 | static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest) | ||
15 | { | ||
16 | - if (dc->base.singlestep_enabled) { | ||
17 | - TCGv_i32 tmp = tcg_const_i32(EXCP_DEBUG); | ||
18 | - tcg_gen_movi_i32(cpu_pc, dest); | ||
19 | - gen_helper_raise_exception(cpu_env, tmp); | ||
20 | - tcg_temp_free_i32(tmp); | ||
21 | - } else if (translator_use_goto_tb(&dc->base, dest)) { | ||
22 | + if (translator_use_goto_tb(&dc->base, dest)) { | ||
23 | tcg_gen_goto_tb(n); | ||
24 | tcg_gen_movi_i32(cpu_pc, dest); | ||
25 | tcg_gen_exit_tb(dc->base.tb, n); | ||
26 | @@ -XXX,XX +XXX,XX @@ static void mb_tr_tb_stop(DisasContextBase *dcb, CPUState *cs) | ||
27 | /* Indirect jump (or direct jump w/ goto_tb disabled) */ | ||
28 | tcg_gen_mov_i32(cpu_pc, cpu_btarget); | ||
29 | tcg_gen_discard_i32(cpu_btarget); | ||
30 | - | ||
31 | - if (unlikely(cs->singlestep_enabled)) { | ||
32 | - gen_raise_exception(dc, EXCP_DEBUG); | ||
33 | - } else { | ||
34 | - tcg_gen_lookup_and_goto_ptr(); | ||
35 | - } | ||
36 | + tcg_gen_lookup_and_goto_ptr(); | ||
37 | return; | ||
38 | |||
39 | default: | ||
40 | -- | ||
41 | 2.25.1 | ||
42 | |||
43 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | As per an ancient comment in mips_tr_translate_insn about the | ||
2 | expectations of gdb, when restarting the insn in a delay slot | ||
3 | we also re-execute the branch. Which means that we are | ||
4 | expected to execute two insns in this case. | ||
1 | 5 | ||
6 | This has been broken since 8b86d6d2580, where we forced max_insns | ||
7 | to 1 while single-stepping. This resulted in an exit from the | ||
8 | translator loop after the branch but before the delay slot is | ||
9 | translated. | ||
10 | |||
11 | Increase the max_insns to 2 for this case. In addition, bypass | ||
12 | the end-of-page check, for when the branch itself ends the page. | ||
13 | |||
14 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
15 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
16 | --- | ||
17 | target/mips/tcg/translate.c | 25 ++++++++++++++++--------- | ||
18 | 1 file changed, 16 insertions(+), 9 deletions(-) | ||
19 | |||
20 | diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c | ||
21 | index XXXXXXX..XXXXXXX 100644 | ||
22 | --- a/target/mips/tcg/translate.c | ||
23 | +++ b/target/mips/tcg/translate.c | ||
24 | @@ -XXX,XX +XXX,XX @@ static void mips_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) | ||
25 | ctx->default_tcg_memop_mask = (ctx->insn_flags & (ISA_MIPS_R6 | | ||
26 | INSN_LOONGSON3A)) ? MO_UNALN : MO_ALIGN; | ||
27 | |||
28 | + /* | ||
29 | + * Execute a branch and its delay slot as a single instruction. | ||
30 | + * This is what GDB expects and is consistent with what the | ||
31 | + * hardware does (e.g. if a delay slot instruction faults, the | ||
32 | + * reported PC is the PC of the branch). | ||
33 | + */ | ||
34 | + if (ctx->base.singlestep_enabled && (ctx->hflags & MIPS_HFLAG_BMASK)) { | ||
35 | + ctx->base.max_insns = 2; | ||
36 | + } | ||
37 | + | ||
38 | LOG_DISAS("\ntb %p idx %d hflags %04x\n", ctx->base.tb, ctx->mem_idx, | ||
39 | ctx->hflags); | ||
40 | } | ||
41 | @@ -XXX,XX +XXX,XX @@ static void mips_tr_translate_insn(DisasContextBase *dcbase, CPUState *cs) | ||
42 | if (ctx->base.is_jmp != DISAS_NEXT) { | ||
43 | return; | ||
44 | } | ||
45 | + | ||
46 | /* | ||
47 | - * Execute a branch and its delay slot as a single instruction. | ||
48 | - * This is what GDB expects and is consistent with what the | ||
49 | - * hardware does (e.g. if a delay slot instruction faults, the | ||
50 | - * reported PC is the PC of the branch). | ||
51 | + * End the TB on (most) page crossings. | ||
52 | + * See mips_tr_init_disas_context about single-stepping a branch | ||
53 | + * together with its delay slot. | ||
54 | */ | ||
55 | - if (ctx->base.singlestep_enabled && | ||
56 | - (ctx->hflags & MIPS_HFLAG_BMASK) == 0) { | ||
57 | - ctx->base.is_jmp = DISAS_TOO_MANY; | ||
58 | - } | ||
59 | - if (ctx->base.pc_next - ctx->page_start >= TARGET_PAGE_SIZE) { | ||
60 | + if (ctx->base.pc_next - ctx->page_start >= TARGET_PAGE_SIZE | ||
61 | + && !ctx->base.singlestep_enabled) { | ||
62 | ctx->base.is_jmp = DISAS_TOO_MANY; | ||
63 | } | ||
64 | } | ||
65 | -- | ||
66 | 2.25.1 | ||
67 | |||
68 | diff view generated by jsdifflib |
1 | From: Kele Huang <kele.hwang@gmail.com> | 1 | GDB single-stepping is now handled generically. |
---|---|---|---|
2 | 2 | ||
3 | Detect all MIPS store instructions in cpu_signal_handler for all available | 3 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
4 | MIPS versions, and set is_write if encountering such store instructions. | ||
5 | |||
6 | This fixed the error while dealing with self-modified code for MIPS. | ||
7 | |||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
9 | Signed-off-by: Kele Huang <kele.hwang@gmail.com> | ||
10 | Signed-off-by: Xu Zou <iwatchnima@gmail.com> | ||
11 | Message-Id: <20201002081420.10814-1-kele.hwang@gmail.com> | ||
12 | [rth: Use uintptr_t for pc to fix n32 build error.] | ||
13 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
14 | --- | 5 | --- |
15 | accel/tcg/user-exec.c | 43 +++++++++++++++++++++++++++++++++++++++---- | 6 | target/mips/tcg/translate.c | 50 +++++++++++++------------------------ |
16 | 1 file changed, 39 insertions(+), 4 deletions(-) | 7 | 1 file changed, 18 insertions(+), 32 deletions(-) |
17 | 8 | ||
18 | diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c | 9 | diff --git a/target/mips/tcg/translate.c b/target/mips/tcg/translate.c |
19 | index XXXXXXX..XXXXXXX 100644 | 10 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/accel/tcg/user-exec.c | 11 | --- a/target/mips/tcg/translate.c |
21 | +++ b/accel/tcg/user-exec.c | 12 | +++ b/target/mips/tcg/translate.c |
22 | @@ -XXX,XX +XXX,XX @@ int cpu_signal_handler(int host_signum, void *pinfo, | 13 | @@ -XXX,XX +XXX,XX @@ static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest) |
23 | 14 | tcg_gen_exit_tb(ctx->base.tb, n); | |
24 | #elif defined(__mips__) | 15 | } else { |
25 | 16 | gen_save_pc(dest); | |
26 | +#if defined(__misp16) || defined(__mips_micromips) | 17 | - if (ctx->base.singlestep_enabled) { |
27 | +#error "Unsupported encoding" | 18 | - save_cpu_state(ctx, 0); |
28 | +#endif | 19 | - gen_helper_raise_exception_debug(cpu_env); |
29 | + | 20 | - } else { |
30 | int cpu_signal_handler(int host_signum, void *pinfo, | 21 | - tcg_gen_lookup_and_goto_ptr(); |
31 | void *puc) | 22 | - } |
23 | + tcg_gen_lookup_and_goto_ptr(); | ||
24 | } | ||
25 | } | ||
26 | |||
27 | @@ -XXX,XX +XXX,XX @@ static void gen_branch(DisasContext *ctx, int insn_bytes) | ||
28 | } else { | ||
29 | tcg_gen_mov_tl(cpu_PC, btarget); | ||
30 | } | ||
31 | - if (ctx->base.singlestep_enabled) { | ||
32 | - save_cpu_state(ctx, 0); | ||
33 | - gen_helper_raise_exception_debug(cpu_env); | ||
34 | - } | ||
35 | tcg_gen_lookup_and_goto_ptr(); | ||
36 | break; | ||
37 | default: | ||
38 | @@ -XXX,XX +XXX,XX @@ static void mips_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) | ||
32 | { | 39 | { |
33 | siginfo_t *info = pinfo; | 40 | DisasContext *ctx = container_of(dcbase, DisasContext, base); |
34 | ucontext_t *uc = puc; | 41 | |
35 | - greg_t pc = uc->uc_mcontext.pc; | 42 | - if (ctx->base.singlestep_enabled && ctx->base.is_jmp != DISAS_NORETURN) { |
36 | - int is_write; | 43 | - save_cpu_state(ctx, ctx->base.is_jmp != DISAS_EXIT); |
37 | + uintptr_t pc = uc->uc_mcontext.pc; | 44 | - gen_helper_raise_exception_debug(cpu_env); |
38 | + uint32_t insn = *(uint32_t *)pc; | 45 | - } else { |
39 | + int is_write = 0; | 46 | - switch (ctx->base.is_jmp) { |
40 | + | 47 | - case DISAS_STOP: |
41 | + /* Detect all store instructions at program counter. */ | 48 | - gen_save_pc(ctx->base.pc_next); |
42 | + switch((insn >> 26) & 077) { | 49 | - tcg_gen_lookup_and_goto_ptr(); |
43 | + case 050: /* SB */ | 50 | - break; |
44 | + case 051: /* SH */ | 51 | - case DISAS_NEXT: |
45 | + case 052: /* SWL */ | 52 | - case DISAS_TOO_MANY: |
46 | + case 053: /* SW */ | 53 | - save_cpu_state(ctx, 0); |
47 | + case 054: /* SDL */ | 54 | - gen_goto_tb(ctx, 0, ctx->base.pc_next); |
48 | + case 055: /* SDR */ | 55 | - break; |
49 | + case 056: /* SWR */ | 56 | - case DISAS_EXIT: |
50 | + case 070: /* SC */ | 57 | - tcg_gen_exit_tb(NULL, 0); |
51 | + case 071: /* SWC1 */ | 58 | - break; |
52 | + case 074: /* SCD */ | 59 | - case DISAS_NORETURN: |
53 | + case 075: /* SDC1 */ | 60 | - break; |
54 | + case 077: /* SD */ | 61 | - default: |
55 | +#if !defined(__mips_isa_rev) || __mips_isa_rev < 6 | 62 | - g_assert_not_reached(); |
56 | + case 072: /* SWC2 */ | 63 | - } |
57 | + case 076: /* SDC2 */ | 64 | + switch (ctx->base.is_jmp) { |
58 | +#endif | 65 | + case DISAS_STOP: |
59 | + is_write = 1; | 66 | + gen_save_pc(ctx->base.pc_next); |
67 | + tcg_gen_lookup_and_goto_ptr(); | ||
60 | + break; | 68 | + break; |
61 | + case 023: /* COP1X */ | 69 | + case DISAS_NEXT: |
62 | + /* Required in all versions of MIPS64 since | 70 | + case DISAS_TOO_MANY: |
63 | + MIPS64r1 and subsequent versions of MIPS32r2. */ | 71 | + save_cpu_state(ctx, 0); |
64 | + switch (insn & 077) { | 72 | + gen_goto_tb(ctx, 0, ctx->base.pc_next); |
65 | + case 010: /* SWXC1 */ | ||
66 | + case 011: /* SDXC1 */ | ||
67 | + case 015: /* SUXC1 */ | ||
68 | + is_write = 1; | ||
69 | + } | ||
70 | + break; | 73 | + break; |
71 | + } | 74 | + case DISAS_EXIT: |
72 | 75 | + tcg_gen_exit_tb(NULL, 0); | |
73 | - /* XXX: compute is_write */ | 76 | + break; |
74 | - is_write = 0; | 77 | + case DISAS_NORETURN: |
75 | return handle_cpu_signal(pc, info, is_write, &uc->uc_sigmask); | 78 | + break; |
79 | + default: | ||
80 | + g_assert_not_reached(); | ||
81 | } | ||
76 | } | 82 | } |
77 | 83 | ||
78 | -- | 84 | -- |
79 | 2.25.1 | 85 | 2.25.1 |
80 | 86 | ||
81 | 87 | diff view generated by jsdifflib |
1 | The union is unused; let "regs" appear in the main structure | 1 | GDB single-stepping is now handled generically. |
---|---|---|---|
2 | without the "u.regs" wrapping. | ||
3 | 2 | ||
4 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 3 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
6 | --- | 5 | --- |
7 | include/tcg/tcg.h | 4 +--- | 6 | target/openrisc/translate.c | 18 +++--------------- |
8 | tcg/tcg.c | 22 +++++++++++----------- | 7 | 1 file changed, 3 insertions(+), 15 deletions(-) |
9 | tcg/aarch64/tcg-target.c.inc | 14 +++++++------- | ||
10 | tcg/arm/tcg-target.c.inc | 26 +++++++++++++------------- | ||
11 | tcg/i386/tcg-target.c.inc | 26 +++++++++++++------------- | ||
12 | tcg/mips/tcg-target.c.inc | 18 +++++++++--------- | ||
13 | tcg/ppc/tcg-target.c.inc | 24 ++++++++++++------------ | ||
14 | tcg/riscv/tcg-target.c.inc | 14 +++++++------- | ||
15 | tcg/s390/tcg-target.c.inc | 18 +++++++++--------- | ||
16 | tcg/sparc/tcg-target.c.inc | 16 ++++++++-------- | ||
17 | tcg/tci/tcg-target.c.inc | 2 +- | ||
18 | 11 files changed, 91 insertions(+), 93 deletions(-) | ||
19 | 8 | ||
20 | diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h | 9 | diff --git a/target/openrisc/translate.c b/target/openrisc/translate.c |
21 | index XXXXXXX..XXXXXXX 100644 | 10 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/include/tcg/tcg.h | 11 | --- a/target/openrisc/translate.c |
23 | +++ b/include/tcg/tcg.h | 12 | +++ b/target/openrisc/translate.c |
24 | @@ -XXX,XX +XXX,XX @@ void tcg_dump_op_count(void); | 13 | @@ -XXX,XX +XXX,XX @@ static void openrisc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) |
25 | typedef struct TCGArgConstraint { | 14 | /* The jump destination is indirect/computed; use jmp_pc. */ |
26 | uint16_t ct; | 15 | tcg_gen_mov_tl(cpu_pc, jmp_pc); |
27 | uint8_t alias_index; | 16 | tcg_gen_discard_tl(jmp_pc); |
28 | - union { | 17 | - if (unlikely(dc->base.singlestep_enabled)) { |
29 | - TCGRegSet regs; | 18 | - gen_exception(dc, EXCP_DEBUG); |
30 | - } u; | 19 | - } else { |
31 | + TCGRegSet regs; | 20 | - tcg_gen_lookup_and_goto_ptr(); |
32 | } TCGArgConstraint; | 21 | - } |
33 | 22 | + tcg_gen_lookup_and_goto_ptr(); | |
34 | #define TCG_MAX_OP_ARGS 16 | 23 | break; |
35 | diff --git a/tcg/tcg.c b/tcg/tcg.c | ||
36 | index XXXXXXX..XXXXXXX 100644 | ||
37 | --- a/tcg/tcg.c | ||
38 | +++ b/tcg/tcg.c | ||
39 | @@ -XXX,XX +XXX,XX @@ static int get_constraint_priority(const TCGOpDef *def, int k) | ||
40 | return 0; | ||
41 | n = 0; | ||
42 | for(i = 0; i < TCG_TARGET_NB_REGS; i++) { | ||
43 | - if (tcg_regset_test_reg(arg_ct->u.regs, i)) | ||
44 | + if (tcg_regset_test_reg(arg_ct->regs, i)) | ||
45 | n++; | ||
46 | } | 24 | } |
47 | } | 25 | /* The jump destination is direct; use jmp_pc_imm. |
48 | @@ -XXX,XX +XXX,XX @@ static void process_op_defs(TCGContext *s) | 26 | @@ -XXX,XX +XXX,XX @@ static void openrisc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) |
49 | /* Incomplete TCGTargetOpDef entry. */ | 27 | break; |
50 | tcg_debug_assert(ct_str != NULL); | ||
51 | |||
52 | - def->args_ct[i].u.regs = 0; | ||
53 | + def->args_ct[i].regs = 0; | ||
54 | def->args_ct[i].ct = 0; | ||
55 | while (*ct_str != '\0') { | ||
56 | switch(*ct_str) { | ||
57 | @@ -XXX,XX +XXX,XX @@ static void liveness_pass_1(TCGContext *s) | ||
58 | pset = la_temp_pref(ts); | ||
59 | set = *pset; | ||
60 | |||
61 | - set &= ct->u.regs; | ||
62 | + set &= ct->regs; | ||
63 | if (ct->ct & TCG_CT_IALIAS) { | ||
64 | set &= op->output_pref[ct->alias_index]; | ||
65 | } | ||
66 | /* If the combination is not possible, restart. */ | ||
67 | if (set == 0) { | ||
68 | - set = ct->u.regs; | ||
69 | + set = ct->regs; | ||
70 | } | ||
71 | *pset = set; | ||
72 | } | ||
73 | @@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_dup(TCGContext *s, const TCGOp *op) | ||
74 | return; | ||
75 | } | ||
76 | |||
77 | - dup_out_regs = tcg_op_defs[INDEX_op_dup_vec].args_ct[0].u.regs; | ||
78 | - dup_in_regs = tcg_op_defs[INDEX_op_dup_vec].args_ct[1].u.regs; | ||
79 | + dup_out_regs = tcg_op_defs[INDEX_op_dup_vec].args_ct[0].regs; | ||
80 | + dup_in_regs = tcg_op_defs[INDEX_op_dup_vec].args_ct[1].regs; | ||
81 | |||
82 | /* Allocate the output register now. */ | ||
83 | if (ots->val_type != TEMP_VAL_REG) { | ||
84 | @@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) | ||
85 | } | ||
86 | } | 28 | } |
87 | 29 | tcg_gen_movi_tl(cpu_pc, jmp_dest); | |
88 | - temp_load(s, ts, arg_ct->u.regs, i_allocated_regs, i_preferred_regs); | 30 | - if (unlikely(dc->base.singlestep_enabled)) { |
89 | + temp_load(s, ts, arg_ct->regs, i_allocated_regs, i_preferred_regs); | 31 | - gen_exception(dc, EXCP_DEBUG); |
90 | reg = ts->reg; | 32 | - } else { |
91 | 33 | - tcg_gen_lookup_and_goto_ptr(); | |
92 | - if (tcg_regset_test_reg(arg_ct->u.regs, reg)) { | 34 | - } |
93 | + if (tcg_regset_test_reg(arg_ct->regs, reg)) { | 35 | + tcg_gen_lookup_and_goto_ptr(); |
94 | /* nothing to do : the constraint is satisfied */ | ||
95 | } else { | ||
96 | allocate_in_reg: | ||
97 | @@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) | ||
98 | and move the temporary register into it */ | ||
99 | temp_load(s, ts, tcg_target_available_regs[ts->type], | ||
100 | i_allocated_regs, 0); | ||
101 | - reg = tcg_reg_alloc(s, arg_ct->u.regs, i_allocated_regs, | ||
102 | + reg = tcg_reg_alloc(s, arg_ct->regs, i_allocated_regs, | ||
103 | o_preferred_regs, ts->indirect_base); | ||
104 | if (!tcg_out_mov(s, ts->type, reg, ts->reg)) { | ||
105 | /* | ||
106 | @@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) | ||
107 | && !const_args[arg_ct->alias_index]) { | ||
108 | reg = new_args[arg_ct->alias_index]; | ||
109 | } else if (arg_ct->ct & TCG_CT_NEWREG) { | ||
110 | - reg = tcg_reg_alloc(s, arg_ct->u.regs, | ||
111 | + reg = tcg_reg_alloc(s, arg_ct->regs, | ||
112 | i_allocated_regs | o_allocated_regs, | ||
113 | op->output_pref[k], ts->indirect_base); | ||
114 | } else { | ||
115 | - reg = tcg_reg_alloc(s, arg_ct->u.regs, o_allocated_regs, | ||
116 | + reg = tcg_reg_alloc(s, arg_ct->regs, o_allocated_regs, | ||
117 | op->output_pref[k], ts->indirect_base); | ||
118 | } | ||
119 | tcg_regset_set_reg(o_allocated_regs, reg); | ||
120 | diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc | ||
121 | index XXXXXXX..XXXXXXX 100644 | ||
122 | --- a/tcg/aarch64/tcg-target.c.inc | ||
123 | +++ b/tcg/aarch64/tcg-target.c.inc | ||
124 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
125 | switch (*ct_str++) { | ||
126 | case 'r': /* general registers */ | ||
127 | ct->ct |= TCG_CT_REG; | ||
128 | - ct->u.regs |= 0xffffffffu; | ||
129 | + ct->regs |= 0xffffffffu; | ||
130 | break; | 36 | break; |
131 | case 'w': /* advsimd registers */ | 37 | |
132 | ct->ct |= TCG_CT_REG; | 38 | case DISAS_EXIT: |
133 | - ct->u.regs |= 0xffffffff00000000ull; | 39 | - if (unlikely(dc->base.singlestep_enabled)) { |
134 | + ct->regs |= 0xffffffff00000000ull; | 40 | - gen_exception(dc, EXCP_DEBUG); |
135 | break; | 41 | - } else { |
136 | case 'l': /* qemu_ld / qemu_st address, data_reg */ | 42 | - tcg_gen_exit_tb(NULL, 0); |
137 | ct->ct |= TCG_CT_REG; | 43 | - } |
138 | - ct->u.regs = 0xffffffffu; | 44 | + tcg_gen_exit_tb(NULL, 0); |
139 | + ct->regs = 0xffffffffu; | ||
140 | #ifdef CONFIG_SOFTMMU | ||
141 | /* x0 and x1 will be overwritten when reading the tlb entry, | ||
142 | and x2, and x3 for helper args, better to avoid using them. */ | ||
143 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_X0); | ||
144 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_X1); | ||
145 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_X2); | ||
146 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_X3); | ||
147 | + tcg_regset_reset_reg(ct->regs, TCG_REG_X0); | ||
148 | + tcg_regset_reset_reg(ct->regs, TCG_REG_X1); | ||
149 | + tcg_regset_reset_reg(ct->regs, TCG_REG_X2); | ||
150 | + tcg_regset_reset_reg(ct->regs, TCG_REG_X3); | ||
151 | #endif | ||
152 | break; | ||
153 | case 'A': /* Valid for arithmetic immediate (positive or negative). */ | ||
154 | diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc | ||
155 | index XXXXXXX..XXXXXXX 100644 | ||
156 | --- a/tcg/arm/tcg-target.c.inc | ||
157 | +++ b/tcg/arm/tcg-target.c.inc | ||
158 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
159 | |||
160 | case 'r': | ||
161 | ct->ct |= TCG_CT_REG; | ||
162 | - ct->u.regs = 0xffff; | ||
163 | + ct->regs = 0xffff; | ||
164 | break; | ||
165 | |||
166 | /* qemu_ld address */ | ||
167 | case 'l': | ||
168 | ct->ct |= TCG_CT_REG; | ||
169 | - ct->u.regs = 0xffff; | ||
170 | + ct->regs = 0xffff; | ||
171 | #ifdef CONFIG_SOFTMMU | ||
172 | /* r0-r2,lr will be overwritten when reading the tlb entry, | ||
173 | so don't use these. */ | ||
174 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R0); | ||
175 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R1); | ||
176 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R2); | ||
177 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R3); | ||
178 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R14); | ||
179 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R0); | ||
180 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R1); | ||
181 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R2); | ||
182 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R3); | ||
183 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R14); | ||
184 | #endif | ||
185 | break; | ||
186 | |||
187 | /* qemu_st address & data */ | ||
188 | case 's': | ||
189 | ct->ct |= TCG_CT_REG; | ||
190 | - ct->u.regs = 0xffff; | ||
191 | + ct->regs = 0xffff; | ||
192 | /* r0-r2 will be overwritten when reading the tlb entry (softmmu only) | ||
193 | and r0-r1 doing the byte swapping, so don't use these. */ | ||
194 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R0); | ||
195 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R1); | ||
196 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R0); | ||
197 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R1); | ||
198 | #if defined(CONFIG_SOFTMMU) | ||
199 | /* Avoid clashes with registers being used for helper args */ | ||
200 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R2); | ||
201 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R2); | ||
202 | #if TARGET_LONG_BITS == 64 | ||
203 | /* Avoid clashes with registers being used for helper args */ | ||
204 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R3); | ||
205 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R3); | ||
206 | #endif | ||
207 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R14); | ||
208 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R14); | ||
209 | #endif | ||
210 | break; | ||
211 | |||
212 | diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc | ||
213 | index XXXXXXX..XXXXXXX 100644 | ||
214 | --- a/tcg/i386/tcg-target.c.inc | ||
215 | +++ b/tcg/i386/tcg-target.c.inc | ||
216 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
217 | switch(*ct_str++) { | ||
218 | case 'a': | ||
219 | ct->ct |= TCG_CT_REG; | ||
220 | - tcg_regset_set_reg(ct->u.regs, TCG_REG_EAX); | ||
221 | + tcg_regset_set_reg(ct->regs, TCG_REG_EAX); | ||
222 | break; | ||
223 | case 'b': | ||
224 | ct->ct |= TCG_CT_REG; | ||
225 | - tcg_regset_set_reg(ct->u.regs, TCG_REG_EBX); | ||
226 | + tcg_regset_set_reg(ct->regs, TCG_REG_EBX); | ||
227 | break; | ||
228 | case 'c': | ||
229 | ct->ct |= TCG_CT_REG; | ||
230 | - tcg_regset_set_reg(ct->u.regs, TCG_REG_ECX); | ||
231 | + tcg_regset_set_reg(ct->regs, TCG_REG_ECX); | ||
232 | break; | ||
233 | case 'd': | ||
234 | ct->ct |= TCG_CT_REG; | ||
235 | - tcg_regset_set_reg(ct->u.regs, TCG_REG_EDX); | ||
236 | + tcg_regset_set_reg(ct->regs, TCG_REG_EDX); | ||
237 | break; | ||
238 | case 'S': | ||
239 | ct->ct |= TCG_CT_REG; | ||
240 | - tcg_regset_set_reg(ct->u.regs, TCG_REG_ESI); | ||
241 | + tcg_regset_set_reg(ct->regs, TCG_REG_ESI); | ||
242 | break; | ||
243 | case 'D': | ||
244 | ct->ct |= TCG_CT_REG; | ||
245 | - tcg_regset_set_reg(ct->u.regs, TCG_REG_EDI); | ||
246 | + tcg_regset_set_reg(ct->regs, TCG_REG_EDI); | ||
247 | break; | ||
248 | case 'q': | ||
249 | /* A register that can be used as a byte operand. */ | ||
250 | ct->ct |= TCG_CT_REG; | ||
251 | - ct->u.regs = TCG_TARGET_REG_BITS == 64 ? 0xffff : 0xf; | ||
252 | + ct->regs = TCG_TARGET_REG_BITS == 64 ? 0xffff : 0xf; | ||
253 | break; | ||
254 | case 'Q': | ||
255 | /* A register with an addressable second byte (e.g. %ah). */ | ||
256 | ct->ct |= TCG_CT_REG; | ||
257 | - ct->u.regs = 0xf; | ||
258 | + ct->regs = 0xf; | ||
259 | break; | ||
260 | case 'r': | ||
261 | /* A general register. */ | ||
262 | ct->ct |= TCG_CT_REG; | ||
263 | - ct->u.regs |= ALL_GENERAL_REGS; | ||
264 | + ct->regs |= ALL_GENERAL_REGS; | ||
265 | break; | ||
266 | case 'W': | ||
267 | /* With TZCNT/LZCNT, we can have operand-size as an input. */ | ||
268 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
269 | case 'x': | ||
270 | /* A vector register. */ | ||
271 | ct->ct |= TCG_CT_REG; | ||
272 | - ct->u.regs |= ALL_VECTOR_REGS; | ||
273 | + ct->regs |= ALL_VECTOR_REGS; | ||
274 | break; | ||
275 | |||
276 | /* qemu_ld/st address constraint */ | ||
277 | case 'L': | ||
278 | ct->ct |= TCG_CT_REG; | ||
279 | - ct->u.regs = TCG_TARGET_REG_BITS == 64 ? 0xffff : 0xff; | ||
280 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_L0); | ||
281 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_L1); | ||
282 | + ct->regs = TCG_TARGET_REG_BITS == 64 ? 0xffff : 0xff; | ||
283 | + tcg_regset_reset_reg(ct->regs, TCG_REG_L0); | ||
284 | + tcg_regset_reset_reg(ct->regs, TCG_REG_L1); | ||
285 | break; | ||
286 | |||
287 | case 'e': | ||
288 | diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc | ||
289 | index XXXXXXX..XXXXXXX 100644 | ||
290 | --- a/tcg/mips/tcg-target.c.inc | ||
291 | +++ b/tcg/mips/tcg-target.c.inc | ||
292 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
293 | switch(*ct_str++) { | ||
294 | case 'r': | ||
295 | ct->ct |= TCG_CT_REG; | ||
296 | - ct->u.regs = 0xffffffff; | ||
297 | + ct->regs = 0xffffffff; | ||
298 | break; | ||
299 | case 'L': /* qemu_ld input arg constraint */ | ||
300 | ct->ct |= TCG_CT_REG; | ||
301 | - ct->u.regs = 0xffffffff; | ||
302 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_A0); | ||
303 | + ct->regs = 0xffffffff; | ||
304 | + tcg_regset_reset_reg(ct->regs, TCG_REG_A0); | ||
305 | #if defined(CONFIG_SOFTMMU) | ||
306 | if (TCG_TARGET_REG_BITS < TARGET_LONG_BITS) { | ||
307 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_A2); | ||
308 | + tcg_regset_reset_reg(ct->regs, TCG_REG_A2); | ||
309 | } | ||
310 | #endif | ||
311 | break; | ||
312 | case 'S': /* qemu_st constraint */ | ||
313 | ct->ct |= TCG_CT_REG; | ||
314 | - ct->u.regs = 0xffffffff; | ||
315 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_A0); | ||
316 | + ct->regs = 0xffffffff; | ||
317 | + tcg_regset_reset_reg(ct->regs, TCG_REG_A0); | ||
318 | #if defined(CONFIG_SOFTMMU) | ||
319 | if (TCG_TARGET_REG_BITS < TARGET_LONG_BITS) { | ||
320 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_A2); | ||
321 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_A3); | ||
322 | + tcg_regset_reset_reg(ct->regs, TCG_REG_A2); | ||
323 | + tcg_regset_reset_reg(ct->regs, TCG_REG_A3); | ||
324 | } else { | ||
325 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_A1); | ||
326 | + tcg_regset_reset_reg(ct->regs, TCG_REG_A1); | ||
327 | } | ||
328 | #endif | ||
329 | break; | ||
330 | diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc | ||
331 | index XXXXXXX..XXXXXXX 100644 | ||
332 | --- a/tcg/ppc/tcg-target.c.inc | ||
333 | +++ b/tcg/ppc/tcg-target.c.inc | ||
334 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
335 | switch (*ct_str++) { | ||
336 | case 'A': case 'B': case 'C': case 'D': | ||
337 | ct->ct |= TCG_CT_REG; | ||
338 | - tcg_regset_set_reg(ct->u.regs, 3 + ct_str[0] - 'A'); | ||
339 | + tcg_regset_set_reg(ct->regs, 3 + ct_str[0] - 'A'); | ||
340 | break; | ||
341 | case 'r': | ||
342 | ct->ct |= TCG_CT_REG; | ||
343 | - ct->u.regs = 0xffffffff; | ||
344 | + ct->regs = 0xffffffff; | ||
345 | break; | ||
346 | case 'v': | ||
347 | ct->ct |= TCG_CT_REG; | ||
348 | - ct->u.regs = 0xffffffff00000000ull; | ||
349 | + ct->regs = 0xffffffff00000000ull; | ||
350 | break; | ||
351 | case 'L': /* qemu_ld constraint */ | ||
352 | ct->ct |= TCG_CT_REG; | ||
353 | - ct->u.regs = 0xffffffff; | ||
354 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R3); | ||
355 | + ct->regs = 0xffffffff; | ||
356 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R3); | ||
357 | #ifdef CONFIG_SOFTMMU | ||
358 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R4); | ||
359 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R5); | ||
360 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R4); | ||
361 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R5); | ||
362 | #endif | ||
363 | break; | ||
364 | case 'S': /* qemu_st constraint */ | ||
365 | ct->ct |= TCG_CT_REG; | ||
366 | - ct->u.regs = 0xffffffff; | ||
367 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R3); | ||
368 | + ct->regs = 0xffffffff; | ||
369 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R3); | ||
370 | #ifdef CONFIG_SOFTMMU | ||
371 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R4); | ||
372 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R5); | ||
373 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R6); | ||
374 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R4); | ||
375 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R5); | ||
376 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R6); | ||
377 | #endif | ||
378 | break; | ||
379 | case 'I': | ||
380 | diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc | ||
381 | index XXXXXXX..XXXXXXX 100644 | ||
382 | --- a/tcg/riscv/tcg-target.c.inc | ||
383 | +++ b/tcg/riscv/tcg-target.c.inc | ||
384 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
385 | switch (*ct_str++) { | ||
386 | case 'r': | ||
387 | ct->ct |= TCG_CT_REG; | ||
388 | - ct->u.regs = 0xffffffff; | ||
389 | + ct->regs = 0xffffffff; | ||
390 | break; | ||
391 | case 'L': | ||
392 | /* qemu_ld/qemu_st constraint */ | ||
393 | ct->ct |= TCG_CT_REG; | ||
394 | - ct->u.regs = 0xffffffff; | ||
395 | + ct->regs = 0xffffffff; | ||
396 | /* qemu_ld/qemu_st uses TCG_REG_TMP0 */ | ||
397 | #if defined(CONFIG_SOFTMMU) | ||
398 | - tcg_regset_reset_reg(ct->u.regs, tcg_target_call_iarg_regs[0]); | ||
399 | - tcg_regset_reset_reg(ct->u.regs, tcg_target_call_iarg_regs[1]); | ||
400 | - tcg_regset_reset_reg(ct->u.regs, tcg_target_call_iarg_regs[2]); | ||
401 | - tcg_regset_reset_reg(ct->u.regs, tcg_target_call_iarg_regs[3]); | ||
402 | - tcg_regset_reset_reg(ct->u.regs, tcg_target_call_iarg_regs[4]); | ||
403 | + tcg_regset_reset_reg(ct->regs, tcg_target_call_iarg_regs[0]); | ||
404 | + tcg_regset_reset_reg(ct->regs, tcg_target_call_iarg_regs[1]); | ||
405 | + tcg_regset_reset_reg(ct->regs, tcg_target_call_iarg_regs[2]); | ||
406 | + tcg_regset_reset_reg(ct->regs, tcg_target_call_iarg_regs[3]); | ||
407 | + tcg_regset_reset_reg(ct->regs, tcg_target_call_iarg_regs[4]); | ||
408 | #endif | ||
409 | break; | ||
410 | case 'I': | ||
411 | diff --git a/tcg/s390/tcg-target.c.inc b/tcg/s390/tcg-target.c.inc | ||
412 | index XXXXXXX..XXXXXXX 100644 | ||
413 | --- a/tcg/s390/tcg-target.c.inc | ||
414 | +++ b/tcg/s390/tcg-target.c.inc | ||
415 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
416 | switch (*ct_str++) { | ||
417 | case 'r': /* all registers */ | ||
418 | ct->ct |= TCG_CT_REG; | ||
419 | - ct->u.regs = 0xffff; | ||
420 | + ct->regs = 0xffff; | ||
421 | break; | ||
422 | case 'L': /* qemu_ld/st constraint */ | ||
423 | ct->ct |= TCG_CT_REG; | ||
424 | - ct->u.regs = 0xffff; | ||
425 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R2); | ||
426 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R3); | ||
427 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_R4); | ||
428 | + ct->regs = 0xffff; | ||
429 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R2); | ||
430 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R3); | ||
431 | + tcg_regset_reset_reg(ct->regs, TCG_REG_R4); | ||
432 | break; | ||
433 | case 'a': /* force R2 for division */ | ||
434 | ct->ct |= TCG_CT_REG; | ||
435 | - ct->u.regs = 0; | ||
436 | - tcg_regset_set_reg(ct->u.regs, TCG_REG_R2); | ||
437 | + ct->regs = 0; | ||
438 | + tcg_regset_set_reg(ct->regs, TCG_REG_R2); | ||
439 | break; | ||
440 | case 'b': /* force R3 for division */ | ||
441 | ct->ct |= TCG_CT_REG; | ||
442 | - ct->u.regs = 0; | ||
443 | - tcg_regset_set_reg(ct->u.regs, TCG_REG_R3); | ||
444 | + ct->regs = 0; | ||
445 | + tcg_regset_set_reg(ct->regs, TCG_REG_R3); | ||
446 | break; | ||
447 | case 'A': | ||
448 | ct->ct |= TCG_CT_CONST_S33; | ||
449 | diff --git a/tcg/sparc/tcg-target.c.inc b/tcg/sparc/tcg-target.c.inc | ||
450 | index XXXXXXX..XXXXXXX 100644 | ||
451 | --- a/tcg/sparc/tcg-target.c.inc | ||
452 | +++ b/tcg/sparc/tcg-target.c.inc | ||
453 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
454 | switch (*ct_str++) { | ||
455 | case 'r': | ||
456 | ct->ct |= TCG_CT_REG; | ||
457 | - ct->u.regs = 0xffffffff; | ||
458 | + ct->regs = 0xffffffff; | ||
459 | break; | ||
460 | case 'R': | ||
461 | ct->ct |= TCG_CT_REG; | ||
462 | - ct->u.regs = ALL_64; | ||
463 | + ct->regs = ALL_64; | ||
464 | break; | ||
465 | case 'A': /* qemu_ld/st address constraint */ | ||
466 | ct->ct |= TCG_CT_REG; | ||
467 | - ct->u.regs = TARGET_LONG_BITS == 64 ? ALL_64 : 0xffffffff; | ||
468 | + ct->regs = TARGET_LONG_BITS == 64 ? ALL_64 : 0xffffffff; | ||
469 | reserve_helpers: | ||
470 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_O0); | ||
471 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_O1); | ||
472 | - tcg_regset_reset_reg(ct->u.regs, TCG_REG_O2); | ||
473 | + tcg_regset_reset_reg(ct->regs, TCG_REG_O0); | ||
474 | + tcg_regset_reset_reg(ct->regs, TCG_REG_O1); | ||
475 | + tcg_regset_reset_reg(ct->regs, TCG_REG_O2); | ||
476 | break; | ||
477 | case 's': /* qemu_st data 32-bit constraint */ | ||
478 | ct->ct |= TCG_CT_REG; | ||
479 | - ct->u.regs = 0xffffffff; | ||
480 | + ct->regs = 0xffffffff; | ||
481 | goto reserve_helpers; | ||
482 | case 'S': /* qemu_st data 64-bit constraint */ | ||
483 | ct->ct |= TCG_CT_REG; | ||
484 | - ct->u.regs = ALL_64; | ||
485 | + ct->regs = ALL_64; | ||
486 | goto reserve_helpers; | ||
487 | case 'I': | ||
488 | ct->ct |= TCG_CT_CONST_S11; | ||
489 | diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc | ||
490 | index XXXXXXX..XXXXXXX 100644 | ||
491 | --- a/tcg/tci/tcg-target.c.inc | ||
492 | +++ b/tcg/tci/tcg-target.c.inc | ||
493 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
494 | case 'L': /* qemu_ld constraint */ | ||
495 | case 'S': /* qemu_st constraint */ | ||
496 | ct->ct |= TCG_CT_REG; | ||
497 | - ct->u.regs = BIT(TCG_TARGET_NB_REGS) - 1; | ||
498 | + ct->regs = BIT(TCG_TARGET_NB_REGS) - 1; | ||
499 | break; | 45 | break; |
500 | default: | 46 | default: |
501 | return NULL; | 47 | g_assert_not_reached(); |
502 | -- | 48 | -- |
503 | 2.25.1 | 49 | 2.25.1 |
504 | 50 | ||
505 | 51 | diff view generated by jsdifflib |
1 | These are easier to set and test when they have their own fields. | 1 | GDB single-stepping is now handled generically. |
---|---|---|---|
2 | Reduce the size of alias_index and sort_index to 4 bits, which is | 2 | Reuse gen_debug_exception to handle architectural debug exceptions. |
3 | sufficient for TCG_MAX_OP_ARGS. This leaves only the bits indicating | ||
4 | constants within the ct field. | ||
5 | |||
6 | Move all initialization to allocation time, rather than init | ||
7 | individual fields in process_op_defs. | ||
8 | 3 | ||
9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
10 | --- | 5 | --- |
11 | include/tcg/tcg.h | 14 +++++++------- | 6 | target/ppc/translate.c | 38 ++++++++------------------------------ |
12 | tcg/tcg.c | 28 ++++++++++++---------------- | 7 | 1 file changed, 8 insertions(+), 30 deletions(-) |
13 | 2 files changed, 19 insertions(+), 23 deletions(-) | ||
14 | 8 | ||
15 | diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h | 9 | diff --git a/target/ppc/translate.c b/target/ppc/translate.c |
16 | index XXXXXXX..XXXXXXX 100644 | 10 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/include/tcg/tcg.h | 11 | --- a/target/ppc/translate.c |
18 | +++ b/include/tcg/tcg.h | 12 | +++ b/target/ppc/translate.c |
19 | @@ -XXX,XX +XXX,XX @@ int64_t tcg_cpu_exec_time(void); | 13 | @@ -XXX,XX +XXX,XX @@ |
20 | void tcg_dump_info(void); | 14 | |
21 | void tcg_dump_op_count(void); | 15 | #define CPU_SINGLE_STEP 0x1 |
22 | 16 | #define CPU_BRANCH_STEP 0x2 | |
23 | -#define TCG_CT_ALIAS 0x80 | 17 | -#define GDBSTUB_SINGLE_STEP 0x4 |
24 | -#define TCG_CT_IALIAS 0x40 | 18 | |
25 | -#define TCG_CT_NEWREG 0x20 /* output requires a new register */ | 19 | /* Include definitions for instructions classes and implementations flags */ |
26 | -#define TCG_CT_CONST 0x02 /* any constant of register size */ | 20 | /* #define PPC_DEBUG_DISAS */ |
27 | +#define TCG_CT_CONST 1 /* any constant of register size */ | 21 | @@ -XXX,XX +XXX,XX @@ static uint32_t gen_prep_dbgex(DisasContext *ctx) |
28 | 22 | ||
29 | typedef struct TCGArgConstraint { | 23 | static void gen_debug_exception(DisasContext *ctx) |
30 | - uint16_t ct; | 24 | { |
31 | - uint8_t alias_index; | 25 | - gen_helper_raise_exception(cpu_env, tcg_constant_i32(EXCP_DEBUG)); |
32 | - uint8_t sort_index; | 26 | + gen_helper_raise_exception(cpu_env, tcg_constant_i32(gen_prep_dbgex(ctx))); |
33 | + unsigned ct : 16; | 27 | ctx->base.is_jmp = DISAS_NORETURN; |
34 | + unsigned alias_index : 4; | 28 | } |
35 | + unsigned sort_index : 4; | 29 | |
36 | + bool oalias : 1; | 30 | @@ -XXX,XX +XXX,XX @@ static inline bool use_goto_tb(DisasContext *ctx, target_ulong dest) |
37 | + bool ialias : 1; | 31 | |
38 | + bool newreg : 1; | 32 | static void gen_lookup_and_goto_ptr(DisasContext *ctx) |
39 | TCGRegSet regs; | 33 | { |
40 | } TCGArgConstraint; | 34 | - int sse = ctx->singlestep_enabled; |
41 | 35 | - if (unlikely(sse)) { | |
42 | diff --git a/tcg/tcg.c b/tcg/tcg.c | 36 | - if (sse & GDBSTUB_SINGLE_STEP) { |
43 | index XXXXXXX..XXXXXXX 100644 | 37 | - gen_debug_exception(ctx); |
44 | --- a/tcg/tcg.c | 38 | - } else if (sse & (CPU_SINGLE_STEP | CPU_BRANCH_STEP)) { |
45 | +++ b/tcg/tcg.c | 39 | - gen_helper_raise_exception(cpu_env, tcg_constant_i32(gen_prep_dbgex(ctx))); |
46 | @@ -XXX,XX +XXX,XX @@ void tcg_context_init(TCGContext *s) | 40 | - } else { |
47 | total_args += n; | 41 | - tcg_gen_exit_tb(NULL, 0); |
42 | - } | ||
43 | + if (unlikely(ctx->singlestep_enabled)) { | ||
44 | + gen_debug_exception(ctx); | ||
45 | } else { | ||
46 | tcg_gen_lookup_and_goto_ptr(); | ||
48 | } | 47 | } |
49 | 48 | @@ -XXX,XX +XXX,XX @@ static void ppc_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) | |
50 | - args_ct = g_malloc(sizeof(TCGArgConstraint) * total_args); | 49 | ctx->singlestep_enabled = 0; |
51 | + args_ct = g_new0(TCGArgConstraint, total_args); | 50 | if ((hflags >> HFLAGS_SE) & 1) { |
52 | 51 | ctx->singlestep_enabled |= CPU_SINGLE_STEP; | |
53 | for(op = 0; op < NB_OPS; op++) { | 52 | + ctx->base.max_insns = 1; |
54 | def = &tcg_op_defs[op]; | 53 | } |
55 | @@ -XXX,XX +XXX,XX @@ static int get_constraint_priority(const TCGOpDef *def, int k) | 54 | if ((hflags >> HFLAGS_BE) & 1) { |
56 | const TCGArgConstraint *arg_ct = &def->args_ct[k]; | 55 | ctx->singlestep_enabled |= CPU_BRANCH_STEP; |
57 | int n; | 56 | } |
58 | 57 | - if (unlikely(ctx->base.singlestep_enabled)) { | |
59 | - if (arg_ct->ct & TCG_CT_ALIAS) { | 58 | - ctx->singlestep_enabled |= GDBSTUB_SINGLE_STEP; |
60 | + if (arg_ct->oalias) { | 59 | - } |
61 | /* an alias is equivalent to a single register */ | 60 | - |
62 | n = 1; | 61 | - if (ctx->singlestep_enabled & (CPU_SINGLE_STEP | GDBSTUB_SINGLE_STEP)) { |
63 | } else { | 62 | - ctx->base.max_insns = 1; |
64 | @@ -XXX,XX +XXX,XX @@ static void process_op_defs(TCGContext *s) | 63 | - } |
65 | /* Incomplete TCGTargetOpDef entry. */ | 64 | } |
66 | tcg_debug_assert(ct_str != NULL); | 65 | |
67 | 66 | static void ppc_tr_tb_start(DisasContextBase *db, CPUState *cs) | |
68 | - def->args_ct[i].regs = 0; | 67 | @@ -XXX,XX +XXX,XX @@ static void ppc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) |
69 | - def->args_ct[i].ct = 0; | 68 | DisasContext *ctx = container_of(dcbase, DisasContext, base); |
70 | while (*ct_str != '\0') { | 69 | DisasJumpType is_jmp = ctx->base.is_jmp; |
71 | switch(*ct_str) { | 70 | target_ulong nip = ctx->base.pc_next; |
72 | case '0' ... '9': | 71 | - int sse; |
73 | @@ -XXX,XX +XXX,XX @@ static void process_op_defs(TCGContext *s) | 72 | |
74 | tcg_debug_assert(ct_str == tdefs->args_ct_str[i]); | 73 | if (is_jmp == DISAS_NORETURN) { |
75 | tcg_debug_assert(oarg < def->nb_oargs); | 74 | /* We have already exited the TB. */ |
76 | tcg_debug_assert(def->args_ct[oarg].regs != 0); | 75 | @@ -XXX,XX +XXX,XX @@ static void ppc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) |
77 | - /* TCG_CT_ALIAS is for the output arguments. | 76 | } |
78 | - The input is tagged with TCG_CT_IALIAS. */ | 77 | |
79 | def->args_ct[i] = def->args_ct[oarg]; | 78 | /* Honor single stepping. */ |
80 | - def->args_ct[oarg].ct |= TCG_CT_ALIAS; | 79 | - sse = ctx->singlestep_enabled & (CPU_SINGLE_STEP | GDBSTUB_SINGLE_STEP); |
81 | + /* The output sets oalias. */ | 80 | - if (unlikely(sse)) { |
82 | + def->args_ct[oarg].oalias = true; | 81 | + if (unlikely(ctx->singlestep_enabled & CPU_SINGLE_STEP) |
83 | def->args_ct[oarg].alias_index = i; | 82 | + && (nip <= 0x100 || nip > 0xf00)) { |
84 | - def->args_ct[i].ct |= TCG_CT_IALIAS; | 83 | switch (is_jmp) { |
85 | + /* The input sets ialias. */ | 84 | case DISAS_TOO_MANY: |
86 | + def->args_ct[i].ialias = true; | 85 | case DISAS_EXIT_UPDATE: |
87 | def->args_ct[i].alias_index = oarg; | 86 | @@ -XXX,XX +XXX,XX @@ static void ppc_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) |
88 | } | 87 | g_assert_not_reached(); |
89 | ct_str++; | ||
90 | break; | ||
91 | case '&': | ||
92 | - def->args_ct[i].ct |= TCG_CT_NEWREG; | ||
93 | + def->args_ct[i].newreg = true; | ||
94 | ct_str++; | ||
95 | break; | ||
96 | case 'i': | ||
97 | @@ -XXX,XX +XXX,XX @@ static void liveness_pass_1(TCGContext *s) | ||
98 | set = *pset; | ||
99 | |||
100 | set &= ct->regs; | ||
101 | - if (ct->ct & TCG_CT_IALIAS) { | ||
102 | + if (ct->ialias) { | ||
103 | set &= op->output_pref[ct->alias_index]; | ||
104 | } | ||
105 | /* If the combination is not possible, restart. */ | ||
106 | @@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) | ||
107 | } | 88 | } |
108 | 89 | ||
109 | i_preferred_regs = o_preferred_regs = 0; | 90 | - if (sse & GDBSTUB_SINGLE_STEP) { |
110 | - if (arg_ct->ct & TCG_CT_IALIAS) { | 91 | - gen_debug_exception(ctx); |
111 | + if (arg_ct->ialias) { | 92 | - return; |
112 | o_preferred_regs = op->output_pref[arg_ct->alias_index]; | 93 | - } |
113 | if (ts->fixed_reg) { | 94 | - /* else CPU_SINGLE_STEP... */ |
114 | /* if fixed register, we must allocate a new register | 95 | - if (nip <= 0x100 || nip > 0xf00) { |
115 | @@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) | 96 | - gen_helper_raise_exception(cpu_env, tcg_constant_i32(gen_prep_dbgex(ctx))); |
116 | reg = ts->reg; | 97 | - return; |
117 | for (k2 = 0 ; k2 < k ; k2++) { | 98 | - } |
118 | i2 = def->args_ct[nb_oargs + k2].sort_index; | 99 | + gen_debug_exception(ctx); |
119 | - if ((def->args_ct[i2].ct & TCG_CT_IALIAS) && | 100 | + return; |
120 | - reg == new_args[i2]) { | 101 | } |
121 | + if (def->args_ct[i2].ialias && reg == new_args[i2]) { | 102 | |
122 | goto allocate_in_reg; | 103 | switch (is_jmp) { |
123 | } | ||
124 | } | ||
125 | @@ -XXX,XX +XXX,XX @@ static void tcg_reg_alloc_op(TCGContext *s, const TCGOp *op) | ||
126 | /* ENV should not be modified. */ | ||
127 | tcg_debug_assert(!ts->fixed_reg); | ||
128 | |||
129 | - if ((arg_ct->ct & TCG_CT_ALIAS) | ||
130 | - && !const_args[arg_ct->alias_index]) { | ||
131 | + if (arg_ct->oalias && !const_args[arg_ct->alias_index]) { | ||
132 | reg = new_args[arg_ct->alias_index]; | ||
133 | - } else if (arg_ct->ct & TCG_CT_NEWREG) { | ||
134 | + } else if (arg_ct->newreg) { | ||
135 | reg = tcg_reg_alloc(s, arg_ct->regs, | ||
136 | i_allocated_regs | o_allocated_regs, | ||
137 | op->output_pref[k], ts->indirect_base); | ||
138 | -- | 104 | -- |
139 | 2.25.1 | 105 | 2.25.1 |
140 | 106 | ||
141 | 107 | diff view generated by jsdifflib |
1 | The definition of INDEX_op_dupi_vec is that it operates on | 1 | We have already set DISAS_NORETURN in generate_exception, |
---|---|---|---|
2 | units of tcg_target_ulong -- in this case 32 bits. It does | 2 | which makes the exit_tb unreachable. |
3 | not work to use this for a uint64_t value that happens to be | ||
4 | small enough to fit in tcg_target_ulong. | ||
5 | 3 | ||
6 | Fixes: d2fd745fe8b | 4 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
7 | Fixes: db432672dc5 | ||
8 | Cc: qemu-stable@nongnu.org | ||
9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
10 | --- | 6 | --- |
11 | tcg/tcg-op-vec.c | 12 ++++++++---- | 7 | target/riscv/insn_trans/trans_privileged.c.inc | 6 +----- |
12 | 1 file changed, 8 insertions(+), 4 deletions(-) | 8 | 1 file changed, 1 insertion(+), 5 deletions(-) |
13 | 9 | ||
14 | diff --git a/tcg/tcg-op-vec.c b/tcg/tcg-op-vec.c | 10 | diff --git a/target/riscv/insn_trans/trans_privileged.c.inc b/target/riscv/insn_trans/trans_privileged.c.inc |
15 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/tcg/tcg-op-vec.c | 12 | --- a/target/riscv/insn_trans/trans_privileged.c.inc |
17 | +++ b/tcg/tcg-op-vec.c | 13 | +++ b/target/riscv/insn_trans/trans_privileged.c.inc |
18 | @@ -XXX,XX +XXX,XX @@ TCGv_vec tcg_const_ones_vec_matching(TCGv_vec m) | 14 | @@ -XXX,XX +XXX,XX @@ static bool trans_ecall(DisasContext *ctx, arg_ecall *a) |
19 | |||
20 | void tcg_gen_dup64i_vec(TCGv_vec r, uint64_t a) | ||
21 | { | 15 | { |
22 | - if (TCG_TARGET_REG_BITS == 32 && a == deposit64(a, 32, 32, a)) { | 16 | /* always generates U-level ECALL, fixed in do_interrupt handler */ |
23 | - do_dupi_vec(r, MO_32, a); | 17 | generate_exception(ctx, RISCV_EXCP_U_ECALL); |
24 | - } else if (TCG_TARGET_REG_BITS == 64 || a == (uint64_t)(int32_t)a) { | 18 | - exit_tb(ctx); /* no chaining */ |
25 | + if (TCG_TARGET_REG_BITS == 64) { | 19 | - ctx->base.is_jmp = DISAS_NORETURN; |
26 | do_dupi_vec(r, MO_64, a); | 20 | return true; |
27 | + } else if (a == dup_const(MO_32, a)) { | 21 | } |
28 | + do_dupi_vec(r, MO_32, a); | 22 | |
23 | @@ -XXX,XX +XXX,XX @@ static bool trans_ebreak(DisasContext *ctx, arg_ebreak *a) | ||
24 | post = opcode_at(&ctx->base, post_addr); | ||
25 | } | ||
26 | |||
27 | - if (pre == 0x01f01013 && ebreak == 0x00100073 && post == 0x40705013) { | ||
28 | + if (pre == 0x01f01013 && ebreak == 0x00100073 && post == 0x40705013) { | ||
29 | generate_exception(ctx, RISCV_EXCP_SEMIHOST); | ||
29 | } else { | 30 | } else { |
30 | TCGv_i64 c = tcg_const_i64(a); | 31 | generate_exception(ctx, RISCV_EXCP_BREAKPOINT); |
31 | tcg_gen_dup_i64_vec(MO_64, r, c); | 32 | } |
32 | @@ -XXX,XX +XXX,XX @@ void tcg_gen_dup8i_vec(TCGv_vec r, uint32_t a) | 33 | - exit_tb(ctx); /* no chaining */ |
33 | 34 | - ctx->base.is_jmp = DISAS_NORETURN; | |
34 | void tcg_gen_dupi_vec(unsigned vece, TCGv_vec r, uint64_t a) | 35 | return true; |
35 | { | ||
36 | - do_dupi_vec(r, MO_REG, dup_const(vece, a)); | ||
37 | + if (vece == MO_64) { | ||
38 | + tcg_gen_dup64i_vec(r, a); | ||
39 | + } else { | ||
40 | + do_dupi_vec(r, MO_REG, dup_const(vece, a)); | ||
41 | + } | ||
42 | } | 36 | } |
43 | 37 | ||
44 | void tcg_gen_dup_i64_vec(unsigned vece, TCGv_vec r, TCGv_i64 a) | ||
45 | -- | 38 | -- |
46 | 2.25.1 | 39 | 2.25.1 |
47 | 40 | ||
48 | 41 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | GDB single-stepping is now handled generically, which means | ||
2 | we don't need to do anything in the wrappers. | ||
1 | 3 | ||
4 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
6 | --- | ||
7 | target/riscv/translate.c | 27 +------------------ | ||
8 | .../riscv/insn_trans/trans_privileged.c.inc | 4 +-- | ||
9 | target/riscv/insn_trans/trans_rvi.c.inc | 8 +++--- | ||
10 | target/riscv/insn_trans/trans_rvv.c.inc | 2 +- | ||
11 | 4 files changed, 7 insertions(+), 34 deletions(-) | ||
12 | |||
13 | diff --git a/target/riscv/translate.c b/target/riscv/translate.c | ||
14 | index XXXXXXX..XXXXXXX 100644 | ||
15 | --- a/target/riscv/translate.c | ||
16 | +++ b/target/riscv/translate.c | ||
17 | @@ -XXX,XX +XXX,XX @@ static void generate_exception_mtval(DisasContext *ctx, int excp) | ||
18 | ctx->base.is_jmp = DISAS_NORETURN; | ||
19 | } | ||
20 | |||
21 | -static void gen_exception_debug(void) | ||
22 | -{ | ||
23 | - gen_helper_raise_exception(cpu_env, tcg_constant_i32(EXCP_DEBUG)); | ||
24 | -} | ||
25 | - | ||
26 | -/* Wrapper around tcg_gen_exit_tb that handles single stepping */ | ||
27 | -static void exit_tb(DisasContext *ctx) | ||
28 | -{ | ||
29 | - if (ctx->base.singlestep_enabled) { | ||
30 | - gen_exception_debug(); | ||
31 | - } else { | ||
32 | - tcg_gen_exit_tb(NULL, 0); | ||
33 | - } | ||
34 | -} | ||
35 | - | ||
36 | -/* Wrapper around tcg_gen_lookup_and_goto_ptr that handles single stepping */ | ||
37 | -static void lookup_and_goto_ptr(DisasContext *ctx) | ||
38 | -{ | ||
39 | - if (ctx->base.singlestep_enabled) { | ||
40 | - gen_exception_debug(); | ||
41 | - } else { | ||
42 | - tcg_gen_lookup_and_goto_ptr(); | ||
43 | - } | ||
44 | -} | ||
45 | - | ||
46 | static void gen_exception_illegal(DisasContext *ctx) | ||
47 | { | ||
48 | generate_exception(ctx, RISCV_EXCP_ILLEGAL_INST); | ||
49 | @@ -XXX,XX +XXX,XX @@ static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest) | ||
50 | tcg_gen_exit_tb(ctx->base.tb, n); | ||
51 | } else { | ||
52 | tcg_gen_movi_tl(cpu_pc, dest); | ||
53 | - lookup_and_goto_ptr(ctx); | ||
54 | + tcg_gen_lookup_and_goto_ptr(); | ||
55 | } | ||
56 | } | ||
57 | |||
58 | diff --git a/target/riscv/insn_trans/trans_privileged.c.inc b/target/riscv/insn_trans/trans_privileged.c.inc | ||
59 | index XXXXXXX..XXXXXXX 100644 | ||
60 | --- a/target/riscv/insn_trans/trans_privileged.c.inc | ||
61 | +++ b/target/riscv/insn_trans/trans_privileged.c.inc | ||
62 | @@ -XXX,XX +XXX,XX @@ static bool trans_sret(DisasContext *ctx, arg_sret *a) | ||
63 | |||
64 | if (has_ext(ctx, RVS)) { | ||
65 | gen_helper_sret(cpu_pc, cpu_env, cpu_pc); | ||
66 | - exit_tb(ctx); /* no chaining */ | ||
67 | + tcg_gen_exit_tb(NULL, 0); /* no chaining */ | ||
68 | ctx->base.is_jmp = DISAS_NORETURN; | ||
69 | } else { | ||
70 | return false; | ||
71 | @@ -XXX,XX +XXX,XX @@ static bool trans_mret(DisasContext *ctx, arg_mret *a) | ||
72 | #ifndef CONFIG_USER_ONLY | ||
73 | tcg_gen_movi_tl(cpu_pc, ctx->base.pc_next); | ||
74 | gen_helper_mret(cpu_pc, cpu_env, cpu_pc); | ||
75 | - exit_tb(ctx); /* no chaining */ | ||
76 | + tcg_gen_exit_tb(NULL, 0); /* no chaining */ | ||
77 | ctx->base.is_jmp = DISAS_NORETURN; | ||
78 | return true; | ||
79 | #else | ||
80 | diff --git a/target/riscv/insn_trans/trans_rvi.c.inc b/target/riscv/insn_trans/trans_rvi.c.inc | ||
81 | index XXXXXXX..XXXXXXX 100644 | ||
82 | --- a/target/riscv/insn_trans/trans_rvi.c.inc | ||
83 | +++ b/target/riscv/insn_trans/trans_rvi.c.inc | ||
84 | @@ -XXX,XX +XXX,XX @@ static bool trans_jalr(DisasContext *ctx, arg_jalr *a) | ||
85 | if (a->rd != 0) { | ||
86 | tcg_gen_movi_tl(cpu_gpr[a->rd], ctx->pc_succ_insn); | ||
87 | } | ||
88 | - | ||
89 | - /* No chaining with JALR. */ | ||
90 | - lookup_and_goto_ptr(ctx); | ||
91 | + tcg_gen_lookup_and_goto_ptr(); | ||
92 | |||
93 | if (misaligned) { | ||
94 | gen_set_label(misaligned); | ||
95 | @@ -XXX,XX +XXX,XX @@ static bool trans_fence_i(DisasContext *ctx, arg_fence_i *a) | ||
96 | * however we need to end the translation block | ||
97 | */ | ||
98 | tcg_gen_movi_tl(cpu_pc, ctx->pc_succ_insn); | ||
99 | - exit_tb(ctx); | ||
100 | + tcg_gen_exit_tb(NULL, 0); | ||
101 | ctx->base.is_jmp = DISAS_NORETURN; | ||
102 | return true; | ||
103 | } | ||
104 | @@ -XXX,XX +XXX,XX @@ static bool do_csr_post(DisasContext *ctx) | ||
105 | { | ||
106 | /* We may have changed important cpu state -- exit to main loop. */ | ||
107 | tcg_gen_movi_tl(cpu_pc, ctx->pc_succ_insn); | ||
108 | - exit_tb(ctx); | ||
109 | + tcg_gen_exit_tb(NULL, 0); | ||
110 | ctx->base.is_jmp = DISAS_NORETURN; | ||
111 | return true; | ||
112 | } | ||
113 | diff --git a/target/riscv/insn_trans/trans_rvv.c.inc b/target/riscv/insn_trans/trans_rvv.c.inc | ||
114 | index XXXXXXX..XXXXXXX 100644 | ||
115 | --- a/target/riscv/insn_trans/trans_rvv.c.inc | ||
116 | +++ b/target/riscv/insn_trans/trans_rvv.c.inc | ||
117 | @@ -XXX,XX +XXX,XX @@ static bool trans_vsetvl(DisasContext *ctx, arg_vsetvl *a) | ||
118 | gen_set_gpr(ctx, a->rd, dst); | ||
119 | |||
120 | tcg_gen_movi_tl(cpu_pc, ctx->pc_succ_insn); | ||
121 | - lookup_and_goto_ptr(ctx); | ||
122 | + tcg_gen_lookup_and_goto_ptr(); | ||
123 | ctx->base.is_jmp = DISAS_NORETURN; | ||
124 | return true; | ||
125 | } | ||
126 | -- | ||
127 | 2.25.1 | ||
128 | |||
129 | diff view generated by jsdifflib |
1 | The cmp_vec opcode is mandatory; this symbol is unused. | 1 | GDB single-stepping is now handled generically. |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 3 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
5 | --- | 5 | --- |
6 | tcg/aarch64/tcg-target.h | 1 - | 6 | target/rx/helper.h | 1 - |
7 | tcg/i386/tcg-target.h | 1 - | 7 | target/rx/op_helper.c | 8 -------- |
8 | tcg/ppc/tcg-target.h | 1 - | 8 | target/rx/translate.c | 12 ++---------- |
9 | 3 files changed, 3 deletions(-) | 9 | 3 files changed, 2 insertions(+), 19 deletions(-) |
10 | 10 | ||
11 | diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h | 11 | diff --git a/target/rx/helper.h b/target/rx/helper.h |
12 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/tcg/aarch64/tcg-target.h | 13 | --- a/target/rx/helper.h |
14 | +++ b/tcg/aarch64/tcg-target.h | 14 | +++ b/target/rx/helper.h |
15 | @@ -XXX,XX +XXX,XX @@ typedef enum { | 15 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_1(raise_illegal_instruction, noreturn, env) |
16 | #define TCG_TARGET_HAS_shi_vec 1 | 16 | DEF_HELPER_1(raise_access_fault, noreturn, env) |
17 | #define TCG_TARGET_HAS_shs_vec 0 | 17 | DEF_HELPER_1(raise_privilege_violation, noreturn, env) |
18 | #define TCG_TARGET_HAS_shv_vec 1 | 18 | DEF_HELPER_1(wait, noreturn, env) |
19 | -#define TCG_TARGET_HAS_cmp_vec 1 | 19 | -DEF_HELPER_1(debug, noreturn, env) |
20 | #define TCG_TARGET_HAS_mul_vec 1 | 20 | DEF_HELPER_2(rxint, noreturn, env, i32) |
21 | #define TCG_TARGET_HAS_sat_vec 1 | 21 | DEF_HELPER_1(rxbrk, noreturn, env) |
22 | #define TCG_TARGET_HAS_minmax_vec 1 | 22 | DEF_HELPER_FLAGS_3(fadd, TCG_CALL_NO_WG, f32, env, f32, f32) |
23 | diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h | 23 | diff --git a/target/rx/op_helper.c b/target/rx/op_helper.c |
24 | index XXXXXXX..XXXXXXX 100644 | 24 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/tcg/i386/tcg-target.h | 25 | --- a/target/rx/op_helper.c |
26 | +++ b/tcg/i386/tcg-target.h | 26 | +++ b/target/rx/op_helper.c |
27 | @@ -XXX,XX +XXX,XX @@ extern bool have_avx2; | 27 | @@ -XXX,XX +XXX,XX @@ void QEMU_NORETURN helper_wait(CPURXState *env) |
28 | #define TCG_TARGET_HAS_shi_vec 1 | 28 | raise_exception(env, EXCP_HLT, 0); |
29 | #define TCG_TARGET_HAS_shs_vec 1 | 29 | } |
30 | #define TCG_TARGET_HAS_shv_vec have_avx2 | 30 | |
31 | -#define TCG_TARGET_HAS_cmp_vec 1 | 31 | -void QEMU_NORETURN helper_debug(CPURXState *env) |
32 | #define TCG_TARGET_HAS_mul_vec 1 | 32 | -{ |
33 | #define TCG_TARGET_HAS_sat_vec 1 | 33 | - CPUState *cs = env_cpu(env); |
34 | #define TCG_TARGET_HAS_minmax_vec 1 | 34 | - |
35 | diff --git a/tcg/ppc/tcg-target.h b/tcg/ppc/tcg-target.h | 35 | - cs->exception_index = EXCP_DEBUG; |
36 | - cpu_loop_exit(cs); | ||
37 | -} | ||
38 | - | ||
39 | void QEMU_NORETURN helper_rxint(CPURXState *env, uint32_t vec) | ||
40 | { | ||
41 | raise_exception(env, 0x100 + vec, 0); | ||
42 | diff --git a/target/rx/translate.c b/target/rx/translate.c | ||
36 | index XXXXXXX..XXXXXXX 100644 | 43 | index XXXXXXX..XXXXXXX 100644 |
37 | --- a/tcg/ppc/tcg-target.h | 44 | --- a/target/rx/translate.c |
38 | +++ b/tcg/ppc/tcg-target.h | 45 | +++ b/target/rx/translate.c |
39 | @@ -XXX,XX +XXX,XX @@ extern bool have_vsx; | 46 | @@ -XXX,XX +XXX,XX @@ static void gen_goto_tb(DisasContext *dc, int n, target_ulong dest) |
40 | #define TCG_TARGET_HAS_shi_vec 0 | 47 | tcg_gen_exit_tb(dc->base.tb, n); |
41 | #define TCG_TARGET_HAS_shs_vec 0 | 48 | } else { |
42 | #define TCG_TARGET_HAS_shv_vec 1 | 49 | tcg_gen_movi_i32(cpu_pc, dest); |
43 | -#define TCG_TARGET_HAS_cmp_vec 1 | 50 | - if (dc->base.singlestep_enabled) { |
44 | #define TCG_TARGET_HAS_mul_vec 1 | 51 | - gen_helper_debug(cpu_env); |
45 | #define TCG_TARGET_HAS_sat_vec 1 | 52 | - } else { |
46 | #define TCG_TARGET_HAS_minmax_vec 1 | 53 | - tcg_gen_lookup_and_goto_ptr(); |
54 | - } | ||
55 | + tcg_gen_lookup_and_goto_ptr(); | ||
56 | } | ||
57 | dc->base.is_jmp = DISAS_NORETURN; | ||
58 | } | ||
59 | @@ -XXX,XX +XXX,XX @@ static void rx_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) | ||
60 | gen_goto_tb(ctx, 0, dcbase->pc_next); | ||
61 | break; | ||
62 | case DISAS_JUMP: | ||
63 | - if (ctx->base.singlestep_enabled) { | ||
64 | - gen_helper_debug(cpu_env); | ||
65 | - } else { | ||
66 | - tcg_gen_lookup_and_goto_ptr(); | ||
67 | - } | ||
68 | + tcg_gen_lookup_and_goto_ptr(); | ||
69 | break; | ||
70 | case DISAS_UPDATE: | ||
71 | tcg_gen_movi_i32(cpu_pc, ctx->base.pc_next); | ||
47 | -- | 72 | -- |
48 | 2.25.1 | 73 | 2.25.1 |
49 | 74 | ||
50 | 75 | diff view generated by jsdifflib |
1 | When the two arguments are identical, this can be reduced to | 1 | GDB single-stepping is now handled generically. |
---|---|---|---|
2 | dup_vec or to mov_vec from a tcg_constant_vec. | ||
3 | 2 | ||
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
5 | --- | 4 | --- |
6 | tcg/optimize.c | 15 +++++++++++++++ | 5 | target/s390x/tcg/translate.c | 8 ++------ |
7 | 1 file changed, 15 insertions(+) | 6 | 1 file changed, 2 insertions(+), 6 deletions(-) |
8 | 7 | ||
9 | diff --git a/tcg/optimize.c b/tcg/optimize.c | 8 | diff --git a/target/s390x/tcg/translate.c b/target/s390x/tcg/translate.c |
10 | index XXXXXXX..XXXXXXX 100644 | 9 | index XXXXXXX..XXXXXXX 100644 |
11 | --- a/tcg/optimize.c | 10 | --- a/target/s390x/tcg/translate.c |
12 | +++ b/tcg/optimize.c | 11 | +++ b/target/s390x/tcg/translate.c |
13 | @@ -XXX,XX +XXX,XX @@ void tcg_optimize(TCGContext *s) | 12 | @@ -XXX,XX +XXX,XX @@ struct DisasContext { |
14 | } | 13 | uint64_t pc_tmp; |
15 | goto do_default; | 14 | uint32_t ilen; |
16 | 15 | enum cc_op cc_op; | |
17 | + case INDEX_op_dup2_vec: | 16 | - bool do_debug; |
18 | + assert(TCG_TARGET_REG_BITS == 32); | 17 | }; |
19 | + if (arg_is_const(op->args[1]) && arg_is_const(op->args[2])) { | 18 | |
20 | + tmp = arg_info(op->args[1])->val; | 19 | /* Information carried about a condition to be evaluated. */ |
21 | + if (tmp == arg_info(op->args[2])->val) { | 20 | @@ -XXX,XX +XXX,XX @@ static void s390x_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) |
22 | + tcg_opt_gen_movi(s, op, op->args[0], tmp); | 21 | |
23 | + break; | 22 | dc->cc_op = CC_OP_DYNAMIC; |
24 | + } | 23 | dc->ex_value = dc->base.tb->cs_base; |
25 | + } else if (args_are_copies(op->args[1], op->args[2])) { | 24 | - dc->do_debug = dc->base.singlestep_enabled; |
26 | + op->opc = INDEX_op_dup_vec; | 25 | } |
27 | + TCGOP_VECE(op) = MO_32; | 26 | |
28 | + nb_iargs = 1; | 27 | static void s390x_tr_tb_start(DisasContextBase *db, CPUState *cs) |
29 | + } | 28 | @@ -XXX,XX +XXX,XX @@ static void s390x_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) |
30 | + goto do_default; | 29 | /* FALLTHRU */ |
31 | + | 30 | case DISAS_PC_CC_UPDATED: |
32 | CASE_OP_32_64(not): | 31 | /* Exit the TB, either by raising a debug exception or by return. */ |
33 | CASE_OP_32_64(neg): | 32 | - if (dc->do_debug) { |
34 | CASE_OP_32_64(ext8s): | 33 | - gen_exception(EXCP_DEBUG); |
34 | - } else if ((dc->base.tb->flags & FLAG_MASK_PER) || | ||
35 | - dc->base.is_jmp == DISAS_PC_STALE_NOCHAIN) { | ||
36 | + if ((dc->base.tb->flags & FLAG_MASK_PER) || | ||
37 | + dc->base.is_jmp == DISAS_PC_STALE_NOCHAIN) { | ||
38 | tcg_gen_exit_tb(NULL, 0); | ||
39 | } else { | ||
40 | tcg_gen_lookup_and_goto_ptr(); | ||
35 | -- | 41 | -- |
36 | 2.25.1 | 42 | 2.25.1 |
37 | 43 | ||
38 | 44 | diff view generated by jsdifflib |
1 | The last user of this field disappeared in f69d277ece4. | 1 | GDB single-stepping is now handled generically. |
---|---|---|---|
2 | 2 | ||
3 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 3 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
5 | --- | 5 | --- |
6 | include/tcg/tcg.h | 3 --- | 6 | target/sh4/helper.h | 1 - |
7 | 1 file changed, 3 deletions(-) | 7 | target/sh4/op_helper.c | 5 ----- |
8 | target/sh4/translate.c | 14 +++----------- | ||
9 | 3 files changed, 3 insertions(+), 17 deletions(-) | ||
8 | 10 | ||
9 | diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h | 11 | diff --git a/target/sh4/helper.h b/target/sh4/helper.h |
10 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
11 | --- a/include/tcg/tcg.h | 13 | --- a/target/sh4/helper.h |
12 | +++ b/include/tcg/tcg.h | 14 | +++ b/target/sh4/helper.h |
13 | @@ -XXX,XX +XXX,XX @@ typedef struct TCGOpDef { | 15 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_1(raise_illegal_instruction, noreturn, env) |
14 | uint8_t nb_oargs, nb_iargs, nb_cargs, nb_args; | 16 | DEF_HELPER_1(raise_slot_illegal_instruction, noreturn, env) |
15 | uint8_t flags; | 17 | DEF_HELPER_1(raise_fpu_disable, noreturn, env) |
16 | TCGArgConstraint *args_ct; | 18 | DEF_HELPER_1(raise_slot_fpu_disable, noreturn, env) |
17 | -#if defined(CONFIG_DEBUG_TCG) | 19 | -DEF_HELPER_1(debug, noreturn, env) |
18 | - int used; | 20 | DEF_HELPER_1(sleep, noreturn, env) |
19 | -#endif | 21 | DEF_HELPER_2(trapa, noreturn, env, i32) |
20 | } TCGOpDef; | 22 | DEF_HELPER_1(exclusive, noreturn, env) |
21 | 23 | diff --git a/target/sh4/op_helper.c b/target/sh4/op_helper.c | |
22 | extern TCGOpDef tcg_op_defs[]; | 24 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/target/sh4/op_helper.c | ||
26 | +++ b/target/sh4/op_helper.c | ||
27 | @@ -XXX,XX +XXX,XX @@ void helper_raise_slot_fpu_disable(CPUSH4State *env) | ||
28 | raise_exception(env, 0x820, 0); | ||
29 | } | ||
30 | |||
31 | -void helper_debug(CPUSH4State *env) | ||
32 | -{ | ||
33 | - raise_exception(env, EXCP_DEBUG, 0); | ||
34 | -} | ||
35 | - | ||
36 | void helper_sleep(CPUSH4State *env) | ||
37 | { | ||
38 | CPUState *cs = env_cpu(env); | ||
39 | diff --git a/target/sh4/translate.c b/target/sh4/translate.c | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/target/sh4/translate.c | ||
42 | +++ b/target/sh4/translate.c | ||
43 | @@ -XXX,XX +XXX,XX @@ static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest) | ||
44 | tcg_gen_exit_tb(ctx->base.tb, n); | ||
45 | } else { | ||
46 | tcg_gen_movi_i32(cpu_pc, dest); | ||
47 | - if (ctx->base.singlestep_enabled) { | ||
48 | - gen_helper_debug(cpu_env); | ||
49 | - } else if (use_exit_tb(ctx)) { | ||
50 | + if (use_exit_tb(ctx)) { | ||
51 | tcg_gen_exit_tb(NULL, 0); | ||
52 | } else { | ||
53 | tcg_gen_lookup_and_goto_ptr(); | ||
54 | @@ -XXX,XX +XXX,XX @@ static void gen_jump(DisasContext * ctx) | ||
55 | delayed jump as immediate jump are conditinal jumps */ | ||
56 | tcg_gen_mov_i32(cpu_pc, cpu_delayed_pc); | ||
57 | tcg_gen_discard_i32(cpu_delayed_pc); | ||
58 | - if (ctx->base.singlestep_enabled) { | ||
59 | - gen_helper_debug(cpu_env); | ||
60 | - } else if (use_exit_tb(ctx)) { | ||
61 | + if (use_exit_tb(ctx)) { | ||
62 | tcg_gen_exit_tb(NULL, 0); | ||
63 | } else { | ||
64 | tcg_gen_lookup_and_goto_ptr(); | ||
65 | @@ -XXX,XX +XXX,XX @@ static void sh4_tr_tb_stop(DisasContextBase *dcbase, CPUState *cs) | ||
66 | switch (ctx->base.is_jmp) { | ||
67 | case DISAS_STOP: | ||
68 | gen_save_cpu_state(ctx, true); | ||
69 | - if (ctx->base.singlestep_enabled) { | ||
70 | - gen_helper_debug(cpu_env); | ||
71 | - } else { | ||
72 | - tcg_gen_exit_tb(NULL, 0); | ||
73 | - } | ||
74 | + tcg_gen_exit_tb(NULL, 0); | ||
75 | break; | ||
76 | case DISAS_NEXT: | ||
77 | case DISAS_TOO_MANY: | ||
23 | -- | 78 | -- |
24 | 2.25.1 | 79 | 2.25.1 |
25 | 80 | ||
26 | 81 | diff view generated by jsdifflib |
1 | With larger vector sizes, it turns out oprsz == maxsz, and we only | 1 | GDB single-stepping is now handled generically. |
---|---|---|---|
2 | need to represent mismatch for oprsz <= 32. We do, however, need | ||
3 | to represent larger oprsz and do so without reducing SIMD_DATA_BITS. | ||
4 | 2 | ||
5 | Reduce the size of the oprsz field and increase the maxsz field. | ||
6 | Steal the oprsz value of 24 to indicate equality with maxsz. | ||
7 | |||
8 | Tested-by: Frank Chang <frank.chang@sifive.com> | ||
9 | Reviewed-by: Frank Chang <frank.chang@sifive.com> | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 3 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
11 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 4 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
12 | --- | 5 | --- |
13 | include/tcg/tcg-gvec-desc.h | 38 ++++++++++++++++++++++++------------- | 6 | target/tricore/helper.h | 1 - |
14 | tcg/tcg-op-gvec.c | 35 ++++++++++++++++++++++++++-------- | 7 | target/tricore/op_helper.c | 7 ------- |
15 | 2 files changed, 52 insertions(+), 21 deletions(-) | 8 | target/tricore/translate.c | 14 +------------- |
9 | 3 files changed, 1 insertion(+), 21 deletions(-) | ||
16 | 10 | ||
17 | diff --git a/include/tcg/tcg-gvec-desc.h b/include/tcg/tcg-gvec-desc.h | 11 | diff --git a/target/tricore/helper.h b/target/tricore/helper.h |
18 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/include/tcg/tcg-gvec-desc.h | 13 | --- a/target/tricore/helper.h |
20 | +++ b/include/tcg/tcg-gvec-desc.h | 14 | +++ b/target/tricore/helper.h |
21 | @@ -XXX,XX +XXX,XX @@ | 15 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_2(psw_write, void, env, i32) |
22 | #ifndef TCG_TCG_GVEC_DESC_H | 16 | DEF_HELPER_1(psw_read, i32, env) |
23 | #define TCG_TCG_GVEC_DESC_H | 17 | /* Exceptions */ |
24 | 18 | DEF_HELPER_3(raise_exception_sync, noreturn, env, i32, i32) | |
25 | -/* ??? These bit widths are set for ARM SVE, maxing out at 256 byte vectors. */ | 19 | -DEF_HELPER_2(qemu_excp, noreturn, env, i32) |
26 | -#define SIMD_OPRSZ_SHIFT 0 | 20 | diff --git a/target/tricore/op_helper.c b/target/tricore/op_helper.c |
27 | -#define SIMD_OPRSZ_BITS 5 | 21 | index XXXXXXX..XXXXXXX 100644 |
28 | +/* | 22 | --- a/target/tricore/op_helper.c |
29 | + * This configuration allows MAXSZ to represent 2048 bytes, and | 23 | +++ b/target/tricore/op_helper.c |
30 | + * OPRSZ to match MAXSZ, or represent the smaller values 8, 16, or 32. | 24 | @@ -XXX,XX +XXX,XX @@ static void raise_exception_sync_helper(CPUTriCoreState *env, uint32_t class, |
31 | + * | 25 | raise_exception_sync_internal(env, class, tin, pc, 0); |
32 | + * Encode this with: | 26 | } |
33 | + * 0, 1, 3 -> 8, 16, 32 | 27 | |
34 | + * 2 -> maxsz | 28 | -void helper_qemu_excp(CPUTriCoreState *env, uint32_t excp) |
35 | + * | ||
36 | + * This steals the input that would otherwise map to 24 to match maxsz. | ||
37 | + */ | ||
38 | +#define SIMD_MAXSZ_SHIFT 0 | ||
39 | +#define SIMD_MAXSZ_BITS 8 | ||
40 | |||
41 | -#define SIMD_MAXSZ_SHIFT (SIMD_OPRSZ_SHIFT + SIMD_OPRSZ_BITS) | ||
42 | -#define SIMD_MAXSZ_BITS 5 | ||
43 | +#define SIMD_OPRSZ_SHIFT (SIMD_MAXSZ_SHIFT + SIMD_MAXSZ_BITS) | ||
44 | +#define SIMD_OPRSZ_BITS 2 | ||
45 | |||
46 | -#define SIMD_DATA_SHIFT (SIMD_MAXSZ_SHIFT + SIMD_MAXSZ_BITS) | ||
47 | +#define SIMD_DATA_SHIFT (SIMD_OPRSZ_SHIFT + SIMD_OPRSZ_BITS) | ||
48 | #define SIMD_DATA_BITS (32 - SIMD_DATA_SHIFT) | ||
49 | |||
50 | /* Create a descriptor from components. */ | ||
51 | uint32_t simd_desc(uint32_t oprsz, uint32_t maxsz, int32_t data); | ||
52 | |||
53 | -/* Extract the operation size from a descriptor. */ | ||
54 | -static inline intptr_t simd_oprsz(uint32_t desc) | ||
55 | -{ | 29 | -{ |
56 | - return (extract32(desc, SIMD_OPRSZ_SHIFT, SIMD_OPRSZ_BITS) + 1) * 8; | 30 | - CPUState *cs = env_cpu(env); |
31 | - cs->exception_index = excp; | ||
32 | - cpu_loop_exit(cs); | ||
57 | -} | 33 | -} |
58 | - | 34 | - |
59 | /* Extract the max vector size from a descriptor. */ | 35 | /* Addressing mode helper */ |
60 | static inline intptr_t simd_maxsz(uint32_t desc) | 36 | |
37 | static uint16_t reverse16(uint16_t val) | ||
38 | diff --git a/target/tricore/translate.c b/target/tricore/translate.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/target/tricore/translate.c | ||
41 | +++ b/target/tricore/translate.c | ||
42 | @@ -XXX,XX +XXX,XX @@ static inline void gen_save_pc(target_ulong pc) | ||
43 | tcg_gen_movi_tl(cpu_PC, pc); | ||
44 | } | ||
45 | |||
46 | -static void generate_qemu_excp(DisasContext *ctx, int excp) | ||
47 | -{ | ||
48 | - TCGv_i32 tmp = tcg_const_i32(excp); | ||
49 | - gen_helper_qemu_excp(cpu_env, tmp); | ||
50 | - ctx->base.is_jmp = DISAS_NORETURN; | ||
51 | - tcg_temp_free(tmp); | ||
52 | -} | ||
53 | - | ||
54 | static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest) | ||
61 | { | 55 | { |
62 | - return (extract32(desc, SIMD_MAXSZ_SHIFT, SIMD_MAXSZ_BITS) + 1) * 8; | 56 | if (translator_use_goto_tb(&ctx->base, dest)) { |
63 | + return extract32(desc, SIMD_MAXSZ_SHIFT, SIMD_MAXSZ_BITS) * 8 + 8; | 57 | @@ -XXX,XX +XXX,XX @@ static void gen_goto_tb(DisasContext *ctx, int n, target_ulong dest) |
64 | +} | 58 | tcg_gen_exit_tb(ctx->base.tb, n); |
65 | + | 59 | } else { |
66 | +/* Extract the operation size from a descriptor. */ | 60 | gen_save_pc(dest); |
67 | +static inline intptr_t simd_oprsz(uint32_t desc) | 61 | - if (ctx->base.singlestep_enabled) { |
68 | +{ | 62 | - generate_qemu_excp(ctx, EXCP_DEBUG); |
69 | + uint32_t f = extract32(desc, SIMD_OPRSZ_SHIFT, SIMD_OPRSZ_BITS); | 63 | - } else { |
70 | + intptr_t o = f * 8 + 8; | 64 | - tcg_gen_lookup_and_goto_ptr(); |
71 | + intptr_t m = simd_maxsz(desc); | 65 | - } |
72 | + return f == 2 ? m : o; | 66 | + tcg_gen_lookup_and_goto_ptr(); |
67 | } | ||
73 | } | 68 | } |
74 | 69 | ||
75 | /* Extract the operation-specific data from a descriptor. */ | ||
76 | diff --git a/tcg/tcg-op-gvec.c b/tcg/tcg-op-gvec.c | ||
77 | index XXXXXXX..XXXXXXX 100644 | ||
78 | --- a/tcg/tcg-op-gvec.c | ||
79 | +++ b/tcg/tcg-op-gvec.c | ||
80 | @@ -XXX,XX +XXX,XX @@ static const TCGOpcode vecop_list_empty[1] = { 0 }; | ||
81 | of the operand offsets so that we can check them all at once. */ | ||
82 | static void check_size_align(uint32_t oprsz, uint32_t maxsz, uint32_t ofs) | ||
83 | { | ||
84 | - uint32_t opr_align = oprsz >= 16 ? 15 : 7; | ||
85 | - uint32_t max_align = maxsz >= 16 || oprsz >= 16 ? 15 : 7; | ||
86 | - tcg_debug_assert(oprsz > 0); | ||
87 | - tcg_debug_assert(oprsz <= maxsz); | ||
88 | - tcg_debug_assert((oprsz & opr_align) == 0); | ||
89 | + uint32_t max_align; | ||
90 | + | ||
91 | + switch (oprsz) { | ||
92 | + case 8: | ||
93 | + case 16: | ||
94 | + case 32: | ||
95 | + tcg_debug_assert(oprsz <= maxsz); | ||
96 | + break; | ||
97 | + default: | ||
98 | + tcg_debug_assert(oprsz == maxsz); | ||
99 | + break; | ||
100 | + } | ||
101 | + tcg_debug_assert(maxsz <= (8 << SIMD_MAXSZ_BITS)); | ||
102 | + | ||
103 | + max_align = maxsz >= 16 ? 15 : 7; | ||
104 | tcg_debug_assert((maxsz & max_align) == 0); | ||
105 | tcg_debug_assert((ofs & max_align) == 0); | ||
106 | } | ||
107 | @@ -XXX,XX +XXX,XX @@ uint32_t simd_desc(uint32_t oprsz, uint32_t maxsz, int32_t data) | ||
108 | { | ||
109 | uint32_t desc = 0; | ||
110 | |||
111 | - assert(oprsz % 8 == 0 && oprsz <= (8 << SIMD_OPRSZ_BITS)); | ||
112 | - assert(maxsz % 8 == 0 && maxsz <= (8 << SIMD_MAXSZ_BITS)); | ||
113 | - assert(data == sextract32(data, 0, SIMD_DATA_BITS)); | ||
114 | + check_size_align(oprsz, maxsz, 0); | ||
115 | + tcg_debug_assert(data == sextract32(data, 0, SIMD_DATA_BITS)); | ||
116 | |||
117 | oprsz = (oprsz / 8) - 1; | ||
118 | maxsz = (maxsz / 8) - 1; | ||
119 | + | ||
120 | + /* | ||
121 | + * We have just asserted in check_size_align that either | ||
122 | + * oprsz is {8,16,32} or matches maxsz. Encode the final | ||
123 | + * case with '2', as that would otherwise map to 24. | ||
124 | + */ | ||
125 | + if (oprsz == maxsz) { | ||
126 | + oprsz = 2; | ||
127 | + } | ||
128 | + | ||
129 | desc = deposit32(desc, SIMD_OPRSZ_SHIFT, SIMD_OPRSZ_BITS, oprsz); | ||
130 | desc = deposit32(desc, SIMD_MAXSZ_SHIFT, SIMD_MAXSZ_BITS, maxsz); | ||
131 | desc = deposit32(desc, SIMD_DATA_SHIFT, SIMD_DATA_BITS, data); | ||
132 | -- | 70 | -- |
133 | 2.25.1 | 71 | 2.25.1 |
134 | 72 | ||
135 | 73 | diff view generated by jsdifflib |
1 | This wasn't actually used for anything, really. All variable | 1 | GDB single-stepping is now handled generically. |
---|---|---|---|
2 | operands must accept registers, and which are indicated by the | ||
3 | set in TCGArgConstraint.regs. | ||
4 | 2 | ||
5 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 3 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
6 | --- | 4 | --- |
7 | include/tcg/tcg.h | 1 - | 5 | target/xtensa/translate.c | 25 ++++++++----------------- |
8 | tcg/tcg.c | 15 ++++----------- | 6 | 1 file changed, 8 insertions(+), 17 deletions(-) |
9 | tcg/aarch64/tcg-target.c.inc | 3 --- | ||
10 | tcg/arm/tcg-target.c.inc | 3 --- | ||
11 | tcg/i386/tcg-target.c.inc | 11 ----------- | ||
12 | tcg/mips/tcg-target.c.inc | 3 --- | ||
13 | tcg/ppc/tcg-target.c.inc | 5 ----- | ||
14 | tcg/riscv/tcg-target.c.inc | 2 -- | ||
15 | tcg/s390/tcg-target.c.inc | 4 ---- | ||
16 | tcg/sparc/tcg-target.c.inc | 5 ----- | ||
17 | tcg/tci/tcg-target.c.inc | 1 - | ||
18 | 11 files changed, 4 insertions(+), 49 deletions(-) | ||
19 | 7 | ||
20 | diff --git a/include/tcg/tcg.h b/include/tcg/tcg.h | 8 | diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c |
21 | index XXXXXXX..XXXXXXX 100644 | 9 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/include/tcg/tcg.h | 10 | --- a/target/xtensa/translate.c |
23 | +++ b/include/tcg/tcg.h | 11 | +++ b/target/xtensa/translate.c |
24 | @@ -XXX,XX +XXX,XX @@ void tcg_dump_op_count(void); | 12 | @@ -XXX,XX +XXX,XX @@ static void gen_jump_slot(DisasContext *dc, TCGv dest, int slot) |
25 | #define TCG_CT_ALIAS 0x80 | 13 | if (dc->icount) { |
26 | #define TCG_CT_IALIAS 0x40 | 14 | tcg_gen_mov_i32(cpu_SR[ICOUNT], dc->next_icount); |
27 | #define TCG_CT_NEWREG 0x20 /* output requires a new register */ | 15 | } |
28 | -#define TCG_CT_REG 0x01 | 16 | - if (dc->base.singlestep_enabled) { |
29 | #define TCG_CT_CONST 0x02 /* any constant of register size */ | 17 | - gen_exception(dc, EXCP_DEBUG); |
30 | 18 | + if (dc->op_flags & XTENSA_OP_POSTPROCESS) { | |
31 | typedef struct TCGArgConstraint { | 19 | + slot = gen_postprocess(dc, slot); |
32 | diff --git a/tcg/tcg.c b/tcg/tcg.c | 20 | + } |
33 | index XXXXXXX..XXXXXXX 100644 | 21 | + if (slot >= 0) { |
34 | --- a/tcg/tcg.c | 22 | + tcg_gen_goto_tb(slot); |
35 | +++ b/tcg/tcg.c | 23 | + tcg_gen_exit_tb(dc->base.tb, slot); |
36 | @@ -XXX,XX +XXX,XX @@ static void tcg_dump_ops(TCGContext *s, bool have_prefs) | ||
37 | /* we give more priority to constraints with less registers */ | ||
38 | static int get_constraint_priority(const TCGOpDef *def, int k) | ||
39 | { | ||
40 | - const TCGArgConstraint *arg_ct; | ||
41 | + const TCGArgConstraint *arg_ct = &def->args_ct[k]; | ||
42 | + int n; | ||
43 | |||
44 | - int i, n; | ||
45 | - arg_ct = &def->args_ct[k]; | ||
46 | if (arg_ct->ct & TCG_CT_ALIAS) { | ||
47 | /* an alias is equivalent to a single register */ | ||
48 | n = 1; | ||
49 | } else { | 24 | } else { |
50 | - if (!(arg_ct->ct & TCG_CT_REG)) | 25 | - if (dc->op_flags & XTENSA_OP_POSTPROCESS) { |
51 | - return 0; | 26 | - slot = gen_postprocess(dc, slot); |
52 | - n = 0; | ||
53 | - for(i = 0; i < TCG_TARGET_NB_REGS; i++) { | ||
54 | - if (tcg_regset_test_reg(arg_ct->regs, i)) | ||
55 | - n++; | ||
56 | - } | 27 | - } |
57 | + n = ctpop64(arg_ct->regs); | 28 | - if (slot >= 0) { |
29 | - tcg_gen_goto_tb(slot); | ||
30 | - tcg_gen_exit_tb(dc->base.tb, slot); | ||
31 | - } else { | ||
32 | - tcg_gen_exit_tb(NULL, 0); | ||
33 | - } | ||
34 | + tcg_gen_exit_tb(NULL, 0); | ||
58 | } | 35 | } |
59 | return TCG_TARGET_NB_REGS - n + 1; | 36 | dc->base.is_jmp = DISAS_NORETURN; |
60 | } | 37 | } |
61 | @@ -XXX,XX +XXX,XX @@ static void process_op_defs(TCGContext *s) | 38 | @@ -XXX,XX +XXX,XX @@ static void xtensa_tr_tb_stop(DisasContextBase *dcbase, CPUState *cpu) |
62 | int oarg = *ct_str - '0'; | 39 | case DISAS_NORETURN: |
63 | tcg_debug_assert(ct_str == tdefs->args_ct_str[i]); | ||
64 | tcg_debug_assert(oarg < def->nb_oargs); | ||
65 | - tcg_debug_assert(def->args_ct[oarg].ct & TCG_CT_REG); | ||
66 | + tcg_debug_assert(def->args_ct[oarg].regs != 0); | ||
67 | /* TCG_CT_ALIAS is for the output arguments. | ||
68 | The input is tagged with TCG_CT_IALIAS. */ | ||
69 | def->args_ct[i] = def->args_ct[oarg]; | ||
70 | diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc | ||
71 | index XXXXXXX..XXXXXXX 100644 | ||
72 | --- a/tcg/aarch64/tcg-target.c.inc | ||
73 | +++ b/tcg/aarch64/tcg-target.c.inc | ||
74 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
75 | { | ||
76 | switch (*ct_str++) { | ||
77 | case 'r': /* general registers */ | ||
78 | - ct->ct |= TCG_CT_REG; | ||
79 | ct->regs |= 0xffffffffu; | ||
80 | break; | 40 | break; |
81 | case 'w': /* advsimd registers */ | 41 | case DISAS_TOO_MANY: |
82 | - ct->ct |= TCG_CT_REG; | 42 | - if (dc->base.singlestep_enabled) { |
83 | ct->regs |= 0xffffffff00000000ull; | 43 | - tcg_gen_movi_i32(cpu_pc, dc->pc); |
84 | break; | 44 | - gen_exception(dc, EXCP_DEBUG); |
85 | case 'l': /* qemu_ld / qemu_st address, data_reg */ | 45 | - } else { |
86 | - ct->ct |= TCG_CT_REG; | 46 | - gen_jumpi(dc, dc->pc, 0); |
87 | ct->regs = 0xffffffffu; | 47 | - } |
88 | #ifdef CONFIG_SOFTMMU | 48 | + gen_jumpi(dc, dc->pc, 0); |
89 | /* x0 and x1 will be overwritten when reading the tlb entry, | ||
90 | diff --git a/tcg/arm/tcg-target.c.inc b/tcg/arm/tcg-target.c.inc | ||
91 | index XXXXXXX..XXXXXXX 100644 | ||
92 | --- a/tcg/arm/tcg-target.c.inc | ||
93 | +++ b/tcg/arm/tcg-target.c.inc | ||
94 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
95 | break; | ||
96 | |||
97 | case 'r': | ||
98 | - ct->ct |= TCG_CT_REG; | ||
99 | ct->regs = 0xffff; | ||
100 | break; | ||
101 | |||
102 | /* qemu_ld address */ | ||
103 | case 'l': | ||
104 | - ct->ct |= TCG_CT_REG; | ||
105 | ct->regs = 0xffff; | ||
106 | #ifdef CONFIG_SOFTMMU | ||
107 | /* r0-r2,lr will be overwritten when reading the tlb entry, | ||
108 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
109 | |||
110 | /* qemu_st address & data */ | ||
111 | case 's': | ||
112 | - ct->ct |= TCG_CT_REG; | ||
113 | ct->regs = 0xffff; | ||
114 | /* r0-r2 will be overwritten when reading the tlb entry (softmmu only) | ||
115 | and r0-r1 doing the byte swapping, so don't use these. */ | ||
116 | diff --git a/tcg/i386/tcg-target.c.inc b/tcg/i386/tcg-target.c.inc | ||
117 | index XXXXXXX..XXXXXXX 100644 | ||
118 | --- a/tcg/i386/tcg-target.c.inc | ||
119 | +++ b/tcg/i386/tcg-target.c.inc | ||
120 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
121 | { | ||
122 | switch(*ct_str++) { | ||
123 | case 'a': | ||
124 | - ct->ct |= TCG_CT_REG; | ||
125 | tcg_regset_set_reg(ct->regs, TCG_REG_EAX); | ||
126 | break; | ||
127 | case 'b': | ||
128 | - ct->ct |= TCG_CT_REG; | ||
129 | tcg_regset_set_reg(ct->regs, TCG_REG_EBX); | ||
130 | break; | ||
131 | case 'c': | ||
132 | - ct->ct |= TCG_CT_REG; | ||
133 | tcg_regset_set_reg(ct->regs, TCG_REG_ECX); | ||
134 | break; | ||
135 | case 'd': | ||
136 | - ct->ct |= TCG_CT_REG; | ||
137 | tcg_regset_set_reg(ct->regs, TCG_REG_EDX); | ||
138 | break; | ||
139 | case 'S': | ||
140 | - ct->ct |= TCG_CT_REG; | ||
141 | tcg_regset_set_reg(ct->regs, TCG_REG_ESI); | ||
142 | break; | ||
143 | case 'D': | ||
144 | - ct->ct |= TCG_CT_REG; | ||
145 | tcg_regset_set_reg(ct->regs, TCG_REG_EDI); | ||
146 | break; | ||
147 | case 'q': | ||
148 | /* A register that can be used as a byte operand. */ | ||
149 | - ct->ct |= TCG_CT_REG; | ||
150 | ct->regs = TCG_TARGET_REG_BITS == 64 ? 0xffff : 0xf; | ||
151 | break; | ||
152 | case 'Q': | ||
153 | /* A register with an addressable second byte (e.g. %ah). */ | ||
154 | - ct->ct |= TCG_CT_REG; | ||
155 | ct->regs = 0xf; | ||
156 | break; | ||
157 | case 'r': | ||
158 | /* A general register. */ | ||
159 | - ct->ct |= TCG_CT_REG; | ||
160 | ct->regs |= ALL_GENERAL_REGS; | ||
161 | break; | ||
162 | case 'W': | ||
163 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
164 | break; | ||
165 | case 'x': | ||
166 | /* A vector register. */ | ||
167 | - ct->ct |= TCG_CT_REG; | ||
168 | ct->regs |= ALL_VECTOR_REGS; | ||
169 | break; | ||
170 | |||
171 | /* qemu_ld/st address constraint */ | ||
172 | case 'L': | ||
173 | - ct->ct |= TCG_CT_REG; | ||
174 | ct->regs = TCG_TARGET_REG_BITS == 64 ? 0xffff : 0xff; | ||
175 | tcg_regset_reset_reg(ct->regs, TCG_REG_L0); | ||
176 | tcg_regset_reset_reg(ct->regs, TCG_REG_L1); | ||
177 | diff --git a/tcg/mips/tcg-target.c.inc b/tcg/mips/tcg-target.c.inc | ||
178 | index XXXXXXX..XXXXXXX 100644 | ||
179 | --- a/tcg/mips/tcg-target.c.inc | ||
180 | +++ b/tcg/mips/tcg-target.c.inc | ||
181 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
182 | { | ||
183 | switch(*ct_str++) { | ||
184 | case 'r': | ||
185 | - ct->ct |= TCG_CT_REG; | ||
186 | ct->regs = 0xffffffff; | ||
187 | break; | ||
188 | case 'L': /* qemu_ld input arg constraint */ | ||
189 | - ct->ct |= TCG_CT_REG; | ||
190 | ct->regs = 0xffffffff; | ||
191 | tcg_regset_reset_reg(ct->regs, TCG_REG_A0); | ||
192 | #if defined(CONFIG_SOFTMMU) | ||
193 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
194 | #endif | ||
195 | break; | ||
196 | case 'S': /* qemu_st constraint */ | ||
197 | - ct->ct |= TCG_CT_REG; | ||
198 | ct->regs = 0xffffffff; | ||
199 | tcg_regset_reset_reg(ct->regs, TCG_REG_A0); | ||
200 | #if defined(CONFIG_SOFTMMU) | ||
201 | diff --git a/tcg/ppc/tcg-target.c.inc b/tcg/ppc/tcg-target.c.inc | ||
202 | index XXXXXXX..XXXXXXX 100644 | ||
203 | --- a/tcg/ppc/tcg-target.c.inc | ||
204 | +++ b/tcg/ppc/tcg-target.c.inc | ||
205 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
206 | { | ||
207 | switch (*ct_str++) { | ||
208 | case 'A': case 'B': case 'C': case 'D': | ||
209 | - ct->ct |= TCG_CT_REG; | ||
210 | tcg_regset_set_reg(ct->regs, 3 + ct_str[0] - 'A'); | ||
211 | break; | ||
212 | case 'r': | ||
213 | - ct->ct |= TCG_CT_REG; | ||
214 | ct->regs = 0xffffffff; | ||
215 | break; | ||
216 | case 'v': | ||
217 | - ct->ct |= TCG_CT_REG; | ||
218 | ct->regs = 0xffffffff00000000ull; | ||
219 | break; | ||
220 | case 'L': /* qemu_ld constraint */ | ||
221 | - ct->ct |= TCG_CT_REG; | ||
222 | ct->regs = 0xffffffff; | ||
223 | tcg_regset_reset_reg(ct->regs, TCG_REG_R3); | ||
224 | #ifdef CONFIG_SOFTMMU | ||
225 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
226 | #endif | ||
227 | break; | ||
228 | case 'S': /* qemu_st constraint */ | ||
229 | - ct->ct |= TCG_CT_REG; | ||
230 | ct->regs = 0xffffffff; | ||
231 | tcg_regset_reset_reg(ct->regs, TCG_REG_R3); | ||
232 | #ifdef CONFIG_SOFTMMU | ||
233 | diff --git a/tcg/riscv/tcg-target.c.inc b/tcg/riscv/tcg-target.c.inc | ||
234 | index XXXXXXX..XXXXXXX 100644 | ||
235 | --- a/tcg/riscv/tcg-target.c.inc | ||
236 | +++ b/tcg/riscv/tcg-target.c.inc | ||
237 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
238 | { | ||
239 | switch (*ct_str++) { | ||
240 | case 'r': | ||
241 | - ct->ct |= TCG_CT_REG; | ||
242 | ct->regs = 0xffffffff; | ||
243 | break; | ||
244 | case 'L': | ||
245 | /* qemu_ld/qemu_st constraint */ | ||
246 | - ct->ct |= TCG_CT_REG; | ||
247 | ct->regs = 0xffffffff; | ||
248 | /* qemu_ld/qemu_st uses TCG_REG_TMP0 */ | ||
249 | #if defined(CONFIG_SOFTMMU) | ||
250 | diff --git a/tcg/s390/tcg-target.c.inc b/tcg/s390/tcg-target.c.inc | ||
251 | index XXXXXXX..XXXXXXX 100644 | ||
252 | --- a/tcg/s390/tcg-target.c.inc | ||
253 | +++ b/tcg/s390/tcg-target.c.inc | ||
254 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
255 | { | ||
256 | switch (*ct_str++) { | ||
257 | case 'r': /* all registers */ | ||
258 | - ct->ct |= TCG_CT_REG; | ||
259 | ct->regs = 0xffff; | ||
260 | break; | ||
261 | case 'L': /* qemu_ld/st constraint */ | ||
262 | - ct->ct |= TCG_CT_REG; | ||
263 | ct->regs = 0xffff; | ||
264 | tcg_regset_reset_reg(ct->regs, TCG_REG_R2); | ||
265 | tcg_regset_reset_reg(ct->regs, TCG_REG_R3); | ||
266 | tcg_regset_reset_reg(ct->regs, TCG_REG_R4); | ||
267 | break; | ||
268 | case 'a': /* force R2 for division */ | ||
269 | - ct->ct |= TCG_CT_REG; | ||
270 | ct->regs = 0; | ||
271 | tcg_regset_set_reg(ct->regs, TCG_REG_R2); | ||
272 | break; | ||
273 | case 'b': /* force R3 for division */ | ||
274 | - ct->ct |= TCG_CT_REG; | ||
275 | ct->regs = 0; | ||
276 | tcg_regset_set_reg(ct->regs, TCG_REG_R3); | ||
277 | break; | ||
278 | diff --git a/tcg/sparc/tcg-target.c.inc b/tcg/sparc/tcg-target.c.inc | ||
279 | index XXXXXXX..XXXXXXX 100644 | ||
280 | --- a/tcg/sparc/tcg-target.c.inc | ||
281 | +++ b/tcg/sparc/tcg-target.c.inc | ||
282 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
283 | { | ||
284 | switch (*ct_str++) { | ||
285 | case 'r': | ||
286 | - ct->ct |= TCG_CT_REG; | ||
287 | ct->regs = 0xffffffff; | ||
288 | break; | ||
289 | case 'R': | ||
290 | - ct->ct |= TCG_CT_REG; | ||
291 | ct->regs = ALL_64; | ||
292 | break; | ||
293 | case 'A': /* qemu_ld/st address constraint */ | ||
294 | - ct->ct |= TCG_CT_REG; | ||
295 | ct->regs = TARGET_LONG_BITS == 64 ? ALL_64 : 0xffffffff; | ||
296 | reserve_helpers: | ||
297 | tcg_regset_reset_reg(ct->regs, TCG_REG_O0); | ||
298 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
299 | tcg_regset_reset_reg(ct->regs, TCG_REG_O2); | ||
300 | break; | ||
301 | case 's': /* qemu_st data 32-bit constraint */ | ||
302 | - ct->ct |= TCG_CT_REG; | ||
303 | ct->regs = 0xffffffff; | ||
304 | goto reserve_helpers; | ||
305 | case 'S': /* qemu_st data 64-bit constraint */ | ||
306 | - ct->ct |= TCG_CT_REG; | ||
307 | ct->regs = ALL_64; | ||
308 | goto reserve_helpers; | ||
309 | case 'I': | ||
310 | diff --git a/tcg/tci/tcg-target.c.inc b/tcg/tci/tcg-target.c.inc | ||
311 | index XXXXXXX..XXXXXXX 100644 | ||
312 | --- a/tcg/tci/tcg-target.c.inc | ||
313 | +++ b/tcg/tci/tcg-target.c.inc | ||
314 | @@ -XXX,XX +XXX,XX @@ static const char *target_parse_constraint(TCGArgConstraint *ct, | ||
315 | case 'r': | ||
316 | case 'L': /* qemu_ld constraint */ | ||
317 | case 'S': /* qemu_st constraint */ | ||
318 | - ct->ct |= TCG_CT_REG; | ||
319 | ct->regs = BIT(TCG_TARGET_NB_REGS) - 1; | ||
320 | break; | 49 | break; |
321 | default: | 50 | default: |
51 | g_assert_not_reached(); | ||
322 | -- | 52 | -- |
323 | 2.25.1 | 53 | 2.25.1 |
324 | 54 | ||
325 | 55 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | This reverts commit 1b36e4f5a5de585210ea95f2257839c2312be28f. | ||
1 | 2 | ||
3 | Despite a comment saying why cpu_common_props cannot be placed in | ||
4 | a file that is compiled once, it was moved anyway. Revert that. | ||
5 | |||
6 | Since then, Property is not defined in hw/core/cpu.h, so it is now | ||
7 | easier to declare a function to install the properties rather than | ||
8 | the Property array itself. | ||
9 | |||
10 | Cc: Eduardo Habkost <ehabkost@redhat.com> | ||
11 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | --- | ||
14 | include/hw/core/cpu.h | 1 + | ||
15 | cpu.c | 21 +++++++++++++++++++++ | ||
16 | hw/core/cpu-common.c | 17 +---------------- | ||
17 | 3 files changed, 23 insertions(+), 16 deletions(-) | ||
18 | |||
19 | diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/include/hw/core/cpu.h | ||
22 | +++ b/include/hw/core/cpu.h | ||
23 | @@ -XXX,XX +XXX,XX @@ void QEMU_NORETURN cpu_abort(CPUState *cpu, const char *fmt, ...) | ||
24 | GCC_FMT_ATTR(2, 3); | ||
25 | |||
26 | /* $(top_srcdir)/cpu.c */ | ||
27 | +void cpu_class_init_props(DeviceClass *dc); | ||
28 | void cpu_exec_initfn(CPUState *cpu); | ||
29 | void cpu_exec_realizefn(CPUState *cpu, Error **errp); | ||
30 | void cpu_exec_unrealizefn(CPUState *cpu); | ||
31 | diff --git a/cpu.c b/cpu.c | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/cpu.c | ||
34 | +++ b/cpu.c | ||
35 | @@ -XXX,XX +XXX,XX @@ void cpu_exec_unrealizefn(CPUState *cpu) | ||
36 | cpu_list_remove(cpu); | ||
37 | } | ||
38 | |||
39 | +static Property cpu_common_props[] = { | ||
40 | +#ifndef CONFIG_USER_ONLY | ||
41 | + /* | ||
42 | + * Create a memory property for softmmu CPU object, | ||
43 | + * so users can wire up its memory. (This can't go in hw/core/cpu.c | ||
44 | + * because that file is compiled only once for both user-mode | ||
45 | + * and system builds.) The default if no link is set up is to use | ||
46 | + * the system address space. | ||
47 | + */ | ||
48 | + DEFINE_PROP_LINK("memory", CPUState, memory, TYPE_MEMORY_REGION, | ||
49 | + MemoryRegion *), | ||
50 | +#endif | ||
51 | + DEFINE_PROP_BOOL("start-powered-off", CPUState, start_powered_off, false), | ||
52 | + DEFINE_PROP_END_OF_LIST(), | ||
53 | +}; | ||
54 | + | ||
55 | +void cpu_class_init_props(DeviceClass *dc) | ||
56 | +{ | ||
57 | + device_class_set_props(dc, cpu_common_props); | ||
58 | +} | ||
59 | + | ||
60 | void cpu_exec_initfn(CPUState *cpu) | ||
61 | { | ||
62 | cpu->as = NULL; | ||
63 | diff --git a/hw/core/cpu-common.c b/hw/core/cpu-common.c | ||
64 | index XXXXXXX..XXXXXXX 100644 | ||
65 | --- a/hw/core/cpu-common.c | ||
66 | +++ b/hw/core/cpu-common.c | ||
67 | @@ -XXX,XX +XXX,XX @@ static int64_t cpu_common_get_arch_id(CPUState *cpu) | ||
68 | return cpu->cpu_index; | ||
69 | } | ||
70 | |||
71 | -static Property cpu_common_props[] = { | ||
72 | -#ifndef CONFIG_USER_ONLY | ||
73 | - /* Create a memory property for softmmu CPU object, | ||
74 | - * so users can wire up its memory. (This can't go in hw/core/cpu.c | ||
75 | - * because that file is compiled only once for both user-mode | ||
76 | - * and system builds.) The default if no link is set up is to use | ||
77 | - * the system address space. | ||
78 | - */ | ||
79 | - DEFINE_PROP_LINK("memory", CPUState, memory, TYPE_MEMORY_REGION, | ||
80 | - MemoryRegion *), | ||
81 | -#endif | ||
82 | - DEFINE_PROP_BOOL("start-powered-off", CPUState, start_powered_off, false), | ||
83 | - DEFINE_PROP_END_OF_LIST(), | ||
84 | -}; | ||
85 | - | ||
86 | static void cpu_class_init(ObjectClass *klass, void *data) | ||
87 | { | ||
88 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
89 | @@ -XXX,XX +XXX,XX @@ static void cpu_class_init(ObjectClass *klass, void *data) | ||
90 | dc->realize = cpu_common_realizefn; | ||
91 | dc->unrealize = cpu_common_unrealizefn; | ||
92 | dc->reset = cpu_common_reset; | ||
93 | - device_class_set_props(dc, cpu_common_props); | ||
94 | + cpu_class_init_props(dc); | ||
95 | /* | ||
96 | * Reason: CPUs still need special care by board code: wiring up | ||
97 | * IRQs, adding reset handlers, halting non-first CPUs, ... | ||
98 | -- | ||
99 | 2.25.1 | ||
100 | |||
101 | diff view generated by jsdifflib |