diff options
author | Michael Brown <mcb30@etherboot.org> | 2008-09-06 01:57:25 +0100 |
---|---|---|
committer | Michael Brown <mcb30@etherboot.org> | 2008-09-06 01:57:52 +0100 |
commit | 2e03610c0d6840aab412e2c2be554453bfd99eb5 (patch) | |
tree | be4847d8ff6257f3a676b8f11781e3fa9ac7602d | |
parent | 6de45ad4ae65d1754abaee4d5e92851b7b40c9b5 (diff) | |
download | ipxe-2e03610c0d6840aab412e2c2be554453bfd99eb5.tar.gz |
[multiboot] Allow for unspecified {load,bss}_end_addr for raw images
The multiboot specification states that, for raw images, if
load_end_addr is zero then it should be interpreted as meaning "use
the entire file", and if bss_end_addr is zero it should be interpreted
as meaning "no bss".
-rw-r--r-- | src/arch/i386/image/multiboot.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/arch/i386/image/multiboot.c b/src/arch/i386/image/multiboot.c index 3aa52e431..a4a340fd2 100644 --- a/src/arch/i386/image/multiboot.c +++ b/src/arch/i386/image/multiboot.c @@ -360,8 +360,11 @@ static int multiboot_load_raw ( struct image *image, /* Verify and prepare segment */ offset = ( hdr->offset - hdr->mb.header_addr + hdr->mb.load_addr ); - filesz = ( hdr->mb.load_end_addr - hdr->mb.load_addr ); - memsz = ( hdr->mb.bss_end_addr - hdr->mb.load_addr ); + filesz = ( hdr->mb.load_end_addr ? + ( hdr->mb.load_end_addr - hdr->mb.load_addr ) : + ( image->len - offset ) ); + memsz = ( hdr->mb.bss_end_addr ? + ( hdr->mb.bss_end_addr - hdr->mb.load_addr ) : filesz ); buffer = phys_to_user ( hdr->mb.load_addr ); if ( ( rc = prep_segment ( buffer, filesz, memsz ) ) != 0 ) { DBGC ( image, "MULTIBOOT %p could not prepare segment: %s\n", |