Skip to contentSkip to conversation

target-alpha prep work for qom cpu changes

PATCH In review Richard Henderson 2 participants 6 messages Jul 1, 2013 – Jul 6, 2013

lore
Share & tools
lore
#0 lore raw

cover target-alpha prep work for qom cpu changes

As discussed in the QOM thread.

r~

Richard Henderson (2):
target-alpha: Copy singlestep_enabled to DisasContext
target-alpha: Copy implver to DisasContext

 target-alpha/translate.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
Signature · 1 line
1.8.1.4
#1 lore raw

PATCH 1/2 target-alpha: Copy singlestep_enabled to DisasContext

Prepare for removing env from DisasContext.

---
 target-alpha/translate.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
target-alpha/translate.c +6 -3
index 4db16db..b59f919 100644
@@ -46,6 +46,8 @@ struct DisasContext {
     int tb_rm;
     /* Current flush-to-zero setting for this TB.  */
     int tb_ftz;
+
+    bool singlestep_enabled;
 };
 
 /* Return values from translate_one, indicating the state of the TB.
@@ -380,7 +382,7 @@ static int use_goto_tb(DisasContext *ctx, uint64_t dest)
     /* Check for the dest on the same page as the start of the TB.  We
        also want to suppress goto_tb in the case of single-steping and IO.  */
     return (((ctx->tb->pc ^ dest) & TARGET_PAGE_MASK) == 0
-            && !ctx->env->singlestep_enabled
+            && !ctx->singlestep_enabled
             && !(ctx->tb->cflags & CF_LAST_IO));
 }
 
