Переглянути джерело

[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>
tags/v1.20.1
Michael Brown 8 роки тому
джерело
коміт
80c482c0ed
1 змінених файлів з 38 додано та 14 видалено
  1. 38
    14
      src/arch/x86/prefix/libprefix.S

+ 38
- 14
src/arch/x86/prefix/libprefix.S Переглянути файл

@@ -36,10 +36,24 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
36 36
 
37 37
 /* Allow for DBG()-style messages within libprefix */
38 38
 #ifdef NDEBUG
39
-	.macro	progress message
39
+	.macro	progress message, regs:vararg
40 40
 	.endm
41 41
 #else
42
-	.macro	progress message
42
+	.macro	dumpreg reg, others:vararg
43
+	pushl	%eax
44
+	movl	\reg, %eax
45
+	pushw	%di
46
+	xorw	%di, %di
47
+	call	print_space
48
+	call	print_hex_dword
49
+	popw	%di
50
+	popl	%eax
51
+	.ifnb	\others
52
+	dumpreg \others
53
+	.endif
54
+	.endm
55
+
56
+	.macro	progress message, regs:vararg
43 57
 	pushfl
44 58
 	pushw	%ds
45 59
 	pushw	%si
@@ -51,6 +65,16 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
51 65
 	call	print_message
52 66
 	popw	%di
53 67
 	popw	%si
68
+	.ifnb	\regs
69
+	dumpreg \regs
70
+	.endif
71
+	pushw	%di
72
+	pushw	%ax
73
+	xorw	%di, %di
74
+	movb	$( '\n' ), %al
75
+	call	print_character
76
+	popw	%ax
77
+	popw	%di
54 78
 	popw	%ds
55 79
 	popfl
56 80
 	.section ".prefix.data", "aw", @progbits
@@ -659,7 +683,7 @@ hooked_bios_interrupts:
659 683
 	.code16
660 684
 	.globl install
661 685
 install:
662
-	progress "install:\n"
686
+	progress "\ninstall:"
663 687
 	/* Preserve registers */
664 688
 	pushl	%esi
665 689
 	pushl	%edi
@@ -702,7 +726,7 @@ install:
702 726
 	.code16
703 727
 	.globl install_prealloc
704 728
 install_prealloc:
705
-	progress "install_prealloc:\n"
729
+	progress "\ninstall_prealloc:", %eax, %ebx, %esi, %edi, %ebp
706 730
 	/* Save registers on external stack */
707 731
 	pushal
708 732
 	pushw	%ds
@@ -726,7 +750,6 @@ install_prealloc:
726 750
 	pushl	%edi
727 751
 
728 752
 	/* Install .text16.early and calculate %ecx as offset to next block */
729
-	progress "  .text16.early\n"
730 753
 	pushl	%esi
731 754
 	xorl	%esi, %esi
732 755
 	movw	%cs, %si
@@ -737,6 +760,7 @@ install_prealloc:
737 760
 	shll	$4, %edi
738 761
 	movl	$_text16_early_filesz, %ecx
739 762
 	movl	$_text16_early_memsz, %edx
763
+	progress "  .text16.early  ", %esi, %edi, %ecx, %edx
740 764
 	call	install_block		/* .text16.early */
741 765
 	jc	install_block_death
742 766
 	popl	%ecx			/* Calculate offset to next block */
@@ -750,7 +774,7 @@ install_prealloc:
750 774
 	 * already have 4GB segment limits as a result of calling
751 775
 	 * install_block.)
752 776
 	 */
753
-	progress "  access_highmem\n"
777
+	progress "  access_highmem"
754 778
 	pushw	%cs
755 779
 	pushw	$1f
756 780
 	pushw	%ax
@@ -762,7 +786,7 @@ install_prealloc:
762 786
 #endif
763 787
 
764 788
 	/* Open payload (which may not yet be in memory) */
765
-	progress "  open_payload\n"
789
+	progress "  open_payload   ", %esi, %ecx
766 790
 	pushw	%cs
767 791
 	pushw	$1f
768 792
 	pushw	%ax
@@ -779,16 +803,16 @@ install_prealloc:
779 803
 1:	addl	%ecx, %esi
780 804
 
781 805
 	/* Install .text16.late and .data16 */
782
-	progress "  .text16.late\n"
783 806
 	movl	$_text16_late_filesz, %ecx
784 807
 	movl	$_text16_late_memsz, %edx
808
+	progress "  .text16.late   ", %esi, %edi, %ecx, %edx
785 809
 	call	install_block		/* .text16.late */
786 810
 	jc	install_block_death
787
-	progress "  .data16\n"
788 811
 	movzwl	%bx, %edi
789 812
 	shll	$4, %edi
790 813
 	movl	$_data16_filesz, %ecx
791 814
 	movl	$_data16_filesz, %edx	/* do not zero our temporary stack */
815
+	progress "  .data16        ", %esi, %edi, %ecx, %edx
792 816
 	call	install_block		/* .data16 */
793 817
 	jc	install_block_death
794 818
 
@@ -825,10 +849,10 @@ install_prealloc:
825 849
 	 * prior to reading the E820 memory map and relocating
826 850
 	 * properly.
827 851
 	 */
828
-	progress "  .textdata\n"
829 852
 	pushl	%edi
830 853
 	movl	$_textdata_filesz, %ecx
831 854
 	movl	$_textdata_memsz, %edx
855
+	progress "  .textdata      ", %esi, %edi, %ecx, %edx
832 856
 	call	install_block
833 857
 	jc	install_block_death
834 858
 	popl	%edi
@@ -850,7 +874,7 @@ install_prealloc:
850 874
 #ifndef KEEP_IT_REAL
851 875
 
852 876
 	/* Initialise librm at current location */
853
-	progress "  init_librm\n"
877
+	progress "  init_librm     ", %eax, %ebx, %edi
854 878
 	movw	%ax, (init_librm_vector+2)
855 879
 	lcall	*init_librm_vector
856 880
 
@@ -881,7 +905,7 @@ install_prealloc:
881 905
 	.section ".prefix.install_prealloc", "awx", @progbits
882 906
 1:
883 907
 	/* Copy code to new location */
884
-	progress "  copy\n"
908
+	progress "  copy           ", %esi, %edi, %ecx
885 909
 	pushl	%edi
886 910
 	pushw	%bx
887 911
 	movw	$copy_bytes, %bx
@@ -890,7 +914,7 @@ install_prealloc:
890 914
 	popl	%edi
891 915
 
892 916
 	/* Initialise librm at new location */
893
-	progress "  init_librm\n"
917
+	progress "  init_librm     ", %eax, %ebx, %edi
894 918
 	lcall	*init_librm_vector
895 919
 
896 920
 #else /* KEEP_IT_REAL */
@@ -902,7 +926,7 @@ install_prealloc:
902 926
 #endif /* KEEP_IT_REAL */
903 927
 
904 928
 	/* Close access to payload */
905
-	progress "  close_payload\n"
929
+	progress "  close_payload"
906 930
 	movw	%ax, (close_payload_vector+2)
907 931
 	lcall	*close_payload_vector
908 932
 

Завантаження…
Відмінити
Зберегти