Browse Source

[prefix] Use %cs as implicit parameter to uninstall()

romprefix.S currently calls uninstall() with an invalid value in %ax.
Consequently, base memory is not freed after a ROM boot attempt (or
after entering iPXE during POST).

The uninstall() function is physically present in .text16, and so can
use %cs to determine the .text16 segment address.  The .data16 segment
address is not required, since uninstall() is called only by code
paths which set up .data16 to immediately follow .text16.

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

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

545
  * Free space allocated with alloc_basemem.
545
  * Free space allocated with alloc_basemem.
546
  *
546
  *
547
  * Parameters:
547
  * Parameters:
548
- *   %ax : .text16 segment address
549
- *   %bx : .data16 segment address
548
+ *   none (.text16 segment address is implicit in %cs)
550
  * Returns:
549
  * Returns:
551
  *   %ax : 0 if successfully freed
550
  *   %ax : 0 if successfully freed
552
  * Corrupts:
551
  * Corrupts:
559
 free_basemem:
558
 free_basemem:
560
 	/* Preserve registers */
559
 	/* Preserve registers */
561
 	pushw	%fs
560
 	pushw	%fs
561
+	pushw	%ax
562
 
562
 
563
 	/* Check FBMS counter */
563
 	/* Check FBMS counter */
564
-	pushw	%ax
564
+	movw	%cs, %ax
565
 	shrw	$6, %ax
565
 	shrw	$6, %ax
566
 	pushw	$0x40
566
 	pushw	$0x40
567
 	popw	%fs
567
 	popw	%fs
568
 	cmpw	%ax, %fs:0x13
568
 	cmpw	%ax, %fs:0x13
569
-	popw	%ax
570
 	jne	1f
569
 	jne	1f
571
 
570
 
572
 	/* Check hooked interrupt count */
571
 	/* Check hooked interrupt count */
574
 	jne	1f
573
 	jne	1f
575
 
574
 
576
 	/* OK to free memory */
575
 	/* OK to free memory */
576
+	movw	%cs, %ax
577
 	addw	$_text16_memsz_pgh, %ax
577
 	addw	$_text16_memsz_pgh, %ax
578
 	addw	$_data16_memsz_pgh, %ax
578
 	addw	$_data16_memsz_pgh, %ax
579
 	shrw	$6, %ax
579
 	shrw	$6, %ax
581
 	xorw	%ax, %ax
581
 	xorw	%ax, %ax
582
 
582
 
583
 1:	/* Restore registers and return */
583
 1:	/* Restore registers and return */
584
+	popw	%ax
584
 	popw	%fs
585
 	popw	%fs
585
 	ret
586
 	ret
586
 	.size free_basemem, . - free_basemem
587
 	.size free_basemem, . - free_basemem
872
  * Uninstall all text and data segments.
873
  * Uninstall all text and data segments.
873
  *
874
  *
874
  * Parameters:
875
  * Parameters:
875
- *   %ax  : .text16 segment address
876
- *   %bx  : .data16 segment address
876
+ *   none (.text16 segment address is implicit in %cs)
877
  * Returns:
877
  * Returns:
878
  *   none
878
  *   none
879
  * Corrupts:
879
  * Corrupts:

Loading…
Cancel
Save