A20

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Ryu

A20

Post by Ryu »

Okay, after a day of hair pulling, usual coffee slurping, and debugging the unbugged, I realised that somehow in protected mode I was getting address wrap around effects, and at the time it never occurred to me that this was the A20, which I thought entering 32bit protected mode would enable this line automatically. So for you people who don't know, I hope to save you that whole day of utterly nonsense I went through. >:(

I am wondering now, should the BIOS INT 15, AX=2401 be sufficient (pentiums and up) or should I have this long messy code of trying to enable A20 line using keyboard controller and etc.
paulbarker

Re:A20

Post by paulbarker »

In theory the BIOS function should be sufficient, but A20 gates are generally a nightmare. I would try about 4 of the most common methods (starting with the BIOS call) in a loop of 3 re-tries. If this fails, I would print a message to the screen and give up.

An alternative approach is to just do the BIOS call, comment the code well and test the A20 gate once it has been (in theory) set. If any user tells you about problems, then add alternative methods.
blip

Re:A20

Post by blip »

I implemented most if not everything from here. On my testbed laptop I found that if there are multiple sources, they are ORed together and the result is then ANDed with A20. Later confirmed this behavior with a document I read. Funny thing since after a warm boot HIMEM found it couldn't disable A20 because it didn't try every source. It's not that bad to implement really since you only have to write the code once.
Ryu

Re:A20

Post by Ryu »

Okay I guess its not a good time to take the easy way out, I'll use that page as a guide. Thanks for your replies.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re:A20

Post by Brendan »

Hi,

You might find my "enable A20" code useful:

http://bcos.hopto.org/latest/sys/i386/b ... tea20.html

It's "well commented", and works on everything I've tried it on...


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Ryu

Re:A20

Post by Ryu »

Ah thanks Brendan, I was using yours last night which summed it up quite nicely. I've also found out that, on my machine and its fairly not that old does not support the BIOS service to enable A20 line, which I found that really odd, so these steps are pretty necessary.
crackers

Re:A20

Post by crackers »

Since we're on this topic... about one or two months ago I was fighting with A20 and go to conclusion that A20 is sometimes enabled. For example on Bochs it's enabled, but on VMware it's not. I've checked it on my real computer (AMD) and was little schocked because A20 was enabled. My guess is that some BIOSes enable it before calling bootloader and some not.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:A20

Post by Pype.Clicker »

crackers wrote: My guess is that some BIOSes enable it before calling bootloader and some not.
Exactly. Some even have an option in the BIOS control menu saying "Enable A20 Gate ?"
mystran

Re:A20

Post by mystran »

Some of them might also have some other option that essentially does the same but is named something more "userfriendly".
Post Reply