david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[prefix] Include diagnostic information within progress messages

Include some relevant diagnostic infomation within the progress
messages generated via DEBUG=libprefix.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2016-12-06 09:38:33 +00:00
parent ce81601181
commit 80c482c0ed
1 changed files with 38 additions and 14 deletions

View File

@ -36,10 +36,24 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
/* Allow for DBG()-style messages within libprefix */ /* Allow for DBG()-style messages within libprefix */
#ifdef NDEBUG #ifdef NDEBUG
.macro progress message .macro progress message, regs:vararg
.endm .endm
#else #else
.macro progress message .macro dumpreg reg, others:vararg
pushl %eax
movl \reg, %eax
pushw %di
xorw %di, %di
call print_space
call print_hex_dword
popw %di
popl %eax
.ifnb \others
dumpreg \others
.endif
.endm
.macro progress message, regs:vararg
pushfl pushfl
pushw %ds pushw %ds
pushw %si pushw %si
@ -51,6 +65,16 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
call print_message call print_message
popw %di popw %di
popw %si popw %si
.ifnb \regs
dumpreg \regs
.endif
pushw %di
pushw %ax
xorw %di, %di
movb $( '\n' ), %al
call print_character
popw %ax
popw %di
popw %ds popw %ds
popfl popfl
.section ".prefix.data", "aw", @progbits .section ".prefix.data", "aw", @progbits
@ -659,7 +683,7 @@ hooked_bios_interrupts:
.code16 .code16
.globl install .globl install
install: install:
progress "install:\n" progress "\ninstall:"
/* Preserve registers */ /* Preserve registers */
pushl %esi pushl %esi
pushl %edi pushl %edi
@ -702,7 +726,7 @@ install:
.code16 .code16
.globl install_prealloc .globl install_prealloc
install_prealloc: install_prealloc:
progress "install_prealloc:\n" progress "\ninstall_prealloc:", %eax, %ebx, %esi, %edi, %ebp
/* Save registers on external stack */ /* Save registers on external stack */
pushal pushal
pushw %ds pushw %ds
@ -726,7 +750,6 @@ install_prealloc:
pushl %edi pushl %edi
/* Install .text16.early and calculate %ecx as offset to next block */ /* Install .text16.early and calculate %ecx as offset to next block */
progress " .text16.early\n"
pushl %esi pushl %esi
xorl %esi, %esi xorl %esi, %esi
movw %cs, %si movw %cs, %si
@ -737,6 +760,7 @@ install_prealloc:
shll $4, %edi shll $4, %edi
movl $_text16_early_filesz, %ecx movl $_text16_early_filesz, %ecx
movl $_text16_early_memsz, %edx movl $_text16_early_memsz, %edx
progress " .text16.early ", %esi, %edi, %ecx, %edx
call install_block /* .text16.early */ call install_block /* .text16.early */
jc install_block_death jc install_block_death
popl %ecx /* Calculate offset to next block */ popl %ecx /* Calculate offset to next block */
@ -750,7 +774,7 @@ install_prealloc:
* already have 4GB segment limits as a result of calling * already have 4GB segment limits as a result of calling
* install_block.) * install_block.)
*/ */
progress " access_highmem\n" progress " access_highmem"
pushw %cs pushw %cs
pushw $1f pushw $1f
pushw %ax pushw %ax
@ -762,7 +786,7 @@ install_prealloc:
#endif #endif
/* Open payload (which may not yet be in memory) */ /* Open payload (which may not yet be in memory) */
progress " open_payload\n" progress " open_payload ", %esi, %ecx
pushw %cs pushw %cs
pushw $1f pushw $1f
pushw %ax pushw %ax
@ -779,16 +803,16 @@ install_prealloc:
1: addl %ecx, %esi 1: addl %ecx, %esi
/* Install .text16.late and .data16 */ /* Install .text16.late and .data16 */
progress " .text16.late\n"
movl $_text16_late_filesz, %ecx movl $_text16_late_filesz, %ecx
movl $_text16_late_memsz, %edx movl $_text16_late_memsz, %edx
progress " .text16.late ", %esi, %edi, %ecx, %edx
call install_block /* .text16.late */ call install_block /* .text16.late */
jc install_block_death jc install_block_death
progress " .data16\n"
movzwl %bx, %edi movzwl %bx, %edi
shll $4, %edi shll $4, %edi
movl $_data16_filesz, %ecx movl $_data16_filesz, %ecx
movl $_data16_filesz, %edx /* do not zero our temporary stack */ movl $_data16_filesz, %edx /* do not zero our temporary stack */
progress " .data16 ", %esi, %edi, %ecx, %edx
call install_block /* .data16 */ call install_block /* .data16 */
jc install_block_death jc install_block_death
@ -825,10 +849,10 @@ install_prealloc:
* prior to reading the E820 memory map and relocating * prior to reading the E820 memory map and relocating
* properly. * properly.
*/ */
progress " .textdata\n"
pushl %edi pushl %edi
movl $_textdata_filesz, %ecx movl $_textdata_filesz, %ecx
movl $_textdata_memsz, %edx movl $_textdata_memsz, %edx
progress " .textdata ", %esi, %edi, %ecx, %edx
call install_block call install_block
jc install_block_death jc install_block_death
popl %edi popl %edi
@ -850,7 +874,7 @@ install_prealloc:
#ifndef KEEP_IT_REAL #ifndef KEEP_IT_REAL
/* Initialise librm at current location */ /* Initialise librm at current location */
progress " init_librm\n" progress " init_librm ", %eax, %ebx, %edi
movw %ax, (init_librm_vector+2) movw %ax, (init_librm_vector+2)
lcall *init_librm_vector lcall *init_librm_vector
@ -881,7 +905,7 @@ install_prealloc:
.section ".prefix.install_prealloc", "awx", @progbits .section ".prefix.install_prealloc", "awx", @progbits
1: 1:
/* Copy code to new location */ /* Copy code to new location */
progress " copy\n" progress " copy ", %esi, %edi, %ecx
pushl %edi pushl %edi
pushw %bx pushw %bx
movw $copy_bytes, %bx movw $copy_bytes, %bx
@ -890,7 +914,7 @@ install_prealloc:
popl %edi popl %edi
/* Initialise librm at new location */ /* Initialise librm at new location */
progress " init_librm\n" progress " init_librm ", %eax, %ebx, %edi
lcall *init_librm_vector lcall *init_librm_vector
#else /* KEEP_IT_REAL */ #else /* KEEP_IT_REAL */
@ -902,7 +926,7 @@ install_prealloc:
#endif /* KEEP_IT_REAL */ #endif /* KEEP_IT_REAL */
/* Close access to payload */ /* Close access to payload */
progress " close_payload\n" progress " close_payload"
movw %ax, (close_payload_vector+2) movw %ax, (close_payload_vector+2)
lcall *close_payload_vector lcall *close_payload_vector