linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matt Mackall <mpm@selenic.com>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
	Davide Libenzi <davidel@xmailserver.org>,
	Jamie Lokier <jamie@shareable.org>, Jos Hulzink <josh@stack.nl>,
	Andi Kleen <ak@muc.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] Use correct x86 reboot vector
Date: Sun, 11 May 2003 14:00:23 -0500	[thread overview]
Message-ID: <20030511190023.GC9173@waste.org> (raw)
In-Reply-To: <Pine.LNX.4.44.0305111124240.12955-100000@home.transmeta.com>

On Sun, May 11, 2003 at 11:38:34AM -0700, Linus Torvalds wrote:
> 
> On 11 May 2003, Eric W. Biederman wrote:
> > 
> > Now if someone could tell me how to do a jump to 0xffff0000:0xfff0 in real
> > mode I would find that very interesting.
> 
> You should be able to do it the same way as you enter unreal mode, ie:
> 
>  - in protected mode cpl0, crate a segment that has index 0xf000 (ie you 
>    need a large GDT for this to work), and has the right attributes (ie 
>    base 0xffff0000, 16-bit, etc).
> 
>    Make sure you reload the other segments with something sanish and be 
>    16-bit clean.
> 
>  - clear the PE bit, but do _not_ do the long jump to reload the segment 
>    that intel says you should do - just do a short jump to 0xfff0.
> 
> One problem is that the code segment you create this way will have the 
> right base and size, but it will be non-writeable (no way to create a 
> writable code segment in protected mode), so it will be different in other 
> ways.
> 
> And because you'll have to do some of the the setup with that new and
> inconvenient CS, you'll either have to make the limit be big (and wrap 
> around EIP in order to first execute code that is in low memory), or 
> you'll have to play even more tricks and clear both PE and PG at the same 
> time and just "fall through" to the code at 0xfffffff0. 
> 
> Sounds like it might work, at least on a few CPU's. 

There's a missing piece of behavior here that's probably fatal.
Namely, the next time the CS descriptor is loaded, even with the same
value, the high bits are lost. So, for example, if you're running BIOS
out of ROM, decompressing it into the top of 20-bit address space,
then long jumping to your uncompressed code, you don't want to find
yourself back in ROM.

Perhaps there's a trick that can be played with loading the descriptor
into CS and then clearing the descriptor table without flushing, but it
sounds rather dubious..

-- 
Matt Mackall : http://www.selenic.com : of or relating to the moon

  reply	other threads:[~2003-05-11 18:48 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-10  2:56 [PATCH] Use correct x86 reboot vector Andi Kleen
2003-05-10  3:35 ` CaT
2003-05-10  3:58   ` H. Peter Anvin
2003-05-10 14:49   ` Alan Cox
2003-05-10 16:17     ` Jamie Lokier
2003-05-10 18:47       ` Jos Hulzink
2003-05-11 18:01     ` Eric W. Biederman
2003-05-11 17:24       ` Alan Cox
2003-05-11 19:04         ` Eric W. Biederman
2003-05-12  5:48         ` [PATCH] always shutdown on the bootstrap processor Eric W. Biederman
2003-05-10 16:15 ` [PATCH] Use correct x86 reboot vector Jamie Lokier
2003-05-10 17:09   ` Randy.Dunlap
2003-05-10 19:41   ` Jos Hulzink
2003-05-10 18:10     ` Jamie Lokier
2003-05-10 20:55       ` Jos Hulzink
2003-05-11  3:50       ` Linus Torvalds
2003-05-11  9:37         ` Jos Hulzink
2003-05-11 14:01           ` Jamie Lokier
2003-05-11 17:38             ` Davide Libenzi
2003-05-11 17:56               ` Eric W. Biederman
2003-05-11 18:23                 ` Davide Libenzi
2003-05-11 19:12                   ` Eric W. Biederman
2003-05-12 15:36                     ` Maciej W. Rozycki
2003-05-13  6:35                     ` H. Peter Anvin
2003-05-11 18:38                 ` Linus Torvalds
2003-05-11 19:00                   ` Matt Mackall [this message]
2003-05-11 19:16                     ` Eric W. Biederman
2003-05-12  1:07                     ` H. Peter Anvin
2003-05-11 19:10                   ` Eric W. Biederman
2003-05-11 18:43                 ` Christer Weinigel
2003-05-11 20:22                   ` wingel
2003-05-11 20:26                     ` Davide Libenzi
2003-05-11 17:54         ` Eric W. Biederman
2003-05-13 12:49 Chuck Ebbert
2003-05-13 18:45 ` H. Peter Anvin
2003-05-13 19:04   ` Richard B. Johnson
2003-05-13 19:27     ` H. Peter Anvin

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=20030511190023.GC9173@waste.org \
    --to=mpm@selenic.com \
    --cc=ak@muc.de \
    --cc=davidel@xmailserver.org \
    --cc=ebiederm@xmission.com \
    --cc=jamie@shareable.org \
    --cc=josh@stack.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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;
as well as URLs for NNTP newsgroup(s).