Disable a20 on 16bit calls.
authorKevin O'Connor <kevin@koconnor.net>
Wed, 12 Nov 2008 03:03:55 +0000 (22:03 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Wed, 12 Nov 2008 03:03:55 +0000 (22:03 -0500)
The a20 gate is enabled when invoking 32bit mode.  Turn it off before
    returning to 16bit mode.

TODO
src/romlayout.S

diff --git a/TODO b/TODO
index 07015deb75b5c2262067439cf7f75d9ebf25a1c7..ca76fe3c369a6c6b1c59c2d7f5b6ebb27add3e9e 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,7 +1,5 @@
 Clean up timer code.  Don't use PORT_DIAG as delay mechanism.
 
-Disable a20 on jump to 16bit mode.
-
 The keyboard driver should detect ctrl+alt+del and reboot the
 machine.
 
index e9ea067052f50c5d99c3b8e47cd02217e6a6ca50..f7c2b022070598d487610bce1e584524f8dfe228 100644 (file)
@@ -181,11 +181,6 @@ transition32:
 __call16_from32:
         pushl %eax
 
-        // Jump to 16bit mode
-        ljmpw $SEG32_MODE16_CS, $1f
-
-        .code16gcc
-1:
         // restore data segment limits to 0xffff
         movw $SEG32_MODE16_DS, %ax
         movw %ax, %ds
@@ -194,6 +189,16 @@ __call16_from32:
         movw %ax, %fs
         movw %ax, %gs
 
+        // disable a20
+        inb $0x92, %al
+        andb $~0x02, %al
+        outb %al, $0x92
+
+        // Jump to 16bit mode
+        ljmpw $SEG32_MODE16_CS, $1f
+
+        .code16gcc
+1:
         // reset PE bit in CR0
         movl %cr0, %eax
         andb $0xfe, %al