david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

Setup now calls initialise() directly, rather than expecting the

prefix to do it.
This commit is contained in:
Michael Brown 2005-04-10 16:46:46 +00:00
parent 44e62317be
commit 04682f9838
1 changed files with 24 additions and 16 deletions

View File

@ -84,8 +84,9 @@ setup:
#endif /* CODE16 */ #endif /* CODE16 */
/* Preserve flags (including interrupt status) */ /* Preserve flags (including interrupt status) and registers */
pushfl pushfl
pushl %ebp
/* Switch to (uninitialised) internal environment. This will /* Switch to (uninitialised) internal environment. This will
* preserve the external environment for when we call * preserve the external environment for when we call
@ -100,15 +101,13 @@ setup:
* after the code segment. * after the code segment.
*/ */
pushw %ax pushw %ax
pushw %bx
movw %cs, %ax movw %cs, %ax
movw %ds, %bx movw %ds, %bp
cmpw %ax, %bx cmpw %ax, %bp
jne 1f jne 1f
addw $_text_load_size_pgh, %ax addw $_text_load_size_pgh, %ax
movw %ax, %ds movw %ax, %ds
1: popw %bx 1: popw %ax
popw %ax
/* Switch to internal stack */ /* Switch to internal stack */
pushw %ds pushw %ds
@ -117,11 +116,11 @@ setup:
#else /* CODE16 && KEEP_IT_REAL */ #else /* CODE16 && KEEP_IT_REAL */
/* Work out where we're running */ /* Work out where we're running and switch to internal pmode
* stack
*/
call 1f call 1f
1: popl %ebp 1: popl %ebp
/* Switch to internal pmode stack */
leal (_estack-1b)(%ebp), %esp leal (_estack-1b)(%ebp), %esp
/* Set up GDT for virtual addressing */ /* Set up GDT for virtual addressing */
@ -134,17 +133,26 @@ setup:
*/ */
RETURN_TO_EXTERNAL RETURN_TO_EXTERNAL
/* Pass pointer to entry-point function back to prefix. %es /* Set %es:[e]di to point to entry-point function.
* may, by now, have been destroyed, so we re-initialise it
* from %cs.
*/ */
pushw %cs push %cs
popw %es pop %es
mov $ENTRY_POINT, %ENTRY_POINT_REGISTER mov $ENTRY_POINT, %ENTRY_POINT_REGISTER
/* Far call to arch_initialise via the entry-point function.
* arch_initialise() (or the entry-point function itself) may
* update %es:[e]di to point to a new entry-point function for
* subsequent calls. librm will use this facility, since
* arch_initialise() causes librm to be relocated.
*/
pushl $arch_initialise
push %cs /* lcall %es:[x]di == %cs:[x]di */
call *%ENTRY_POINT_REGISTER
popl %ebp /* discard */
/* Restore flags (including interrupt status) */ /* Restore flags (including interrupt status) and return */
popl %ebp
popfl popfl
lret lret
/**************************************************************************** /****************************************************************************