aboutsummaryrefslogtreecommitdiff
path: root/target-sparc/cpu.h
diff options
context:
space:
mode:
authorblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-02-14 17:46:44 +0000
committerblueswir1 <blueswir1@c046a42c-6fe2-441c-8c8c-71466251a162>2008-02-14 17:46:44 +0000
commit9e31b9e28a894c582b8ecaeb2d40e55e407aacd0 (patch)
treef64c3740695adab523474d20723c9be0bc96f10e /target-sparc/cpu.h
parentd0dc7dc3274a88db1c9941614454ed842d62cf91 (diff)
downloadqemu-9e31b9e28a894c582b8ecaeb2d40e55e407aacd0.zip
qemu-9e31b9e28a894c582b8ecaeb2d40e55e407aacd0.tar.gz
qemu-9e31b9e28a894c582b8ecaeb2d40e55e407aacd0.tar.bz2
Fix remote debugger memory access problems reported by Matthias Stein
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3982 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-sparc/cpu.h')
-rw-r--r--target-sparc/cpu.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/target-sparc/cpu.h b/target-sparc/cpu.h
index e0715a1..8a4cdbc 100644
--- a/target-sparc/cpu.h
+++ b/target-sparc/cpu.h
@@ -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
}