Quellcode durchsuchen

[prefix] Add rudimentary debugging messages to libprefix

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown vor 14 Jahren
Ursprung
Commit
17ef28414f
1 geänderte Dateien mit 40 neuen und 0 gelöschten Zeilen
  1. 40
    0
      src/arch/i386/prefix/libprefix.S

+ 40
- 0
src/arch/i386/prefix/libprefix.S Datei anzeigen

@@ -27,6 +27,33 @@ FILE_LICENCE ( GPL2_OR_LATER )
27 27
 /* Protected mode flag */
28 28
 #define CR0_PE 1
29 29
 
30
+/* Allow for DBG()-style messages within libprefix */
31
+#ifdef NDEBUG
32
+	.macro	progress message
33
+	.endm
34
+#else
35
+	.macro	progress message
36
+	pushfl
37
+	pushw	%ds
38
+	pushw	%si
39
+	pushw	%di
40
+	pushw	%cs
41
+	popw	%ds
42
+	xorw	%di, %di
43
+	movw	$progress_\@, %si
44
+	call	print_message
45
+	popw	%di
46
+	popw	%si
47
+	popw	%ds
48
+	popfl
49
+	.section ".prefix.data", "aw", @progbits
50
+progress_\@:
51
+	.asciz	"\message"
52
+	.size	progress_\@, . - progress\@
53
+	.previous
54
+	.endm
55
+#endif
56
+
30 57
 /*****************************************************************************
31 58
  * Utility function: print character (with LF -> LF,CR translation)
32 59
  *
@@ -583,6 +610,7 @@ hooked_bios_interrupts:
583 610
 	.code16
584 611
 	.globl install
585 612
 install:
613
+	progress "install:\n"
586 614
 	/* Preserve registers */
587 615
 	pushl	%esi
588 616
 	pushl	%edi
@@ -621,6 +649,7 @@ install:
621 649
 	.code16
622 650
 	.globl install_prealloc
623 651
 install_prealloc:
652
+	progress "install_prealloc:\n"
624 653
 	/* Save registers */
625 654
 	pushal
626 655
 	pushw	%ds
@@ -636,6 +665,7 @@ install_prealloc:
636 665
 	movl	%edi, %ebp
637 666
 
638 667
 	/* Install .text16.early */
668
+	progress "  .text16.early\n"
639 669
 	pushl	%esi
640 670
 	xorl	%esi, %esi
641 671
 	movw	%cs, %si
@@ -653,6 +683,7 @@ install_prealloc:
653 683
 	 * already have 4GB segment limits as a result of calling
654 684
 	 * install_block.)
655 685
 	 */
686
+	progress "  access_highmem\n"
656 687
 	pushw	%cs
657 688
 	pushw	$1f
658 689
 	pushw	%ax
@@ -673,6 +704,7 @@ a20_death_message:
673 704
 #endif
674 705
 
675 706
 	/* Open payload (which may not yet be in memory) */
707
+	progress "  open_payload\n"
676 708
 	pushw	%cs
677 709
 	pushw	$1f
678 710
 	pushw	%ax
@@ -701,9 +733,11 @@ payload_death_message:
701 733
 1:	addl	payload_lma, %esi
702 734
 
703 735
 	/* Install .text16.late and .data16 */
736
+	progress "  .text16.late\n"
704 737
 	movl	$_text16_late_filesz, %ecx
705 738
 	movl	$_text16_late_memsz, %edx
706 739
 	call	install_block		/* .text16.late */
740
+	progress "  .data16\n"
707 741
 	movzwl	%bx, %edi
708 742
 	shll	$4, %edi
709 743
 	movl	$_data16_filesz, %ecx
@@ -738,12 +772,14 @@ payload_death_message:
738 772
 	 * prior to reading the E820 memory map and relocating
739 773
 	 * properly.
740 774
 	 */
775
+	progress "  .textdata\n"
741 776
 	movl	%ebp, %edi
742 777
 	movl	$_textdata_filesz, %ecx
743 778
 	movl	$_textdata_memsz, %edx
744 779
 	call	install_block
745 780
 
746 781
 	/* Initialise librm at current location */
782
+	progress "  init_librm\n"
747 783
 	movw	%ax, (init_librm_vector+2)
748 784
 	movl	%ebp, %edi
749 785
 	lcall	*init_librm_vector
@@ -757,12 +793,14 @@ payload_death_message:
757 793
 	 * relocate() will return with %esi, %edi and %ecx set up
758 794
 	 * ready for the copy to the new location.
759 795
 	 */
796
+	progress "  relocate\n"
760 797
 	movw	%ax, (prot_call_vector+2)
761 798
 	pushl	$relocate
762 799
 	lcall	*prot_call_vector
763 800
 	popl	%edx /* discard */
764 801
 
765 802
 	/* Copy code to new location */
803
+	progress "  copy\n"
766 804
 	pushl	%edi
767 805
 	pushw	%bx
768 806
 	movw	$copy_bytes, %bx
@@ -771,11 +809,13 @@ payload_death_message:
771 809
 	popl	%edi
772 810
 
773 811
 	/* Initialise librm at new location */
812
+	progress "  init_librm\n"
774 813
 	lcall	*init_librm_vector
775 814
 skip_relocate:
776 815
 #endif
777 816
 
778 817
 	/* Close access to payload */
818
+	progress "  close_payload\n"
779 819
 	movw	%ax, (close_payload_vector+2)
780 820
 	lcall	*close_payload_vector
781 821
 

Laden…
Abbrechen
Speichern