Various embodiments of the present invention are directed to efficient methods for virtual-
machine monitors to detect, at run time, initial attempts by guest operating systems and other higher-level
software to access or execute particular instructions or values corresponding to the particular instructions, that, when accessed for execution, need to be emulated by a virtual-
machine monitor, rather than directly accessed by guest operating systems. In certain embodiments of the present invention, the virtual-
machine monitor assigns various guest-operating-
system-code-containing memory pages to one of a small number of protection-key domains. By doing so, the virtual-machine monitor can arrange for any initial access to the memory pages assigned to the protection-key domains to generate a key-permission fault, after which the key-permission-fault handler of the virtual-machine monitor is invoked to arrange for subsequent, efficient access or emulation of access to the protected pages. In alternative embodiments, protection domains can be implemented by using page-level access rights or translation-lookaside-buffer entry fields.