diff options
author | Michael Brown <mcb30@etherboot.org> | 2007-07-16 16:58:38 +0100 |
---|---|---|
committer | Michael Brown <mcb30@etherboot.org> | 2007-07-16 16:58:38 +0100 |
commit | 048bbeeebcfce2eac0a21a8eaf44a6810d685032 (patch) | |
tree | d1d55fed52f9ece7f2fc510a81725e7137ff0104 /src/arch/i386/prefix | |
parent | 37fa9a87065e07ccef0fcc62b67db278a337e4a4 (diff) | |
download | ipxe-048bbeeebcfce2eac0a21a8eaf44a6810d685032.tar.gz |
Compressed ROM images now work.
Diffstat (limited to 'src/arch/i386/prefix')
-rw-r--r-- | src/arch/i386/prefix/libprefix.S | 9 | ||||
-rw-r--r-- | src/arch/i386/prefix/nonrv2b.S | 18 | ||||
-rw-r--r-- | src/arch/i386/prefix/romprefix.S | 16 | ||||
-rw-r--r-- | src/arch/i386/prefix/unnrv2b.S | 29 |
4 files changed, 65 insertions, 7 deletions
diff --git a/src/arch/i386/prefix/libprefix.S b/src/arch/i386/prefix/libprefix.S index d1554513..0966dcbd 100644 --- a/src/arch/i386/prefix/libprefix.S +++ b/src/arch/i386/prefix/libprefix.S @@ -37,6 +37,9 @@ */ #define HIGHMEM_LOADPOINT ( 4 << 20 ) +/* Image compression enabled */ +#define COMPRESS 1 + #define CR0_PE 1 .arch i386 @@ -81,7 +84,11 @@ install_block: /* Do the copy */ cld - rep addr32 movsb /* or "call decompress16" */ +#if COMPRESS + call decompress16 +#else + call nodecompress16 +#endif /* Zero remaining space */ movl %eax, %edi diff --git a/src/arch/i386/prefix/nonrv2b.S b/src/arch/i386/prefix/nonrv2b.S new file mode 100644 index 00000000..d40396b3 --- /dev/null +++ b/src/arch/i386/prefix/nonrv2b.S @@ -0,0 +1,18 @@ +/* Placeholder for decompress16 in non-compressed images */ + + .text + .arch i386 + .section ".prefix.lib", "ax", @progbits + + .code16 + .globl nodecompress16 +nodecompress16: + rep addr32 movsb + ret + + /* File split information for the compressor */ + .section ".zinfo", "a" + .ascii "COPY" + .long _prefix_load_offset + .long _load_size + .long _max_align diff --git a/src/arch/i386/prefix/romprefix.S b/src/arch/i386/prefix/romprefix.S index f68c14e0..3e6cd2d0 100644 --- a/src/arch/i386/prefix/romprefix.S +++ b/src/arch/i386/prefix/romprefix.S @@ -14,7 +14,7 @@ .org 0x00 romheader: .word 0xAA55 /* BIOS extension signature */ - .byte _rom_size /* Size in 512-byte blocks */ +romheader_size: .byte _rom_size /* Size in 512-byte blocks */ jmp init_vector /* Initialisation vector */ .org 0x16 .word undiheader @@ -34,7 +34,7 @@ pciheader: .byte 0x02 /* Device Base Type code */ .byte 0x00 /* Device Sub-Type code */ .byte 0x00 /* Device Interface Type code */ - .word _rom_size /* Image length same as offset 02h */ +pciheader_size: .word _rom_size /* Image length same as offset 02h */ .word 0x0001 /* revision level of code/data */ .byte 0x00 /* code type */ .byte 0x80 /* Flags (last PCI data structure) */ @@ -215,3 +215,15 @@ print_message: popw %ax ret .size print_message, . - print_message + + + /* Data update information for the compressor */ + .section ".zinfo.fixup", "a" + .ascii "SUBB" + .long romheader_size + .long 512 + .long 0 + .ascii "SUBW" + .long pciheader_size + .long 512 + .long 0 diff --git a/src/arch/i386/prefix/unnrv2b.S b/src/arch/i386/prefix/unnrv2b.S index 4e3090e2..1cf570d0 100644 --- a/src/arch/i386/prefix/unnrv2b.S +++ b/src/arch/i386/prefix/unnrv2b.S @@ -35,7 +35,7 @@ .text .arch i386 - .section ".prefix", "ax", @progbits + .section ".prefix.lib", "ax", @progbits #ifdef CODE16 /**************************************************************************** @@ -54,6 +54,7 @@ * NOTE: It would be possible to build a smaller version of the * decompression code for -DKEEP_IT_REAL by using * #define REG(x) x + * #define MOVSB movsb * to use 16-bit registers where possible. This would impose limits * that the compressed data size must be in the range [1,65533-%si] * and the uncompressed data size must be in the range [1,65536-%di] @@ -66,6 +67,7 @@ */ #define REG(x) e ## x +#define MOVSB addr32 movsb .code16 .globl decompress16 @@ -109,11 +111,10 @@ decompress: cld xor %xBP, %xBP dec %xBP /* last_m_off = -1 */ - add $4, %xSI /* Skip "file length" field */ jmp dcl1_n2b decompr_literals_n2b: - movsb + MOVSB decompr_loop_n2b: addl %ebx, %ebx jnz dcl2_n2b @@ -157,7 +158,7 @@ decompr_got_mlen_n2b: push %xSI lea (%xBP,%xDI), %xSI /* m_pos = dst + olen + -m_off */ rep - es movsb /* dst[olen++] = *m_pos++ while(m_len > 0) */ + es MOVSB /* dst[olen++] = *m_pos++ while(m_len > 0) */ pop %xSI jmp decompr_loop_n2b @@ -179,3 +180,23 @@ decompr_end_n2b: popl %ebx pop %xAX ret + + + /* File split information for the compressor */ + .section ".zinfo", "a" + .ascii "COPY" + .long _prefix_load_offset + .long _prefix_progbits_size + .long _max_align + .ascii "PACK" + .long _text16_load_offset + .long _text16_progbits_size + .long _max_align + .ascii "PACK" + .long _data16_load_offset + .long _data16_progbits_size + .long _max_align + .ascii "PACK" + .long _textdata_load_offset + .long _textdata_progbits_size + .long _max_align |