diff mbox series

[v5,10/22] target/arm: Define arm_cpu_do_unaligned_access for CONFIG_USER_ONLY

Message ID 20191011134744.2477-11-richard.henderson@linaro.org
State New
Headers show
Series [v5,01/22] target/arm: Add MTE_ACTIVE to tb_flags | expand

Commit Message

Richard Henderson Oct. 11, 2019, 1:47 p.m. UTC
We will need this to raise unaligned exceptions from user mode.

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

---
 target/arm/tlb_helper.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

-- 
2.17.1

Comments

Peter Maydell Dec. 5, 2019, 4:12 p.m. UTC | #1
On Fri, 11 Oct 2019 at 14:50, Richard Henderson
<richard.henderson@linaro.org> wrote:
>

> We will need this to raise unaligned exceptions from user mode.

>

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

> ---

>  target/arm/tlb_helper.c | 3 +--

>  1 file changed, 1 insertion(+), 2 deletions(-)

>

> diff --git a/target/arm/tlb_helper.c b/target/arm/tlb_helper.c

> index 5feb312941..29b92a1149 100644

> --- a/target/arm/tlb_helper.c

> +++ b/target/arm/tlb_helper.c

> @@ -10,8 +10,6 @@

>  #include "internals.h"

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

>

> -#if !defined(CONFIG_USER_ONLY)

> -

>  static inline uint32_t merge_syn_data_abort(uint32_t template_syn,

>                                              unsigned int target_el,

>                                              bool same_el, bool ea,

> @@ -122,6 +120,7 @@ void arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr,

>      arm_deliver_fault(cpu, vaddr, access_type, mmu_idx, &fi);

>  }

>

> +#ifndef CONFIG_USER_ONLY

>  /*

>   * arm_cpu_do_transaction_failed: handle a memory system error response

>   * (eg "no device/memory present at address") by raising an external abort

> --

> 2.17.1


Isn't this just enabling compilation of the softmmu
arm_cpu_do_unaligned_access() on linux-user? That codepath
does a lot of softmmu stuff including calling arm_deliver_fault()
(which implicitly does somewhat more looking at EL1 system
register state than we necessarily have set up correctly
for the user-mode code).

For arm_cpu_tlb_fill() which handles prefetch/data aborts
we just have a separate much simpler codepath for
CONFIG_USER_ONLY which doesn't call arm_deliver_fault().
I think being consistent here about how we handle the
CONFIG_USER_ONLY case would help avoid having a codepath
that isn't very well tested because it's only used in
the odd special case of unaligned-address exceptions.

thanks
-- PMM
Richard Henderson Feb. 17, 2020, 10:56 p.m. UTC | #2
On 12/5/19 8:12 AM, Peter Maydell wrote:
> For arm_cpu_tlb_fill() which handles prefetch/data aborts

> we just have a separate much simpler codepath for

> CONFIG_USER_ONLY which doesn't call arm_deliver_fault().

> I think being consistent here about how we handle the

> CONFIG_USER_ONLY case would help avoid having a codepath

> that isn't very well tested because it's only used in

> the odd special case of unaligned-address exceptions.


Fair enough.

It also reminds me that I had failed to add the linux-user changes to go along
with this to raise SIGBUS instead of SIGSEGV.


r~
diff mbox series

Patch

diff --git a/target/arm/tlb_helper.c b/target/arm/tlb_helper.c
index 5feb312941..29b92a1149 100644
--- a/target/arm/tlb_helper.c
+++ b/target/arm/tlb_helper.c
@@ -10,8 +10,6 @@ 
 #include "internals.h"
 #include "exec/exec-all.h"
 
-#if !defined(CONFIG_USER_ONLY)
-
 static inline uint32_t merge_syn_data_abort(uint32_t template_syn,
                                             unsigned int target_el,
                                             bool same_el, bool ea,
@@ -122,6 +120,7 @@  void arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr,
     arm_deliver_fault(cpu, vaddr, access_type, mmu_idx, &fi);
 }
 
+#ifndef CONFIG_USER_ONLY
 /*
  * arm_cpu_do_transaction_failed: handle a memory system error response
  * (eg "no device/memory present at address") by raising an external abort