最初x64 vmlinux入口点是:
Entry point address: 0x1000000
我将Multiboot标头定义为单独的部分,然后在链接描述文件的.text开头链接该部分。 在此入口点之后是:
Entry point address: 0x1000010
使用旧的入口地址,我能够从我的引导加载程序跳转到内核入口点并且它成功启动,但是我希望我的vmlinux成为多引导投诉(所以我需要那个头文件) 但是在添加它并执行跳转到新地址后,它就会挂起..
跳转地址不正确还是我需要更改内核中的内容? --- a / arch / x86 / kernel / head_64.S +++ b / arch / x86 / kernel / head_64.S
+.section .mboot
+.code64
+ /* Align 32 bits boundary. */
+ .align 8
+ /* Multiboot header. */
+multiboot_header:
+ /* magic */
+ .long MULTIBOOT_HEADER_MAGIC
+ /* flags */
+ .long MULTIBOOT_HEADER_FLAGS
+ /* checksum */
+ .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
.text
__HEAD
.code64
.globl startup_64
startup_64:
--- a / arch / x86 / kernel / vmlinux.lds.S +++ b / arch / x86 / kernel / vmlinux.lds.S
@@ -91,6 +91,7 @@ SECTIONS
/* Text and read-only data */
.text : AT(ADDR(.text) - LOAD_OFFSET) {
+ *(.mboot)
_text = .;
/* bootstrapping code */
HEAD_TEXT
objdump -d
Disassembly of section .text:
ffffffff81000000 <multiboot_header>:
ffffffff81000000: 02 b0 ad 1b 03 00 add 0x31bad(%rax),%dh
ffffffff81000006: 00 00 add %al,(%rax)
ffffffff81000008: fb sti
ffffffff81000009: 4f 52 rex.WRXB push %r10
ffffffff8100000b: e4 90 in $0x90,%al
ffffffff8100000c <_text>:
ffffffff8100000c: 90 nop
ffffffff8100000d: 90 nop
ffffffff8100000e: 90 nop
ffffffff8100000f: 90 nop
ffffffff81000010 <startup_64>:
ffffffff81000010: e8 a4 01 00 00 callq ffffffff810001b9 <verify_cpu>
ffffffff81000015: 48 8d 2d f0 ff ff ff lea -0x10(%rip),%rbp #
ffffffff8100000c <_text>
ffffffff8100001c: 48 81 ed 0c 00 00 01 sub $0x100000c,%rbp
ffffffff81000023: 48 89 e8 mov %rbp,%rax
ffffffff81000026: 25 ff ff 1f 00 and $0x1fffff,%eax
System.map:
0000000001000010 A phys_startup_64
ffffffff81000000 t multiboot_header
ffffffff8100000c T _text
ffffffff81000010 T startup_64