19-40 Vol. 3
ARCHITECTURE COMPATIBILITY
19.33.1 Segment Wraparound
On the 8086 processor, an attempt to access a memory operand that crosses offset
65,535 or 0FFFFH or offset 0 (for example, moving a word to offset 65,535 or
pushing a word when the stack pointer is set to 1) causes the offset to wrap around
modulo 65,536 or 010000H. With the Intel 286 processor, any base and offset combi
-
nation that addresses beyond 16 MBytes wraps around to the 1 MByte of the address
space. The P6 family, Pentium, Intel486, and Intel386 processors in real-address
mode generate an exception in these cases:
• A general-protection exception (#GP) if the segment is a data segment (that is,
if the CS, DS, ES, FS, or GS register is being used to address the segment).
• A stack-fault exception (#SS) if the segment is a stack segment (that is, if the SS
register is being used).
An exception to this behavior occurs when a stack access is data aligned, and the
stack pointer is pointing to the last aligned piece of data that size at the top of the
stack (ESP is FFFFFFFCH). When this data is popped, no segment limit violation
occurs and the stack pointer will wrap around to 0.
The address space of the P6 family, Pentium, and Intel486 processors may wrap-
around at 1 MByte in real-address mode. An external A20M# pin forces wraparound
if enabled. On Intel 8086 processors, it is possible to specify addresses greater than
1 MByte. For example, with a selector value FFFFH and an offset of FFFFH, the effec
-
tive address would be 10FFEFH (1 MByte plus 65519 bytes). The 8086 processor,
which can form addresses up to 20 bits long, truncates the uppermost bit, which
“wraps” this address to FFEFH. However, the P6 family, Pentium, and Intel486
processors do not truncate this bit if A20M# is not enabled.
If a stack operation wraps around the address limit, shutdown occurs. (The 8086
processor does not have a shutdown mode or a limit.)
The behavior when executing near the limit of a 4-GByte selector (limit=0xFFFFFFFF)
is different between the Pentium Pro and the Pentium 4 family of processors. On the
Pentium Pro, instructions which cross the limit -- for example, a two byte instruction
such as INC EAX that is encoded as 0xFF 0xC0 starting exactly at the limit faults for
a segment violation (a one byte instruction at 0xFFFFFFFF does not cause an excep
-
tion). Using the Pentium 4 microprocessor family, neither of these situations causes
a fault.
Segment wraparound and the functionality of A20M# is used primarily by older oper-
ating systems and not used by modern operating systems. On newer Intel 64 proces-
sors, A20M# may be absent.
19.34 STORE BUFFERS AND MEMORY ORDERING
The Pentium 4, Intel Xeon, and P6 family processors provide a store buffer for
temporary storage of writes (stores) to memory (see
Section 11.10, “Store Buffer”).
Writes stored in the store buffer(s) are always written to memory in program order,