Page 1 of 1

A20: after or before pmode?

Posted: Sat Oct 05, 2002 4:13 pm
by dronkit
Can i enable a20 and remap pic interrupts AFTER switching to pmode without having any problems?

Re:A20: after or before pmode?

Posted: Sat Oct 05, 2002 4:28 pm
by Warmaster199
Yes

Re:A20: after or before pmode?

Posted: Sat Oct 05, 2002 6:21 pm
by dronkit
thanks! just to make sure. i read somewhere that i could have some problems ;)

Re:A20: after or before pmode?

Posted: Sun Oct 06, 2002 7:41 am
by Chris
Yes. All the A20 does is either force a 0 asthe 21st bit in the address, or leave it be. Thus, with the A20 disabled, you can access even memory addresses (0MB-1MB; 2MB-3MB; 4MB-5MB, etc.).

In fact, you don't even need to enable the A20 (But you'll only have have the 4GB address space).

Chris

Re:A20: after or before pmode?

Posted: Sun Oct 06, 2002 2:30 pm
by Ozguxxx
In fact, you don't even need to enable the A20 (But you'll only have have the 4GB address space).
So, whats the problem?

Re:A20: after or before pmode?

Posted: Sun Oct 06, 2002 2:44 pm
by Tim
"Only the 4GB address space?" What, enabling A20 gives you access to more than 4GB of memory? ;)

Re:A20: after or before pmode?

Posted: Sun Oct 06, 2002 6:30 pm
by Warmaster199
:o - Actually, The A20 line allows access to the odd numbered MBytes in your system. This means that you cannot access MByte number 1, but 0 and 2 are accessible. Therefore with only half of the total memory accessible, only 2GBytes of RAM are addressible without using the A20 line IF you have 4GBytes of RAM. To access all 4GBytes of RAM, you would have to enable the A20 line.

Re:A20: after or before pmode?

Posted: Mon Oct 07, 2002 12:17 am
by Pype.Clicker
gee. that A20 stuff is definitely the oddest stuff in my PC !!

Re:A20: after or before pmode?

Posted: Mon Oct 07, 2002 7:01 am
by dronkit
is there a way to check if a20 is on from inside bochs?

Re:A20: after or before pmode?

Posted: Tue Oct 08, 2002 6:43 am
by Pype.Clicker
something that can be tested from anywhere is to check wether 00000000 and 00100000 are identical or not (if you're still in real mode, use 0xffff:0010 to access 00100000 :) )

cli
mov gs,ZERO_BASED_DATA_SEGMENT
mov eax,[gs:00100000]
mov ebx,[gs:00000000]
cmp eax, ebx
jne A20_Enabled
mov [gs:00100000],12345678
cmp [gs:00000000],12345678
jne A20_Enabled
mov [gs:000000],eax
mov eax,DISABLED
sti
ret

A20_ENABLED:
mov [gs:000000],eax
mov eax,ENABLED
sti
ret

Re:A20: after or before pmode?

Posted: Tue Oct 08, 2002 7:20 am
by dronkit
great. thanks, i'll do that.
anyway, i'd still like to know if something like this is available directly from bochs ;)

just curious...

Re:A20: after or before pmode?

Posted: Tue Oct 08, 2002 5:29 pm
by Chris
Heh...I ment only on my previous post.

The reason for the A20 when they "broke" the 1MB limit, they found out that alot of software didn't work. It turns out that alot of system software relied on the fact that the processor would "wrap-around" at the 1MB limit. Thus, they needed a way to turn off and on this wrap-around quirk.