Page 1 of 1
A20 Line
Posted: Sat Feb 14, 2004 12:00 am
by joe
Can somone tell me what he A20 Line is all about, and if it would wise to enale it through my bootloader or kernel? and if so what advatages does enabling the A20 Line have?
peace out...
RE: A20 Line
Posted: Sat Feb 14, 2004 12:00 am
by Adek336
Each memory address can be written as binary, fe.
0x101 == 0b1_0000_0001
0x10_0000 (1Mb) == 0b1_0000_0000_0000_0000_0000
0x110_0000 (17 Mb) == 0xb1_0001_0000_0000_0000_0000_0000
As you see, both the 17Mb and the 1Mb addresses have the 20th bit set (if you want, count
). Indeed all addresses with an odd number of megabytes, like 1Mb 200Kb, 3Mb 1023 Kb etc. Do have the 20th bit set.
Now because of compatibility reasons, the 20th bit is ignored when accessing that memory. So 3Mb 200 kb becomes 2Mb 200kb, etc.
You have to enable it, if you want to access memory above 1Mb. I think you should do it in the bootloader, there is a fine way by dummy writing some port (not sure which, google for "A20 enable code snippet"). The keyboard method is also good but I suppose all newer computers will support the new method.
Or, use GRUB.
Cheers,
Adrian.
RE: A20 Line
Posted: Sat Feb 14, 2004 12:00 am
by Adek336
gosh, forgot to mention, the 20th bit is ignored when the A20 gate is disabled. But many BIOSes enable it on startup; though it is a good practice to have a snippet enabling it anyways.
Cheers,
Adrian.
RE: A20 Line
Posted: Sat Feb 14, 2004 12:00 am
by Karig
J. Andrew McLaughlin wrote a routine to set the A20 line that he says "seems to work more reliably than other examples I've tried." Find it at:
http://visopsys.org/osdev/sources/enableA20.s
This code is rather long, so if you want something quick and dirty, and SHORT, you might try this (though I can't promise it'll always work -- make sure you have interrupts turned off before running it!):
mov al, 0xD1
out 0x64, al
mov al, 0x03
out 0x60, al
http://www.karig.net/0003.html
RE: A20 Line
Posted: Wed Feb 18, 2004 12:00 am
by bubach
Just a little note:
The A20 is the 21th bit! We start counting on 0.
RE: A20 Line
Posted: Mon Feb 23, 2004 12:00 am
by neil
Also note that multiboot compliant boot loaders must initialize the A20 gate. (
http://www.gnu.org/software/grub/multiboot)