TransWikia.com

Linux X86_64 physical memory layout

Unix & Linux Asked by Franc M on November 19, 2021

As per the Linux kernel documentation https://www.kernel.org/doc/Documentation/x86/boot.txt, there is a kernel real mode code from X+10000 to X+08000. There are two question I have;


For a modern bzImage kernel with boot protocol version >= 2.02, a
memory layout like the following is suggested:

    ~                        ~
        |  Protected-mode kernel |
100000  +------------------------+
    |  I/O memory hole   |
0A0000  +------------------------+
    |  Reserved for BIOS     |  Leave as much as possible unused
    ~                        ~
    |  Command line      |  (Can also be below the X+10000 mark)
X+10000 +------------------------+
    |  Stack/heap        |  For use by the kernel real-mode code.
X+08000 +------------------------+  
    |  Kernel setup      |  The kernel real-mode code.
    |  Kernel boot sector    |  The kernel legacy boot sector.
X       +------------------------+
    |  Boot loader       |  <- Boot sector entry point 0000:7C00
001000  +------------------------+
    |  Reserved for MBR/BIOS |
000800  +------------------------+
    |  Typically used by MBR |
000600  +------------------------+ 
    |  BIOS use only     |
000000  +------------------------+

1.Is the real mode code is part of GRUB or it is part of bzImage.
2.If the real mode code is in between X+10000 to X+08000 where is the physical location of the long mode/64 bit mode kernel code?

One Answer

(I’ll refer to the latest version of the boot protocol documentation, the document you looked at is old.)

The real-mode kernel boot sector and setup code are part of the kernel; see section 1.2. They live between X and X+0x08000.

The protected-mode kernel is loaded at 0x100000, it’s the first item in the table above.

Answered by Stephen Kitt on November 19, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP