376 EMBEDDED PROCESSOR
Table 3.1. Access Rights Byte Definition for Code and Data Descriptors
Bit
Name Function
Position
7 Present (P) Pe1 Segment is mapped into physical memory.
P
e
0 No mapping to physical memory exits
6–5 Descriptor Privilege Segment privilege attribute used in privilege tests.
Level (DPL)
4 Segment Se1 Code or Data (includes stacks) segment descriptor
Descriptor (S) S
e
0 System Segment Descriptor or Gate Descriptor
3 Executable (E) Ee0 Descriptor type is data segment: If
2 Expansion ED
e
0 Expand up segment, offsets must beslimit. Data
Direction (ED) ED
e
1 Expand down segment, offsets must bellimit. Segment
1 Writable (W) (S
e
1,We0 Data segment may not be written into.
E
e
0)*W
e
1 Data segment may be written into.
3 Executable (E) IfEe1 Descriptor type is code segment:
2 Conforming (C) CodeC
e
1 Code segment may only be executed when
SegmentCPL
t
DPL and CPL remains unchanged.
1 Readable (R) (S
e
1,Re0 Code segment may not be read.
E
e
1)*R
e
1 Code segment may be read.
0 Accessed (A) Ae0 Segment has not been accessed.
Ae1 Segment selector has been loaded into segment register
or used by selector test instructions.
generated that is a truncated version of this linear
address. Truncation will be to the maximum number
of address bits. It is recommended to place EPROM
at the highest physical address and DRAM at the
lowest physical addresses.
Code and Data Descriptors (S
e
1)
Figure 3.4 shows the general format of a code and
data descriptor and Table 3.1 illustrates how the bits
in the Access Right Byte are interpreted.
Code and data segments have several descriptor
fields in common. The accessed bit, A, is set whenever the processor accesses a descriptor. The granularity bit, G, specifies if a segment length is 1-bytegranular or 4-Kbyte-granular. Base address bits
31–24, which are normally found in 80386 descriptors, are not made externally available on the 80376.
They do not affect the operation of the 80376. The
A
31–A24
field should be set to allow an 80386 to
correctly execute with EPROM at the upper 4096
Mbytes of physical memory.
System Descriptor Formats (S
e
0)
System segments describe information about operating system tables, tasks, and gates. Figure 3.5
shows the general format of system segment descriptors, and the various types of system segments.
80376 system descriptors (which are the same as
80386 descriptor types 2, 5, 9, B, C, E and F) contain
a 32-bit logical base address and a 20-bit segment
limit.
Selector Fields
A selector has three fields: Local or Global Descriptor Table Indicator (TI), Descriptor Entry Index (Index), and Requestor ( the selector’s) Privilege Level
(RPL) as shown in Figure 3.6. The TI bit selects either the Global Descriptor Table or the Local Descriptor Table. The Index selects one of 8K descriptors in the appropriate descriptor table. The RPL bits
allow high speed testing of the selector’s privilege
attributes.
Segment Descriptor Cache
In addition to the selector value, every segment register has a segment descriptor cache register associated with it. Whenever a segment register’s contents are changed, the 8-byte descriptor associated
with that selector is automatically loaded (cached)
on the chip. Once loaded, all references to that segment use the cached descriptor information instead
of reaccessing the descriptor. The contents of the
descriptor cache are not visible to the programmer.
Since descriptor caches only change when a segment register is changed, programs which modify
the descriptor tables must reload the appropriate
segment registers after changing a descriptor’s
value.
26