diff mbox series

[v2,02/45] target/hppa: Use hppa_form_gva_psw in hppa_cpu_get_pc

Message ID 20240513074717.130949-3-richard.henderson@linaro.org
State Superseded
Headers show
Series target/hppa: Misc improvements | expand

Commit Message

Richard Henderson May 13, 2024, 7:46 a.m. UTC
This function is for log_pc(), which needs to produce a
similar result to cpu_get_tb_cpu_state().

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/hppa/cpu.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Helge Deller May 14, 2024, 2:05 p.m. UTC | #1
* Richard Henderson <richard.henderson@linaro.org>:
> This function is for log_pc(), which needs to produce a
> similar result to cpu_get_tb_cpu_state().
> 
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>


Reviewed-by: Helge Deller <deller@gmx.de>

---
> ---
>  target/hppa/cpu.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
> index 582036b31e..be8c558014 100644
> --- a/target/hppa/cpu.c
> +++ b/target/hppa/cpu.c
> @@ -38,9 +38,10 @@ static void hppa_cpu_set_pc(CPUState *cs, vaddr value)
>  
>  static vaddr hppa_cpu_get_pc(CPUState *cs)
>  {
> -    HPPACPU *cpu = HPPA_CPU(cs);
> +    CPUHPPAState *env = cpu_env(cs);
>  
> -    return cpu->env.iaoq_f;
> +    return hppa_form_gva_psw(env->psw, (env->psw & PSW_C ? env->iasq_f : 0),
> +                             env->iaoq_f & -4);
>  }
>  
>  void cpu_get_tb_cpu_state(CPUHPPAState *env, vaddr *pc,
> @@ -61,8 +62,7 @@ void cpu_get_tb_cpu_state(CPUHPPAState *env, vaddr *pc,
>      flags |= env->psw & (PSW_W | PSW_C | PSW_D | PSW_P);
>      flags |= (env->iaoq_f & 3) << TB_FLAG_PRIV_SHIFT;
>  
> -    *pc = hppa_form_gva_psw(env->psw, (env->psw & PSW_C ? env->iasq_f : 0),
> -                            env->iaoq_f & -4);
> +    *pc = hppa_cpu_get_pc(env_cpu(env));
>      *cs_base = env->iasq_f;
>  
>      /* Insert a difference between IAOQ_B and IAOQ_F within the otherwise zero
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/target/hppa/cpu.c b/target/hppa/cpu.c
index 582036b31e..be8c558014 100644
--- a/target/hppa/cpu.c
+++ b/target/hppa/cpu.c
@@ -38,9 +38,10 @@  static void hppa_cpu_set_pc(CPUState *cs, vaddr value)
 
 static vaddr hppa_cpu_get_pc(CPUState *cs)
 {
-    HPPACPU *cpu = HPPA_CPU(cs);
+    CPUHPPAState *env = cpu_env(cs);
 
-    return cpu->env.iaoq_f;
+    return hppa_form_gva_psw(env->psw, (env->psw & PSW_C ? env->iasq_f : 0),
+                             env->iaoq_f & -4);
 }
 
 void cpu_get_tb_cpu_state(CPUHPPAState *env, vaddr *pc,
@@ -61,8 +62,7 @@  void cpu_get_tb_cpu_state(CPUHPPAState *env, vaddr *pc,
     flags |= env->psw & (PSW_W | PSW_C | PSW_D | PSW_P);
     flags |= (env->iaoq_f & 3) << TB_FLAG_PRIV_SHIFT;
 
-    *pc = hppa_form_gva_psw(env->psw, (env->psw & PSW_C ? env->iasq_f : 0),
-                            env->iaoq_f & -4);
+    *pc = hppa_cpu_get_pc(env_cpu(env));
     *cs_base = env->iasq_f;
 
     /* Insert a difference between IAOQ_B and IAOQ_F within the otherwise zero