aboutsummaryrefslogtreecommitdiff
path: root/target-unicore32/op_helper.c
diff options
context:
space:
mode:
authorGuan Xuetao <gxt@mprc.pku.edu.cn>2012-08-10 14:42:25 +0800
committerBlue Swirl <blauwirbel@gmail.com>2012-08-11 09:36:58 +0000
commitf3ccc32369532e8a069ea5b7ee201b75e668deab (patch)
tree296f9bec6a1d969d912c4717fefc683ee2db7eef /target-unicore32/op_helper.c
parent889c134a82ac30f9beafa214b3920b2b39687832 (diff)
unicore32-softmmu: Implement softmmu specific functions
This patch implements softmmu specific functions, include tlb_fill, switch_mode, do_interrupt and uc32_cpu_handle_mmu_fault. So the full exception handlers and page table walking could work now. Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'target-unicore32/op_helper.c')
-rw-r--r--target-unicore32/op_helper.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/target-unicore32/op_helper.c b/target-unicore32/op_helper.c
index 6df30db668..c63789d6cb 100644
--- a/target-unicore32/op_helper.c
+++ b/target-unicore32/op_helper.c
@@ -267,6 +267,26 @@ uint32_t HELPER(ror_cc)(uint32_t x, uint32_t i)
void tlb_fill(CPUUniCore32State *env1, target_ulong addr, int is_write,
int mmu_idx, uintptr_t retaddr)
{
- cpu_abort(env, "%s not supported yet\n", __func__);
+ TranslationBlock *tb;
+ CPUUniCore32State *saved_env;
+ unsigned long pc;
+ int ret;
+
+ saved_env = env;
+ env = env1;
+ ret = uc32_cpu_handle_mmu_fault(env, addr, is_write, mmu_idx);
+ if (unlikely(ret)) {
+ if (retaddr) {
+ /* now we have a real cpu fault */
+ pc = (unsigned long)retaddr;
+ tb = tb_find_pc(pc);
+ if (tb) {/* the PC is inside the translated code.
+ It means that we have a virtual CPU fault */
+ cpu_restore_state(tb, env, pc);
+ }
+ }
+ cpu_loop_exit(env);
+ }
+ env = saved_env;
}
#endif