grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* esp register value after jump to linux
@ 2014-12-24 18:59 Alexander Kuleshov
  2014-12-26 18:35 ` Andrei Borzenkov
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Kuleshov @ 2014-12-24 18:59 UTC (permalink / raw)
  To: grub-devel

Hello all,

I see that grub setups registers before jump to linux kernel at
grub/grub-core/loader/i386/pc/linux.c:

grub_linux16_boot (void)

{

  ...

  state.gs = state.fs = state.es = state.Tds = state.ss = segment;

  state.sp = GRUB_LINUX_SETUP_STACK;

  state.cs = segment + 0x20;

  state.ip = 0;

  ...

}

I see in gdb that: ss, ds, and other segment registers are 0x1000, and
cs is 0x1020. It is good. But why esp is 0xf7f4? I see that
GRUB_LINUX_SETUP_STACK is 0x9000.

Thank you.


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

* Re: esp register value after jump to linux
  2014-12-24 18:59 esp register value after jump to linux Alexander Kuleshov
@ 2014-12-26 18:35 ` Andrei Borzenkov
  0 siblings, 0 replies; 2+ messages in thread
From: Andrei Borzenkov @ 2014-12-26 18:35 UTC (permalink / raw)
  To: Alexander Kuleshov; +Cc: grub-devel

В Thu, 25 Dec 2014 00:59:36 +0600
Alexander Kuleshov <kuleshovmail@gmail.com> пишет:

> Hello all,
> 
> I see that grub setups registers before jump to linux kernel at
> grub/grub-core/loader/i386/pc/linux.c:
> 
> grub_linux16_boot (void)
> 
> {
> 
>   ...
> 
>   state.gs = state.fs = state.es = state.Tds = state.ss = segment;
> 
>   state.sp = GRUB_LINUX_SETUP_STACK;
> 
>   state.cs = segment + 0x20;
> 
>   state.ip = 0;
> 
>   ...
> 
> }
> 
> I see in gdb that: ss, ds, and other segment registers are 0x1000, and
> cs is 0x1020. It is good. But why esp is 0xf7f4? I see that
> GRUB_LINUX_SETUP_STACK is 0x9000.
> 

It is absolutely unclear at which point, where and how you get content
of ESP.


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

end of thread, other threads:[~2014-12-26 18:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-24 18:59 esp register value after jump to linux Alexander Kuleshov
2014-12-26 18:35 ` Andrei Borzenkov

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