Files
ipxe/src/arch/i386/prefix/nbiprefix.S
Joshua Oreman d5d68b2e31 [zbin] Change fixup semantics to support ROMs over 128k uncompressed
The option ROM header contains a one-byte field indicating the number
of 512-byte sectors in the ROM image.  Currently it is linked to
contain the number of uncompressed sectors, with an instruction to the
compressor to correct it.  This causes link failure when the
uncompressed size of the ROM image is over 128k.

Fix by replacing the SUBx compressor fixup with an ADDx fixup that
adds the total compressed output length, scaled as requested, to an
addend stored in the field where the final length value will be
placed.  This is similar to the behavior of ELF relocations, and
ensures that an overflow error will not be generated unless the
compressed size is still too large for the field.

This also allows us to do away with the _filesz_pgh and _filesz_sect
calculations exported by the linker script.

Output tested bitwise identical to the old SUBx mechanism on hd, dsk,
lkrn, and rom prefixes, on both 32-bit and 64-bit processors.

Modified-by: Michael Brown <mcb30@etherboot.org>
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-08-11 12:59:26 +01:00

78 lines
1.6 KiB
ArmAsm

.text
.arch i386
.code16
.section ".prefix", "ax", @progbits
.org 0
nbi_header:
/*****************************************************************************
* NBI file header
*****************************************************************************
*/
file_header:
.long 0x1b031336 /* Signature */
.byte 0x04 /* 16 bytes header, no vendor info */
.byte 0
.byte 0
.byte 0 /* No flags */
.word 0x0000, 0x07c0 /* Load header to 0x07c0:0x0000 */
.word entry, 0x07c0 /* Start execution at 0x07c0:entry */
.size file_header, . - file_header
/*****************************************************************************
* NBI segment header
*****************************************************************************
*/
segment_header:
.byte 0x04 /* 16 bytes header, no vendor info */
.byte 0
.byte 0
.byte 0x04 /* Last segment */
.long 0x00007e00
imglen: .long -512
memlen: .long -512
.size segment_header, . - segment_header
.section ".zinfo.fixup", "a", @progbits /* Compressor fixups */
.ascii "ADDL"
.long imglen
.long 1
.long 0
.ascii "ADDL"
.long memlen
.long 1
.long 0
.previous
/*****************************************************************************
* NBI entry point
*****************************************************************************
*/
entry:
/* Install gPXE */
call install
/* Jump to .text16 segment */
pushw %ax
pushw $1f
lret
.section ".text16", "awx", @progbits
1:
pushl $main
pushw %cs
call prot_call
popl %ecx /* discard */
/* Uninstall gPXE */
call uninstall
/* Reboot system */
int $0x19
.previous
.size entry, . - entry
nbi_header_end:
.org 512