Intel 253668-032US Manuale Utente

Pagina di 806
3-14   Vol. 3
PROTECTED-MODE MEMORY MANAGEMENT
to the segment limit. Offsets greater than the segment limit generate 
general-protection exceptions (#GP). For expand-down segments, 
the segment limit has the reverse function; the offset can range from 
the segment limit to FFFFFFFFH or FFFFH, depending on the setting of 
the B flag. Offsets less than the segment limit generate general-
protection exceptions. Decreasing the value in the segment limit field 
for an expand-down segment allocates new memory at the bottom of 
the segment's address space, rather than at the top. IA-32 architec-
ture stacks always grow downwards, making this mechanism conve-
nient for expandable stacks.
Base address fields 
Defines the location of byte 0 of the segment within the 4-GByte 
linear address space. The processor puts together the three base 
address fields to form a single 32-bit value. Segment base addresses 
should be aligned to 16-byte boundaries. Although 16-byte alignment 
is not required, this alignment allows programs to maximize perfor-
mance by aligning code and data on 16-byte boundaries.
Type field
Indicates the segment or gate type and specifies the kinds of access 
that can be made to the segment and the direction of growth. The 
interpretation of this field depends on whether the descriptor type flag 
specifies an application (code or data) descriptor or a system 
descriptor. The encoding of the type field is different for code, data, 
and system descriptors (see Figure 5-1). See Section 3.4.5.1, “Code- 
and Data-Segment Descriptor Types”, for a 
description of how this 
field is used to specify code and data-segment types. 
S (descriptor type) flag 
Specifies whether the segment descriptor is for a system segment 
(S flag is clear) or a code or data segment (S flag is set).
DPL (descriptor privilege level) field 
Specifies the privilege level of the segment. The privilege level can 
range from 0 to 3, with 0 being the most privileged level. The DPL is 
used to control access to the segment. See Section 5.5, “Privilege 
Levels”, for a 
description of the relationship of the DPL to the CPL of 
the executing code segment and the RPL of a segment selector.
P (segment-present) flag 
Indicates whether the segment is present in memory (set) or not 
present (clear). If this flag is clear, the processor generates a 
segment-not-present exception (#NP) when a segment selector that 
points to the segment descriptor is loaded into a segment register. 
Memory management software can use this flag to control which 
segments are actually loaded into physical memory at a given time. It 
offers a control in addition to paging for managing virtual memory.
Figure 3-9 shows the format of a segment descriptor when the 
segment-present flag is clear. When this flag is clear, the operating 
system or executive is free to use the locations marked “Available” to