* Where in GRUB2 source code is the handover/jump to kernel code on x86?
@ 2015-09-03 12:49 deffo
2015-09-03 17:24 ` Colin Watson
0 siblings, 1 reply; 2+ messages in thread
From: deffo @ 2015-09-03 12:49 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/html, Size: 559 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Where in GRUB2 source code is the handover/jump to kernel code on x86?
2015-09-03 12:49 Where in GRUB2 source code is the handover/jump to kernel code on x86? deffo
@ 2015-09-03 17:24 ` Colin Watson
0 siblings, 0 replies; 2+ messages in thread
From: Colin Watson @ 2015-09-03 17:24 UTC (permalink / raw)
To: grub-devel
On Thu, Sep 03, 2015 at 02:49:45PM +0200, deffo@gmx.de wrote:
> <html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
Plain-text mail would be appreciated, or at least mail with a text/plain
part.
> I'm looking for the line of code where GRUB2 finally jumps to kernel
> code and thus hands over execution on x86 systems? I guess it's in an
> assembler file since this is very low architecture stuff. I looked at
> the source files in /grub-core/boot/i386/pc/*.S and found a JMP in
> boot.S at line 455 but kernel_address could be the address of the
> GRUB2 kernel in memory and not the linux kernel.
grub_linux_boot is the top level of this. From there it gets
complicated. On x86, it goes from there to grub_relocator32_boot, which
(essentially) copies the code from grub-core/lib/i386/relocator32.S into
a freshly-allocated area of memory and fills in some details specific to
the kernel image it wants to boot. The final bit is:
.byte 0xea
VARIABLE(grub_relocator32_eip)
.long 0
This is a JMP opcode followed by space into which the relocator fills in
an instruction pointer. When that's put together, it forms the line of
code you're looking for.
--
Colin Watson [cjwatson@ubuntu.com]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-09-03 17:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-03 12:49 Where in GRUB2 source code is the handover/jump to kernel code on x86? deffo
2015-09-03 17:24 ` Colin Watson
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).