Chris Giese wrote:
A20 isn't being pulsed, it's being enabled
The comments above that code seem to agree with what you're saying. What's confusing me is that the code doesn't seem to agree with the comments... In order to enable A20, isn't it necessary to actually write to the output register (command 0xD1 IIRC)? I thought command 0xFx (which is what KB_PULSE_OUTPUT is) was specifically for pulsing those signals for 6 usecs or so... Does the A20 gate behave differently for some reason? Is it "sticky" or something...?
See Curufir's observation about this code only running in protected mode... That makes me scratch my head too.
I've stared at the comment a few more times, and here are the parts that are giving me trouble:
and because some machines appear to drive the fake A20 high instead of low just after reset, leading to an illegal opode trap.
Just so it's crystal clear, this means that the A20 gate is active-low, right? As in, low = enabled, high = disabled? Also, what do you think it means by the "fake A20"? I'm aware of the A20 line and the A20 gate... Does "fake" A20 refer to one of these, or something else entirely?
leading to an illegal opode trap.
I assume this is what the author observed, but more generally it's the result of executing garbage at 0xFFEFFFF0...
This bug is more of a problem if the fake A20 is in use, as it would be if the keyboard reset were used for real mode.
Something else that suggests that this is really only a problem when in real mode.... I get the feeling this is redundant if the A20 gate is already enabled, but I can't be sure. I can't figure out how to parse "fake A20 is in use"... "A20 gate is disabled" maybe?
I also found a very interesting comment in the Linux kernel source that makes me wonder if they ran into some variant of this problem. From the 2.6.10 version of Linux/arch/i386/kernel/reboot.c, line 148:
The following code and data reboots the machine by switching to real mode and jumping to the BIOS reset entry point, as if the CPU has really been reset. The previous version asked the keyboard controller to pulse the CPU reset line, which is more thorough, but doesn't work with at least one type of 486 motherboard.