3.4 Protected Mode

Linear

Address Space

Wondershare

Logical Address

32-bit Effective Address

32-bit Linear Address Offset

- HH-) -H

(±) '

16-bit Selector

V

64-bit Segment Descriptor

GDT

48-bit GDTR

J

32-bit

Linear

Base

Address

Protcctcd-Modc Segmentation Without Paging

Figure 3.10

There are two types of descriptor tables: global descriptor tables (GDTs) and

local descriptor tables (LDTs). Having a GDT is mandatory; every operating

system running on IA-32 must create one when it starts up. Typically, there

will be a singie GDT for the entire system (hence the name "Globai") that can

be shared by all tasks. Using an LDT is optional; it can be used by a single

task or a group of related tasks. For the purposes of this book, we'll focus

on the GDT. As far as Windows is concerned, the LDT is an orphan data

structure.

Note: The first entry in the GDT is always empty and is referred to as a null segment

dsscriptor. A selector that refers to this descriptor in the GDT is called a null selector.

Looking at Figure 3.10, you may be puzzling over the role of the GDTR object.

This is a special register (i.e., GDTR) used to hold the base address of the GDT.

The GDTR register is 48 bits in size. The lowest 16 bits (bits 0 to 15) determine

the size of the GDT (in bytes). The remaining 32 bits store the base linear ad¬

dress of the GDT (i.e., the linear address of the first byte).

If there's one thing you learn when it comes to system-level development, it's

that special registers often entail special instructions. Hence, there are also

dedicated instructions to set and read the value in the GDTR. The LGDT loads a

Parti I 91