linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 2.6.13-rc3] i386: clean up user_mode macros
@ 2005-07-25 22:59 Chuck Ebbert
  2005-07-25 23:13 ` Linus Torvalds
  0 siblings, 1 reply; 8+ messages in thread
From: Chuck Ebbert @ 2005-07-25 22:59 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andrew Morton, Linus Torvalds, Vincent Hanquez, Andi Kleen


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)

        2. Removes conditional jump from user_mode_vm()
           (it's called every timer tick on each CPU on SMP)

I've been running this patch for a while now.  Please apply.

Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com>

Index: 2.6.13-rc3a/include/asm-i386/ptrace.h
===================================================================
--- 2.6.13-rc3a.orig/include/asm-i386/ptrace.h	2005-07-13 16:20:26.000000000 -0400
+++ 2.6.13-rc3a/include/asm-i386/ptrace.h	2005-07-14 02:47:51.000000000 -0400
@@ -57,8 +57,8 @@
 #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))
+#define user_mode(regs)		(!!(3 & (regs)->xcs))
+#define user_mode_vm(regs)	(!!((VM_MASK & (regs)->eflags) | (3 & (regs)->xcs)))
 #define instruction_pointer(regs) ((regs)->eip)
 #if defined(CONFIG_SMP) && defined(CONFIG_FRAME_POINTER)
 extern unsigned long profile_pc(struct pt_regs *regs);
__
Chuck

^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: [patch 2.6.13-rc3] i386: clean up user_mode macros
@ 2005-07-27  1:57 Chuck Ebbert
  0 siblings, 0 replies; 8+ messages in thread
From: Chuck Ebbert @ 2005-07-27  1:57 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Andi Kleen, Vincent Hanquez, Andrew Morton, linux-kernel

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 <76306.1226@compuserve.com>
===================================================================
--- 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-07-27  2:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-25 22:59 [patch 2.6.13-rc3] i386: clean up user_mode macros Chuck Ebbert
2005-07-25 23:13 ` Linus Torvalds
2005-07-26  0:20   ` Steven Rostedt
2005-07-26  2:45     ` Lee Revell
2005-07-26  1:28   ` Miles Bader
2005-07-26  1:34     ` Andrew Morton
2005-07-26  2:31       ` randy_dunlap
2005-07-27  1:57 Chuck Ebbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).