This preview shows page 1. Sign up to view the full content.
Unformatted text preview: . Figure 4-2 shows the byte order of each of the fundamental data types when referenced as operands in memory. The low byte (bits 0 through 7) of each data type occupies the lowest address in memory and that address is also the address of the operand. Vol. 1 4-1 DATA TYPES 12H 7AH Word at Address BH Contains FE06H Byte at Address 9H Contains 1FH Word at Address 6H Contains 230BH FEH 06H 36H 1FH A4H 23H 0BH 45H Word at Address 2H Contains 74CBH Word at Address 1H Contains CB31H 67H 74H CBH 31H 12H EH DH CH BH AH 9H 8H 7H 6H 5H 4H 3H 2H 1H 0H Double quadword at Address 0H Contains 127AFE06361FA4230B456774CB3112H Quadword at Address 6H Contains 7AFE06361FA4230BH Doubleword at Address AH Contains 7AFE0636H Figure 4-2. Bytes, Words, Doublewords, Quadwords, and Double Quadwords in Memory 4.1.1 Alignment of Words, Doublewords, Quadwords, and Double Quadwords Words, doublewords, and quadwords do not need to be aligned in memory on natural boundaries. The natural boundaries for words, double words, and quadwords are even-numbered addresses, addresses evenly divisible by four, and addresses evenly divisible by eight, respectively. However, to improve the performance of programs, data structures (especially stacks) should be aligned on natural boundaries whenever possible. The reason for this is that the processor requires two memory accesses to make an unaligned memory access; aligned accesses require only one memory access. A word or doubleword operand that crosses a 4-byte boundary or a quadword operand that crosses an 8-byte boundary is considered unaligned and requires two separate memory bus cycles for access. Some instructions that operate on double quadwords require memory operands to be aligned on a natural boundary. These instructions generate a general-protection exception (#GP) if an unaligned operand is specified. A natural boundary for a double quadword is any address evenly divisible by 16. Other instructions that operate on double quadwords permit unaligned access (without generating a general-protection exception). However, additional memory bus cycles are required to access unaligned data from memory.
4-2 Vol. 1 DATA TYPES 4.2 NUMERIC DATA TYPES Although bytes, words, and doublewords are fundamental data types, some instructions support additional interpretations of these data types to allow operations to be performed on numeric data types (signed and unsigned integers, and floating-point numbers). See Figure 4-3. Byte Unsigned Integer 7 0 Word Unsigned Integer 15 0 Doubleword Unsigned Integer 31 0 Quadword Unsigned Integer 63 Sign Byte Signed Integer 76 Sign Word Signed Integer 15 14 Sign Doubleword Signed Integer 31 30 Sign Quadword Signed Integer 63 62 Sign 31 30 Sign 63 62 Sign 79 78 Integer Bit 64 63 62 0 52 51 0 23 22 0 0 Single Precision Floating Point 0 0 0 0 Double Precision Floating Point Double Extended Precision Floating Point Figure 4-3. Numeric Data Types Vol. 1 4-3 DATA TYPES 4.2.1 Integers The Intel 64 and IA-32 architectures...
View Full Document
- Winter '11