Why does the A20 address line need to be enabled when the real mode is switched to the protection mode (compatibility issues caused by system upgrades)

Source: Internet
Author: User

Why does the A20 address line need to be enabled when the real mode is switched to the protection mode (compatibility issues caused by system upgrades)

[-1] preface:

Complementary: Compatibility refers to the CPU running in the early stage. For example, a program running on 8086/8088 can also run on a later processor, such as 80286;

[0] Look at the development history of intel processors

The system does not think that its access is out of bounds and generates an exception. Instead, the system automatically starts computing from 0. That is to say, when the system calculates the actual address, it performs the calculation based on the 1 m model, this technology is called wrap-around.

[2] addressing and problems of 80286

2.0) addressing:By 80286, the address bus of the system has grown to 24, so that the accessible memory can reach 2 ^ 24 = 16 M. Intel's goal in designing 80286 is that in real mode, the behavior of the system should be exactly the same as that of 8086/8088. That is to say, in real mode, 80286 and subsequent series should be fully compatible with 8086/8088;

2.1) Problem:If a programmer accesses the memory between 100000H-10FFEFH, 80286 will actually access this memory, instead of starting from 0 again as in the past, because 80286 has this addressing capability, however, this does not meet the system compatibility of 8086/8088, because 8086/8088 cannot access the real address of the memory between 100000H-10FFEFH, but is based on the memory addressing method for 1 m modulo;

[3] talking about the compatibility between 80286 and 8086/8088: (in real mode, 80286 of the system performance must be consistent with 8086/8088)

3.1) When A20 is disabled:The programmer gives H ~ The addresses of 10 ffefh are the same as those of 80286 and 8086/8088, that is, addressing is performed based on 1 m modulo to meet the compatibility problem of system upgrade;

3.2) When A20 is Enabled:H ~ given by programmers ~ In the 10FFEFH, 80286 is the actual address for access, while 8086/8088 is always calculated based on the 1 m model (note here, it is always );

[4] solution:

To solve the problem above, IBM uses some of the remaining output lines on the keyboard controller to manage 21st IP lines (starting from 0 to 20th), known as A20Gate: If A20 Gate is opened, when the programmer gives an address between 100000H-10FFEFH, the system will actually access this memory area. If A20Gate is disabled, when the programmer gives an address between 100000H-10FFEFH and, the system still uses 8086/8088.

[5] Real-time mode + protection mode debut (dry goods)

5.1) Real mode:The real mode means that, in order to realize system upgrade compatibility, such as 80286 of the system performance (including CPU after 80286) must be consistent with 8086/8088 of the system performance, when 80286 CPU is required to access the address between 100000H-10FFEFH, perform the modulo operation for 1 M. Whether the A20 address line is enabled or disabled, the memory access is called the real mode;

5.2) protection mode:The protection mode is that, on the premise that the A20 address line is enabled, when 80286 CPUs access addresses between 100000H-10FFEFH, it is to access the real memory address, not to evaluate the mode access, such as access to 100001 H, it is a protection mode that truly accesses 0x100001 H instead of the 0x000001 H address of the modulo;

5.3) Birthdate:The actual mode exists from 8088/8086, And the protection mode exists from 80286;

[6] Why do we need a protection mode? (Because the real mode is born with 8088/8086 falling from the sky, it is only a way to access the memory; and for 8086/8088, it only supports the real-mode memory addressing mode, and for 80286 including its later CPU, there are two addressing modes: Real-mode and protection mode, because both system compatibility should be taken into account)

Obviously, with the upgrade of the CPU, 8088/8086 of the memory addressing methods can no longer meet the needs. You can also say that in order to be able to access more than 10 ffefh of memory, you must enter the protection mode;

[7] different results of A20 being disabled + Enabled

7.1) If A20Gate is disabled:For 80286, its address is 24bit, and its address is expressed as EFFFFF; for the 32-bit chip that is extremely followed by 80386, its address is expressed as FFEFFFFF. This indicates that if A20Gate is disabled, the 20-bit of A20Gate is invalid when the CPU is used for address access and can always be used as 0;

7.2) If A20 Gate is opened:The 20-bit value is valid. The value can be either 0 or 1;

7.3) So:In protection mode, if the A20 Gate is enabled, the memory that can be accessed is continuous. If the A20Gate is disabled, the memory that can be accessed can only be an even number of segments,

Because 20 bits (starting from 0) are always zero ~ The 20 digits can only be 0000, 0010, 0100, 0110, 1000, 1010, 1100, and 1110. The hexadecimal values are 0, 2, 4, 6, 8, A, C, and E. The corresponding hexadecimal address segment is 000000-0FFFFF, 200000-2FFFFF, 400000-4FFFFF...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.