Browse Source

[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 years ago
parent
commit
6c5f1a342b
1 changed files with 14 additions and 11 deletions
  1. 14
    11
      src/arch/i386/prefix/libprefix.S

+ 14
- 11
src/arch/i386/prefix/libprefix.S View File

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

Loading…
Cancel
Save