]> git.proxmox.com Git - qemu.git/commitdiff
target-mips: add a function to do virtual -> physical translations
authorAurelien Jarno <aurelien@aurel32.net>
Mon, 30 Nov 2009 00:39:22 +0000 (01:39 +0100)
committerAurelien Jarno <aurelien@aurel32.net>
Mon, 30 Nov 2009 15:10:04 +0000 (16:10 +0100)
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
target-mips/cpu.h
target-mips/helper.c

index 82f9a381644c22475bff70333b5bd42d696587ee..97e106f47aa22ef81a906e9f84726a9c9c3640ac 100644 (file)
@@ -590,6 +590,8 @@ int cpu_mips_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
 #define cpu_handle_mmu_fault cpu_mips_handle_mmu_fault
 void do_interrupt (CPUState *env);
 void r4k_invalidate_tlb (CPUState *env, int idx, int use_extra);
+target_phys_addr_t do_translate_address (CPUState *env, target_ulong address,
+                                        int rw);
 
 static inline void cpu_pc_from_tb(CPUState *env, TranslationBlock *tb)
 {
index 0b5ec3e566a1e78de4cc680311c5e6d95182d8ff..1e7e016084fb2b2cadd35b8749ae58a6d12fee0c 100644 (file)
@@ -310,6 +310,29 @@ int cpu_mips_handle_mmu_fault (CPUState *env, target_ulong address, int rw,
     return ret;
 }
 
+#if !defined(CONFIG_USER_ONLY)
+target_phys_addr_t do_translate_address(CPUState *env, target_ulong address, int rw)
+{
+    target_phys_addr_t physical;
+    int prot;
+    int access_type;
+    int ret = 0;
+
+    rw &= 1;
+
+    /* data access */
+    access_type = ACCESS_INT;
+    ret = get_physical_address(env, &physical, &prot,
+                               address, rw, access_type);
+    if (ret != TLBRET_MATCH) {
+        raise_mmu_exception(env, address, rw, ret);
+        cpu_loop_exit();
+    }
+
+    return physical;
+}
+#endif
+
 static const char * const excp_names[EXCP_LAST + 1] = {
     [EXCP_RESET] = "reset",
     [EXCP_SRESET] = "soft reset",