A20: after or before pmode?

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
dronkit

A20: after or before pmode?

Post by dronkit »

Can i enable a20 and remap pic interrupts AFTER switching to pmode without having any problems?
Warmaster199

Re:A20: after or before pmode?

Post by Warmaster199 »

Yes
dronkit

Re:A20: after or before pmode?

Post by dronkit »

thanks! just to make sure. i read somewhere that i could have some problems ;)
Chris

Re:A20: after or before pmode?

Post 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
Ozguxxx

Re:A20: after or before pmode?

Post 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?
Tim

Re:A20: after or before pmode?

Post by Tim »

"Only the 4GB address space?" What, enabling A20 gives you access to more than 4GB of memory? ;)
Warmaster199

Re:A20: after or before pmode?

Post 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.
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: after or before pmode?

Post by Pype.Clicker »

gee. that A20 stuff is definitely the oddest stuff in my PC !!
dronkit

Re:A20: after or before pmode?

Post by dronkit »

is there a way to check if a20 is on from inside bochs?
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: after or before pmode?

Post 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
dronkit

Re:A20: after or before pmode?

Post 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...
Chris

Re:A20: after or before pmode?

Post 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.
Post Reply