qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH for-4.1 v2 10/36] target/cris: Use env_cpu, env_arch


From: Richard Henderson
Subject: [Qemu-devel] [PATCH for-4.1 v2 10/36] target/cris: Use env_cpu, env_archcpu
Date: Thu, 28 Mar 2019 13:03:38 -1000

Signed-off-by: Richard Henderson <address@hidden>
---
 target/cris/cpu.h          |  5 -----
 linux-user/cris/cpu_loop.c |  2 +-
 target/cris/mmu.c          |  3 +--
 target/cris/op_helper.c    | 10 +++-------
 target/cris/translate.c    |  2 +-
 5 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/target/cris/cpu.h b/target/cris/cpu.h
index 632ebf84b0..6111dbb14c 100644
--- a/target/cris/cpu.h
+++ b/target/cris/cpu.h
@@ -183,11 +183,6 @@ struct CRISCPU {
     CPUCRISState env;
 };
 
-static inline CRISCPU *cris_env_get_cpu(CPUCRISState *env)
-{
-    return container_of(env, CRISCPU, env);
-}
-
 #define ENV_OFFSET offsetof(CRISCPU, env)
 
 #ifndef CONFIG_USER_ONLY
diff --git a/linux-user/cris/cpu_loop.c b/linux-user/cris/cpu_loop.c
index d012e70a7a..06709f19c1 100644
--- a/linux-user/cris/cpu_loop.c
+++ b/linux-user/cris/cpu_loop.c
@@ -23,7 +23,7 @@
 
 void cpu_loop(CPUCRISState *env)
 {
-    CPUState *cs = CPU(cris_env_get_cpu(env));
+    CPUState *cs = env_cpu(env);
     int trapnr, ret;
     target_siginfo_t info;
     
diff --git a/target/cris/mmu.c b/target/cris/mmu.c
index b8db908823..ff0d3f4182 100644
--- a/target/cris/mmu.c
+++ b/target/cris/mmu.c
@@ -290,7 +290,6 @@ static int cris_mmu_translate_page(struct cris_mmu_result 
*res,
 
 void cris_mmu_flush_pid(CPUCRISState *env, uint32_t pid)
 {
-    CRISCPU *cpu = cris_env_get_cpu(env);
        target_ulong vaddr;
        unsigned int idx;
        uint32_t lo, hi;
@@ -316,7 +315,7 @@ void cris_mmu_flush_pid(CPUCRISState *env, uint32_t pid)
                                        vaddr = tlb_vpn << TARGET_PAGE_BITS;
                                        D_LOG("flush pid=%x vaddr=%x\n", 
                                                  pid, vaddr);
-                    tlb_flush_page(CPU(cpu), vaddr);
+                    tlb_flush_page(env_cpu(env), vaddr);
                                }
                        }
                }
diff --git a/target/cris/op_helper.c b/target/cris/op_helper.c
index 0ee3a3117b..acb137a8ce 100644
--- a/target/cris/op_helper.c
+++ b/target/cris/op_helper.c
@@ -67,7 +67,7 @@ void tlb_fill(CPUState *cs, target_ulong addr, int size,
 
 void helper_raise_exception(CPUCRISState *env, uint32_t index)
 {
-    CPUState *cs = CPU(cris_env_get_cpu(env));
+    CPUState *cs = env_cpu(env);
 
     cs->exception_index = index;
     cpu_loop_exit(cs);
@@ -85,8 +85,7 @@ void helper_tlb_flush_pid(CPUCRISState *env, uint32_t pid)
 void helper_spc_write(CPUCRISState *env, uint32_t new_spc)
 {
 #if !defined(CONFIG_USER_ONLY)
-    CRISCPU *cpu = cris_env_get_cpu(env);
-    CPUState *cs = CPU(cpu);
+    CPUState *cs = env_cpu(env);
 
     tlb_flush_page(cs, env->pregs[PR_SPC]);
     tlb_flush_page(cs, new_spc);
@@ -99,9 +98,6 @@ void helper_spc_write(CPUCRISState *env, uint32_t new_spc)
 
 void helper_movl_sreg_reg(CPUCRISState *env, uint32_t sreg, uint32_t reg)
 {
-#if !defined(CONFIG_USER_ONLY)
-    CRISCPU *cpu = cris_env_get_cpu(env);
-#endif
        uint32_t srs;
        srs = env->pregs[PR_SRS];
        srs &= 3;
@@ -143,7 +139,7 @@ void helper_movl_sreg_reg(CPUCRISState *env, uint32_t sreg, 
uint32_t reg)
                        D_LOG("tlb flush vaddr=%x v=%d pc=%x\n", 
                                  vaddr, tlb_v, env->pc);
                        if (tlb_v) {
-                tlb_flush_page(CPU(cpu), vaddr);
+                tlb_flush_page(env_cpu(env), vaddr);
                        }
                }
        }
diff --git a/target/cris/translate.c b/target/cris/translate.c
index 11b2c11174..b5598c6fd5 100644
--- a/target/cris/translate.c
+++ b/target/cris/translate.c
@@ -3104,7 +3104,7 @@ void gen_intermediate_code(CPUState *cs, struct 
TranslationBlock *tb)
      * delayslot, like in real hw.
      */
     pc_start = tb->pc & ~1;
-    dc->cpu = cris_env_get_cpu(env);
+    dc->cpu = env_archcpu(env);
     dc->tb = tb;
 
     dc->is_jmp = DISAS_NEXT;
-- 
2.17.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]