我正在使用打印出内核代码开始和结束(物理)地址的自定义内核模块编译内核。它从 0x8000 开始,到 0xefe6d8 结束。查看生成的 System.map,我发现内核中的几乎所有函数都位于物理内存中的 0x10000 (1Mb) 及以后位置。但是代码从 0x8000 开始。我无法弄清楚这两个地址之间有什么。任何人都可以阐明这一点吗?
来自 System.map 的片段(虚拟映射从 0xc0000000 开始):
c0008000 T _text
c0008000 T stext
c000804c t __create_page_tables
c000814c t __turn_mmu_on_loc
c0008158 t __vet_atags
c0100000 T __exception_text_start
__create_page_tables
函数表明页表在 __vet_atags
代码之后存在。但为什么它们会成为可执行内存的一部分?
最佳答案
来自kernel boot procotol ,内核内存布局如下:
~ ~
| 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 +------------------------+
关于linux - Linux 上物理内存 0x8000 (32Kb) 到 0x10000 (1Mb) 是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26237681/