public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [GIT PULL] x86/paravirt for v2.6.33
Date: Wed, 09 Dec 2009 10:31:41 -0800	[thread overview]
Message-ID: <4B1FED0D.7060003@goop.org> (raw)
In-Reply-To: <20091209073632.GD8187@elte.hu>

On 12/08/09 23:36, Ingo Molnar wrote:
> Jeremy, mind sending a patch that updates this code to use the less
> obfuscated 32-bit version, not the 64-bit version? (a delta patch
> against tip:master would be nice, as there's a fair amount of testing in
> the unification change itself already, which we dont want to discard.)
>    

How does this look?

git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen.git fix-iopl

From: Jeremy Fitzhardinge<jeremy.fitzhardinge@citrix.com>
Date: Wed, 9 Dec 2009 10:26:59 -0800
Subject: [PATCH] x86: Make sys_iopl use passed-in pt_regs

Rather than using task_pt_regs, use the pt_regs * passed into the syscall.
The ABI differences are handled in small 32/64-bit specific functions,
and everything else is handled in the common do_iopl().

Signed-off-by: Jeremy Fitzhardinge<jeremy.fitzhardinge@citrix.com>

diff --git a/arch/x86/include/asm/syscalls.h b/arch/x86/include/asm/syscalls.h
index 5336ce2..70497f0 100644
--- a/arch/x86/include/asm/syscalls.h
+++ b/arch/x86/include/asm/syscalls.h
@@ -33,11 +33,11 @@ long sys_rt_sigreturn(struct pt_regs *);
  asmlinkage int sys_set_thread_area(struct user_desc __user *);
  asmlinkage int sys_get_thread_area(struct user_desc __user *);

-/* kernel/ioport.c */
-asmlinkage long sys_iopl(unsigned int);
-
  /* X86_32 only */
  #ifdef CONFIG_X86_32
+/* kernel/ioport.c */
+asmlinkage long sys_iopl(struct pt_regs *);
+
  /* kernel/process_32.c */
  int sys_clone(struct pt_regs *);
  int sys_execve(struct pt_regs *);
@@ -71,6 +71,9 @@ int sys_vm86(struct pt_regs *);

  /* X86_64 only */

+/* kernel/ioport.c */
+asmlinkage long sys_iopl(unsigned int, struct pt_regs *);
+
  /* kernel/process_64.c */
  asmlinkage long sys_clone(unsigned long, unsigned long,
  			  void __user *, void __user *,
diff --git a/arch/x86/kernel/ioport.c b/arch/x86/kernel/ioport.c
index bad4f22..ac3cf88 100644
--- a/arch/x86/kernel/ioport.c
+++ b/arch/x86/kernel/ioport.c
@@ -105,6 +105,7 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
   */
  static int do_iopl(unsigned int level, struct pt_regs *regs)
  {
+	struct thread_struct *t =&current->thread;
  	unsigned int old = (regs->flags>>  12)&  3;

  	if (level>  3)
@@ -116,21 +117,20 @@ static int do_iopl(unsigned int level, struct pt_regs *regs)
  	}
  	regs->flags = (regs->flags&  ~X86_EFLAGS_IOPL) | (level<<  12);

+	t->iopl = level<<  12;
+	set_iopl_mask(t->iopl);
+
  	return 0;
  }

-asmlinkage long sys_iopl(unsigned int level)
+#ifdef CONFIG_X86_64
+asmlinkage long sys_iopl(unsigned int level, struct pt_regs *regs)
  {
-	struct thread_struct *t =&current->thread;
-	struct pt_regs *regs = task_pt_regs(current);
-	int rc;
-
-	rc = do_iopl(level, regs);
-	if (rc<  0)
-		goto out;
-
-	t->iopl = level<<  12;
-	set_iopl_mask(t->iopl);
-out:
-	return rc;
+	return do_iopl(level, regs);
+}
+#else
+asmlinkage long sys_iopl(struct pt_regs *regs)
+{
+	return do_iopl(regs->bx, regs);
  }
+#endif



  parent reply	other threads:[~2009-12-09 18:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-03 21:09 [GIT PULL] x86/paravirt for v2.6.33 Ingo Molnar
2009-12-08 21:34 ` Linus Torvalds
2009-12-09  7:36   ` Ingo Molnar
2009-12-09 18:19     ` Jeremy Fitzhardinge
2009-12-09 18:31     ` Jeremy Fitzhardinge [this message]
2009-12-09 18:47       ` Linus Torvalds
2009-12-09 18:54         ` H. Peter Anvin
2009-12-09 19:08           ` Linus Torvalds
2009-12-09 19:25           ` Brian Gerst
2009-12-09 19:35             ` H. Peter Anvin
2009-12-09 19:32         ` Jeremy Fitzhardinge
2009-12-09 20:05           ` H. Peter Anvin
2009-12-09 18:49       ` H. Peter Anvin
2009-12-09 18:18   ` Jeremy Fitzhardinge
2009-12-09 21:58     ` Linus Torvalds
  -- strict thread matches above, loose matches on Subject: below --
2009-12-09 18:29 H. Peter Anvin
2009-12-09 18:38 ` Linus Torvalds

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=4B1FED0D.7060003@goop.org \
    --to=jeremy@goop.org \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /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