mirror of https://github.com/ipxe/ipxe.git
Don't trash the %ecx value returned by relocate(). This was causing
us to round down the size for the relocation copy to the nearest 64kB (+0x10 bytes); this just happened to work on most machines because the last 64kB of the image is all-zeroes anyway (it's the .bss).pull/1/head
parent
a8111e8ab7
commit
2cfe0dee1f
|
@ -277,7 +277,7 @@ gdt_end:
|
||||||
* Sets limits on the data segments %ds and %es.
|
* Sets limits on the data segments %ds and %es.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* %cx : segment type (FLAT_DS for 4GB or REAL_DS for 64kB)
|
* %dx : segment type (FLAT_DS for 4GB or REAL_DS for 64kB)
|
||||||
****************************************************************************
|
****************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -309,8 +309,8 @@ set_real_mode_limits:
|
||||||
movl %eax, %cr0
|
movl %eax, %cr0
|
||||||
|
|
||||||
/* Set flat segment limits */
|
/* Set flat segment limits */
|
||||||
movw %cx, %ds
|
movw %dx, %ds
|
||||||
movw %cx, %es
|
movw %dx, %es
|
||||||
|
|
||||||
/* Switch back to real mode */
|
/* Switch back to real mode */
|
||||||
movl %cr0, %eax
|
movl %cr0, %eax
|
||||||
|
@ -355,6 +355,7 @@ install:
|
||||||
install_prealloc:
|
install_prealloc:
|
||||||
/* Save registers */
|
/* Save registers */
|
||||||
pushl %esi
|
pushl %esi
|
||||||
|
pushw %dx
|
||||||
/* Install .text16 and .data16 */
|
/* Install .text16 and .data16 */
|
||||||
movl $_payload_offset, %esi
|
movl $_payload_offset, %esi
|
||||||
call install_basemem
|
call install_basemem
|
||||||
|
@ -385,7 +386,7 @@ install_prealloc:
|
||||||
* prior to reading the E820 memory map and relocating
|
* prior to reading the E820 memory map and relocating
|
||||||
* properly.
|
* properly.
|
||||||
*/
|
*/
|
||||||
movw $FLAT_DS, %cx
|
movw $FLAT_DS, %dx
|
||||||
call set_real_mode_limits
|
call set_real_mode_limits
|
||||||
movl $HIGHMEM_LOADPOINT, %edi
|
movl $HIGHMEM_LOADPOINT, %edi
|
||||||
call install_highmem
|
call install_highmem
|
||||||
|
@ -400,7 +401,7 @@ install_prealloc:
|
||||||
addw $4, %sp
|
addw $4, %sp
|
||||||
|
|
||||||
/* Move code to new location, set up new protected-mode GDT */
|
/* Move code to new location, set up new protected-mode GDT */
|
||||||
movw $FLAT_DS, %cx
|
movw $FLAT_DS, %dx
|
||||||
call set_real_mode_limits
|
call set_real_mode_limits
|
||||||
pushl %edi
|
pushl %edi
|
||||||
es rep addr32 movsb
|
es rep addr32 movsb
|
||||||
|
@ -408,7 +409,7 @@ install_prealloc:
|
||||||
lcall *init_librm_vector
|
lcall *init_librm_vector
|
||||||
|
|
||||||
/* Restore real-mode segment limits */
|
/* Restore real-mode segment limits */
|
||||||
movw $REAL_DS, %cx
|
movw $REAL_DS, %dx
|
||||||
call set_real_mode_limits
|
call set_real_mode_limits
|
||||||
|
|
||||||
/* Restore registers and interrupt status */
|
/* Restore registers and interrupt status */
|
||||||
|
@ -417,6 +418,7 @@ install_prealloc:
|
||||||
popw %ds
|
popw %ds
|
||||||
popfw
|
popfw
|
||||||
#endif
|
#endif
|
||||||
|
popw %dx
|
||||||
popl %esi
|
popl %esi
|
||||||
ret
|
ret
|
||||||
.size install_prealloc, . - install_prealloc
|
.size install_prealloc, . - install_prealloc
|
||||||
|
|
Loading…
Reference in New Issue