public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Brian Gerst <brgerst@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] x86: Pass in pt_regs pointer for syscalls that	need it
Date: Thu, 12 Feb 2009 10:12:06 +0900	[thread overview]
Message-ID: <49937766.4070102@gmail.com> (raw)
In-Reply-To: <20090211155926.GA26194@elte.hu>

Ingo Molnar wrote:
> * Tejun Heo <htejun@gmail.com> wrote:
> 
>> Brian Gerst wrote:
>>> x86-64 doesn't have the tail-call problem because it doesn't use the
>>> pt_regs on stack trick for syscall args.  All the args are passed in
>>> registers.
>> Yeah, I was saying that we can do about the same thing on x86_32 by
>> passing in pointer to pt_regs and defining proper syscall wrappers.
>> It will cost a bit of performance by increasing register pressure tho.
> 
> Do you mean converting:
> 
> ptregscall int sys_execve(struct pt_regs *regs, char __user *u_filename,
>                           char __user * __user *argv,
>                           char __user * __user *envp)
> 
> to:
> 
> ptregscall int sys_execve(struct pt_regs *regs)
> {
> 	char __user *u_filename		= syscall_arg1(regs);
> 	char __user * __user *argv	= syscall_arg2(regs);
> 	char __user * __user *envp	= syscall_arg3(regs);
> 
> etc.?

Not exactly.  include/linux/syscalls.h already has syscall wrapping
macros defined, with slight modification to allow archs to define its
own __SC_DECL and __SC_LONG (probably should use different name tho),
the outer function can be easily defined to take pt_regs pointer and
pass in the correct argument to the actual implementation function.
The only added overhead would be pt_regs pointer having to be loaded
into %edi and it having to stay somewhere in the callee till the last
parameter access.

Thanks.

-- 
tejun

  reply	other threads:[~2009-02-12  1:12 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 [this message]
2009-02-11 15:01       ` Ingo Molnar
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=49937766.4070102@gmail.com \
    --to=htejun@gmail.com \
    --cc=brgerst@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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