public inbox for kexec@lists.infradead.org
 help / color / mirror / Atom feed
From: Vivek Goyal <vgoyal@redhat.com>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Kexec Mailing List <kexec@lists.infradead.org>
Subject: Re: Query regarding x86_64 purgatory and IA32-e compatibility mode
Date: Fri, 26 Oct 2012 09:19:34 -0400	[thread overview]
Message-ID: <20121026131934.GA24687@redhat.com> (raw)
In-Reply-To: <87lietq5zh.fsf@xmission.com>

On Thu, Oct 25, 2012 at 08:14:58PM -0700, Eric W. Biederman wrote:

[..]
> > I see that bit 21  in second doubleword is 0. IIUC, that means that we
> > will switch to compatibility mode. If yes, we are still continuing to
> > use 64bit instructions and continue to access registers (rip, r8-15)
> > which are available in 64bit mode only. Is this correct? How does this
> > work?
> 
>          /* 0x10 4GB flat code segment */
>         .word   0xFFFF, 0x0000, 0x9A00, 0x00AF
> 
> The high 16bits of that are:
> 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
>  0  0  0  0  0  0  0  0  1  0  1  0  1  1  1  1
> 
> Since L is bit 21 I read that as L=1.
> 
> I don't know how you see L=1 there.

My bad. I did not take care of little endianness and read the bits in 
reverse order.
0x00AF

16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
 0  0  0  0  0  0  0  0  1  0  1  0  1  1  1  1

And concluded that bit 21 is 0.

> 
> The transition happens in entry64-32.S
> We get there via:
> 	jmp	*rip(%rip)
> 
> The default value of rip is entry32.
> 
> That is where we clear bit 21 in 
> 	ljmp	*lm_exit_addr(%rip)

Ok, now I understand. In entry64-32.S we load a different GDT 
where bit 21, L = 0. Hence long jump will put it in compatibility
mode.

0x00CF

31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
 0  0  0  0  0  0  0  0  1  1  0  0  1  1  1  1

Thanks for explaining this.

Thanks
Vivek

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

      reply	other threads:[~2012-10-26 13:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-25 20:54 Query regarding x86_64 purgatory and IA32-e compatibility mode Vivek Goyal
2012-10-26  3:14 ` Eric W. Biederman
2012-10-26 13:19   ` Vivek Goyal [this message]

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=20121026131934.GA24687@redhat.com \
    --to=vgoyal@redhat.com \
    --cc=ebiederm@xmission.com \
    --cc=kexec@lists.infradead.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