x86 new setup: use appropriate sections for code and data
PATCH 1/1 x86 new setup: use appropriate sections for code and data
An intermediate elf file is generated for the 16-bit setup code. The generated code can be viewed using objdump -m i8086 -d. As it stands, it also tries to disassemble the bugger_off_msg, which results in garbage. This introduces two new sections to separate the code and the data part of the bootsector stub. It also moves some code from the .header section (a data section) to .inittext.
---
Hi,
I hope the new section names are ok? Alternatives would be .bstext/.bsdata or .floppytext/.floppydata.
Greetings,
Alexander
arch/i386/boot/header.S | 10 +++++----- arch/i386/boot/setup.ld | 4 ++++ 2 files changed, 9 insertions(+), 5 deletions(-)
arch/i386/boot/header.S +5 -5
@@ -44,7 +44,7 @@ SWAP_DEV = 0 /* SWAP_DEV is now written by "build" */ #endif .code16 - .section ".header", "ax" + .section ".stubtext", "ax" .global bootsect_start bootsect_start:
@@ -82,7 +82,7 @@ bs_die: # invoke the BIOS reset code... ljmp $0xf000,$0xfff0 - + .section ".stubdata", "a" bugger_off_msg: .ascii "Direct booting from floppy is no longer supported.\r\n" .ascii "Please use a boot loader program instead.\r\n"
@@ -94,7 +94,7 @@ bugger_off_msg: # Kernel attributes; used by setup. This is part 1 of the # header, from the old boot sector. - .org 497 + .section ".header", "a" .globl hdr hdr: setup_sects: .byte SETUPSECTS
@@ -208,10 +208,11 @@ pad3: .word 0 cmdline_size: .long COMMAND_LINE_SIZE-1 #length of the command line, #added with boot protocol #version 2.06 +start_of_setup: # End of setup header ##################################################### -start_of_setup: + .section ".inittext", "ax" #ifdef SAFE_RESET_DISK_CONTROLLER # Reset the disk controller. movw $0x0000, %ax # Reset disk controller
@@ -225,7 +226,6 @@ start_of_setup: pushw $setup2 lretw - .section ".inittext", "ax" setup2: # Force %es = %ds movw %ds, %ax
arch/i386/boot/setup.ld +4 -0
@@ -10,6 +10,10 @@ ENTRY(_start) SECTIONS { . = 0; + .stubtext : { *(.stubtext) } + .stubdata : { *(.stubdata) } + + . = 497; .header : { *(.header) } .inittext : { *(.inittext) } .initdata : { *(.initdata) }
Signature · 1 line
1.4.4.2
Quoted 7 lines · Alexander van Heukelum
An intermediate elf file is generated for the 16-bit setup code. The generated code can be viewed using objdump -m i8086 -d. As it stands, it also tries to disassemble the
bugger_off_msg, which results in garbage. This introduces two new sections to separate the code and the data part of the bootsector stub. It also moves some code from the .header section (a data section) to .inittext.
Quoted 7 lines
Signed-off-by Alexander van Heukelum <[email protected]>---
Hi,
I hope the new section names are ok? Alternatives would be .bstext/.bsdata or .floppytext/.floppydata.
I'd prefer .bstext or .bs_text and .bsdata/.bs_data; possibly .bsecttext and .bsectdata. The term "boot sector" for that particular piece of code is firmly established.
-hpa
An intermediate elf file is generated for the 16-bit setup code. The generated code can be viewed using objdump -m i8086 -d. As it stands, it also tries to disassemble the bugger_off_msg, which results in garbage. This introduces two new sections to separate the code and the data part of the bootsector stub. It also moves some code from the .header section (a data section) to .inittext.
---
Quoted 5 lines
I'd prefer .bstext or .bs_text and .bsdata/.bs_data; possibly .bsecttext and .bsectdata. The term "boot sector" for that particular piece of code is firmly established.
-hpa
Hi,
This version uses the section names .bstext/.bsdata.
Greetings,
Alexander
arch/i386/boot/header.S | 10 +++++----- arch/i386/boot/setup.ld | 4 ++++ 2 files changed, 9 insertions(+), 5 deletions(-)
arch/i386/boot/header.S +5 -5
@@ -44,7 +44,7 @@ SWAP_DEV = 0 /* SWAP_DEV is now written by "build" */ #endif .code16 - .section ".header", "ax" + .section ".bstext", "ax" .global bootsect_start bootsect_start:
@@ -82,7 +82,7 @@ bs_die: # invoke the BIOS reset code... ljmp $0xf000,$0xfff0 - + .section ".bsdata", "a" bugger_off_msg: .ascii "Direct booting from floppy is no longer supported.\r\n" .ascii "Please use a boot loader program instead.\r\n"
@@ -94,7 +94,7 @@ bugger_off_msg: # Kernel attributes; used by setup. This is part 1 of the # header, from the old boot sector. - .org 497 + .section ".header", "a" .globl hdr hdr: setup_sects: .byte SETUPSECTS
@@ -208,10 +208,11 @@ pad3: .word 0 cmdline_size: .long COMMAND_LINE_SIZE-1 #length of the command line, #added with boot protocol #version 2.06 +start_of_setup: # End of setup header ##################################################### -start_of_setup: + .section ".inittext", "ax" #ifdef SAFE_RESET_DISK_CONTROLLER # Reset the disk controller. movw $0x0000, %ax # Reset disk controller
@@ -225,7 +226,6 @@ start_of_setup: pushw $setup2 lretw - .section ".inittext", "ax" setup2: # Force %es = %ds movw %ds, %ax
arch/i386/boot/setup.ld +4 -0
@@ -10,6 +10,10 @@ ENTRY(_start) SECTIONS { . = 0; + .bstext : { *(.bstext) } + .bsdata : { *(.bsdata) } + + . = 497; .header : { *(.header) } .inittext : { *(.inittext) } .initdata : { *(.initdata) }
Signature · 1 line
1.4.4.2