lkml.org 
[lkml]   [2004]   [Dec]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 32-bit syscalls from 64-bit process on x86-64?
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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:08    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site