I have a question about the A20 gate. I read an article about it saying that the mechanism exists to solve problems with address "wraparound" that appeared when newer CPUs got a 32-bit address bus instead of the older 20-bit bus.
It would seem to me that the correct way to handle the wraparound would be to turn off all of bits A20-A31, and not just A20.
Why is it sufficient to only turn off bit A20 to handle the problem?
The original problem had to do with x86 memory segmentation.
Memory would be accessed using segment:offset
, where both segment
and offset
were 16-bit integers. The actual address was computed as segment*16+offset
. On a 20-bit address bus, this would naturally get truncated to the lowest 20 bits.
This truncation could present a problem when the same code was run on an address bus wider than 20 bits, since instead of the wraparound, the program could access memory past the first megabyte. While not a problem per se, this could be a backwards compatibility issue.
To work around this issue, they introduced a way to force the A20
address line to zero, thereby forcing the wraparound.
Your question is: "Why just A20
? What about A21
-A31
?"
Note that the highest location that could be addressed using the the 16-bit segment:offset
scheme was 0xffff * 16 + 0xffff = 0x10ffef
. This fits in 21 bits. Thus, the lines A21
-A31
were always zero, and it was only A20
that needed to be controlled.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With