瀏覽代碼

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

Loading…
取消
儲存