Linux X86_64物理内存布局

Linux X86_64物理内存布局

根据 Linux 内核文档https://www.kernel.org/doc/Documentation/x86/boot.txt,有一个内核实模式代码从X+10000X+08000。我有两个问题;


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.实模式代码是GRUB的一部分还是bzImage的一部分。 2.如果实模式代码在中间X+10000,那么模式内核代码X+08000的物理位置在哪里?long mode/64 bit

答案1

(我会参考最新版本的启动协议文档,您查看的文档是旧的。)

实模式内核引导扇区和设置代码是内核的一部分;看第 1.2 节。他们生活在XX+0x08000。

保护模式内核在 0x100000 处加载,它是上表中的第一项。

相关内容