Re: That horrible hack from hell called A20

Linus Torvalds
2000-12-06T02:09:03Z

On Tue, 5 Dec 2000, H. Peter Anvin wrote:
>
> I might hack on using INT 15h to do the jump to protected mode, as ugly
> as it is, but I won't have time before my trip. It would require quite a
> bit of restructuring in setup.S, and would probably break LOADLIN.

Right now this is my interim patch (to clean test11). The thing to note is
that I decreased the keyboard controller timeout by a factor of about 167,
while making the "delay" a bit longer.

Now, if you don't have a keyboard controller, the bootup delay should be
on the order of 1.2 seconds or so (calling empty_8042 three times, each
around 0.4 seconds to time out). Which is acceptable. Especially as the
non-keyboard-controller machines that don't even emulate one are quite
rare. And it's still long enough that if the keyboard controller hasn't
emptied in 0.4 seconds, something else is badly wrong.

The non-keyboard-controller timeout used to be around three minutes
before. Which _definitely_ is excessive. Most people would assume that the
machine had hung.

Linus

----
--- v2.4.0-test11/linux/arch/i386/boot/setup.S Tue Oct 31 12:42:26 2000
+++ linux/arch/i386/boot/setup.S Tue Dec 5 17:31:53 2000
@@ -825,10 +825,18 @@
#
# Some machines have delusions that the keyboard buffer is always full
# with no keyboard attached...
+#
+# If there is no keyboard controller, we will usually get 0xff
+# to all the reads. With each IO taking a microsecond and
+# a timeout of 100,000 iterations, this can take about half a
+# second ("delay" == outb to port 0x80). That should be ok,
+# and should also be plenty of time for a real keyboard controller
+# to empty.
+#

empty_8042:
pushl %ecx
- movl $0x00FFFFFF, %ecx
+ movl $100000, %ecx

empty_8042_loop:
decl %ecx
@@ -867,7 +875,7 @@

# Delay is needed after doing I/O
delay:
- jmp .+2 # jmp $+2
+ outb %al,$0x80
ret

# Descriptor tables