mirror of https://github.com/ipxe/ipxe.git
[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>pull/6/merge
parent
c7694acb51
commit
0d4a760ffc
|
@ -545,8 +545,7 @@ alloc_basemem:
|
||||||
* Free space allocated with alloc_basemem.
|
* Free space allocated with alloc_basemem.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* %ax : .text16 segment address
|
* none (.text16 segment address is implicit in %cs)
|
||||||
* %bx : .data16 segment address
|
|
||||||
* Returns:
|
* Returns:
|
||||||
* %ax : 0 if successfully freed
|
* %ax : 0 if successfully freed
|
||||||
* Corrupts:
|
* Corrupts:
|
||||||
|
@ -559,14 +558,14 @@ alloc_basemem:
|
||||||
free_basemem:
|
free_basemem:
|
||||||
/* Preserve registers */
|
/* Preserve registers */
|
||||||
pushw %fs
|
pushw %fs
|
||||||
|
pushw %ax
|
||||||
|
|
||||||
/* Check FBMS counter */
|
/* Check FBMS counter */
|
||||||
pushw %ax
|
movw %cs, %ax
|
||||||
shrw $6, %ax
|
shrw $6, %ax
|
||||||
pushw $0x40
|
pushw $0x40
|
||||||
popw %fs
|
popw %fs
|
||||||
cmpw %ax, %fs:0x13
|
cmpw %ax, %fs:0x13
|
||||||
popw %ax
|
|
||||||
jne 1f
|
jne 1f
|
||||||
|
|
||||||
/* Check hooked interrupt count */
|
/* Check hooked interrupt count */
|
||||||
|
@ -574,6 +573,7 @@ free_basemem:
|
||||||
jne 1f
|
jne 1f
|
||||||
|
|
||||||
/* OK to free memory */
|
/* OK to free memory */
|
||||||
|
movw %cs, %ax
|
||||||
addw $_text16_memsz_pgh, %ax
|
addw $_text16_memsz_pgh, %ax
|
||||||
addw $_data16_memsz_pgh, %ax
|
addw $_data16_memsz_pgh, %ax
|
||||||
shrw $6, %ax
|
shrw $6, %ax
|
||||||
|
@ -581,6 +581,7 @@ free_basemem:
|
||||||
xorw %ax, %ax
|
xorw %ax, %ax
|
||||||
|
|
||||||
1: /* Restore registers and return */
|
1: /* Restore registers and return */
|
||||||
|
popw %ax
|
||||||
popw %fs
|
popw %fs
|
||||||
ret
|
ret
|
||||||
.size free_basemem, . - free_basemem
|
.size free_basemem, . - free_basemem
|
||||||
|
@ -872,8 +873,7 @@ close_payload:
|
||||||
* Uninstall all text and data segments.
|
* Uninstall all text and data segments.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* %ax : .text16 segment address
|
* none (.text16 segment address is implicit in %cs)
|
||||||
* %bx : .data16 segment address
|
|
||||||
* Returns:
|
* Returns:
|
||||||
* none
|
* none
|
||||||
* Corrupts:
|
* Corrupts:
|
||||||
|
|
Loading…
Reference in New Issue