IO operations and MOV to/from CR3

Onkar N Mahajan kernzap at gmail.com
Sat Oct 27 10:42:13 EDT 2012


Hi List, 

I prepared some notes for CR3 involvement in different IO
operations, so here are the notes

- memory-mapped IO & DMA IO: 
    - Each such operation involves MOV to/from CR3 :
        - MOV from CR3 causes "Unconditional VM exit"
        - MOV to CR3 causes "Conditional VM exit" :
            - The MOV to CR3 instruction causes a VM exit unless the 
              value of its source operand is equal to one of the 
              CR3-target values specified in the VMCS (controlled by 
              Hypervisor). This feature allows a guest kernel to 
              change the CR3 value without causing a world switch to   
              the hypervisor, provided that the value written into     
              the CR3 register was previously specified by the 
              hypervisor in the CR3-Target registers. An execution of 
              MOV to CR3 in VMX non-root operation does not cause a VM 
              exit if its source operand matches one of these 
              previsously stored values. If the CR3-target count is n, 
              only the first n (0 .. (n-1)) CR3-target 
              values do not cause VM-Exit. nth value causes VM-Exit. 
              if n=0 , MOV to CR3 always causes VM-Exit.

Please comment if I understood something incorrectly here.

Regards,
K Arun Kumar




More information about the Kernelnewbies mailing list