AMD NPT (Nested Page Table): Hardware-Accelerated Memory Virtualization

NPT (Nested Page Table) is AMD's counterpart to Intel EPT: second-level address translation. It lets guest page tables map directly to real physical memory, eliminating shadow-page-table sync overhead and providing a hardware anchor for page-level security monitoring.

Core Concepts

Two-Level Translation

Guest virtual → guest physical (gCR3 tables) → host physical (nCR3 tables) is completed by hardware in one pass.

The nCR3 Root Pointer

nCR3 at VMCB control offset 0x40 points to the nested table root; guest CR3 switches do not #VMEXIT (unless intercepted).

gCR3 & TLB Control

Each guest CR3 switch is recorded by hardware into gCR3 and paired with ASID tags to flush the relevant TLB.

Page Attribute Combination

Attributes (U/S, W, P, etc.) from both levels are combined with AND semantics, letting the host tighten permissions at the NPT level.

Performance Edge

No shadow-table maintenance or guest write-protection traps; VM memory access approaches native speed.

Security Monitoring Uses

Marking pages read-only or non-executable at the NPT level enables residue-free monitoring of writes and code execution — the cornerstone of VT hooks.

Key Code

// 在 NPT 层把 guest 某物理页设为只读(伪代码)
        // 目标: 监控对 gPA=0x10000 的写入
        pte = walk_npt(nCR3, 0x10000);   // 找到嵌套页表项
        pte->write = 0;                   // 清除 W 位
        invlpga(0x10000, asid);           // 按 ASID 使 TLB 失效
        // 之后 guest 写该页 → #NPF → host 记录并重新标记
        // 实现"写入时复制"式监控

Structure Cheat Sheet

nCR3Nested table root (VMCB 0x40), controlled by host
gCR3Guest's current CR3, recorded automatically by hardware
ASIDTLB tag avoiding full flushes after exits
TLB ControlVMCB fields controlling TLB flushes
属性联合Permissions combine with AND across levels
#NPFNested page fault event handled by the host

Related Reading

Virtualization Technology Intro: From Software Emulation to Hardware Assist

A systematic introduction to virtualization concepts, evolution and taxonomy, and the roles of Intel VT-x and AMD-V.

A Brief History of Hardware Virtualization: The Road of VT-x and AMD-V

A retrospective of three decades of x86 hardware virtualization: binary translation, Intel VT-x, AMD SVM, EPT/NPT, and the modern virtualization security ecosystem.

Intel VT-x Basics: VMX Modes and Core Virtualization Concepts

In-depth explanation of Intel VT-x VMX root/non-root modes, the VM-exit/VM-entry mechanism, and the VMCS virtual machine control structure.

VMX Instruction Set and VMCS Structure Fully Explained

Detailed semantics of VMXON/VMXOFF/VMLAUNCH/VMRESUME/VMREAD/VMWRITE and the six field areas of the VMCS layout.

VMX Root vs Non-root Mode: The Foundation of VT Debuggers

Explains VMX root/non-root dual-mode switching, the VM-exit event flow, and how VT debuggers exploit dual modes for invisible monitoring.

Nested Virtualization: A VM Inside a VM

How nested virtualization works: nested VMCS/VMCB, shadow-VMCS optimization, and its use in WSL2 and cloud environments.

AMD SVM Virtualization Explained: AMD's VT Solution

A full breakdown of AMD SVM (Secure Virtual Machine): VMCB, #VMEXIT, guest/host modes and AMD's hardware virtualization design.

AMD VMCB Deep Dive: Internal Layout of the Virtual Machine Control Block

Field-by-field analysis of the AMD VMCB memory layout: control area, save area, intercept bitmap and precise offsets.

AMD SVM vs Intel VT-x: A Full Comparison and Trade-offs

A systematic comparison of AMD SVM vs Intel VT-x: mode design, state structures, intercept…

AMD SVM vs Intel VT-x: A Full Comparison and Trade-offs

A systematic comparison of AMD SVM vs Intel VT-x: mode design, state structures, interception, nested paging, and ecosystem support.

AMD-Vi IOMMU: Device Virtualization and DMA Isolation

Explains AMD-Vi IOMMU DMA remapping, interrupt remapping and device passthrough, plus its …

AMD-Vi IOMMU: Device Virtualization and DMA Isolation

Explains AMD-Vi IOMMU DMA remapping, interrupt remapping and device passthrough, plus its security roles.

How to Enable AMD SVM Virtualization: BIOS Setup Guide

Step-by-step guide to enabling SVM on AMD platforms: BIOS entry points, naming differences…

How to Enable AMD SVM Virtualization: BIOS Setup Guide

Step-by-step guide to enabling SVM on AMD platforms: BIOS entry points, naming differences, verification and common issues.

How the VT Debugger Works: Invisible Virtualization-Based Debugging

An overview of the VT Debugger: hypervisor-layer isolation, EPT-based residue-free breakpoints, VM-exit event handling and invisible memory access.

VT Debugger Core Features Explained

A feature-by-feature breakdown of the VT Debugger: invisible breakpoints, invisible hooks, kernel-level memory access, process protection and anti-anti-debugging.

VT Debugger Quick Start Guide

