Apex › Systems & OS

How a VM translates memory (nested paging)

Inside a virtual machine, memory is translated twice: the guest OS maps guest-virtual → guest-physical with its own 4-level page tables, and the hypervisor maps guest-physical → host-physical with a second set (Intel EPT / AMD NPT). Because the guest’s page tables sit at guest-physical addresses, every pointer in the guest walk must first be run through the EPT — the linear walk becomes a 2-D grid. Verified in node: the nested result equals composing the two translations, and one translation costs L·(L+2) = 24 memory accesses for 4-level tables (vs 4 bare-metal) — why the TLB matters. Step the 2-D walk.

More in Systems & OS