Browse Source

[prefix] Add rudimentary debugging messages to libprefix

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 14 years ago
parent
commit
17ef28414f
1 changed files with 40 additions and 0 deletions
  1. 40
    0
      src/arch/i386/prefix/libprefix.S

+ 40
- 0
src/arch/i386/prefix/libprefix.S View File

27
 /* Protected mode flag */
27
 /* Protected mode flag */
28
 #define CR0_PE 1
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
  * Utility function: print character (with LF -> LF,CR translation)
58
  * Utility function: print character (with LF -> LF,CR translation)
32
  *
59
  *
583
 	.code16
610
 	.code16
584
 	.globl install
611
 	.globl install
585
 install:
612
 install:
613
+	progress "install:\n"
586
 	/* Preserve registers */
614
 	/* Preserve registers */
587
 	pushl	%esi
615
 	pushl	%esi
588
 	pushl	%edi
616
 	pushl	%edi
621
 	.code16
649
 	.code16
622
 	.globl install_prealloc
650
 	.globl install_prealloc
623
 install_prealloc:
651
 install_prealloc:
652
+	progress "install_prealloc:\n"
624
 	/* Save registers */
653
 	/* Save registers */
625
 	pushal
654
 	pushal
626
 	pushw	%ds
655
 	pushw	%ds
636
 	movl	%edi, %ebp
665
 	movl	%edi, %ebp
637
 
666
 
638
 	/* Install .text16.early */
667
 	/* Install .text16.early */
668
+	progress "  .text16.early\n"
639
 	pushl	%esi
669
 	pushl	%esi
640
 	xorl	%esi, %esi
670
 	xorl	%esi, %esi
641
 	movw	%cs, %si
671
 	movw	%cs, %si
653
 	 * already have 4GB segment limits as a result of calling
683
 	 * already have 4GB segment limits as a result of calling
654
 	 * install_block.)
684
 	 * install_block.)
655
 	 */
685
 	 */
686
+	progress "  access_highmem\n"
656
 	pushw	%cs
687
 	pushw	%cs
657
 	pushw	$1f
688
 	pushw	$1f
658
 	pushw	%ax
689
 	pushw	%ax
673
 #endif
704
 #endif
674
 
705
 
675
 	/* Open payload (which may not yet be in memory) */
706
 	/* Open payload (which may not yet be in memory) */
707
+	progress "  open_payload\n"
676
 	pushw	%cs
708
 	pushw	%cs
677
 	pushw	$1f
709
 	pushw	$1f
678
 	pushw	%ax
710
 	pushw	%ax
701
 1:	addl	payload_lma, %esi
733
 1:	addl	payload_lma, %esi
702
 
734
 
703
 	/* Install .text16.late and .data16 */
735
 	/* Install .text16.late and .data16 */
736
+	progress "  .text16.late\n"
704
 	movl	$_text16_late_filesz, %ecx
737
 	movl	$_text16_late_filesz, %ecx
705
 	movl	$_text16_late_memsz, %edx
738
 	movl	$_text16_late_memsz, %edx
706
 	call	install_block		/* .text16.late */
739
 	call	install_block		/* .text16.late */
740
+	progress "  .data16\n"
707
 	movzwl	%bx, %edi
741
 	movzwl	%bx, %edi
708
 	shll	$4, %edi
742
 	shll	$4, %edi
709
 	movl	$_data16_filesz, %ecx
743
 	movl	$_data16_filesz, %ecx
738
 	 * prior to reading the E820 memory map and relocating
772
 	 * prior to reading the E820 memory map and relocating
739
 	 * properly.
773
 	 * properly.
740
 	 */
774
 	 */
775
+	progress "  .textdata\n"
741
 	movl	%ebp, %edi
776
 	movl	%ebp, %edi
742
 	movl	$_textdata_filesz, %ecx
777
 	movl	$_textdata_filesz, %ecx
743
 	movl	$_textdata_memsz, %edx
778
 	movl	$_textdata_memsz, %edx
744
 	call	install_block
779
 	call	install_block
745
 
780
 
746
 	/* Initialise librm at current location */
781
 	/* Initialise librm at current location */
782
+	progress "  init_librm\n"
747
 	movw	%ax, (init_librm_vector+2)
783
 	movw	%ax, (init_librm_vector+2)
748
 	movl	%ebp, %edi
784
 	movl	%ebp, %edi
749
 	lcall	*init_librm_vector
785
 	lcall	*init_librm_vector
757
 	 * relocate() will return with %esi, %edi and %ecx set up
793
 	 * relocate() will return with %esi, %edi and %ecx set up
758
 	 * ready for the copy to the new location.
794
 	 * ready for the copy to the new location.
759
 	 */
795
 	 */
796
+	progress "  relocate\n"
760
 	movw	%ax, (prot_call_vector+2)
797
 	movw	%ax, (prot_call_vector+2)
761
 	pushl	$relocate
798
 	pushl	$relocate
762
 	lcall	*prot_call_vector
799
 	lcall	*prot_call_vector
763
 	popl	%edx /* discard */
800
 	popl	%edx /* discard */
764
 
801
 
765
 	/* Copy code to new location */
802
 	/* Copy code to new location */
803
+	progress "  copy\n"
766
 	pushl	%edi
804
 	pushl	%edi
767
 	pushw	%bx
805
 	pushw	%bx
768
 	movw	$copy_bytes, %bx
806
 	movw	$copy_bytes, %bx
771
 	popl	%edi
809
 	popl	%edi
772
 
810
 
773
 	/* Initialise librm at new location */
811
 	/* Initialise librm at new location */
812
+	progress "  init_librm\n"
774
 	lcall	*init_librm_vector
813
 	lcall	*init_librm_vector
775
 skip_relocate:
814
 skip_relocate:
776
 #endif
815
 #endif
777
 
816
 
778
 	/* Close access to payload */
817
 	/* Close access to payload */
818
+	progress "  close_payload\n"
779
 	movw	%ax, (close_payload_vector+2)
819
 	movw	%ax, (close_payload_vector+2)
780
 	lcall	*close_payload_vector
820
 	lcall	*close_payload_vector
781
 
821
 

Loading…
Cancel
Save