x86/boot: Annotate the multiboot headers with size and type information
PATCH 1/1 x86/boot: Annotate the multiboot headers with size and type information
This causes objdump not to try and disassemble the data.
While altering this area, switch to using .balign, and fill with 0xc2 to help highlight the embedded padding (rather than having it filled with 0f 1f 40 00 which is a long nop). Also, shorten the labels by stripping off the _start suffix.
The end result is now:
ffff82d080200000 <_start>:
ffff82d080200000: e9 af c1 1c 00 jmpq ffff82d0803cc1b4 <__start> ffff82d080200005: 0f 1f 00 nopl (%rax)
ffff82d080200008 <multiboot1_header>:
ffff82d080200008: 02 b0 ad 1b 03 00 00 00 fb 4f 52 e4 c2 c2 c2 c2 .........OR.....
ffff82d080200018 <multiboot2_header>:
ffff82d080200018: d6 50 52 e8 00 00 00 00 88 00 00 00 a2 ae ad 17 .PR............. ffff82d080200028: 01 00 00 00 10 00 00 00 04 00 00 00 06 00 00 00 ................ ffff82d080200038: 06 00 00 00 08 00 00 00 0a 00 01 00 18 00 00 00 ................ ffff82d080200048: 00 00 20 00 ff ff ff ff 00 00 20 00 02 00 00 00 .. ....... ..... ffff82d080200058: 04 00 01 00 0c 00 00 00 02 00 00 00 c2 c2 c2 c2 ................ ffff82d080200068: 05 00 01 00 14 00 00 00 00 00 00 00 00 00 00 00 ................ ffff82d080200078: 00 00 00 00 c2 c2 c2 c2 07 00 01 00 08 00 00 00 ................ ffff82d080200088: 09 00 01 00 0c 00 00 00 5e c0 3c 00 c2 c2 c2 c2 ........^.<..... ffff82d080200098: 00 00 00 00 08 00 00 00 ........
ffff82d0802000a0 <__high_start>:
ffff82d0802000a0: 0f 01 15 5f 8f 25 00 lgdt 0x258f5f(%rip) # ffff82d080459006 <gdt_descr>
---
CC: Jan Beulich <[email protected]>
I was considering whether it was worth splitting the multiboot headers out into a separate file, to declutter the top of head.S
--- xen/arch/x86/boot/head.S | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
xen/arch/x86/boot/head.S +13 -8
@@ -34,7 +34,7 @@ .endm .macro mb2ht_init type:req, req:req, args:vararg - .align MULTIBOOT2_TAG_ALIGN + .balign MULTIBOOT2_TAG_ALIGN, 0xc2 /* Avoid padding with long nops. */ .Lmb2ht_init_start\@: .short \type .short \req
@@ -48,8 +48,8 @@ ENTRY(start) jmp __start - .align 4 -multiboot1_header_start: /*** MULTIBOOT1 HEADER ****/ + .balign 4 +multiboot1_header: /*** MULTIBOOT1 HEADER ****/ #define MULTIBOOT_HEADER_FLAGS (MULTIBOOT_HEADER_MODS_ALIGNED | \ MULTIBOOT_HEADER_WANT_MEMORY) /* Magic number indicating a Multiboot header. */
@@ -58,22 +58,24 @@ multiboot1_header_start: /*** MULTIBOOT1 HEADER ****/ .long MULTIBOOT_HEADER_FLAGS /* Checksum: must be the negated sum of the first two fields. */ .long -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS) -multiboot1_header_end: + + .size multiboot1_header, . - multiboot1_header + .type multiboot1_header, @object /*** MULTIBOOT2 HEADER ****/ /* Some ideas are taken from grub-2.00/grub-core/tests/boot/kernel-i386.S file. */ - .align MULTIBOOT2_HEADER_ALIGN + .balign MULTIBOOT2_HEADER_ALIGN, 0xc2 /* Avoid padding the MB1 header with long nops. */ -multiboot2_header_start: +multiboot2_header: /* Magic number indicating a Multiboot2 header. */ .long MULTIBOOT2_HEADER_MAGIC /* Architecture: i386. */ .long MULTIBOOT2_ARCHITECTURE_I386 /* Multiboot2 header length. */ - .long .Lmultiboot2_header_end - multiboot2_header_start + .long .Lmultiboot2_header_end - multiboot2_header /* Multiboot2 header checksum. */ .long -(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT2_ARCHITECTURE_I386 + \ - (.Lmultiboot2_header_end - multiboot2_header_start)) + (.Lmultiboot2_header_end - multiboot2_header)) /* Multiboot2 information request tag. */ mb2ht_init MB2_HT(INFORMATION_REQUEST), MB2_HT(REQUIRED), \
@@ -110,6 +112,9 @@ multiboot2_header_start: mb2ht_init MB2_HT(END), MB2_HT(REQUIRED) .Lmultiboot2_header_end: + .size multiboot2_header, . - multiboot2_header + .type multiboot2_header, @object + .section .init.rodata, "a", @progbits .Lbad_cpu_msg: .asciz "ERR: Not a 64-bit CPU!"
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 26 lines
Quoted 1 line
Quoted 1 line · On 02.03.18 at 19:58, <[email protected]> wrote:
This causes objdump not to try and disassemble the data.
While altering this area, switch to using .balign, and fill with
0xc2to help highlight the embedded padding (rather than having it filled with 0f 1f 40 00 which is a long nop). Also, shorten the labels by stripping off the_startsuffix.The end result is now:
ffff82d080200000<_start>:ffff82d080200000: e9 af c1 1c 00 jmpq ffff82d0803cc1b4 <__start> ffff82d080200005: 0f 1f 00 nopl (%rax)
ffff82d080200008<multiboot1_header>:
ffff82d080200008: 02 b0 ad 1b 03 00 00 00 fb 4f 52 e4 c2 c2 c2 c2 .........OR.....
ffff82d080200018<multiboot2_header>:ffff82d080200018: d6 50 52 e8 00 00 00 00 88 00 00 00 a2 ae ad 17 .PR............. ffff82d080200028: 01 00 00 00 10 00 00 00 04 00 00 00 06 00 00 00 ................ ffff82d080200038: 06 00 00 00 08 00 00 00 0a 00 01 00 18 00 00 00 ................ ffff82d080200048: 00 00 20 00 ff ff ff ff 00 00 20 00 02 00 00 00 .. ....... ..... ffff82d080200058: 04 00 01 00 0c 00 00 00 02 00 00 00 c2 c2 c2 c2 ................ ffff82d080200068: 05 00 01 00 14 00 00 00 00 00 00 00 00 00 00 00 ................ ffff82d080200078: 00 00 00 00 c2 c2 c2 c2 07 00 01 00 08 00 00 00 ................ ffff82d080200088: 09 00 01 00 0c 00 00 00 5e c0 3c 00 c2 c2 c2 c2 ........^.<..... ffff82d080200098: 00 00 00 00 08 00 00 00
Quoted 6 lines
........
ffff82d0802000a0<__high_start>:
ffff82d0802000a0: 0f 01 15 5f 8f 25 00 lgdt 0x258f5f(%rip) #ffff82d080459006<gdt_descr>Signed-off-by Andrew Cooper <[email protected]>
Quoted 2 lines
I was considering whether it was worth splitting the multiboot headers out into a separate file, to declutter the top of
head.S
That would probably help overall readability, I agree.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel