Intel 80286 Computer Accessories User Manual


 
PROTECTION
P DPL 5 E C R A
P DPL 5 E
ED
W A
1 0 1 0
I 1
01
1 0 0
7
o
7
o
Readable Code Segment
Writable Code Segment
G3010B
Figure 7-8. Access Byte Examples
Table 7-2. Allowed Segment Types in Segment Registers
(
Allowed
Segnlent Types
Segment Register
Read
Only
Read-Write Execute
Only
Execute'Read
Data
Segment Data Segment
Code Segment Code Segment
OS
Yes Yes
No
Yes
ES
Yes
Yes
No
Yes
SS
No
Yes
No
No
CS
No
No
Yes Yes
NOTE
The Intel reserved bytes
in
the segment descriptor must
be
set to 0 for compatibility with
the 80386.
7.4.1 Data Accesses
Data
may be accessed in data segments or readable code segments. When DS or ES
is
ioaded with a
new selector, e.g., by an
LDS, LES, or MOV to ES, SS, or DS instruction, the bits in the access byte
are checked to verify legitimate descriptor type and access (see table 7-2).
If
any test fails, an error
code
is
pushed onto the stack identifying the selector involved (see figure
7-5
for the error code format).
A privilege check
is
made when the segment register
is
loaded.
In
general, a data segment's
DPL
must
be numerically greater than or equal to the
CPL. The
DPL
of a descriptor loaded into the
SS
must
eq'1!"J
the C.PL Conforming code segments are an exception to privilege checking rules (see
section 11. 2).
Once the segment descriptor and selector are loaded, the offset of subsequent accesses within the
segment are checked against the limit given in the segment descriptor. Violating the segment size limit
causes a General Protection exception with an error code of
O.
A normal data segment
is
addressed with offset values ranging from 0 to the size of the segment. When
the ED bit of the access rights byte in the segment descriptor
is
0, the allowed range of offsets
is
OOOOH
to the limit.
If
limit
is
OFFFFH, the data segment contains 65,536 bytes.
7-12