Intel ARCHITECTURE IA-32 User Manual Page 136

  • Download
  • Add to my manuals
  • Print
  • Page
    / 636
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 135
4-6 Vol. 3A
PROTECTION
For expand-down data segments, the segment limit has the same function but is interpreted
differently. Here, the effective limit specifies the last address that is not allowed to be accessed
within the segment; the range of valid offsets is from (effective-limit + 1) to FFFFFFFFH if the
B flag is set and from (effective-limit + 1) to FFFFH if the B flag is clear. An expand-down
segment has maximum size when the segment limit is 0.
Limit checking catches programming errors such as runaway code, runaway subscripts, and
invalid pointer calculations. These errors are detected when they occur, so identification of the
cause is easier. Without limit checking, these errors could overwrite code or data in another
segment.
In addition to checking segment limits, the processor also checks descriptor table limits. The
GDTR and IDTR registers contain 16-bit limit values that the processor uses to prevent
programs from selecting a segment descriptors outside the respective descriptor tables. The
LDTR and task registers contain 32-bit segment limit value (read from the segment descriptors
for the current LDT and TSS, respectively). The processor uses these segment limits to prevent
accesses beyond the bounds of the current LDT and TSS. See Section 3.5.1, “Segment
Descriptor Tables,” for more information on the GDT and LDT limit fields; see Section 5.10,
“Interrupt Descriptor Table (IDT),” for more information on the IDT limit field; and see Section
6.2.4, “Task Register,” for more information on the TSS segment limit field.
4.3.1 Limit Checking in 64-bit Mode
In 64-bit mode, the processor does not perform runtime limit checking on code or data segments.
However, the processor does check descriptor-table limits.
4.4 TYPE CHECKING
Segment descriptors contain type information in two places:
The S (descriptor type) flag.
The type field.
The processor uses this information to detect programming errors that result in an attempt to use
a segment or gate in an incorrect or unintended manner.
The S flag indicates whether a descriptor is a system type or a code or data type. The type field
provides 4 additional bits for use in defining various types of code, data, and system descriptors.
Table 3-1 shows the encoding of the type field for code and data descriptors; Table 3-2 shows
the encoding of the field for system descriptors.
The processor examines type information at various times while operating on segment selectors
and segment descriptors. The following list gives examples of typical operations where type
checking is performed (this list is not exhaustive):
Page view 135
1 2 ... 131 132 133 134 135 136 137 138 139 140 141 ... 635 636

Comments to this Manuals

No comments