mirror of
https://github.com/ipxe/ipxe
synced 2026-01-25 07:31:04 +03:00
[image] Use image name rather than pointer value in all debug messages
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -62,8 +62,8 @@ static int com32_exec_loop ( struct image *image ) {
|
||||
memmap_describe ( COM32_START_PHYS, 1, ®ion );
|
||||
assert ( memmap_is_usable ( ®ion ) );
|
||||
avail_mem_top = ( COM32_START_PHYS + memmap_size ( ®ion ) );
|
||||
DBGC ( image, "COM32 %p: available memory top = 0x%x\n",
|
||||
image, avail_mem_top );
|
||||
DBGC ( image, "COM32 %s: available memory top = 0x%x\n",
|
||||
image->name, avail_mem_top );
|
||||
assert ( avail_mem_top != 0 );
|
||||
|
||||
/* Hook COMBOOT API interrupts */
|
||||
@@ -114,22 +114,22 @@ static int com32_exec_loop ( struct image *image ) {
|
||||
image->cmdline : "" ) ),
|
||||
"i" ( COM32_START_PHYS )
|
||||
: "memory" );
|
||||
DBGC ( image, "COM32 %p: returned\n", image );
|
||||
DBGC ( image, "COM32 %s: returned\n", image->name );
|
||||
break;
|
||||
|
||||
case COMBOOT_EXIT:
|
||||
DBGC ( image, "COM32 %p: exited\n", image );
|
||||
DBGC ( image, "COM32 %s: exited\n", image->name );
|
||||
break;
|
||||
|
||||
case COMBOOT_EXIT_RUN_KERNEL:
|
||||
assert ( image->replacement );
|
||||
DBGC ( image, "COM32 %p: exited to run kernel %s\n",
|
||||
image, image->replacement->name );
|
||||
DBGC ( image, "COM32 %s: exited to run kernel %s\n",
|
||||
image->name, image->replacement->name );
|
||||
break;
|
||||
|
||||
case COMBOOT_EXIT_COMMAND:
|
||||
DBGC ( image, "COM32 %p: exited after executing command\n",
|
||||
image );
|
||||
DBGC ( image, "COM32 %s: exited after executing command\n",
|
||||
image->name );
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -159,8 +159,8 @@ static int com32_identify ( struct image *image ) {
|
||||
* B8 FF 4C CD 21
|
||||
*/
|
||||
if ( memcmp ( image->data, magic, sizeof ( magic) ) == 0 ) {
|
||||
DBGC ( image, "COM32 %p: found magic number\n",
|
||||
image );
|
||||
DBGC ( image, "COM32 %s: found magic number\n",
|
||||
image->name );
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -170,16 +170,16 @@ static int com32_identify ( struct image *image ) {
|
||||
ext = strrchr( image->name, '.' );
|
||||
|
||||
if ( ! ext ) {
|
||||
DBGC ( image, "COM32 %p: no extension\n",
|
||||
image );
|
||||
DBGC ( image, "COM32 %s: no extension\n",
|
||||
image->name );
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
++ext;
|
||||
|
||||
if ( strcasecmp( ext, "c32" ) ) {
|
||||
DBGC ( image, "COM32 %p: unrecognized extension %s\n",
|
||||
image, ext );
|
||||
DBGC ( image, "COM32 %s: unrecognized extension %s\n",
|
||||
image->name, ext );
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
@@ -201,8 +201,8 @@ static int com32_load_image ( struct image *image ) {
|
||||
memsz = filesz;
|
||||
buffer = phys_to_virt ( COM32_START_PHYS );
|
||||
if ( ( rc = prep_segment ( buffer, filesz, memsz ) ) != 0 ) {
|
||||
DBGC ( image, "COM32 %p: could not prepare segment: %s\n",
|
||||
image, strerror ( rc ) );
|
||||
DBGC ( image, "COM32 %s: could not prepare segment: %s\n",
|
||||
image->name, strerror ( rc ) );
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -230,8 +230,8 @@ static int com32_prepare_bounce_buffer ( struct image * image ) {
|
||||
|
||||
/* Prepare, verify, and load the real-mode segment */
|
||||
if ( ( rc = prep_segment ( seg, filesz, memsz ) ) != 0 ) {
|
||||
DBGC ( image, "COM32 %p: could not prepare bounce buffer segment: %s\n",
|
||||
image, strerror ( rc ) );
|
||||
DBGC ( image, "COM32 %s: could not prepare bounce buffer segment: %s\n",
|
||||
image->name, strerror ( rc ) );
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -247,8 +247,6 @@ static int com32_prepare_bounce_buffer ( struct image * image ) {
|
||||
static int com32_probe ( struct image *image ) {
|
||||
int rc;
|
||||
|
||||
DBGC ( image, "COM32 %p: name '%s'\n", image, image->name );
|
||||
|
||||
/* Check if this is a COMBOOT image */
|
||||
if ( ( rc = com32_identify ( image ) ) != 0 ) {
|
||||
return rc;
|
||||
|
||||
@@ -108,8 +108,8 @@ static void comboot_init_psp ( struct image * image, void *seg ) {
|
||||
* kilobytes; x * 1024 / 16 == x * 64 == x << 6 */
|
||||
psp->first_non_free_para = get_fbms() << 6;
|
||||
|
||||
DBGC ( image, "COMBOOT %p: first non-free paragraph = 0x%x\n",
|
||||
image, psp->first_non_free_para );
|
||||
DBGC ( image, "COMBOOT %s: first non-free paragraph = 0x%x\n",
|
||||
image->name, psp->first_non_free_para );
|
||||
|
||||
/* Copy the command line to the PSP */
|
||||
comboot_copy_cmdline ( image, seg );
|
||||
@@ -172,22 +172,22 @@ static int comboot_exec_loop ( struct image *image ) {
|
||||
"xorw %%bp, %%bp\n\t"
|
||||
"lret\n\t" )
|
||||
: : "R" ( COMBOOT_PSP_SEG ) : "eax" );
|
||||
DBGC ( image, "COMBOOT %p: returned\n", image );
|
||||
DBGC ( image, "COMBOOT %s: returned\n", image->name );
|
||||
break;
|
||||
|
||||
case COMBOOT_EXIT:
|
||||
DBGC ( image, "COMBOOT %p: exited\n", image );
|
||||
DBGC ( image, "COMBOOT %s: exited\n", image->name );
|
||||
break;
|
||||
|
||||
case COMBOOT_EXIT_RUN_KERNEL:
|
||||
assert ( image->replacement );
|
||||
DBGC ( image, "COMBOOT %p: exited to run kernel %s\n",
|
||||
image, image->replacement->name );
|
||||
DBGC ( image, "COMBOOT %s: exited to run kernel %s\n",
|
||||
image->name, image->replacement->name );
|
||||
break;
|
||||
|
||||
case COMBOOT_EXIT_COMMAND:
|
||||
DBGC ( image, "COMBOOT %p: exited after executing command\n",
|
||||
image );
|
||||
DBGC ( image, "COMBOOT %s: exited after executing command\n",
|
||||
image->name );
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -213,16 +213,16 @@ static int comboot_identify ( struct image *image ) {
|
||||
ext = strrchr( image->name, '.' );
|
||||
|
||||
if ( ! ext ) {
|
||||
DBGC ( image, "COMBOOT %p: no extension\n",
|
||||
image );
|
||||
DBGC ( image, "COMBOOT %s: no extension\n",
|
||||
image->name );
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
++ext;
|
||||
|
||||
if ( strcasecmp( ext, "cbt" ) ) {
|
||||
DBGC ( image, "COMBOOT %p: unrecognized extension %s\n",
|
||||
image, ext );
|
||||
DBGC ( image, "COMBOOT %s: unrecognized extension %s\n",
|
||||
image->name, ext );
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
@@ -251,8 +251,8 @@ static int comboot_prepare_segment ( struct image *image )
|
||||
|
||||
/* Prepare, verify, and load the real-mode segment */
|
||||
if ( ( rc = prep_segment ( seg, filesz, memsz ) ) != 0 ) {
|
||||
DBGC ( image, "COMBOOT %p: could not prepare segment: %s\n",
|
||||
image, strerror ( rc ) );
|
||||
DBGC ( image, "COMBOOT %s: could not prepare segment: %s\n",
|
||||
image->name, strerror ( rc ) );
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -274,9 +274,6 @@ static int comboot_prepare_segment ( struct image *image )
|
||||
static int comboot_probe ( struct image *image ) {
|
||||
int rc;
|
||||
|
||||
DBGC ( image, "COMBOOT %p: name '%s'\n",
|
||||
image, image->name );
|
||||
|
||||
/* Check if this is a COMBOOT image */
|
||||
if ( ( rc = comboot_identify ( image ) ) != 0 ) {
|
||||
|
||||
@@ -297,8 +294,8 @@ static int comboot_exec ( struct image *image ) {
|
||||
|
||||
/* Sanity check for filesize */
|
||||
if( image->len >= 0xFF00 ) {
|
||||
DBGC( image, "COMBOOT %p: image too large\n",
|
||||
image );
|
||||
DBGC( image, "COMBOOT %s: image too large\n",
|
||||
image->name );
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
|
||||
@@ -111,8 +111,8 @@ static int nbi_prepare_segment ( struct image *image, size_t offset __unused,
|
||||
int rc;
|
||||
|
||||
if ( ( rc = prep_segment ( dest, filesz, memsz ) ) != 0 ) {
|
||||
DBGC ( image, "NBI %p could not prepare segment: %s\n",
|
||||
image, strerror ( rc ) );
|
||||
DBGC ( image, "NBI %s could not prepare segment: %s\n",
|
||||
image->name, strerror ( rc ) );
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -174,8 +174,8 @@ static int nbi_process_segments ( struct image *image,
|
||||
sh = ( image->data + sh_off );
|
||||
if ( sh->length == 0 ) {
|
||||
/* Avoid infinite loop? */
|
||||
DBGC ( image, "NBI %p invalid segheader length 0\n",
|
||||
image );
|
||||
DBGC ( image, "NBI %s invalid segheader length 0\n",
|
||||
image->name );
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
@@ -207,7 +207,8 @@ static int nbi_process_segments ( struct image *image,
|
||||
filesz = sh->imglength;
|
||||
memsz = sh->memlength;
|
||||
if ( ( offset + filesz ) > image->len ) {
|
||||
DBGC ( image, "NBI %p segment outside file\n", image );
|
||||
DBGC ( image, "NBI %s segment outside file\n",
|
||||
image->name );
|
||||
return -ENOEXEC;
|
||||
}
|
||||
if ( ( rc = process ( image, offset, dest,
|
||||
@@ -219,15 +220,16 @@ static int nbi_process_segments ( struct image *image,
|
||||
/* Next segheader */
|
||||
sh_off += NBI_LENGTH ( sh->length );
|
||||
if ( sh_off >= NBI_HEADER_LENGTH ) {
|
||||
DBGC ( image, "NBI %p header overflow\n", image );
|
||||
DBGC ( image, "NBI %s header overflow\n",
|
||||
image->name );
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
} while ( ! NBI_LAST_SEGHEADER ( sh->flags ) );
|
||||
|
||||
if ( offset != image->len ) {
|
||||
DBGC ( image, "NBI %p length wrong (file %zd, metadata %zd)\n",
|
||||
image, image->len, offset );
|
||||
DBGC ( image, "NBI %s length wrong (file %zd, metadata %zd)\n",
|
||||
image->name, image->len, offset );
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
@@ -245,8 +247,8 @@ static int nbi_boot16 ( struct image *image,
|
||||
int discard_D, discard_S, discard_b;
|
||||
int32_t rc;
|
||||
|
||||
DBGC ( image, "NBI %p executing 16-bit image at %04x:%04x\n", image,
|
||||
imgheader->execaddr.segoff.segment,
|
||||
DBGC ( image, "NBI %s executing 16-bit image at %04x:%04x\n",
|
||||
image->name, imgheader->execaddr.segoff.segment,
|
||||
imgheader->execaddr.segoff.offset );
|
||||
|
||||
__asm__ __volatile__ (
|
||||
@@ -288,8 +290,8 @@ static int nbi_boot32 ( struct image *image,
|
||||
int discard_D, discard_S, discard_b;
|
||||
int32_t rc;
|
||||
|
||||
DBGC ( image, "NBI %p executing 32-bit image at %lx\n",
|
||||
image, imgheader->execaddr.linear );
|
||||
DBGC ( image, "NBI %s executing 32-bit image at %lx\n",
|
||||
image->name, imgheader->execaddr.linear );
|
||||
|
||||
/* Jump to OS with flat physical addressing */
|
||||
__asm__ __volatile__ (
|
||||
@@ -324,14 +326,15 @@ static int nbi_prepare_dhcp ( struct image *image ) {
|
||||
|
||||
boot_netdev = last_opened_netdev();
|
||||
if ( ! boot_netdev ) {
|
||||
DBGC ( image, "NBI %p could not identify a network device\n",
|
||||
image );
|
||||
DBGC ( image, "NBI %s could not identify a network device\n",
|
||||
image->name );
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if ( ( rc = create_fakedhcpack ( boot_netdev, basemem_packet,
|
||||
sizeof ( basemem_packet ) ) ) != 0 ) {
|
||||
DBGC ( image, "NBI %p failed to build DHCP packet\n", image );
|
||||
DBGC ( image, "NBI %s failed to build DHCP packet\n",
|
||||
image->name );
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -352,7 +355,7 @@ static int nbi_exec ( struct image *image ) {
|
||||
/* Retrieve image header */
|
||||
imgheader = image->data;
|
||||
|
||||
DBGC ( image, "NBI %p placing header at %hx:%hx\n", image,
|
||||
DBGC ( image, "NBI %s placing header at %hx:%hx\n", image->name,
|
||||
imgheader->location.segment, imgheader->location.offset );
|
||||
|
||||
/* NBI files can have overlaps between segments; the bss of
|
||||
@@ -387,12 +390,12 @@ static int nbi_exec ( struct image *image ) {
|
||||
|
||||
if ( ! may_return ) {
|
||||
/* Cannot continue after shutdown() called */
|
||||
DBGC ( image, "NBI %p returned %d from non-returnable image\n",
|
||||
image, rc );
|
||||
DBGC ( image, "NBI %s returned %d from non-returnable image\n",
|
||||
image->name, rc );
|
||||
while ( 1 ) {}
|
||||
}
|
||||
|
||||
DBGC ( image, "NBI %p returned %d\n", image, rc );
|
||||
DBGC ( image, "NBI %s returned %d\n", image->name, rc );
|
||||
|
||||
return rc;
|
||||
}
|
||||
@@ -408,14 +411,15 @@ static int nbi_probe ( struct image *image ) {
|
||||
|
||||
/* If we don't have enough data give up */
|
||||
if ( image->len < NBI_HEADER_LENGTH ) {
|
||||
DBGC ( image, "NBI %p too short for an NBI image\n", image );
|
||||
DBGC ( image, "NBI %s too short for an NBI image\n",
|
||||
image->name );
|
||||
return -ENOEXEC;
|
||||
}
|
||||
imgheader = image->data;
|
||||
|
||||
/* Check image header */
|
||||
if ( imgheader->magic != NBI_MAGIC ) {
|
||||
DBGC ( image, "NBI %p has no NBI signature\n", image );
|
||||
DBGC ( image, "NBI %s has no NBI signature\n", image->name );
|
||||
return -ENOEXEC;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,8 +60,8 @@ static int pxe_exec ( struct image *image ) {
|
||||
|
||||
/* Verify and prepare segment */
|
||||
if ( ( rc = prep_segment ( buffer, image->len, image->len ) ) != 0 ) {
|
||||
DBGC ( image, "IMAGE %p could not prepare segment: %s\n",
|
||||
image, strerror ( rc ) );
|
||||
DBGC ( image, "IMAGE %s could not prepare segment: %s\n",
|
||||
image->name, strerror ( rc ) );
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -70,8 +70,8 @@ static int pxe_exec ( struct image *image ) {
|
||||
|
||||
/* Arbitrarily pick the most recently opened network device */
|
||||
if ( ( netdev = last_opened_netdev() ) == NULL ) {
|
||||
DBGC ( image, "IMAGE %p could not locate PXE net device\n",
|
||||
image );
|
||||
DBGC ( image, "IMAGE %s could not locate PXE net device\n",
|
||||
image->name );
|
||||
return -ENODEV;
|
||||
}
|
||||
netdev_get ( netdev );
|
||||
@@ -155,8 +155,8 @@ int pxe_probe_no_mz ( struct image *image ) {
|
||||
if ( image->len >= sizeof ( *magic ) ) {
|
||||
magic = image->data;
|
||||
if ( *magic == cpu_to_le16 ( EFI_IMAGE_DOS_SIGNATURE ) ) {
|
||||
DBGC ( image, "IMAGE %p may be an EFI image\n",
|
||||
image );
|
||||
DBGC ( image, "IMAGE %s may be an EFI image\n",
|
||||
image->name );
|
||||
return -ENOTTY;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user