V1
Contents
Revision History
Conventions and Definitions
1 Overview of the AMD64 Architecture
1.1 Introduction
1.2 Modes of Operation
2 Memory Model
3 General-Purpose Programming
4 Streaming SIMD Extensions Media and Scientific Programming
5 64-Bit Media Programming
6 x87 Floating-Point Programming
V2
Contents
1 System-Programming Overview
1.1 Memory Model
1.1.1 Memory Addressing
1.1.2 Memory Organization
1.1.3 Canonical Address Form
1.2 Memory Management
1.2.1 Segmentation
1.2.2 Paging
1.2.3 Mixing Segmentation and Paging
1.2.4 Real Addressing
1.3 Operating Modes
1.3.1 Long Mode
1.3.2 64-Bit Mode
1.3.3 Compatibility Mode
1.3.4 Legacy Modes
1.3.5 System Management Mode
1.4 System Registers
1.5 System-Data Structures
1.6 Interrupts
1.7 Additional System-Programming Facilities
2 x86 and AMD64 Architecture Differences
3 System Resources
3.1 System-Control Registers
3.1.1 CR0 Register
4 Segmented Virtual Memory
4.1 Real Mode Segmentation
4.2 Virtual-8086 Mode Segmentation
4.3 Protected Mode Segmented-Memory Models
4.3.1 Multi-Segmented Model
4.3.2 Flat-Memory Model
4.3.3 Segmentation in 64-Bit Mode
4.4 Segmentation Data Structures and Registers
4.5 Segment Selectors and Registers
4.5.1 Segment Selectors
4.5.2 Segment Registers
4.5.3 Segment Registers in 64-Bit Mode
4.6 Descriptor Tables
4.6.1 Global Descriptor Table
4.6.2 Global Descriptor-Table Register
4.6.3 Local Descriptor Table
4.6.4 Local Descriptor-Table Register
4.6.5 Interrupt Descriptor Table
4.6.6 Interrupt Descriptor-Table Register
4.7 Legacy Segment Descriptors
4.7.1 Descriptor Format
4.7.2 Code-Segment Descriptors
4.7.3 Data-Segment Descriptors
4.7.4 System Descriptors
4.7.5 Gate Descriptors
4.8 Long-Mode Segment Descriptors
4.8.1 Code-Segment Descriptors
4.8.2 Data-Segment Descriptors
4.8.3 System Descriptors
4.8.4 Gate Descriptors
4.8.5 Long Mode Descriptor Summary
4.9 Segment-Protection Overview
4.9.1 Privilege-Level Concept
4.9.2 Privilege-Level Types
4.10 Data-Access Privilege Checks
4.10.1 Accessing Data Segments
4.10.2 Accessing Stack Segments
4.11 Control-Transfer Privilege Checks
4.11.1 Direct Control Transfers
4.11.2 Control Transfers Through Call Gates
4.11.3 Return Control Transfers
4.12 Limit Checks
4.12.1 Determining Limit Violations
4.12.2 Data Limit Checks in 64-bit Mode
4.13 Type Checks
4.13.1 Type Checks in Legacy and Compatibility Modes
4.13.2 Long Mode Type Check Differences
5 Page Translation and Protection
5.1 Page Translation Overview
5.1.1 Page-Translation Options
5.1.2 Page-Translation Enable (PG) Bit
5.1.3 Physical-Address Extensions (PAE) Bit
5.1.4 Page-Size Extensions (PSE) Bit
5.1.5 Page-Directory Page Size (PS) Bit
5.2 Legacy-Mode Page Translation
5.2.1 CR3 Register
5.2.2 Normal (Non-PAE) Paging
5.3 Long-Mode Page Translation
5.3.1 Canonical Address Form
5.3.2 CR3
5.3.3 4-Kbyte Page Translation
5.3.4 2-Mbyte Page Translation
5.3.5 1-Gbyte Page Translation
5.4 Page-Translation-Table Entry Fields
5.4.1 Field Definitions
5.4.2 Notes on Accessed and Dirty Bits
5.5 Translation-Lookaside Buffer (TLB)
5.5.1 Global Pages
5.5.2 TLB Management
5.6 Page-Protection Checks
5.6.1 User/Supervisor (U/S) Bit
5.6.2 Read/Write (R/W) Bit
5.6.3 No Execute (NX) Bit
5.6.4 Write Protect (CR0.WP) Bit
5.6.5 Supervisor-Mode Execution Prevention (CR4.SMEP) Bit
5.7 Protection Across Paging Hierarchy
5.8 Effects of Segment Protection
6 System-Management Instructions
7 Memory System
8 Exceptions and Interrupts
8.1 General Characteristics
8.2 Vectors
8.2.1 #DE—Divide-by-Zero-Error Exception (Vector 0)
8.2.2 #DB—Debug Exception (Vector 1)
8.2.3 NMI—Non-Maskable-Interrupt Exception (Vector 2)
8.2.4 #BP—Breakpoint Exception (Vector 3)
8.2.5 #OF—Overflow Exception (Vector 4)
8.2.6 #BR—Bound-Range Exception (Vector 5)
8.2.7 #UD—Invalid-Opcode Exception (Vector 6)
8.2.8 #NM—Device-Not-Available Exception (Vector 7)
8.2.9 #DF—Double-Fault Exception (Vector 8)
8.2.10 Coprocessor-Segment-Overrun Exception (Vector 9)
8.2.11 #TS—Invalid-TSS Exception (Vector 10)
8.2.12 #NP—Segment-Not-Present Exception (Vector 11)
8.2.13 #SS—Stack Exception (Vector 12)
8.2.14 #GP—General-Protection Exception (Vector 13)
8.2.15 #PF—Page-Fault Exception (Vector 14)
8.2.16 #MF—x87 Floating-Point Exception-Pending (Vector 16)
8.2.17 #AC—Alignment-Check Exception (Vector 17)
8.3 Exceptions During a Task Switch
8.4 Error Codes
8.5 Priorities
8.6 Real-Mode Interrupt Control Transfers
8.7 Legacy Protected-Mode Interrupt Control Transfers
8.8 Virtual-8086 Mode Interrupt Control Transfers
8.9 Long-Mode Interrupt Control Transfers
8.10 Virtual Interrupts
9 Machine Check Architecture
10 System-Management Mode
11 SSE, MMX, and x87 Programming
12 Task Management
13 Software Debug and Performance Resource
14 Processor Initialization and Long Mode Activation
15 Secure Virtual Machine
15.1 The Virtual Machine Monitor
15.2 SVM Hardware Overview
15.3 SVM Processor and Platform Extensions
15.4 Enabling SVM
15.5 VMRUN Instruction
15.6 #VMEXIT
15.7 Intercept Operation
15.8 Decode Assists
15.9 Instruction Intercepts
15.10 IOIO Intercepts
15.11 MSR Intercepts
15.12 Exception Intercepts
15.13 Interrupt Intercepts
15.14 Miscellaneous Intercepts
15.15 VMCB State Caching
15.16 TLB Control
15.17 Global Interrupt Flag, STGI and CLGI Instructions
15.18 VMMCALL Instruction
15.19 Paged Real Mode
15.20 Event Injection
15.21 Interrupt and Local APIC Support
15.22 SMM Support
15.23 Last Branch Record Virtualization
15.24 External Access Protection
15.25 Nested Paging
15.26 Security
15.27 Secure Startup with SKINIT
15.28 Security Exception (#SX)
15.29 Advanced Virtual Interrupt Controller
15.30 SVM Related MSRs
15.31 SVM-Lock
15.32 SMM-Lock
15.33 Nested Virtualization
15.34 Secure Encrypted Virtualization
15.35 Encrypted State (SEV-ES)
16 Advanced Programmable Interrupt Controller (APIC)
17 Hardware Performance Monitoring and Control
V3
Contents
1 Instruction Encoding
2 Instruction Overview
3 General-Purpose Instruction Reference
4 System Instruction Reference
Appendix A Opcode and Operand Encodings
Appendix B General-Purpose Instructions in 64-Bit Mode