Question

Besides code, data, and stack segments that make up the execution environment of a program or procedure, the architecture defines two system segments: the task-state segment (TSS) and the LDT.

The GDT is not considered a segment because it is not accessed by means of a segment selector and segment descriptor. TSSs and LDTs have segment descriptors defined for them.

-- Intel 64 and IA32 architecture software manual 3A,2.1.2

I'm little confused about why the GDT is not considered a segment.

Can any one give a detailed explanation?

Était-ce utile?

La solution

The GDT, being the first point of lookup for everything, cannot be accessed via a selector because that would give you a chicken-and-egg situation.

The GDT itself has descriptors for the various TSS and LDT memory blocks, so they are considered to be segments, accessible via segment selectors. In addition, individual LDTs have selectors for other memory regions so those regions are segments as well.

But you just have to ask yourself in which table would you look up the descriptor to locate the GDT when the GDT is the first point of entry to the selection process?

In actual fact, when you load up the address of the GDT (with the LGDT instruction), it's a linear address you're using rather than a selector. From the x86 developer guide:

The LGDT and LIDT instructions are used only in operating-system software; they are not used in application programs. They are the only instructions that directly load a linear address (that is, not a segment-relative address) and a limit in protected mode. They are commonly executed in real-address mode to allow processor initialization prior to switching to protected mode.

That's why they say the GDT isn't considered a segment.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top