Fix remote debugger memory access problems reported by Matthias Stein
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>
Thu, 14 Feb 2008 17:46:44 +0000 (17:46 +0000)
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>
Thu, 14 Feb 2008 17:46:44 +0000 (17:46 +0000)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3982 c046a42c-6fe2-441c-8c8c-71466251a162

target-sparc/cpu.h
target-sparc/translate.c

index e0715a1..8a4cdbc 100644 (file)
@@ -338,20 +338,23 @@ void cpu_check_irqs(CPUSPARCState *env);
 #ifdef TARGET_SPARC64
 #define MMU_MODE2_SUFFIX _hypv
 #endif
-#define MMU_USER_IDX 0
+#define MMU_USER_IDX   0
+#define MMU_KERNEL_IDX 1
+#define MMU_HYPV_IDX   2
+
 static inline int cpu_mmu_index (CPUState *env)
 {
 #if defined(CONFIG_USER_ONLY)
-    return 0;
+    return MMU_USER_IDX;
 #elif !defined(TARGET_SPARC64)
     return env->psrs;
 #else
     if (!env->psrs)
-        return 0;
+        return MMU_USER_IDX;
     else if ((env->hpstate & HS_PRIV) == 0)
-        return 1;
+        return MMU_KERNEL_IDX;
     else
-        return 2;
+        return MMU_HYPV_IDX;
 #endif
 }
 
index eb3b23b..6356136 100644 (file)
@@ -4194,8 +4194,10 @@ target_phys_addr_t cpu_get_phys_page_debug(CPUState *env, target_ulong addr)
     target_phys_addr_t phys_addr;
     int prot, access_index;
 
-    if (get_physical_address(env, &phys_addr, &prot, &access_index, addr, 2, 0) != 0)
-        if (get_physical_address(env, &phys_addr, &prot, &access_index, addr, 0, 0) != 0)
+    if (get_physical_address(env, &phys_addr, &prot, &access_index, addr, 2,
+                             MMU_KERNEL_IDX) != 0)
+        if (get_physical_address(env, &phys_addr, &prot, &access_index, addr,
+                                 0, MMU_KERNEL_IDX) != 0)
             return -1;
     if (cpu_get_physical_page_desc(phys_addr) == IO_MEM_UNASSIGNED)
         return -1;