mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andi Kleen <ak@suse.de>
To: Petr Vandrovec <VANDROVE@vc.cvut.cz>
Cc: Andi Kleen <ak@suse.de>, Jeremy Fitzhardinge <jeremy@goop.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: 32-bit syscalls from 64-bit process on x86-64?
Date: Wed, 15 Dec 2004 05:27:04 +0100	[thread overview]
Message-ID: <20041215042704.GE27225@wotan.suse.de> (raw)
In-Reply-To: <380350F3EC1@vcnet.vc.cvut.cz>

On Tue, Dec 14, 2004 at 11:01:12PM +0100, Petr Vandrovec wrote:
> 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.

Ah sorry. I misread the intention of your code. I thought you wanted
to do it the other way round - 32bit syscall from 64bit code.
I just wanted to point out that you can do it directly without
changing the code segment, as long as you use int $0x80.

>From 64bit-from-32bit the lcall is needed agreed. However as a 
warning it will not work for all calls since a few check a bit
in task_struct that says if the process is 32bit or 64bit
(rather rare though, most prominent is signal handling) 

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

I haven't ever tried it, but I see no reason it cannot work.

-Andi

  reply	other threads:[~2004-12-15  4:27 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-14 22:01 Petr Vandrovec
2004-12-15  4:27 ` Andi Kleen [this message]
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
  -- strict thread matches above, loose matches on Subject: below --
2004-12-02 16:22 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

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=20041215042704.GE27225@wotan.suse.de \
    --to=ak@suse.de \
    --cc=VANDROVE@vc.cvut.cz \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome