
80386
4.3 SEGMENTATION
4.3.1 Segmentation Introduction
Segmentation is one method of memory manage- ment. Segmentation provides the basis for protec- tion. Segments are used to encapsulate regions of memory which have common attributes. For exam- ple, all of the code of a given program could be con- tained in a segment, or an operating system table may reside in a segment. All information about a segment is stored in an 8 byte data structure called a descriptor. All of the descriptors in a system are contained in tables recognized by hardware.
4.3.2 Terminology
The following terms are used throughout the discus- sion of descriptors, privilege levels and protection:
PL: Privilege
RPL: Requestor Privilege
DPL: Descriptor Privilege
CPL: Current Privilege
CPL can also be determined by examining the low- est 2 bits of the CS register, except for conforming code segments.
EPL: Effective Privilege
Task: One instance of the execution of a program. Tasks are also referred to as processes.
4.3.3 Descriptor Tables
4.3.3.1 DESCRIPTOR TABLES INTRODUCTION
The descriptor tables define all of the segments which are used in an 80386 system. There are three types of tables on the 80386 which hold descriptors: the Global Descriptor Table, Local Descriptor Table, and the Interrupt Descriptor Table. All of the tables are variable length memory arrays. They can range in size between 8 bytes and 64K bytes. Each table can hold up to 8192 8 byte descriptors. The upper 13 bits of a selector are used as an index into the descriptor table. The tables have registers associat- ed with them which hold the
Each of the tables has a register associated with it the GDTR, LDTR, and the IDTR (see Figure
| 15 | 0 | 15 | 0 |
LDTR | ILOT DESCR |
| LOT LIMIT |
|
| SELECTOR |
| I |
|
|
|
| lLOT BASE |
|
| 15 | 0 | LINEAR ADDRESS |
|
|
|
| ||
| IlOT LIMIT |
| 32 |
|
|
| PROGRAM INVISIBLE |
| |
|
| AUTOMATICALLY LOADED | ||
IDTR | LINEAR ADDRESS |
| FROM LOT DESCRIPTOR | |
| ||||
| IlOT BASE |
|
|
|
| 31 | 0 |
|
|
| 15 | 0 |
|
|
| IGOT LIMIT |
|
|
|
GDTR | IGOT BASE |
|
|
|
LINEAR ADDRESS |
|
|
| |
| 31 | 0 |
| |
|
|
|
| |
Figure 4·3.Descriptor Table Registers
35