Intel 80386 DJ Equipment User Manual


 
80386
4.3.4.4
LDT
DESCRIPTORS
(S
=
0,
TYPE = 2)
LDT
descriptors
(S
= 0 TYPE =
2)
contain informa-
tion about Local Descriptor Tables.
LDTs
contain a
table of segment descriptors, unique to a particular
task. Since the instruction to load the
LDTR
is
only
available
at privilege level
0,
the
DPL
field
is
ignored.
LDT
descriptors
are
only allowed
in
the Global
De-
scriptor Table
(GDT).
4.3.4.5 TSS DESCRIPTORS
(5=0,
TVPE=
1,
3,
9,
B)
A Task State Segment
(TSS)
descriptor contains in-
formation about the location,
size,
and
privilege level
of a Task State Segment
(TSS).
A TSS in turn is a
special fixed format segment which contains
all
the
state information for a task
and
a linkage field to
permit nesting tasks. The
TYPE
field
is
used to indi-
cate whether the task
is
currently BUSY
(Le.
on
a
chain of active tasks) or the
TSS
is
available. The
TYPE field also indicates
if
the segment contains a
286 or a 386
TSS.
The Task Register
(TR)
contains
the selector which points to the current Task State
Segment.
4.3.4.6
GATE
DESCRIPTORS (S=O,
TYPE=4-7,
C,
F)
Gates
are
used to control access to entry points
within the target code segment. The various types of
31
24
16
gate descriptors
are
call gates, task gates,
interrupt
gates,
and
trap
gates. Gates provide a
level of indirection between the source and destina-
tion of the control transfer. This indirection allows
the processor to automatically perform protection
checks. It also allows system designers to control
entry points to the operating system. Call gates
are
used to change privilege levels (see section 4.4
Protection), task gates
are
used to perform a task
switch, and interrupt and trap gates are used to
specify interrupt service routines.
Figure
4-8
shows the format of the four types of gate
descriptors.
Call gates are primarily used to transfer
program control to a more privileged level. The call
gate descriptor consists of three fields: the access
byte, a long pointer (selector and offset) which
points to the start of a routine
and
a word count
which specifies how many parameters
are
to be cop-
ied from the caller's stack to the stack of the called
routine. The word count field
is
only used
by
call
gates when there
is
a change
in
the privilege level,
other types of gates ignore the word count field.
I nterrupt
and
trap gates use the destination selector
and
destination offset fields of the gate descriptor
as
a pointer to the start of the interrupt or trap handler
routines. The difference between interrupt gates
and
trap gates
is
that the interrupt gate disables inter-
rupts (resets the
IF
bit)
while the trap gate does not.
8
5
o
SELECTOR
OFFSET
15
...
0
o
OFFSET
31
...
16
Name
Type
P
Value
4
5
6
7
C
E
F
o
P
DPL
Gate Descriptor Fields
Description
286 call gate
Task gate (for 286 or 386 task)
286 interrupt gate
286 trap gate
386 call gate
386 interrupt gate
386 trap gate
Descriptor contents are not valid
Descriptor contents are valid
WORD
0 TYPE 0 0 0 COUNT
+4
4
...
0
DPL-Ieast
privileged level at which a task
may
access the gate. WORD COUNT
0-31-the
number of parameters to copy from caller's stack
to the called procedure's stack. The parameters are 32-bit quantities for 386 gates,
and
16-bit quantities for 286 gates.
DESTINATION 16-bit Selector to the target code segment
SELECTOR selector or
DESTINATION
OFFSET
offset
16-bit 286
32-bit 386
Selector to the target task state segment for task gate
Entry point within the target code segment
Figure 4·8. Gate
Descriptor
Formats
39