From: Ingo Molnar <mingo@elte.hu>
To: Brian Gerst <brgerst@gmail.com>
Cc: Tejun Heo <tj@kernel.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] x86: Pass in pt_regs pointer for syscalls that need it
Date: Wed, 11 Feb 2009 16:01:44 +0100 [thread overview]
Message-ID: <20090211150144.GD10525@elte.hu> (raw)
In-Reply-To: <73c1f2160902110631j68e58202h3e49288cfe613d66@mail.gmail.com>
* 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 *)®sp;
> >> - 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
next prev parent reply other threads:[~2009-02-11 15:02 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-10 14:51 [PATCH 0/3] x86: Fix pt_regs passed by value Brian Gerst
2009-02-10 14:51 ` [PATCH 1/3] x86: Use pt_regs pointer in do_device_not_available() Brian Gerst
2009-02-11 7:43 ` Tejun Heo
2009-02-11 10:13 ` Ingo Molnar
2009-02-11 14:34 ` Brian Gerst
2009-02-11 14:42 ` Tejun Heo
2009-02-11 14:46 ` Brian Gerst
2009-02-11 14:53 ` Tejun Heo
2009-02-10 14:51 ` [PATCH 2/3] x86: Pass in pt_regs pointer for syscalls that need it Brian Gerst
2009-02-11 7:41 ` Tejun Heo
2009-02-11 10:18 ` Ingo Molnar
2009-02-11 14:14 ` Tejun Heo
2009-02-11 14:31 ` Brian Gerst
2009-02-11 14:41 ` Tejun Heo
2009-02-11 14:43 ` Tejun Heo
2009-02-11 14:48 ` Tejun Heo
2009-02-11 14:58 ` Ingo Molnar
2009-02-11 14:59 ` Brian Gerst
2009-02-11 15:05 ` Tejun Heo
2009-02-11 15:10 ` Brian Gerst
2009-02-11 15:14 ` Tejun Heo
2009-02-11 15:59 ` Ingo Molnar
2009-02-12 1:12 ` Tejun Heo
2009-02-11 15:01 ` Ingo Molnar [this message]
2009-02-11 17:52 ` H. Peter Anvin
2009-02-11 18:27 ` Brian Gerst
2009-02-11 19:50 ` H. Peter Anvin
2009-02-11 19:57 ` Brian Gerst
2009-02-11 20:00 ` H. Peter Anvin
2009-02-11 21:43 ` [PATCH] x86: pass in pt_regs pointer for syscalls that need it (take 2) Brian Gerst
2009-02-11 21:50 ` H. Peter Anvin
2009-02-11 22:06 ` H. Peter Anvin
2009-02-12 11:02 ` Ingo Molnar
2009-02-10 14:51 ` [PATCH 3/3] x86: Drop -fno-stack-protector after pt_regs fixes Brian Gerst
2009-02-11 11:42 ` [PATCH 0/3] x86: Fix pt_regs passed by value Ingo Molnar
2009-02-11 14:15 ` Tejun Heo
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=20090211150144.GD10525@elte.hu \
--to=mingo@elte.hu \
--cc=brgerst@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.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