[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Gate A20
Re: Gate A20
Tue, 07 May 2002 12:08:11 -0700
"Yoshinori K. Okuji" <address@hidden> wrote:
> About Gate A20.
> GRUB supports only the traditional approach (i.e. using the keyboard
> controller) to enable/disable Gate A20 at the moment. This is not
> In his case, it was difficult to figure out that his problem was
> related to Gate A20. I and he investigated it privately, and it turned
> out that enabling Gate A20 via the keyboard controller made his USB
> keyboard unworkable, but doing that via System Control Port A worked
> quite well. I guess that's because the BIOS keyboard support somewhat
> relies on the status of the keyboard contoller output port.
In my investigation into the details of how exactly the keyboard
controller (AT or PS/2 keyboard + mouse) works, it has become clear
that my original Gate A20 routine I had stolen was broken in 3-4 ways:
1) It didn't mask the interrupt(s) in the 8259 interrupt controller,
so it had weird/bad interactions with the BIOS. Using cli/sti
could still leave a latched interrupt afterward that could
hang the keyboard or even crash the BIOS in some weird
2) If keys were being pressed on the keyboard when it was called,
there was a tiny race condition.
3) It ate any characters in the buffer.
(possibly #4) It unconditionally overwrites an internal state
variable of the keyboard controller. This may not be a
problem, but my paranoia suggests I fix it too.
I am working on a fix for all of the above. The test fix I sent to
Daniel to look at his USB problem includes #'s 1 & 2.
The point being: Done right, the BIOS should simply be unaware
anything happened (i.e. there should be no side effects of putting
it back to the same state as before but with the A20 line enabled).
I think SYSLINUX and others very possibly are (imperfectly) working
around a bad A20 enable/disable routine, and I very much doubt that
Windows does anything else other than use the keyboard controller
unless it's recent support for "non-legacy" PCs and then only if
it can't find a keyboard controller.
Erich Stefan Boleyn <address@hidden> http://www.uruk.org/
"Reality is truly stranger than fiction; Probably why fiction is so popular"
- Gate A20, Yoshinori K. Okuji, 2002/05/02