linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* 32-bit syscalls from 64-bit process on x86-64?
@ 2004-12-02 16:22 Jeremy Fitzhardinge
  2004-12-02 18:52 ` Jeremy Fitzhardinge
  2004-12-03  6:15 ` Andi Kleen
  0 siblings, 2 replies; 14+ messages in thread
From: Jeremy Fitzhardinge @ 2004-12-02 16:22 UTC (permalink / raw)
  To: Andi Kleen; +Cc: linux-kernel

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).

>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...

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?

Thanks,
	J


^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: 32-bit syscalls from 64-bit process on x86-64?
@ 2004-12-14 22:01 Petr Vandrovec
  2004-12-15  4:27 ` Andi Kleen
  0 siblings, 1 reply; 14+ messages in thread
From: Petr Vandrovec @ 2004-12-14 22:01 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Jeremy Fitzhardinge, linux-kernel

On 14 Dec 04 at 8:45, Andi Kleen wrote:
> > #define TOLM                            \
> >                 "pushl %%cs\n"          \
> >                 "pushl $91f\n"          \
> >                 "ljmpl $0x33,$90f\n"    \
> 
> It's useless, there is nothing in the kernel code that checks the 
> 32bit segment.

???  Processor checks for 32bit/64bit segment.  It is impossible to load
upper 32bit of all registers with non-zero value or call 64bit
syscall entry point from 32bit mode.  As x86-64 kernel offers 64bit 
interface through syscall only, only way how to issue 64bit system call
is using syscall instruction in 64bit code.

Or are you trying to say that these samples do not work and you cannot
call 64bit entry point from 32bit app, or vice versa?  Then I'm afraid
that you are not completely right, as these samples do work...
                                                Petr Vandrovec


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2004-12-16  4:35 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).