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.