*BSD News Article 4064


Return to BSD News archive

From: uhclem@nemesis.UUCP
Date: 23 Aug 92 15:59 CDT
Newsgroups: comp.unix.bsd
Subject: Re: Orphaned Response
Message-ID: <-13547391@nemesis>
Path: sserve!manuel!munnari.oz.au!uunet!seas.smu.edu!utacfd.uta.edu!trsvax!trsvax!nemesis!uhclem
Nf-ID: #R:hilly:713629934:nemesis:-13547391:000:2533
Nf-From: nemesis.UUCP!uhclem    Aug 23 15:59:00 1992
References: <713629934@hilly>
Lines: 52


<>
[0]I took the kbdreset() function from i386/stand/kbd.c and replaced the
[0]code that resets the keyboard in pccons.c (pcprobe() ?), and all
[0]is now OK. The extra lines to "defeat gate a20" (will someone *please*
[0]explain what A20 is ?) seem to make the differnce.

Quick summary: The A20 gate is a mechanism IBM put in the original AT to
	       let the AT 286 "look" like an older PC or PC/XT.

The problem is that if you are on a 286 in non-protected mode and
the CPU generates an address like 0xFFFF:0xFFC0, what physical memory
location do you expect to get?

On a 8088/8086, you get the address 0x0FFBF, in the first 64K of RAM.
On a 286, 386 or 486, you get the address 0x10FFBF, which is over 1 Meg.
The 286, 386 and 486 can all address 1Meg + 65520 bytes without going
into protected mode.  Above that address, protected mode must be used to
access memory.  (Expanded banked memory excluded.)

FYI, these extra 65520 bytes are called HMA in most DOS-related books.
Because the processor can access this area directly, you can put DOS
code up there and it can run in-place, as opposed to Extended or Expanded
memory that must be banked and have other weirdness done.  This is how
DOS 5 loads stuff "high".

The A20 gate disables the A20 address line, forcing it to zero.
When running in unprotected mode on a 286, 386, or 486 PC/AT clone,
turning off A20 makes the memory model look exactly like it would if
you had an 8088 or 8086 or a PC/XT system that didn't have an A20 address
line.  You can only address memory from 0x0000 to 0xFFFFF.  If the CPU
generates an address above the 1 Meg mark, it can't assert A20 so the
address that is passed to memory is wrapped to under 1 Meg.

The A20 gate allows some old CPM-86 software and possibly other apps to
run on the newer processors, because some of these products rely on the
address space wrapping back to zero at the one-meg mark.

For any protected-mode environment (yes, even Windows), the A20 line should
be enabled (whatever address the CPU puts out goes out) at all times so that
memory above 1 Meg can be accessed.

On true PC/AT compatibles, the A20 gate only affects CPU addresses, and
DMA addresses are not affected.  I *have* seen a machine where this wasn't
the case.

Frank Durda IV <uhclem@nemesis.lonestar.org>|"The Knights who say "LETNi"
....utacfd!nemesis!uhclem (nearest internet) | demand...  A SEGMENT REGISTER!!!"
....letni!rwsys!nemesis!uhclem	            |"A what?"
....decvax!microsoft!trsvax!nemesis!uhclem   |"LETNi! LETNi! LETNi!"  - 1983