rename 'unused' in sys_iopl to somethign else, since it is used
A message that is not in the archive (sent off-list or not yet received): [email protected]
In message <[email protected]> you write:
Quoted 3 lines
sys_ioplon i386 accepts one parameter, 'unsigned long unused'. Then it goes ahead and uses it to get a pointer to structpt_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...
Quoted 5 lines
diff -Nru
a/arch/i386/kernel/ioport.cb/arch/i386/kernel/ioport.carch/i386/kernel/ioport.c +0
-0@@ -102,9 +102,9 @@* code.
arch/i386/kernel/ioport.c line 110
Quoted 10 lines
arch/i386/kernel/ioport.c +2
-2*/ -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:
arch/i386/kernel/ioport.c +2 -3
@@ -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.
Quoted 7 lines · Rusty Russell
In message <[email protected]> you write:
Quoted 3 lines
sys_ioplon i386 accepts one parameter, 'unsigned long unused'. Then it goes ahead and uses it to get a pointer to structpt_regs. This patch changes its name to 'location'.=20Hmmm.... Andi, the
x86_64version 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