User's Manual

MEMORY MANAGEMENT AND VIRTUAL ADDRESSING
Within each of the two regions addressable by a
program-either
the global address space or a partic-
ular local address
space-as
many as 8,192 (2
13
) distinct segments may be defined. The
INDEX
field
of the segment selector allows for a unique specification of each
of
these segments. This 13-bit quantity
acts as an index into a memory-resident table, called a descriptor table, that records the mapping
between segment address and the physical locations allocated to each distinct segment. (These descrip-
tor tables, and their role
in
virtual-to-physical address translation, are described in the sections that
follow.)
In summary, a Protected Mode virtual address
is
a 32-bit pointer
to
a particular byte location within a
one-gigabyte virtual address space. Each such pointer consists of a 16-bit selector component and a
16-bit offset component. The selector component, in turn, comprises a 13-bit table index, a I-bit table
indicator (local versus global), and a 2-bit
RPL
field; all but this last field serve to select a particular
segment from among the 16K segments in a task's virtual address space. The offset component of a
full pointer
is
an unsigned 16-bit integer that specifies the desired byte location within the selected
segment.
6.3
DESCRIPTOR TABLES
A descriptor table
is
a memory-resident table either defined by program development tools in a static
system or controlled
by
operating system software in systems that are reprogrammable. The descriptor
table contents govern the interpretation of virtual addresses. Whenever the
80286 decodes a virtual
address, translating a full 32-bit pointer into a corresponding 24-bit physical address, it implicitly refer-
ences one of these tables.
Within a Protected Mode system, there are ordinarily several descriptor tables resident in memory.
One of these
is
the global descriptor table (GDT); this table provides a complete description of the
global address space. In addition, there may be one or more local descriptor tables (LDTs), each
describing the local address space of one or more tasks.
For each task in the system, a pair of descriptor
tables-consisting
of the GDT (shared by all tasks)
and a particular
LDT
(private to the task or to a group of closely related
tasks)-provides
a complete
description of
that
task's virtual address space. The protection mechanism described in Chapter 7,
"Protection," ensures that a task
is
granted access only to its own virtual address space. In the simplest
of system configurations, tasks can reside entirely within the GDT without the use of local descriptor
tables. This will simplify system software
by
only requiring maintenance of one table (the GDT)
at
the
expense of
no
isolation between tasks. The point
is:
the 80286 memory management scheme
is
flexible
enough to accommodate a variety of implementations and does not require use of all possible facilities
when implementing a system.
The descriptor tables consist of a sequence of 8-byte entries called descriptors. A descriptor table may
contain from 1 to 8192 entries.
Within a descriptor table, two main classes of descriptors are recognized by the
80286 architecture.
The most important of these,
from the standpoint
oi
memory managemellL,
an;
.:;alled
segmeiit descrip-
tors; these determine the set of segments that are included within a given address space. The other
class are special-purpose control
descriptors-such
as call gates and task
descriptors-to
implement
protection (described in succeeding chapters) and special system data segments.
Figure
6-3
shows the format of a segment descriptor. Note that it provides information about the
physical-memory base address and size of a segment, as well as certain access information.
If
a partic-
ular segment
is
to be included within a virtual address space, then a segment descriptor
that
describes
that
segment must be included within the appropriate descriptor table. Thus, within the GDT, there
6-4