Skip to contentSkip to conversation

Check if we really are in userspace

PATCH In review Thiemo Seufer 2 participants 2 messages Feb 16, 2006 – Mar 11, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Check if we really are in userspace

Hello All,

this tests for MIPS if we are in userspace when handling a TLB fault. For some of the other architectures this may also be a bug, only ppc and x86 handle this so far.

Thiemo

Index: cpu-exec.c
===================================================================
RCS file: /sources/qemu/qemu/cpu-exec.c,v
retrieving revision 1.73

cpu-exec.c +3 -1
diff -u -p -r1.73 cpu-exec.c
@@ -1089,7 +1089,9 @@ static inline int handle_cpu_signal(unsi
     }
 
     /* see if it is an MMU fault */
-    ret = cpu_mips_handle_mmu_fault(env, address, is_write, 1, 0);
+    ret = cpu_mips_handle_mmu_fault(env, address, is_write,
+				    ((env->hflags & MIPS_HFLAG_MODE)
+				     == MIPS_HFLAG_UM), 0);
     if (ret < 0)
         return 0; /* not an MMU fault */
     if (ret == 0)
#1 lore raw
Quoted 8 lines

Index: cpu-exec.c
===================================================================
RCS file: /sources/qemu/qemu/cpu-exec.c,v
retrieving revision 1.73
diff -u -p -r1.73 cpu-exec.c

cpu-exec.c static inline int handle_cpu_signal(unsi · line 1097

Quoted 10 lines
cpu-exec.c +3 -1
@@ -1089,7 +1089,9 @@ static inline int handle_cpu_signal(unsi
     }
 
     /* see if it is an MMU fault */
-    ret = cpu_mips_handle_mmu_fault(env, address, is_write, 1, 0);
+    ret = cpu_mips_handle_mmu_fault(env, address, is_write,
+				    ((env->hflags & MIPS_HFLAG_MODE)
+				     == MIPS_HFLAG_UM), 0);
     if (ret < 0)
         return 0; /* not an MMU fault */
     if (ret == 0)

This code is only used when !defined(CONFIG_SOFTMMU), ie. usermode emulation. The i386 code is a leftover of the now-dead qemu-fast. Presumably the ppc code was just copied from these.

Paul