mirror of
https://github.com/xcat2/xNBA.git
synced 2025-01-05 19:15:05 +00:00
[multiboot] Work around raw-flag bug in Solaris kernels
Solaris kernels are multiboot images with the "raw" flag set, indicating that the loader should use the raw address fields within the multiboot header rather than looking for an ELF header. However, the Solaris kernel contains garbage data in the raw address fields, and requires us to use the ELF header instead. Work around this by always using the ELF header if present. This renders the "raw" flag somewhat redundant.
This commit is contained in:
parent
ad027e41e5
commit
e960fac8d0
@ -360,6 +360,13 @@ static int multiboot_load_raw ( struct image *image,
|
||||
userptr_t buffer;
|
||||
int rc;
|
||||
|
||||
/* Sanity check */
|
||||
if ( ! ( hdr->mb.flags & MB_FLAG_RAW ) ) {
|
||||
DBGC ( image, "MULTIBOOT %p is not flagged as a raw image\n",
|
||||
image );
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Verify and prepare segment */
|
||||
offset = ( hdr->offset - hdr->mb.header_addr + hdr->mb.load_addr );
|
||||
filesz = ( hdr->mb.load_end_addr ?
|
||||
@ -432,14 +439,14 @@ static int multiboot_load ( struct image *image ) {
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
/* Load the actual image */
|
||||
if ( hdr.mb.flags & MB_FLAG_RAW ) {
|
||||
if ( ( rc = multiboot_load_raw ( image, &hdr ) ) != 0 )
|
||||
return rc;
|
||||
} else {
|
||||
if ( ( rc = multiboot_load_elf ( image ) ) != 0 )
|
||||
return rc;
|
||||
}
|
||||
/* There is technically a bit MB_FLAG_RAW to indicate whether
|
||||
* this is an ELF or a raw image. In practice, grub will use
|
||||
* the ELF header if present, and Solaris relies on this
|
||||
* behaviour.
|
||||
*/
|
||||
if ( ( ( rc = multiboot_load_elf ( image ) ) != 0 ) &&
|
||||
( ( rc = multiboot_load_raw ( image, &hdr ) ) != 0 ) )
|
||||
return rc;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user