From: Andi Kleen <ak@suse.de>
To: Jeremy Fitzhardinge <jeremy@goop.org>
Cc: Andi Kleen <ak@suse.de>, linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: 32-bit syscalls from 64-bit process on x86-64?
Date: Fri, 3 Dec 2004 07:15:20 +0100 [thread overview]
Message-ID: <20041203061520.GG31767@wotan.suse.de> (raw)
In-Reply-To: <1102004520.8707.10.camel@localhost>
On Thu, Dec 02, 2004 at 08:22:00AM -0800, Jeremy Fitzhardinge wrote:
> Hi Andi,
>
> Is it possible for a 64-bit process to invoke the 32-bit syscall
> compatibility layer? I'm thinking this might be useful for Valgrind,
> since if it is running on an x86-64 host, it can take advantage of
> having more registers and a larger address space to do a better
> emulation of plain ia32. But this is only practical if I can reuse the
> kernel's 32-bit emulation layer, since duplicating it in Valgrind would
> be silly (particularly ioctls).
It has been done actually (in the intel ia32el JIT)
>
> >From a quick look at the code, it seems to me that int 0x80 might still
> work in 64-bit mode, but connect to 32-bit syscalls. Is that right? If
> not, could it be made to be right? Alternatively, something like adding
> a constant offset to the syscall numbers would work for me (ie, 0-N are
> 64-bit syscalls, 0x10000-N are 32-bit). Hm, no, it looks like int 0x80
> just calls normal 64-bit syscalls....
int 0x80 from 64bit will call 32bit syscalls. But some things
will not work properly, e.g. signals because they test the 32bit
flag in the task_struct. So you would still get 64bit signal frames.
There are some other such tests, but they probably wont affect you.
There were some plans at one point to allow to toggle the flag
using personality or prctl, but so far it hasn't been implemented.
There is also no way to do 64bit calls from a 32bit executable.
>
> And does the 32-bit layer keep any private state? For example, if I
> modify the signal state with 32-syscalls in one place, and 64-bit
> syscalls elsewhere, will that cause a problem or inconsistencies?
64bit processes always get 64bit signals.
-Andi
next prev parent reply other threads:[~2004-12-03 6:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-02 16:22 32-bit syscalls from 64-bit process on x86-64? Jeremy Fitzhardinge
2004-12-02 18:52 ` Jeremy Fitzhardinge
2004-12-03 6:15 ` Andi Kleen [this message]
2004-12-03 23:16 ` Jeremy Fitzhardinge
2004-12-04 14:40 ` Petr Vandrovec
2004-12-04 21:33 ` Jeremy Fitzhardinge
2004-12-08 2:30 ` Jeremy Fitzhardinge
2004-12-14 7:45 ` Andi Kleen
-- strict thread matches above, loose matches on Subject: below --
2004-12-14 22:01 Petr Vandrovec
2004-12-15 4:27 ` Andi Kleen
2004-12-15 10:50 ` Jeremy Fitzhardinge
2004-12-15 10:55 ` Andi Kleen
2004-12-15 20:58 ` Jeremy Fitzhardinge
2004-12-16 4:35 ` Andi Kleen
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=20041203061520.GG31767@wotan.suse.de \
--to=ak@suse.de \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.