2
0
mirror of https://github.com/xcat2/xNBA.git synced 2024-12-14 15:21:32 +00:00

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).
This commit is contained in:
Michael Brown 2007-07-19 15:54:33 +01:00
parent a8111e8ab7
commit 2cfe0dee1f

View File

@ -277,7 +277,7 @@ gdt_end:
* Sets limits on the data segments %ds and %es.
*
* 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
/* Set flat segment limits */
movw %cx, %ds
movw %cx, %es
movw %dx, %ds
movw %dx, %es
/* Switch back to real mode */
movl %cr0, %eax
@ -355,6 +355,7 @@ install:
install_prealloc:
/* Save registers */
pushl %esi
pushw %dx
/* Install .text16 and .data16 */
movl $_payload_offset, %esi
call install_basemem
@ -385,7 +386,7 @@ install_prealloc:
* prior to reading the E820 memory map and relocating
* properly.
*/
movw $FLAT_DS, %cx
movw $FLAT_DS, %dx
call set_real_mode_limits
movl $HIGHMEM_LOADPOINT, %edi
call install_highmem
@ -400,7 +401,7 @@ install_prealloc:
addw $4, %sp
/* Move code to new location, set up new protected-mode GDT */
movw $FLAT_DS, %cx
movw $FLAT_DS, %dx
call set_real_mode_limits
pushl %edi
es rep addr32 movsb
@ -408,7 +409,7 @@ install_prealloc:
lcall *init_librm_vector
/* Restore real-mode segment limits */
movw $REAL_DS, %cx
movw $REAL_DS, %dx
call set_real_mode_limits
/* Restore registers and interrupt status */
@ -417,6 +418,7 @@ install_prealloc:
popw %ds
popfw
#endif
popw %dx
popl %esi
ret
.size install_prealloc, . - install_prealloc