X86 memory segment Management Mechanism

Source: Internet
Author: User

Segment management: the primary storage is allocated and managed by segment. In this method, the primary memory is not divided by a fixed length, but by the size of the degree module (also called segment. A module, array, and table in the program correspond to a segment in the primary storage respectively.

The advantage of segment management is that the main storage segment corresponds to the program module, which is easy to manage and maintain.

 

Segment Management inReal address modeLower andAddress protection modeThe following are different operations. Different segment management methods are also the essential differences between the real address mode and the protected address mode of intel X86.

In real address mode, linear address = segment register value x 4 + offset. In this way, the addressing space of the memory is increased from 64 KB (16 power of 2) to 1 MB.

 

The following describes the address protection mode.

1. introduce several registers

Segment register CS, SS, DS, es, FS, and gs each register corresponds to a correspondingSegment descriptor register. The segment descriptor is also a completely new data structure.

 

Some content of the segment register is called "segment Selection Sub", as shown in.

2. gdt and LDT tables

Gdt (Global Descriptor Table) This table stores information about all segments in the system. Each table sub-item is 8 bytes. The gdt table is also called the Global segment descriptor table. There is a GDTR register used to save the first address of the gdt table in the memory.

LDT (Local Descriptor Table) stores the information of all segments used by a process (task). The table sub-item is also the "segment descriptor ".

 

In the page Storage Manager, the base address of the page directory that is used to save the page. Note that this address is a physical address.

In the Segment Storage tube, GDTR is used to save the base address of the segment descriptor table. When only the Segment Storage tube is used and the page storage tube is not used, the content of GDTR is the physical address.

If a page Storage Manager is used, the content of GDTR is a linear address. You also need to change the page Storage Manager to find the real physical address of the gdt table.

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.