target/arm: Define arm_cpu_do_unaligned_access for user-only

Use the same code as system mode, so that we generate the same
exception + syndrome for the unaligned access.

For the moment, if MTE is enabled so that this path is reachable,
this would generate a SIGSEGV in the user-only cpu_loop. Decoding
the syndrome to produce the proper SIGBUS will be done later.

Backports commit 0d1762e931f8a694f261c604daba605bcda70928 from qemu
This commit is contained in:
Richard Henderson 2021-02-25 14:51:17 -05:00 committed by Lioncash
parent 43ea7aa828
commit 448fc3ae4a
2 changed files with 3 additions and 3 deletions

View file

@ -2006,8 +2006,8 @@ static void arm_cpu_class_init(struct uc_struct *uc, ObjectClass *oc, void *data
cc->tlb_fill = arm_cpu_tlb_fill; cc->tlb_fill = arm_cpu_tlb_fill;
cc->debug_excp_handler = arm_debug_excp_handler; cc->debug_excp_handler = arm_debug_excp_handler;
cc->debug_check_watchpoint = arm_debug_check_watchpoint; cc->debug_check_watchpoint = arm_debug_check_watchpoint;
#if !defined(CONFIG_USER_ONLY)
cc->do_unaligned_access = arm_cpu_do_unaligned_access; cc->do_unaligned_access = arm_cpu_do_unaligned_access;
#if !defined(CONFIG_USER_ONLY)
cc->do_transaction_failed = arm_cpu_do_transaction_failed; cc->do_transaction_failed = arm_cpu_do_transaction_failed;
cc->adjust_watchpoint_address = arm_adjust_watchpoint_address; cc->adjust_watchpoint_address = arm_adjust_watchpoint_address;
#endif #endif

View file

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