A complete getting-started tutorial from download and install to your first breakpoint: requirements, driver loading, attaching and troubleshooting.

How to Check if Your CPU Supports Virtualization (VT-x / AMD-V)

Quickly confirm CPU virtualization support and enablement via Task Manager, systeminfo, CPU-Z and command-line methods.

VT Hook Technique: EPT-Based Residue-Free Hooking

Deep dive into the two core VT Hook implementations: EPT page-remapping hooks and write-protect hooks, and how they defeat integrity checks.

The Principle of Invisible Breakpoints: Core Anti-Anti-Debug Technology

From the detection surface of traditional breakpoints to EPT page-level and virtualized hardware breakpoints: implementation and anti-detection power.

VT Process Protection: Virtualization-Based Anti-Termination, Anti-Injection & Anti-Debug

The VT-layer process protection stack: EPT memory hiding, TerminateProcess interception, anti-injection and anti-debugging.

VT Technology in Anti-Cheat: Principles and Countermeasures

The role of virtualization in anti-cheat: from kernel-level detection to hypervisor-grade monitoring, and the bypass/counter-bypass arms race.

Related Topics

More Resources

Virtualization Technology Intro: From Software Emulation to Hardware Assist

A systematic introduction to virtualization concepts, evolution and taxonomy, and the roles of Intel VT-x and AMD-V.

A Brief History of Hardware Virtualization: The Road of VT-x and AMD-V

A retrospective of three decades of x86 hardware virtualization: binary translation, Intel VT-x, AMD SVM, EPT/NPT, and the modern virtualization security ecosystem.

Intel VT-x Basics: VMX Modes and Core Virtualization Concepts

In-depth explanation of Intel VT-x VMX root/non-root modes, the VM-exit/VM-entry mechanism, and the VMCS virtual machine control structure.

VMX Instruction Set and VMCS Structure Fully Explained

Detailed semantics of VMXON/VMXOFF/VMLAUNCH/VMRESUME/VMREAD/VMWRITE and the six field areas of the VMCS layout.

VMX Root vs Non-root Mode: The Foundation of VT Debuggers

Explains VMX root/non-root dual-mode switching, the VM-exit event flow, and how VT debuggers exploit dual modes for invisible monitoring.

Nested Virtualization: A VM Inside a VM

How nested virtualization works: nested VMCS/VMCB, shadow-VMCS optimization, and its use in WSL2 and cloud environments.

AMD SVM Virtualization Explained: AMD's VT Solution

A full breakdown of AMD SVM (Secure Virtual Machine): VMCB, #VMEXIT, guest/host modes and AMD's hardware virtualization design.

AMD VMCB Deep Dive: Internal Layout of the Virtual Machine Control Block

Field-by-field analysis of the AMD VMCB memory layout: control area, save area, intercept bitmap and precise offsets.

AMD SVM vs Intel VT-x: A Full Comparison and Trade-offs

A systematic comparison of AMD SVM vs Intel VT-x: mode design, state structures, intercept…

AMD SVM vs Intel VT-x: A Full Comparison and Trade-offs

A systematic comparison of AMD SVM vs Intel VT-x: mode design, state structures, interception, nested paging, and ecosystem support.

AMD-Vi IOMMU: Device Virtualization and DMA Isolation

Explains AMD-Vi IOMMU DMA remapping, interrupt remapping and device passthrough, plus its security roles.

How to Enable AMD SVM Virtualization: BIOS Setup Guide

Step-by-step guide to enabling SVM on AMD platforms: BIOS entry points, naming differences, verification and common issues.

How the VT Debugger Works: Invisible Virtualization-Based Debugging

An overview of the VT Debugger: hypervisor-layer isolation, EPT-based residue-free breakpoints, VM-exit event handling and invisible memory access.

VT Debugger Core Features Explained

A feature-by-feature breakdown of the VT Debugger: invisible breakpoints, invisible hooks, kernel-level memory access, process protection and anti-anti-debugging.

VT Debugger Quick Start Guide

A complete getting-started tutorial from download and install to your first breakpoint: requirements, driver loading, attaching and troubleshooting.

How to Check if Your CPU Supports Virtualization (VT-x / AMD-V)

Quickly confirm CPU virtualization support and enablement via Task Manager, systeminfo, CPU-Z and command-line methods.

VT Hook Technique: EPT-Based Residue-Free Hooking

Deep dive into the two core VT Hook implementations: EPT page-remapping hooks and write-protect hooks, and how they defeat integrity checks.

The Principle of Invisible Breakpoints: Core Anti-Anti-Debug Technology

From the detection surface of traditional breakpoints to EPT page-level and virtualized hardware breakpoints: implementation and anti-detection power.

VT Process Protection: Virtualization-Based Anti-Termination, Anti-Injection & Anti-Debug

The VT-layer process protection stack: EPT memory hiding, TerminateProcess interception, anti-injection and anti-debugging.

AMD SVM Virtualization Explained: AMD's VT Solution

A full breakdown of AMD SVM (Secure Virtual Machine): VMCB, #VMEXIT, guest/host modes and …

VT Technology in Anti-Cheat: Principles and Countermeasures

The role of virtualization in anti-cheat: from kernel-level detection to hypervisor-grade monitoring, and the bypass/counter-bypass arms race.