a20 required?

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
User avatar
os64dev
Member
Member
Posts: 553
Joined: Sat Jan 27, 2007 3:21 pm
Location: Best, Netherlands

a20 required?

Post by os64dev »

I am wondering if it is required to enable the a20 address line when switching to long mode, i have tested with the a20 address line disabled and it seems to work but i am not sure it will work on all the x64 architectures. Anybody know for sure?

My OS bootsector loads the bootloader and switches from realmode to longmode(64-bit) without switching to protected mode first. The boot loader will be executing below the 1 MiB, so it does not require the a20 to be set, preparing the PC for the kernel and enabling the a20 address line so the kernel can use the memory above 1 MiB and clear the memory below 1 MiB.
Author of COBOS
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Post by Dex »

I have also entered long mode, on differant 64bit PC, without enabling A20 line, without a problem, these have only been simple "hello world" test progs to test going to long mode.
Tyler
Member
Member
Posts: 514
Joined: Tue Nov 07, 2006 7:37 am
Location: York, England

Post by Tyler »

I am pretty sure (please check though) that i saw somewhere that all EM64T intels have the A20 Mask disabled by default. It may have been an intel chipset thing though so anyway i would still check to be sure.
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Post by Brendan »

Hi,
Tyler wrote:I am pretty sure (please check though) that i saw somewhere that all EM64T intels have the A20 Mask disabled by default. It may have been an intel chipset thing though so anyway i would still check to be sure.
I would expect this depends on the BIOS rather than the chipset - just because the chipset disables A20 mask by default doesn't mean the BIOS leaves it disabled (and if the chipset enables the A20 mask by default the BIOS could disable it).

As for the original question, I have no idea - my real mode boot code is generic (same code used for all 80486 and later CPUs regardless of which kernel will be used) and always checks if A20 is enabled or not and tries to enable A20 if it's not already. This is relatively easy to do, even if the OS is 64-bit only.


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.
User avatar
os64dev
Member
Member
Posts: 553
Joined: Sat Jan 27, 2007 3:21 pm
Location: Best, Netherlands

Post by os64dev »

Brendan wrote:As for the original question, I have no idea - my real mode boot code is generic (same code used for all 80486 and later CPUs regardless of which kernel will be used) and always checks if A20 is enabled or not and tries to enable A20 if it's not already. This is relatively easy to do, even if the OS is 64-bit only.
I have already written the a20 enabler, which tries 5 different methods and after each try checks whether the a20 was successfully enabled or not. I was curious if it was really needed at such an early stage, if i can remove it then my bootsector needs only 512 bytes instead of 1024. If i enable the a20 when in 64-bit then i only have 4 methods (BIOS is not available) and i can write it in C/C++ which for me is a plus :D
Author of COBOS
Post Reply