On Mon, 25 Jul 2005 at 16:13:13 -0700 (PDT), Linus Torvalds wrote:
> On Mon, 25 Jul 2005, Chuck Ebbert wrote:
> >
> > Recent patches from the Xen group changed the X86 user_mode macros.
> >
> > This patch does the following:
> >
> > 1. Makes the new user_mode() return 0 or 1 (same as x86_64)
>
> I _really_ prefer
>
> x != 0
>
> over
>
> !!x
Take 2: compile tested only.
Signed-off-by: Chuck Ebbert <[email protected]>
===================================================================
--- 2.6.13-rc3.orig/include/asm-i386/ptrace.h
+++ 2.6.13-rc3/include/asm-i386/ptrace.h
@@ -57,14 +57,21 @@
#ifdef __KERNEL__
struct task_struct;
extern void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code);
-#define user_mode(regs) (3 & (regs)->xcs)
-#define user_mode_vm(regs) ((VM_MASK & (regs)->eflags) || user_mode(regs))
+
+static inline int user_mode(struct pt_regs *regs)
+{
+ return (regs->xcs & 3) != 0;
+}
+static inline int user_mode_vm(struct pt_regs *regs)
+{
+ return ((regs->xcs & 3) | (regs->eflags & VM_MASK)) != 0;
+}
#define instruction_pointer(regs) ((regs)->eip)
#if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER)
extern unsigned long profile_pc(struct pt_regs *regs);
#else
#define profile_pc(regs) instruction_pointer(regs)
#endif
-#endif
+#endif /* __KERNEL__ */
#endif
__
Chuck
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
|
|