diff options
| author | Michael Brown | 2006-08-24 15:18:05 +0200 |
|---|---|---|
| committer | Michael Brown | 2006-08-24 15:18:05 +0200 |
| commit | 6abfaa153b7b9bcdbdfc8b842ebb3ec99428d69b (patch) | |
| tree | 72f551c4156a9dd85d48099f905daccdb12a5933 /src/arch/i386/transitions/libkir.S | |
| parent | Quick utility to pad floppy disk images for vmware/qemu (diff) | |
| download | ipxe-6abfaa153b7b9bcdbdfc8b842ebb3ec99428d69b.tar.gz ipxe-6abfaa153b7b9bcdbdfc8b842ebb3ec99428d69b.tar.xz ipxe-6abfaa153b7b9bcdbdfc8b842ebb3ec99428d69b.zip | |
Towards making KEEP_IT_REAL work again.
Fix bug that caused over-allocation of .text16 and .data16 memory areas
by a factor of 16.
Diffstat (limited to 'src/arch/i386/transitions/libkir.S')
| -rw-r--r-- | src/arch/i386/transitions/libkir.S | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/src/arch/i386/transitions/libkir.S b/src/arch/i386/transitions/libkir.S index e0d6c57c2..1023ddd0b 100644 --- a/src/arch/i386/transitions/libkir.S +++ b/src/arch/i386/transitions/libkir.S @@ -35,6 +35,23 @@ .code16 /**************************************************************************** + * init_libkir (real-mode or 16:xx protected-mode far call) + * + * Initialise libkir ready for transitions to the kir environment + * + * Parameters: + * %cs : .text16 segment + * %ds : .data16 segment + **************************************************************************** + */ + .globl init_libkir +init_libkir: + /* Record segment registers */ + pushw %ds + popw %cs:kir_ds + lret + +/**************************************************************************** * ext_to_kir (real-mode or 16:xx protected-mode near call) * * Switch from external stack and segment registers to internal stack @@ -45,10 +62,6 @@ * %cs:0000 must point to the start of the runtime image code segment * on entry. * - * Note that this routine can be called *without* having first set up - * a stored kir_ds and kir_sp. If you do this, ext_to_kir will return - * without altering the segment registers or stack pointer. - * * Parameters: none **************************************************************************** */ @@ -73,10 +86,8 @@ ext_to_kir: movw %ss, %ds:ext_ss movl %esp, %ds:ext_esp - /* Load internal segment registers and stack pointer, if available */ + /* Load internal segment registers and stack pointer */ movw %ds:kir_ds, %ax - testw %ax, %ax - jz 1f movw %ax, %ss movzwl %ds:kir_sp, %esp movw %ax, %ds @@ -144,12 +155,12 @@ kir_to_ext: * will also be preserved. * * Parameters: - * function : (16-bit) virtual address of protected-mode function to call + * function : (32-bit) virtual address of C function to call * * Example usage: - * pushw $pxe_api_call + * pushl $pxe_api_call * lcall $UNDI_CS, $kir_call - * addw $2, %sp + * addw $4, %sp * to call in to the C function * void pxe_api_call ( struct i386_all_regs *ix86 ); **************************************************************************** @@ -157,7 +168,6 @@ kir_to_ext: .globl kir_call kir_call: - /* Preserve flags. Must do this before any operation that may * affect flags. */ @@ -174,8 +184,8 @@ kir_call: * either a 16-bit or a 32-bit stack segment. */ popl %cs:save_retaddr /* Scratch location */ - popw %cs:save_function - subl $6, %esp /* Restore %esp */ + popl %cs:save_function + subl $8, %esp /* Restore %esp */ /* Switch to internal stack. Note that the external stack is * inaccessible once we're running internally (since we have @@ -191,6 +201,7 @@ kir_call: pushl %cs:ext_cs_and_ss /* Push &ix86 on stack and call function */ + sti pushl %esp data32 call *%cs:save_function popl %eax /* discard */ @@ -231,13 +242,13 @@ ext_esp: .long 0 .globl kir_ds kir_ds: .word 0 .globl kir_sp -kir_sp: .word 0 +kir_sp: .word _estack /**************************************************************************** * Temporary variables **************************************************************************** */ save_ax: .word 0 -save_retaddr: .word 0 +save_retaddr: .long 0 save_flags: .long 0 save_function: .long 0 |
