lkml.org 
[lkml]   [2009]   [Feb]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/3] x86: Pass in pt_regs pointer for syscalls that need it

* Brian Gerst <brgerst@gmail.com> wrote:

> On Wed, Feb 11, 2009 at 2:41 AM, Tejun Heo <tj@kernel.org> wrote:
> > Hello, Brian.
> >
> > Brian Gerst wrote:
> >> Some syscalls need to access the pt_regs structure, either to copy
> >> user register state or to modifiy it. This patch adds stubs to load
> >> the address of the pt_regs struct into the %eax register, and changes
> >> the syscalls to regparm(1) to receive the pt_regs pointer as the
> >> first argument.
> >
> > Heh... neat. Just one question.
> >
> >> -asmlinkage long sys_iopl(unsigned long regsp)
> >> +ptregscall long sys_iopl(struct pt_regs *regs, unsigned int level)
> >> {
> >> - struct pt_regs *regs = (struct pt_regs *)&regsp;
> >> - unsigned int level = regs->bx;
> >
> > Here and at other places where the function takes more than one
> > arguments, wouldn't it be better to just take *regs and use other
> > parameters from regs? That way we won't have to worry about gcc
> > corrupting register frame at all and I think it's cleaner that way.
>
> Expanding the parameters is good documentation. [...]

Well, that way we shuffle the parameter expansion into assembly code,
instead of creating it as a local variable in the C function.

The latter sure looks better documented, and less error-prone as
well, right? The compiler might also be able to optimize it some.
(and we save one instruction in any case)

Ingo


\
 
 \ /
  Last update: 2009-02-11 16:05    [W:0.063 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site