diff options
author | Michael Brown | 2010-04-20 20:20:26 +0200 |
---|---|---|
committer | Michael Brown | 2010-04-20 22:00:49 +0200 |
commit | 38cd2035ff56307284676d3d10cb77821ae3386a (patch) | |
tree | 1b39266a7bf7bc3161f0c6736d7e4c95d6615329 /src/arch/i386/transitions/librm.S | |
parent | [prefix] Add A20-enabling code in libflat (diff) | |
download | ipxe-38cd2035ff56307284676d3d10cb77821ae3386a.tar.gz ipxe-38cd2035ff56307284676d3d10cb77821ae3386a.tar.xz ipxe-38cd2035ff56307284676d3d10cb77821ae3386a.zip |
[librm] Use libflat to enable A20 line on each real-to-protected transition
Use the shared code in libflat to perform the A20 transitions
automatically on each transition from real to protected mode. This
allows us to remove all explicit calls to gateA20_set().
The old warnings about avoiding automatically enabling A20 are
essentially redundant; they date back to the time when we would always
start hammering the keyboard controller without first checking to see
if gate A20 was already enabled (which it almost always is).
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/i386/transitions/librm.S')
-rw-r--r-- | src/arch/i386/transitions/librm.S | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/arch/i386/transitions/librm.S b/src/arch/i386/transitions/librm.S index a07ffc50..5eb82b44 100644 --- a/src/arch/i386/transitions/librm.S +++ b/src/arch/i386/transitions/librm.S @@ -170,10 +170,18 @@ idt_init: /* Reuse the return opcode here */ .section ".text16", "ax", @progbits .code16 real_to_prot: + /* Enable A20 line */ + call enable_a20 + /* A failure at this point is fatal, and there's nothing we + * can do about it other than lock the machine to make the + * problem immediately visible. + */ +1: jc 1b + /* Make sure we have our data segment available */ movw %cs:rm_ds, %ax movw %ax, %ds - + /* Add _virt_offset, _text16 and _data16 to stack to be * copied, and also copy the return address. */ @@ -181,7 +189,7 @@ real_to_prot: pushl _text16 pushl _data16 addw $16, %cx /* %ecx must be less than 64kB anyway */ - + /* Real-mode %ss:%sp => %ebp:%edx and virtual address => %esi */ xorl %ebp, %ebp movw %ss, %bp @@ -396,9 +404,6 @@ prot_call: .section ".text", "ax", @progbits .code32 1: - /* Set up environment expected by C code */ - call gateA20_set - /* Call function */ leal PC_OFFSET_IX86(%esp), %eax pushl %eax @@ -442,13 +447,7 @@ prot_call: * function will be passed back to the protected-mode caller. A * result of this is that this routine cannot be called directly from * C code, since it clobbers registers that the C ABI expects the - * callee to preserve. Gate A20 will *not* be automatically - * re-enabled. Since we always run from an even megabyte of memory, - * we are guaranteed to return successfully to the protected-mode - * code, which should then call gateA20_set() if it suspects that gate - * A20 may have been disabled. Note that enabling gate A20 is a - * potentially slow operation that may also cause keyboard input to be - * lost; this is why it is not done automatically. + * callee to preserve. * * librm.h defines a convenient macro REAL_CODE() for using real_call. * See librm.h and realmode.h for details and examples. |