Application Programming
Total Page:16
File Type:pdf, Size:1020Kb
AMD64 Technology AMD64 Architecture Programmer’s Manual Volume 1: Application Programming Publication No. Revision Date 24592 3.14 September 2007 Advanced Micro Devices AMD64 Technology 24592—Rev. 3.14—September 2007 © 2002 – 2007 Advanced Micro Devices, Inc. All rights reserved. The contents of this document are provided in connection with Advanced Micro Devices, Inc. (“AMD”) products. AMD makes no representations or warranties with respect to the accuracy or completeness of the contents of this publication and reserves the right to make changes to specifications and product descriptions at any time without notice. The information contained herein may be of a preliminary or advance nature and is subject to change without notice. No license, whether express, implied, arising by estoppel or otherwise, to any intellectual property rights is granted by this publication. Except as set forth in AMD’s Standard Terms and Conditions of Sale, AMD assumes no liability whatsoever, and disclaims any express or implied warranty, relating to its products including, but not limited to, the implied warranty of merchantability, fitness for a particular purpose, or infringement of any intellectual property right. AMD’s products are not designed, intended, authorized or warranted for use as components in systems intended for surgical implant into the body, or in other appli- cations intended to support or sustain life, or in any other application in which the failure of AMD’s product could create a situation where personal injury, death, or severe property or environmental damage may occur. AMD reserves the right to discontinue or make changes to its products at any time without notice. Trademarks AMD, the AMD arrow logo, AMD Athlon, and AMD Opteron, and combinations thereof, and 3DNow! are trademarks, and AMD-K6 is a registered trademark of Advanced Micro Devices, Inc. MMX is a trademark and Pentium is a registered trademark of Intel Corporation. Windows NT is a registered trademark of Microsoft Corporation. Other product names used in this publication are for identification purposes only and may be trademarks of their respective companies. 24592—Rev. 3.14—September 2007 AMD64 Technology Contents Revision History. xv Preface. xvii About This Book. xvii Audience . xvii Organization . xvii Definitions . xviii Terms and Notation . xviii Registers . xxv Endian Order . xxviii Related Documents. xxviii 1 Overview of the AMD64 Architecture . .1 1.1 Introduction . 1 AMD64 Features . 1 Registers. 3 Instruction Set . 3 Media Instructions . 4 Floating-Point Instructions . 5 1.2 Modes of Operation . 6 Long Mode. 6 64-Bit Mode. 6 Compatibility Mode. 7 Legacy Mode . 7 2 Memory Model. .9 2.1 Memory Organization . 9 Virtual Memory . 9 Segment Registers . 10 Physical Memory . 11 Memory Management . 11 2.2 Memory Addressing . 14 Byte Ordering . 14 64-Bit Canonical Addresses . 15 Effective Addresses . 15 Address-Size Prefix . 17 RIP-Relative Addressing . .18 2.3 Pointers . 19 Near and Far Pointers . 19 2.4 Stack Operation . 19 2.5 Instruction Pointer . 20 3 General-Purpose Programming . .23 3.1 Registers . 23 Legacy Registers . 24 64-Bit-Mode Registers. 26 Contents i AMD64 Technology 24592—Rev. 3.14—September 2007 Implicit Uses of GPRs . 30 Flags Register . 33 Instruction Pointer Register . .36 3.2 Operands . 36 Data Types . 36 Operand Sizes and Overrides. 39 Operand Addressing . 40 Data Alignment . 40 3.3 Instruction Summary . 41 Syntax . 41 Data Transfer . ..