mirror of https://github.com/ipxe/ipxe.git
[prefix] Add rudimentary debugging messages to libprefix
Signed-off-by: Michael Brown <mcb30@ipxe.org>pull/1/head
parent
3f13e3d5d2
commit
17ef28414f
|
@ -27,6 +27,33 @@ FILE_LICENCE ( GPL2_OR_LATER )
|
||||||
/* Protected mode flag */
|
/* Protected mode flag */
|
||||||
#define CR0_PE 1
|
#define CR0_PE 1
|
||||||
|
|
||||||
|
/* Allow for DBG()-style messages within libprefix */
|
||||||
|
#ifdef NDEBUG
|
||||||
|
.macro progress message
|
||||||
|
.endm
|
||||||
|
#else
|
||||||
|
.macro progress message
|
||||||
|
pushfl
|
||||||
|
pushw %ds
|
||||||
|
pushw %si
|
||||||
|
pushw %di
|
||||||
|
pushw %cs
|
||||||
|
popw %ds
|
||||||
|
xorw %di, %di
|
||||||
|
movw $progress_\@, %si
|
||||||
|
call print_message
|
||||||
|
popw %di
|
||||||
|
popw %si
|
||||||
|
popw %ds
|
||||||
|
popfl
|
||||||
|
.section ".prefix.data", "aw", @progbits
|
||||||
|
progress_\@:
|
||||||
|
.asciz "\message"
|
||||||
|
.size progress_\@, . - progress\@
|
||||||
|
.previous
|
||||||
|
.endm
|
||||||
|
#endif
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* Utility function: print character (with LF -> LF,CR translation)
|
* Utility function: print character (with LF -> LF,CR translation)
|
||||||
*
|
*
|
||||||
|
@ -583,6 +610,7 @@ hooked_bios_interrupts:
|
||||||
.code16
|
.code16
|
||||||
.globl install
|
.globl install
|
||||||
install:
|
install:
|
||||||
|
progress "install:\n"
|
||||||
/* Preserve registers */
|
/* Preserve registers */
|
||||||
pushl %esi
|
pushl %esi
|
||||||
pushl %edi
|
pushl %edi
|
||||||
|
@ -621,6 +649,7 @@ install:
|
||||||
.code16
|
.code16
|
||||||
.globl install_prealloc
|
.globl install_prealloc
|
||||||
install_prealloc:
|
install_prealloc:
|
||||||
|
progress "install_prealloc:\n"
|
||||||
/* Save registers */
|
/* Save registers */
|
||||||
pushal
|
pushal
|
||||||
pushw %ds
|
pushw %ds
|
||||||
|
@ -636,6 +665,7 @@ install_prealloc:
|
||||||
movl %edi, %ebp
|
movl %edi, %ebp
|
||||||
|
|
||||||
/* Install .text16.early */
|
/* Install .text16.early */
|
||||||
|
progress " .text16.early\n"
|
||||||
pushl %esi
|
pushl %esi
|
||||||
xorl %esi, %esi
|
xorl %esi, %esi
|
||||||
movw %cs, %si
|
movw %cs, %si
|
||||||
|
@ -653,6 +683,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"
|
||||||
pushw %cs
|
pushw %cs
|
||||||
pushw $1f
|
pushw $1f
|
||||||
pushw %ax
|
pushw %ax
|
||||||
|
@ -673,6 +704,7 @@ a20_death_message:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Open payload (which may not yet be in memory) */
|
/* Open payload (which may not yet be in memory) */
|
||||||
|
progress " open_payload\n"
|
||||||
pushw %cs
|
pushw %cs
|
||||||
pushw $1f
|
pushw $1f
|
||||||
pushw %ax
|
pushw %ax
|
||||||
|
@ -701,9 +733,11 @@ payload_death_message:
|
||||||
1: addl payload_lma, %esi
|
1: addl payload_lma, %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
|
||||||
call install_block /* .text16.late */
|
call install_block /* .text16.late */
|
||||||
|
progress " .data16\n"
|
||||||
movzwl %bx, %edi
|
movzwl %bx, %edi
|
||||||
shll $4, %edi
|
shll $4, %edi
|
||||||
movl $_data16_filesz, %ecx
|
movl $_data16_filesz, %ecx
|
||||||
|
@ -738,12 +772,14 @@ payload_death_message:
|
||||||
* prior to reading the E820 memory map and relocating
|
* prior to reading the E820 memory map and relocating
|
||||||
* properly.
|
* properly.
|
||||||
*/
|
*/
|
||||||
|
progress " .textdata\n"
|
||||||
movl %ebp, %edi
|
movl %ebp, %edi
|
||||||
movl $_textdata_filesz, %ecx
|
movl $_textdata_filesz, %ecx
|
||||||
movl $_textdata_memsz, %edx
|
movl $_textdata_memsz, %edx
|
||||||
call install_block
|
call install_block
|
||||||
|
|
||||||
/* Initialise librm at current location */
|
/* Initialise librm at current location */
|
||||||
|
progress " init_librm\n"
|
||||||
movw %ax, (init_librm_vector+2)
|
movw %ax, (init_librm_vector+2)
|
||||||
movl %ebp, %edi
|
movl %ebp, %edi
|
||||||
lcall *init_librm_vector
|
lcall *init_librm_vector
|
||||||
|
@ -757,12 +793,14 @@ payload_death_message:
|
||||||
* relocate() will return with %esi, %edi and %ecx set up
|
* relocate() will return with %esi, %edi and %ecx set up
|
||||||
* ready for the copy to the new location.
|
* ready for the copy to the new location.
|
||||||
*/
|
*/
|
||||||
|
progress " relocate\n"
|
||||||
movw %ax, (prot_call_vector+2)
|
movw %ax, (prot_call_vector+2)
|
||||||
pushl $relocate
|
pushl $relocate
|
||||||
lcall *prot_call_vector
|
lcall *prot_call_vector
|
||||||
popl %edx /* discard */
|
popl %edx /* discard */
|
||||||
|
|
||||||
/* Copy code to new location */
|
/* Copy code to new location */
|
||||||
|
progress " copy\n"
|
||||||
pushl %edi
|
pushl %edi
|
||||||
pushw %bx
|
pushw %bx
|
||||||
movw $copy_bytes, %bx
|
movw $copy_bytes, %bx
|
||||||
|
@ -771,11 +809,13 @@ payload_death_message:
|
||||||
popl %edi
|
popl %edi
|
||||||
|
|
||||||
/* Initialise librm at new location */
|
/* Initialise librm at new location */
|
||||||
|
progress " init_librm\n"
|
||||||
lcall *init_librm_vector
|
lcall *init_librm_vector
|
||||||
skip_relocate:
|
skip_relocate:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Close access to payload */
|
/* Close access to payload */
|
||||||
|
progress " close_payload\n"
|
||||||
movw %ax, (close_payload_vector+2)
|
movw %ax, (close_payload_vector+2)
|
||||||
lcall *close_payload_vector
|
lcall *close_payload_vector
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue