From f3ccc32369532e8a069ea5b7ee201b75e668deab Mon Sep 17 00:00:00 2001 From: Guan Xuetao Date: Fri, 10 Aug 2012 14:42:25 +0800 Subject: 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 Signed-off-by: Blue Swirl --- target-unicore32/op_helper.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'target-unicore32/op_helper.c') 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 -- cgit v1.2.1