target/xtensa: clean up unaligned access
PATCH 1/1 target/xtensa: clean up unaligned access
Xtensa cores may or may not have hardware support for unaligned memory access. On cores with such support pass MO_UNALN in memory access flags for all operations that would not raise an exception. Drop condition from xtensa_cpu_do_unaligned_access and replace it with assertions. Add a test.
Suggested-by Philippe Mathieu-Daudé <[email protected]>
Signed-off-by Max Filippov <[email protected]>
--- target/xtensa/helper.c | 14 +-- target/xtensa/translate.c | 108 ++++++++++---------- tests/tcg/xtensa/test_load_store.S | 156 +++++++++++++++++++++++++++++ 3 files changed, 217 insertions(+), 61 deletions(-) create mode 100644 tests/tcg/xtensa/test_load_store.S
target/xtensa/helper.c +7 -7
@@ -270,13 +270,13 @@ void xtensa_cpu_do_unaligned_access(CPUState *cs,XtensaCPU *cpu =XTENSA_CPU (cs);CPUXtensaState *env = &cpu->env; -if (xtensa_option_enabled (env->config,XTENSA_OPTION_UNALIGNED_EXCEPTION ) && - !xtensa_option_enabled (env->config,XTENSA_OPTION_HW_ALIGNMENT )) { -cpu_restore_state (CPU (cpu), retaddr, true); -HELPER (exception_cause_vaddr)(env, - env->pc,LOAD_STORE_ALIGNMENT_CAUSE , - addr); - } +assert (xtensa_option_enabled (env->config, +XTENSA_OPTION_UNALIGNED_EXCEPTION )); +assert (!xtensa_option_enabled (env->config,XTENSA_OPTION_HW_ALIGNMENT )); +cpu_restore_state (CPU (cpu), retaddr, true); +HELPER (exception_cause_vaddr)(env, + env->pc,LOAD_STORE_ALIGNMENT_CAUSE , + addr); } bool xtensa_cpu_tlb_fill(CPUState *cs, vaddr address, int size,
target/xtensa/translate.c +54 -54
275 lines not on this page · raw message
tests/tcg/xtensa/test_load_store.S new file +156 -0
156 lines not on this page · raw message
Signature · 1 line
2.20.1