diff options
author | Max Filippov <jcmvbkbc@gmail.com> | 2011-09-06 03:55:46 +0400 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2011-09-10 16:57:39 +0000 |
commit | 5b4e481b041150fbc6eaef6205095077893a3781 (patch) | |
tree | b37d286e2cc05bc9c2b6e2b7566589a77b808b9f /target-xtensa/op_helper.c | |
parent | 6ad6dbf7916c59b6ae6dfe208dd64e0bf89dbf0a (diff) |
target-xtensa: implement unaligned exception option
See ISA, 4.4.4 for details.
Correct (aligned as per ISA) address for unaligned access is generated
in case this option is not enabled.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'target-xtensa/op_helper.c')
-rw-r--r-- | target-xtensa/op_helper.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/target-xtensa/op_helper.c b/target-xtensa/op_helper.c index 5e0f56f6da..d37f70dda5 100644 --- a/target-xtensa/op_helper.c +++ b/target-xtensa/op_helper.c @@ -30,6 +30,10 @@ #include "helpers.h" #include "host-utils.h" +static void do_unaligned_access(target_ulong addr, int is_write, int is_user, + void *retaddr); + +#define ALIGNED_ONLY #define MMUSUFFIX _mmu #define SHIFT 0 @@ -44,6 +48,28 @@ #define SHIFT 3 #include "softmmu_template.h" +static void do_restore_state(void *pc_ptr) +{ + TranslationBlock *tb; + uint32_t pc = (uint32_t)(intptr_t)pc_ptr; + + tb = tb_find_pc(pc); + if (tb) { + cpu_restore_state(tb, env, pc); + } +} + +static void do_unaligned_access(target_ulong addr, int is_write, int is_user, + void *retaddr) +{ + if (xtensa_option_enabled(env->config, XTENSA_OPTION_UNALIGNED_EXCEPTION) && + !xtensa_option_enabled(env->config, XTENSA_OPTION_HW_ALIGNMENT)) { + do_restore_state(retaddr); + HELPER(exception_cause_vaddr)( + env->pc, LOAD_STORE_ALIGNMENT_CAUSE, addr); + } +} + void tlb_fill(target_ulong addr, int is_write, int mmu_idx, void *retaddr) { tlb_set_page(cpu_single_env, |