Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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".
  • Loading branch information
Michael Brown committed Sep 6, 2008
1 parent 6de45ad commit 2e03610
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/arch/i386/image/multiboot.c
Expand Up @@ -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",
Expand Down

0 comments on commit 2e03610

Please sign in to comment.