linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chuck Ebbert <76306.1226@compuserve.com>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Andi Kleen <ak@suse.de>,
	Vincent Hanquez <vincent.hanquez@cl.cam.ac.uk>,
	Andrew Morton <akpm@osdl.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [patch 2.6.13-rc3] i386: clean up user_mode macros
Date: Tue, 26 Jul 2005 21:57:24 -0400	[thread overview]
Message-ID: <200507262159_MC3-1-A5A2-A862@compuserve.com> (raw)

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

             reply	other threads:[~2005-07-27  2:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-27  1:57 Chuck Ebbert [this message]
  -- strict thread matches above, loose matches on Subject: below --
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200507262159_MC3-1-A5A2-A862@compuserve.com \
    --to=76306.1226@compuserve.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    --cc=vincent.hanquez@cl.cam.ac.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).