On Thu, Sep 03, 2015 at 02:49:45PM +0200, de...@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                                       [cjwat...@ubuntu.com]

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to