In a virtual computer system, the invention virtualizes a primary
protection mechanism, which restricts memory accesses based on the type
of access attempted and a current hardware privilege level, using a
secondary protection mechanism, which is independent of the hardware
privilege level. The invention may be used to virtualize the protection
mechanisms of the Intel IA-64 architecture. In this embodiment, virtual
access rights settings in a virtual TLB are translated into shadow access
rights settings in a hardware TLB, while virtual protection key settings
in a virtual PKR cache are translated into shadow protection key settings
in a hardware PKR cache, based in part on the virtual access rights
settings. The shadow protection key settings are dependent on the guest
privilege level, but the shadow access rights settings are not.