/* Load the image using core ELF support */
if ( ( rc = elf_load ( image, &entry, &max ) ) != 0 ) {
- DBGC ( image, "ELF %p could not load: %s\n",
- image, strerror ( rc ) );
+ DBGC ( image, "ELF %s could not load: %s\n",
+ image->name, strerror ( rc ) );
return rc;
}
shutdown_boot();
/* Jump to OS with flat physical addressing */
- DBGC ( image, "ELF %p starting execution at %lx\n", image, entry );
+ DBGC ( image, "ELF %s starting execution at %lx\n",
+ image->name, entry );
__asm__ __volatile__ ( PHYS_CODE ( "pushl %%ebp\n\t" /* gcc bug */
"call *%%edi\n\t"
"popl %%ebp\n\t" /* gcc bug */ )
: : "D" ( entry )
: "eax", "ebx", "ecx", "edx", "esi", "memory" );
- DBGC ( image, "ELF %p returned\n", image );
+ DBGC ( image, "ELF %s returned\n", image->name );
/* It isn't safe to continue after calling shutdown() */
while ( 1 ) {}
/* Check that ELF segment uses flat physical addressing */
if ( phdr->p_vaddr != dest ) {
- DBGC ( image, "ELF %p uses virtual addressing (phys %x, "
- "virt %x)\n", image, phdr->p_paddr, phdr->p_vaddr );
+ DBGC ( image, "ELF %s uses virtual addressing (phys %x, virt "
+ "%x)\n", image->name, phdr->p_paddr, phdr->p_vaddr );
return -ENOEXEC;
}
/* Read ELF header */
copy_from_user ( &ehdr, image->data, 0, sizeof ( ehdr ) );
if ( memcmp ( ehdr.e_ident, e_ident, sizeof ( e_ident ) ) != 0 ) {
- DBGC ( image, "Invalid ELF identifier\n" );
+ DBGC ( image, "ELF %s invalid identifier\n", image->name );
return -ENOEXEC;
}
/* Check that this image uses flat physical addressing */
if ( ( rc = elf_segments ( image, &ehdr, elfboot_check_segment,
&entry, &max ) ) != 0 ) {
- DBGC ( image, "Unloadable ELF image\n" );
+ DBGC ( image, "ELF %s is not loadable: %s\n",
+ image->name, strerror ( rc ) );
return rc;
}
memset ( mbmemmap, 0, sizeof ( *mbmemmap ) );
for ( i = 0 ; i < memmap.count ; i++ ) {
if ( i >= limit ) {
- DBGC ( image, "MULTIBOOT %p limit of %d memmap "
- "entries reached\n", image, limit );
+ DBGC ( image, "MULTIBOOT %s limit of %d memmap "
+ "entries reached\n", image->name, limit );
break;
}
mbmemmap[i].size = ( sizeof ( mbmemmap[i] ) -
for_each_image ( module_image ) {
if ( mbinfo->mods_count >= limit ) {
- DBGC ( image, "MULTIBOOT %p limit of %d modules "
- "reached\n", image, limit );
+ DBGC ( image, "MULTIBOOT %s limit of %d modules "
+ "reached\n", image->name, limit );
break;
}
if ( ( rc = prep_segment ( phys_to_virt ( start ),
module_image->len,
module_image->len ) ) != 0 ) {
- DBGC ( image, "MULTIBOOT %p could not prepare module "
- "%s: %s\n", image, module_image->name,
+ DBGC ( image, "MULTIBOOT %s could not prepare module "
+ "%s: %s\n", image->name, module_image->name,
strerror ( rc ) );
return rc;
}
module->mod_end = ( start + module_image->len );
module->string = multiboot_add_cmdline ( module_image );
module->reserved = 0;
- DBGC ( image, "MULTIBOOT %p module %s is [%x,%x)\n",
- image, module_image->name, module->mod_start,
+ DBGC ( image, "MULTIBOOT %s module %s is [%x,%x)\n",
+ image->name, module_image->name, module->mod_start,
module->mod_end );
start += module_image->len;
}
/* Sanity check */
if ( ! ( hdr->mb.flags & MB_FLAG_RAW ) ) {
- DBGC ( image, "MULTIBOOT %p is not flagged as a raw image\n",
- image );
+ DBGC ( image, "MULTIBOOT %s is not flagged as a raw image\n",
+ image->name );
return -EINVAL;
}
( hdr->mb.bss_end_addr - hdr->mb.load_addr ) : filesz );
buffer = phys_to_virt ( hdr->mb.load_addr );
if ( ( rc = prep_segment ( buffer, filesz, memsz ) ) != 0 ) {
- DBGC ( image, "MULTIBOOT %p could not prepare segment: %s\n",
- image, strerror ( rc ) );
+ DBGC ( image, "MULTIBOOT %s could not prepare segment: %s\n",
+ image->name, strerror ( rc ) );
return rc;
}
/* Load ELF image*/
if ( ( rc = elf_load ( image, entry, max ) ) != 0 ) {
- DBGC ( image, "MULTIBOOT %p ELF image failed to load: %s\n",
- image, strerror ( rc ) );
+ DBGC ( image, "MULTIBOOT %s ELF image failed to load: %s\n",
+ image->name, strerror ( rc ) );
return rc;
}
/* Locate multiboot header, if present */
if ( ( rc = multiboot_find_header ( image, &hdr ) ) != 0 ) {
- DBGC ( image, "MULTIBOOT %p has no multiboot header\n",
- image );
+ DBGC ( image, "MULTIBOOT %s has no multiboot header\n",
+ image->name );
return rc;
}
/* Abort if we detect flags that we cannot support */
if ( hdr.mb.flags & MB_UNSUPPORTED_FLAGS ) {
- DBGC ( image, "MULTIBOOT %p flags %08x not supported\n",
- image, ( hdr.mb.flags & MB_UNSUPPORTED_FLAGS ) );
+ DBGC ( image, "MULTIBOOT %s flags %08x not supported\n",
+ image->name, ( hdr.mb.flags & MB_UNSUPPORTED_FLAGS ) );
return -ENOTSUP;
}
( sizeof(mbmemmap) / sizeof(mbmemmap[0]) ) );
/* Jump to OS with flat physical addressing */
- DBGC ( image, "MULTIBOOT %p starting execution at %lx\n",
- image, entry );
+ DBGC ( image, "MULTIBOOT %s starting execution at %lx\n",
+ image->name, entry );
__asm__ __volatile__ ( PHYS_CODE ( "pushl %%ebp\n\t"
"call *%%edi\n\t"
"popl %%ebp\n\t" )
"D" ( entry )
: "ecx", "edx", "esi", "memory" );
- DBGC ( image, "MULTIBOOT %p returned\n", image );
+ DBGC ( image, "MULTIBOOT %s returned\n", image->name );
/* It isn't safe to continue after calling shutdown() */
while ( 1 ) {}
/* Locate multiboot header, if present */
if ( ( rc = multiboot_find_header ( image, &hdr ) ) != 0 ) {
- DBGC ( image, "MULTIBOOT %p has no multiboot header\n",
- image );
+ DBGC ( image, "MULTIBOOT %s has no multiboot header\n",
+ image->name );
return rc;
}
- DBGC ( image, "MULTIBOOT %p found header with flags %08x\n",
- image, hdr.mb.flags );
+ DBGC ( image, "MULTIBOOT %s found header with flags %08x\n",
+ image->name, hdr.mb.flags );
return 0;
}
userptr_t buffer = phys_to_virt ( dest );
int rc;
- DBGC ( image, "ELF %p loading segment [%x,%x) to [%lx,%lx,%lx)\n",
- image, phdr->p_offset, ( phdr->p_offset + phdr->p_filesz ),
+ DBGC ( image, "ELF %s loading segment [%x,%x) to [%lx,%lx,%lx)\n",
+ image->name, phdr->p_offset, ( phdr->p_offset + phdr->p_filesz ),
dest, ( dest + phdr->p_filesz ), ( dest + phdr->p_memsz ) );
/* Verify and prepare segment */
if ( ( rc = prep_segment ( buffer, phdr->p_filesz,
phdr->p_memsz ) ) != 0 ) {
- DBGC ( image, "ELF %p could not prepare segment: %s\n",
- image, strerror ( rc ) );
+ DBGC ( image, "ELF %s could not prepare segment: %s\n",
+ image->name, strerror ( rc ) );
return rc;
}
/* Check segment lies within image */
if ( ( phdr->p_offset + phdr->p_filesz ) > image->len ) {
- DBGC ( image, "ELF %p segment outside image\n", image );
+ DBGC ( image, "ELF %s segment outside image\n", image->name );
return -ENOEXEC;
}
if ( ! dest )
dest = phdr->p_vaddr;
if ( ! dest ) {
- DBGC ( image, "ELF %p segment loads to physical address 0\n",
- image );
+ DBGC ( image, "ELF %s segment loads to physical address 0\n",
+ image->name );
return -ENOEXEC;
}
end = ( dest + phdr->p_memsz );
/* Set execution address, if it lies within this segment */
if ( ( e_offset = ( ehdr->e_entry - dest ) ) < phdr->p_filesz ) {
*entry = ehdr->e_entry;
- DBGC ( image, "ELF %p found physical entry point at %lx\n",
- image, *entry );
+ DBGC ( image, "ELF %s found physical entry point at %lx\n",
+ image->name, *entry );
} else if ( ( e_offset = ( ehdr->e_entry - phdr->p_vaddr ) )
< phdr->p_filesz ) {
if ( ! *entry ) {
*entry = ( dest + e_offset );
- DBGC ( image, "ELF %p found virtual entry point at %lx"
- " (virt %lx)\n", image, *entry,
+ DBGC ( image, "ELF %s found virtual entry point at %lx"
+ " (virt %lx)\n", image->name, *entry,
( ( unsigned long ) ehdr->e_entry ) );
}
}
for ( phoff = ehdr->e_phoff , phnum = ehdr->e_phnum ; phnum ;
phoff += ehdr->e_phentsize, phnum-- ) {
if ( phoff > image->len ) {
- DBGC ( image, "ELF %p program header %d outside "
- "image\n", image, phnum );
+ DBGC ( image, "ELF %s program header %d outside "
+ "image\n", image->name, phnum );
return -ENOEXEC;
}
copy_from_user ( &phdr, image->data, phoff, sizeof ( phdr ) );
/* Check for a valid execution address */
if ( ! *entry ) {
- DBGC ( image, "ELF %p entry point %lx outside image\n",
- image, ( ( unsigned long ) ehdr->e_entry ) );
+ DBGC ( image, "ELF %s entry point %lx outside image\n",
+ image->name, ( ( unsigned long ) ehdr->e_entry ) );
return -ENOEXEC;
}
copy_from_user ( &ehdr, image->data, 0, sizeof ( ehdr ) );
if ( memcmp ( &ehdr.e_ident[EI_MAG0], e_ident,
sizeof ( e_ident ) ) != 0 ) {
- DBGC ( image, "ELF %p has invalid signature\n", image );
+ DBGC ( image, "ELF %s has invalid signature\n", image->name );
return -ENOEXEC;
}