Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!zephyr.ens.tek.com!gvgpsa!gold.gvg.tek.com!grege From: grege@gold.gvg.tek.com (Greg Ebert) Newsgroups: comp.sys.ibm.pc.hardware Subject: GATEA20, RESTART, and related nightmares (1/3) Message-ID: <1832@gold.gvg.tek.com> Date: 4 Jan 91 21:34:43 GMT Organization: Grass Valley Group, Grass Valley, CA Lines: 61 I have received a lot of inquiries about the GATEA20 function in AT's, so I guess there's enough interest for a posting. What the *&%^&@#$ are GATEA20 and restart ? ------------------------------------------- Lets go back to the days of the PC. It had an 8088 which could directly handle up to 1Megabyte of memory. Wherever there is a computer, there is an idiot who thinks he is a programmer. Microsoft is no exception. A version of BASIC, EXE2BIN, and possibly other programs, were written which *require* the 'wrap-around' in the address space. For example, in the 8088, you can keep incrementing an address counter up towards 1 megabyte, and it WILL wrap-around to address 0, then 1, 2, 3, etc. Idiot programmers use features like this (as well as timing loops and self-modifying code). Along comes the 80286. Well, a "feature" in the 8086 Real mode did *NOT* do the 'wrap-around' properly, so the above-mentioned programs bombed. It was determined that only address line 20 (called A20) was the culprit. My 80286 data book vaguely mentions that "A20 through A23 should be ignored in 8086 Real mode". So, instead of fixing (1) the software bugs, and (2), the 80286, an AND gate was placed on A20. The other leg of the AND gate is controlled by a signal called GATEA20. It should be intuitively obvious that this signal should originate from the keyboard controller [sarcasm]. The way it worked was that unless you 'turn-on' GATEA20, the addresses that the system and memory actually 'see' will indeed wrap just as they do in a PC or PC/XT. But, if you turn GATEA20 'on', you can use all that memory up to 16MB. Oh, but that's not all !! The 80286 has this wonderful mode called 'Protected Mode' which gives you its virual memory, etc whiz-bang features. A very good name, I might add, because once you're in, you can't get out !!! So, another function named RESTART was created. What this did was yank the RESET line to the CPU for a short time to reset the processor. This is *not*, I repeat, *NOT* what CTRL+ALT+DELETE does. I will repeat it again !! CTRL+ALT+DELETE does *NOT* issue a reset to the CPU. A flag-bit in (you guessed it) the keyboard controller tells BIOS if the reset came from a power-up or a RESTART. Obviously you wouldn't want to run all of those power-on self-test (POST) routines each time you did a mode switch. Well, our poor keyboard controller has a lot to do: It has to talk to the keyboard, handle GATEA20/RESTART, keep a 'boot flag' to see where reset came from, and possibly control a mouse. Oy veh ! This keyboard controller is actually a single-chip computer with it's own software (Intel 8742 to be exact). - - - - - - - Stay tuned for the next episode: What is fast GATEA20/RESTART and when/why do I need it. ----- Boycott redwood products ---------------------------- Recycle ----- "Thou shalt abide by The GNU Manifesto" ##### {uunet!tektronix!gold!grege} Register to vote, then ## | ## grege@gold.gvg.tek.com vote responsibly # | # # /|\ # Support high oil prices, waste tax $$ on war, evade domestic #/ | \# problems, and die young on foreign soil- Just say YES to Bush #######