Bläddra i källkod

[prefix] Use stack rather than %ebp as temporary storage area

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 13 år sedan
förälder
incheckning
6c5f1a342b
1 ändrade filer med 14 tillägg och 11 borttagningar
  1. 14
    11
      src/arch/i386/prefix/libprefix.S

+ 14
- 11
src/arch/i386/prefix/libprefix.S Visa fil

@@ -661,8 +661,8 @@ install_prealloc:
661 661
 	pushw	%cs
662 662
 	popw	%ds
663 663
 
664
-	/* Copy decompression temporary area physical address to %ebp */
665
-	movl	%edi, %ebp
664
+	/* Save decompression temporary area physical address */
665
+	pushl	%edi
666 666
 
667 667
 	/* Install .text16.early */
668 668
 	progress "  .text16.early\n"
@@ -747,6 +747,9 @@ payload_death_message:
747 747
 	/* Set up %ds for access to .data16 */
748 748
 	movw	%bx, %ds
749 749
 
750
+	/* Restore decompression temporary area physical address */
751
+	popl	%edi
752
+
750 753
 #ifdef KEEP_IT_REAL
751 754
 	/* Initialise libkir */
752 755
 	movw	%ax, (init_libkir_vector+2)
@@ -754,7 +757,7 @@ payload_death_message:
754 757
 #else
755 758
 	/* Find a suitable decompression temporary area, if none specified */
756 759
 	pushl	%eax
757
-	testl	%ebp, %ebp
760
+	testl	%edi, %edi
758 761
 	jnz	1f
759 762
 	/* Use INT 15,88 to find the highest available address via INT
760 763
 	 * 15,88.  This limits us to around 64MB, which should avoid
@@ -762,14 +765,14 @@ payload_death_message:
762 765
 	 */
763 766
 	movb	$0x88, %ah
764 767
 	int	$0x15
765
-	movw	%ax, %bp
766
-	addl	$0x400, %ebp
767
-	subl	$_textdata_memsz_kb, %ebp
768
-	shll	$10, %ebp
768
+	movw	%ax, %di
769
+	addl	$0x400, %edi
770
+	subl	$_textdata_memsz_kb, %edi
771
+	shll	$10, %edi
769 772
 	/* Sanity check: if we have ended up below 1MB, use 1MB */
770
-	cmpl	$0x100000, %ebp
773
+	cmpl	$0x100000, %edi
771 774
 	jae	1f
772
-	movl	$0x100000, %ebp
775
+	movl	$0x100000, %edi
773 776
 1:	popl	%eax
774 777
 
775 778
 	/* Install .text and .data to temporary area in high memory,
@@ -777,15 +780,15 @@ payload_death_message:
777 780
 	 * properly.
778 781
 	 */
779 782
 	progress "  .textdata\n"
780
-	movl	%ebp, %edi
783
+	pushl	%edi
781 784
 	movl	$_textdata_filesz, %ecx
782 785
 	movl	$_textdata_memsz, %edx
783 786
 	call	install_block
787
+	popl	%edi
784 788
 
785 789
 	/* Initialise librm at current location */
786 790
 	progress "  init_librm\n"
787 791
 	movw	%ax, (init_librm_vector+2)
788
-	movl	%ebp, %edi
789 792
 	lcall	*init_librm_vector
790 793
 
791 794
 	/* Skip relocation if CF was set on entry */

Laddar…
Avbryt
Spara