From 1a72e2e8195396bc58f50f2df375c2526a48c355 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Tue, 11 Nov 2008 22:03:55 -0500 Subject: [PATCH] Disable a20 on 16bit calls. The a20 gate is enabled when invoking 32bit mode. Turn it off before returning to 16bit mode. --- TODO | 2 -- src/romlayout.S | 15 ++++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/TODO b/TODO index 07015de..ca76fe3 100644 --- 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. diff --git a/src/romlayout.S b/src/romlayout.S index e9ea067..f7c2b02 100644 --- a/src/romlayout.S +++ b/src/romlayout.S @@ -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 -- 2.25.1