patch-2.3.7 linux/include/asm-arm/proc-armo/ptrace.h

Next file: linux/include/asm-arm/proc-armo/semaphore.h
Previous file: linux/include/asm-arm/irq.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.6/linux/include/asm-arm/proc-armo/ptrace.h linux/include/asm-arm/proc-armo/ptrace.h
@@ -44,6 +44,8 @@
 #define CC_Z_BIT	(1 << 30)
 #define CC_N_BIT	(1 << 31)
 
+#ifdef __KERNEL__
+
 #define processor_mode(regs) \
 	((regs)->ARM_pc & MODE_MASK)
 
@@ -70,11 +72,19 @@
  */
 static inline int valid_user_regs(struct pt_regs *regs)
 {
-	if (!user_mode(regs) || regs->ARM_pc & (F_BIT | I_BIT))
+	if (user_mode(regs) &&
+	    (regs->ARM_pc & (F_BIT | I_BIT)) == 0)
 		return 1;
 
+	/*
+	 * force it to be something sensible
+	 */
+	regs->ARM_pc &= ~(MODE_MASK | F_BIT | I_BIT);
+
 	return 0;
 }
+
+#endif	/* __KERNEL__ */
 
 #endif
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)