diff mbox series

[v3,19/39] target/moxie: Use env_cpu, env_archcpu

Message ID 20190508000641.19090-20-richard.henderson@linaro.org
State New
Headers show
Series tcg: Move the softmmu tlb to CPUNegativeOffsetState | expand

Commit Message

Richard Henderson May 8, 2019, 12:06 a.m. UTC
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 target/moxie/cpu.h       | 5 -----
 target/moxie/helper.c    | 6 +++---
 target/moxie/translate.c | 2 +-
 3 files changed, 4 insertions(+), 9 deletions(-)

-- 
2.17.1

Comments

Alistair Francis May 9, 2019, 6:19 p.m. UTC | #1
On Tue, May 7, 2019 at 5:20 PM Richard Henderson
<richard.henderson@linaro.org> wrote:
>

> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


Reviewed-by: Alistair Francis <alistair.francis@wdc.com>


Alistair

> ---

>  target/moxie/cpu.h       | 5 -----

>  target/moxie/helper.c    | 6 +++---

>  target/moxie/translate.c | 2 +-

>  3 files changed, 4 insertions(+), 9 deletions(-)

>

> diff --git a/target/moxie/cpu.h b/target/moxie/cpu.h

> index 5b9aae95d2..a481a92833 100644

> --- a/target/moxie/cpu.h

> +++ b/target/moxie/cpu.h

> @@ -90,11 +90,6 @@ typedef struct MoxieCPU {

>      CPUMoxieState env;

>  } MoxieCPU;

>

> -static inline MoxieCPU *moxie_env_get_cpu(CPUMoxieState *env)

> -{

> -    return container_of(env, MoxieCPU, env);

> -}

> -

>  #define ENV_OFFSET offsetof(MoxieCPU, env)

>

>  void moxie_cpu_do_interrupt(CPUState *cs);

> diff --git a/target/moxie/helper.c b/target/moxie/helper.c

> index 287a45232c..a18b21c4c0 100644

> --- a/target/moxie/helper.c

> +++ b/target/moxie/helper.c

> @@ -42,7 +42,7 @@ void tlb_fill(CPUState *cs, target_ulong addr, int size,

>

>  void helper_raise_exception(CPUMoxieState *env, int ex)

>  {

> -    CPUState *cs = CPU(moxie_env_get_cpu(env));

> +    CPUState *cs = env_cpu(env);

>

>      cs->exception_index = ex;

>      /* Stash the exception type.  */

> @@ -79,7 +79,7 @@ uint32_t helper_udiv(CPUMoxieState *env, uint32_t a, uint32_t b)

>

>  void helper_debug(CPUMoxieState *env)

>  {

> -    CPUState *cs = CPU(moxie_env_get_cpu(env));

> +    CPUState *cs = env_cpu(env);

>

>      cs->exception_index = EXCP_DEBUG;

>      cpu_loop_exit(cs);

> @@ -89,7 +89,7 @@ void helper_debug(CPUMoxieState *env)

>

>  void moxie_cpu_do_interrupt(CPUState *cs)

>  {

> -    CPUState *cs = CPU(moxie_env_get_cpu(env));

> +    CPUState *cs = env_cpu(env);

>

>      cs->exception_index = -1;

>  }

> diff --git a/target/moxie/translate.c b/target/moxie/translate.c

> index c668178f2c..c87e9ec2b1 100644

> --- a/target/moxie/translate.c

> +++ b/target/moxie/translate.c

> @@ -816,7 +816,7 @@ static int decode_opc(MoxieCPU *cpu, DisasContext *ctx)

>  void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns)

>  {

>      CPUMoxieState *env = cs->env_ptr;

> -    MoxieCPU *cpu = moxie_env_get_cpu(env);

> +    MoxieCPU *cpu = env_archcpu(env);

>      DisasContext ctx;

>      target_ulong pc_start;

>      int num_insns;

> --

> 2.17.1

>

>
diff mbox series

Patch

diff --git a/target/moxie/cpu.h b/target/moxie/cpu.h
index 5b9aae95d2..a481a92833 100644
--- a/target/moxie/cpu.h
+++ b/target/moxie/cpu.h
@@ -90,11 +90,6 @@  typedef struct MoxieCPU {
     CPUMoxieState env;
 } MoxieCPU;
 
-static inline MoxieCPU *moxie_env_get_cpu(CPUMoxieState *env)
-{
-    return container_of(env, MoxieCPU, env);
-}
-
 #define ENV_OFFSET offsetof(MoxieCPU, env)
 
 void moxie_cpu_do_interrupt(CPUState *cs);
diff --git a/target/moxie/helper.c b/target/moxie/helper.c
index 287a45232c..a18b21c4c0 100644
--- a/target/moxie/helper.c
+++ b/target/moxie/helper.c
@@ -42,7 +42,7 @@  void tlb_fill(CPUState *cs, target_ulong addr, int size,
 
 void helper_raise_exception(CPUMoxieState *env, int ex)
 {
-    CPUState *cs = CPU(moxie_env_get_cpu(env));
+    CPUState *cs = env_cpu(env);
 
     cs->exception_index = ex;
     /* Stash the exception type.  */
@@ -79,7 +79,7 @@  uint32_t helper_udiv(CPUMoxieState *env, uint32_t a, uint32_t b)
 
 void helper_debug(CPUMoxieState *env)
 {
-    CPUState *cs = CPU(moxie_env_get_cpu(env));
+    CPUState *cs = env_cpu(env);
 
     cs->exception_index = EXCP_DEBUG;
     cpu_loop_exit(cs);
@@ -89,7 +89,7 @@  void helper_debug(CPUMoxieState *env)
 
 void moxie_cpu_do_interrupt(CPUState *cs)
 {
-    CPUState *cs = CPU(moxie_env_get_cpu(env));
+    CPUState *cs = env_cpu(env);
 
     cs->exception_index = -1;
 }
diff --git a/target/moxie/translate.c b/target/moxie/translate.c
index c668178f2c..c87e9ec2b1 100644
--- a/target/moxie/translate.c
+++ b/target/moxie/translate.c
@@ -816,7 +816,7 @@  static int decode_opc(MoxieCPU *cpu, DisasContext *ctx)
 void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns)
 {
     CPUMoxieState *env = cs->env_ptr;
-    MoxieCPU *cpu = moxie_env_get_cpu(env);
+    MoxieCPU *cpu = env_archcpu(env);
     DisasContext ctx;
     target_ulong pc_start;
     int num_insns;