diff mbox series

[for-6.2,02/43] target/alpha: Implement do_unaligned_access for user-only

Message ID 20210729004647.282017-3-richard.henderson@linaro.org
State Superseded
Headers show
Series Unaligned accesses for user-only | expand

Commit Message

Richard Henderson July 29, 2021, 12:46 a.m. UTC
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 target/alpha/cpu.c        | 2 +-
 target/alpha/mem_helper.c | 8 +++-----
 2 files changed, 4 insertions(+), 6 deletions(-)

-- 
2.25.1

Comments

Peter Maydell July 29, 2021, 1:05 p.m. UTC | #1
On Thu, 29 Jul 2021 at 01:50, Richard Henderson
<richard.henderson@linaro.org> wrote:
>

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

> ---

>  target/alpha/cpu.c        | 2 +-

>  target/alpha/mem_helper.c | 8 +++-----

>  2 files changed, 4 insertions(+), 6 deletions(-)

>

> diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c

> index 4871ad0c0a..cb7e5261bd 100644

> --- a/target/alpha/cpu.c

> +++ b/target/alpha/cpu.c

> @@ -220,11 +220,11 @@ static const struct TCGCPUOps alpha_tcg_ops = {

>      .initialize = alpha_translate_init,

>      .cpu_exec_interrupt = alpha_cpu_exec_interrupt,

>      .tlb_fill = alpha_cpu_tlb_fill,

> +    .do_unaligned_access = alpha_cpu_do_unaligned_access,

>

>  #ifndef CONFIG_USER_ONLY

>      .do_interrupt = alpha_cpu_do_interrupt,

>      .do_transaction_failed = alpha_cpu_do_transaction_failed,

> -    .do_unaligned_access = alpha_cpu_do_unaligned_access,

>  #endif /* !CONFIG_USER_ONLY */

>  };

>

> diff --git a/target/alpha/mem_helper.c b/target/alpha/mem_helper.c

> index 75e72bc337..e3cf98b270 100644

> --- a/target/alpha/mem_helper.c

> +++ b/target/alpha/mem_helper.c

> @@ -23,30 +23,28 @@

>  #include "exec/exec-all.h"

>  #include "exec/cpu_ldst.h"

>

> -/* Softmmu support */

> -#ifndef CONFIG_USER_ONLY

>  void alpha_cpu_do_unaligned_access(CPUState *cs, vaddr addr,

>                                     MMUAccessType access_type,

>                                     int mmu_idx, uintptr_t retaddr)

>  {

>      AlphaCPU *cpu = ALPHA_CPU(cs);

>      CPUAlphaState *env = &cpu->env;

> -    uint64_t pc;

>      uint32_t insn;

>

>      cpu_restore_state(cs, retaddr, true);

>

> -    pc = env->pc;

> -    insn = cpu_ldl_code(env, pc);

> +    insn = cpu_ldl_code(env, env->pc);

>

>      env->trap_arg0 = addr;

>      env->trap_arg1 = insn >> 26;                /* opcode */

>      env->trap_arg2 = (insn >> 21) & 31;         /* dest regno */

> +

>      cs->exception_index = EXCP_UNALIGN;

>      env->error_code = 0;

>      cpu_loop_exit(cs);

>  }


The code changes here seem unnecessary ?

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


thanks
-- PMM
diff mbox series

Patch

diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c
index 4871ad0c0a..cb7e5261bd 100644
--- a/target/alpha/cpu.c
+++ b/target/alpha/cpu.c
@@ -220,11 +220,11 @@  static const struct TCGCPUOps alpha_tcg_ops = {
     .initialize = alpha_translate_init,
     .cpu_exec_interrupt = alpha_cpu_exec_interrupt,
     .tlb_fill = alpha_cpu_tlb_fill,
+    .do_unaligned_access = alpha_cpu_do_unaligned_access,
 
 #ifndef CONFIG_USER_ONLY
     .do_interrupt = alpha_cpu_do_interrupt,
     .do_transaction_failed = alpha_cpu_do_transaction_failed,
-    .do_unaligned_access = alpha_cpu_do_unaligned_access,
 #endif /* !CONFIG_USER_ONLY */
 };
 
diff --git a/target/alpha/mem_helper.c b/target/alpha/mem_helper.c
index 75e72bc337..e3cf98b270 100644
--- a/target/alpha/mem_helper.c
+++ b/target/alpha/mem_helper.c
@@ -23,30 +23,28 @@ 
 #include "exec/exec-all.h"
 #include "exec/cpu_ldst.h"
 
-/* Softmmu support */
-#ifndef CONFIG_USER_ONLY
 void alpha_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
                                    MMUAccessType access_type,
                                    int mmu_idx, uintptr_t retaddr)
 {
     AlphaCPU *cpu = ALPHA_CPU(cs);
     CPUAlphaState *env = &cpu->env;
-    uint64_t pc;
     uint32_t insn;
 
     cpu_restore_state(cs, retaddr, true);
 
-    pc = env->pc;
-    insn = cpu_ldl_code(env, pc);
+    insn = cpu_ldl_code(env, env->pc);
 
     env->trap_arg0 = addr;
     env->trap_arg1 = insn >> 26;                /* opcode */
     env->trap_arg2 = (insn >> 21) & 31;         /* dest regno */
+
     cs->exception_index = EXCP_UNALIGN;
     env->error_code = 0;
     cpu_loop_exit(cs);
 }
 
+#ifndef CONFIG_USER_ONLY
 void alpha_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,
                                      vaddr addr, unsigned size,
                                      MMUAccessType access_type,