ia-32_volume1_basic-arch

Stack and executing a return instruction ret or iret

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: isplacements are 16 bits. This restriction limits the size of a segment to 64 KBytes. When the 32-bit address-size attribute is in force, segment offsets and displacements are 32 bits, allowing up to 4 GBytes to be addressed. The default operand-size attribute and/or address-size attribute can be overridden for a particular instruction by adding an operand-size and/or address-size prefix to an instruction. See Chapter 2, "Instruction Format," in the Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 3A. The effect of this prefix applies only to the targeted instruction. Table 3-4 shows effective operand size and address size (when executing in protected mode or compatibility mode) depending on the settings of the D flag and the operand-size and address-size prefixes. Table 3-3. Effective Operand- and Address-Size Attributes D Flag in Code Segment Descriptor Operand-Size Prefix 66H Address-Size Prefix 67H Effective Operand Size Effective Address Size 0 N N 16 16 0 N Y 16 32 0 Y N 32 16 0 Y Y 32 32 1 N N 32 32 1 N Y 32 16 1 Y N 16 32 1 Y Y 16 16 NOTES: Y: Yes - this instruction prefix is present. N: No - this instruction prefix is not present. 3.6.1 Operand Size and Address Size in 64-Bit Mode In 64-bit mode, the default address size is 64 bits and the default operand size is 32 bits. Defaults can be overridden using prefixes. Address-size and operand-size prefixes allow mixing of 32/64-bit data and 32/64-bit addresses on an instructionby-instruction basis. Table 3-4 shows valid combinations of the 66H instruction prefix and the REX.W prefix that may be used to specify operand-size overrides in 64-bit mode. Note that 16-bit addresses are not supported in 64-bit mode. REX prefixes consist of 4-bit fields that form 16 different values. The W-bit field in the REX prefixes is referred to as REX.W. If the REX.W field is properly set, the prefix specifies an operand size override to 64 bits. Note that software can still use the Vol. 1 3-25 BASIC EXECUTION ENVIRONMENT operand-size 66H prefix to toggle to a 16-bit operand size. However, setting REX.W takes precedence over the operand-size prefix (66H) when both are used. In the case of SSE/SSE2/SSE3/SSSE3 SIMD instructions: the 66H, F2H, and F3H prefixes are mandatory for opcode extensions. In such a case, there is no interaction between a valid REX.W prefix and a 66H opcode extension prefix. See Chapter 2, "Instruction Format," in the Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 3A. Table 3-4. Effective Operand- and Address-Size Attributes in 64-Bit Mode L Flag in Code Segment Descriptor REX.W Prefix Operand-Size Prefix 66H Address-Size Prefix 67H Effective Operand Size Effective Address Size 1 0 N N 32 64 1 0 N Y 32 32 1 0 Y N 16 64 1 0 Y Y 16 32 1 1 N N 64 64 1 1 N Y 64 32 1 1 Y N 64 64 1 1 Y Y 64 32 NOTES: Y: Yes - this instruction prefix is present. N: No - this instruction prefix is not present. 3.7 OPERAND ADDRESSING IA-32 machine-instruction...
View Full Document

Ask a homework question - tutors are online