[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where in GRUB2 source code is the handover/jump to kernel code on x8

From: Colin Watson
Subject: Re: Where in GRUB2 source code is the handover/jump to kernel code on x86?
Date: Thu, 3 Sep 2015 18:24:36 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

On Thu, Sep 03, 2015 at 02:49:45PM +0200, address@hidden 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

> 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
        .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                                       address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]