* Re: rename 'unused' in sys_iopl to somethign else, since it is used
[not found] <20020728141256.GA9573@alhambra.actcom.co.il>
@ 2002-07-30 1:02 ` Rusty Russell
2002-07-30 4:25 ` Andi Kleen
0 siblings, 1 reply; 2+ messages in thread
From: Rusty Russell @ 2002-07-30 1:02 UTC (permalink / raw)
To: Muli Ben-Yehuda; +Cc: ak, linux-kernel
In message <20020728141256.GA9573@alhambra.actcom.co.il> you write:
> sys_iopl on i386 accepts one parameter, 'unsigned long unused'. Then
> it goes ahead and uses it to get a pointer to struct pt_regs. This
> patch changes its name to 'location'.=20
Hmmm.... Andi, the x86_64 version is different: do you really push one
arg on the stack then the regs? Please check...
> diff -Nru a/arch/i386/kernel/ioport.c b/arch/i386/kernel/ioport.c
> --- a/arch/i386/kernel/ioport.c Sun Jul 28 17:08:54 2002
> +++ b/arch/i386/kernel/ioport.c Sun Jul 28 17:08:54 2002
> @@ -102,9 +102,9 @@
> * code.
> */
>
> -asmlinkage int sys_iopl(unsigned long unused)
> +asmlinkage int sys_iopl(unsigned long location)
> {
> - struct pt_regs * regs =3D (struct pt_regs *) &unused;
> + struct pt_regs * regs =3D (struct pt_regs *) &location;=20
> unsigned int level =3D regs->ebx;
> unsigned int old =3D (regs->eflags >> 12) & 3;
>
It also then rereads the arg out of regs->ebx. I prefer the following
patch, which makes it obvious that the arg *is* required, and what it
means:
diff -urpN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.29/arch/i386/kernel/ioport.c working-2.5.29-iopl/arch/i386/kernel/ioport.c
--- linux-2.5.29/arch/i386/kernel/ioport.c Mon Jun 17 23:19:16 2002
+++ working-2.5.29-iopl/arch/i386/kernel/ioport.c Tue Jul 30 10:58:38 2002
@@ -102,10 +102,9 @@ asmlinkage int sys_ioperm(unsigned long
* code.
*/
-asmlinkage int sys_iopl(unsigned long unused)
+asmlinkage int sys_iopl(unsigned int level)
{
- struct pt_regs * regs = (struct pt_regs *) &unused;
- unsigned int level = regs->ebx;
+ struct pt_regs * regs = (struct pt_regs *) &level;
unsigned int old = (regs->eflags >> 12) & 3;
if (level > 3)
Thanks!
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: rename 'unused' in sys_iopl to somethign else, since it is used
2002-07-30 1:02 ` rename 'unused' in sys_iopl to somethign else, since it is used Rusty Russell
@ 2002-07-30 4:25 ` Andi Kleen
0 siblings, 0 replies; 2+ messages in thread
From: Andi Kleen @ 2002-07-30 4:25 UTC (permalink / raw)
To: Rusty Russell; +Cc: Muli Ben-Yehuda, ak, linux-kernel
On Tue, Jul 30, 2002 at 11:02:33AM +1000, Rusty Russell wrote:
> In message <20020728141256.GA9573@alhambra.actcom.co.il> you write:
> > sys_iopl on i386 accepts one parameter, 'unsigned long unused'. Then
> > it goes ahead and uses it to get a pointer to struct pt_regs. This
> > patch changes its name to 'location'.=20
>
> Hmmm.... Andi, the x86_64 version is different: do you really push one
> arg on the stack then the regs? Please check...
level is in a register (rdi), but pt_regs is on the stack. The calling
convention automatically switches to stack location for structures bigger
than one register.
On i386 it is probably cleanest when you need both pt_regs and arguments
to declare pt_regs only and get the first argument directly out of regs->ebx.
-Andi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-07-30 4:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20020728141256.GA9573@alhambra.actcom.co.il>
2002-07-30 1:02 ` rename 'unused' in sys_iopl to somethign else, since it is used Rusty Russell
2002-07-30 4:25 ` Andi Kleen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®