@@ -3396,6 +3398,7 @@ static inline void gen_intermediate_code_internal(CPUAlphaState *env,
     ctx.env = env;
     ctx.pc = pc_start;
     ctx.mem_idx = cpu_mmu_index(env);
+    ctx.singlestep_enabled = env->singlestep_enabled;
 
     /* ??? Every TB begins with unset rounding mode, to be initialized on
        the first fp insn of the TB.  Alternately we could define a proper
@@ -3452,7 +3455,7 @@ static inline void gen_intermediate_code_internal(CPUAlphaState *env,
                 || tcg_ctx.gen_opc_ptr >= gen_opc_end
                 || num_insns >= max_insns
                 || singlestep
-                || env->singlestep_enabled)) {
+                || ctx.singlestep_enabled)) {
             ret = EXIT_PC_STALE;
         }
     } while (ret == NO_EXIT);
@@ -3469,7 +3472,7 @@ static inline void gen_intermediate_code_internal(CPUAlphaState *env,
         tcg_gen_movi_i64(cpu_pc, ctx.pc);
         /* FALLTHRU */
     case EXIT_PC_UPDATED:
-        if (env->singlestep_enabled) {
+        if (ctx.singlestep_enabled) {
             gen_excp_1(EXCP_DEBUG, 0);
         } else {
             tcg_gen_exit_tb(0);
Signature · 1 line
1.8.1.4
#3 lore raw

PATCH 2/2 target-alpha: Copy implver to DisasContext

In reply to Richard Henderson

Which allows removing env from DisasContext.

---
 target-alpha/translate.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
target-alpha/translate.c +7 -4
index b59f919..7dac0c8 100644
@@ -38,7 +38,6 @@
 typedef struct DisasContext DisasContext;
 struct DisasContext {
     struct TranslationBlock *tb;
-    CPUAlphaState *env;
     uint64_t pc;
     int mem_idx;
 
@@ -47,6 +46,9 @@ struct DisasContext {
     /* Current flush-to-zero setting for this TB.  */
     int tb_ftz;
 
+    /* implver value for this CPU.  */
+    int implver;
+
     bool singlestep_enabled;
 };
 
@@ -2246,8 +2248,9 @@ static ExitStatus translate_one(DisasContext *ctx, uint32_t insn)
             break;
         case 0x6C:
             /* IMPLVER */
-            if (rc != 31)
-                tcg_gen_movi_i64(cpu_ir[rc], ctx->env->implver);
+            if (rc != 31) {
+                tcg_gen_movi_i64(cpu_ir[rc], ctx->implver);
+            }
             break;
         default:
             goto invalid_opc;
@@ -3395,9 +3398,9 @@ static inline void gen_intermediate_code_internal(CPUAlphaState *env,
     gen_opc_end = tcg_ctx.gen_opc_buf + OPC_MAX_SIZE;
 
     ctx.tb = tb;
-    ctx.env = env;
     ctx.pc = pc_start;
     ctx.mem_idx = cpu_mmu_index(env);
+    ctx.implver = env->implver;
     ctx.singlestep_enabled = env->singlestep_enabled;
 
     /* ??? Every TB begins with unset rounding mode, to be initialized on
Signature · 1 line
1.8.1.4
Reviewed-by on v1 1/2
#2 lore raw

Re: [Qemu-devel] [PATCH 1/2] target-alpha: Copy singlestep_enabled to DisasContext

In reply to Richard Henderson

Am 01.07.2013 22:19, schrieb Richard Henderson:

Quoted 12 lines

Prepare for removing env from DisasContext.

---
 target-alpha/translate.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
target-alpha/translate.c +0 -0
index 4db16db..b59f919 100644

target-alpha/translate.c struct DisasContext { · line 50

Quoted 5 lines
target-alpha/translate.c +2 -0
@@ -46,6 +46,8 @@ struct DisasContext {
     int tb_rm;
     /* Current flush-to-zero setting for this TB.  */
     int tb_ftz;
+
+    bool singlestep_enabled;

env->singlestep_enabled is an int containing flags. Below it's only used as a boolean though, so

Thanks,
Andreas

Quoted 38 lines
target-alpha/translate.c +4 -3
 };
 
 /* Return values from translate_one, indicating the state of the TB.
@@ -380,7 +382,7 @@ static int use_goto_tb(DisasContext *ctx, uint64_t dest)
     /* Check for the dest on the same page as the start of the TB.  We
        also want to suppress goto_tb in the case of single-steping and IO.  */
     return (((ctx->tb->pc ^ dest) & TARGET_PAGE_MASK) == 0
-            && !ctx->env->singlestep_enabled
+            && !ctx->singlestep_enabled
             && !(ctx->tb->cflags & CF_LAST_IO));
 }
 
@@ -3396,6 +3398,7 @@ static inline void gen_intermediate_code_internal(CPUAlphaState *env,
     ctx.env = env;
     ctx.pc = pc_start;
     ctx.mem_idx = cpu_mmu_index(env);
+    ctx.singlestep_enabled = env->singlestep_enabled;
 
     /* ??? Every TB begins with unset rounding mode, to be initialized on
        the first fp insn of the TB.  Alternately we could define a proper
@@ -3452,7 +3455,7 @@ static inline void gen_intermediate_code_internal(CPUAlphaState *env,
                 || tcg_ctx.gen_opc_ptr >= gen_opc_end
                 || num_insns >= max_insns
                 || singlestep
-                || env->singlestep_enabled)) {
+                || ctx.singlestep_enabled)) {
             ret = EXIT_PC_STALE;
         }
     } while (ret == NO_EXIT);
@@ -3469,7 +3472,7 @@ static inline void gen_intermediate_code_internal(CPUAlphaState *env,
         tcg_gen_movi_i64(cpu_pc, ctx.pc);
         /* FALLTHRU */
     case EXIT_PC_UPDATED:
-        if (env->singlestep_enabled) {
+        if (ctx.singlestep_enabled) {
             gen_excp_1(EXCP_DEBUG, 0);
         } else {
             tcg_gen_exit_tb(0);
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
Reviewed-by on v1 2/2
#4 lore raw

Re: [Qemu-devel] [PATCH 2/2] target-alpha: Copy implver to DisasContext

In reply to Richard Henderson

Am 01.07.2013 22:19, schrieb Richard Henderson:

Quoted 3 lines

Which allows removing env from DisasContext.

I notice that implver is only ever assigned in CPUs' instance_init, so a candidate for moving to AlphaCPUClass as a follow-up.

Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#5 lore raw
In reply to Richard Henderson

Am 01.07.2013 22:19, schrieb Richard Henderson:

Quoted 1 line

As discussed in the QOM thread.

Thanks, applying to qom-cpu-next to rebase qom-cpu-11:
https://github.com/afaerber/qemu-cpu/commits/qom-cpu-next

Andreas

Quoted 7 lines

Richard Henderson (2):
target-alpha: Copy singlestep_enabled to DisasContext
target-alpha: Copy implver to DisasContext

 target-alpha/translate.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg