vmx_shadow_fields.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #ifndef SHADOW_FIELD_RO
  2. #define SHADOW_FIELD_RO(x)
  3. #endif
  4. #ifndef SHADOW_FIELD_RW
  5. #define SHADOW_FIELD_RW(x)
  6. #endif
  7. /*
  8. * We do NOT shadow fields that are modified when L0
  9. * traps and emulates any vmx instruction (e.g. VMPTRLD,
  10. * VMXON...) executed by L1.
  11. * For example, VM_INSTRUCTION_ERROR is read
  12. * by L1 if a vmx instruction fails (part of the error path).
  13. * Note the code assumes this logic. If for some reason
  14. * we start shadowing these fields then we need to
  15. * force a shadow sync when L0 emulates vmx instructions
  16. * (e.g. force a sync if VM_INSTRUCTION_ERROR is modified
  17. * by nested_vmx_failValid)
  18. *
  19. * When adding or removing fields here, note that shadowed
  20. * fields must always be synced by prepare_vmcs02, not just
  21. * prepare_vmcs02_full.
  22. */
  23. /*
  24. * Keeping the fields ordered by size is an attempt at improving
  25. * branch prediction in vmcs_read_any and vmcs_write_any.
  26. */
  27. /* 16-bits */
  28. SHADOW_FIELD_RW(GUEST_CS_SELECTOR)
  29. SHADOW_FIELD_RW(GUEST_INTR_STATUS)
  30. SHADOW_FIELD_RW(GUEST_PML_INDEX)
  31. SHADOW_FIELD_RW(HOST_FS_SELECTOR)
  32. SHADOW_FIELD_RW(HOST_GS_SELECTOR)
  33. /* 32-bits */
  34. SHADOW_FIELD_RO(VM_EXIT_REASON)
  35. SHADOW_FIELD_RO(VM_EXIT_INTR_INFO)
  36. SHADOW_FIELD_RO(VM_EXIT_INSTRUCTION_LEN)
  37. SHADOW_FIELD_RO(IDT_VECTORING_INFO_FIELD)
  38. SHADOW_FIELD_RO(IDT_VECTORING_ERROR_CODE)
  39. SHADOW_FIELD_RO(VM_EXIT_INTR_ERROR_CODE)
  40. SHADOW_FIELD_RW(CPU_BASED_VM_EXEC_CONTROL)
  41. SHADOW_FIELD_RW(EXCEPTION_BITMAP)
  42. SHADOW_FIELD_RW(VM_ENTRY_EXCEPTION_ERROR_CODE)
  43. SHADOW_FIELD_RW(VM_ENTRY_INTR_INFO_FIELD)
  44. SHADOW_FIELD_RW(VM_ENTRY_INSTRUCTION_LEN)
  45. SHADOW_FIELD_RW(TPR_THRESHOLD)
  46. SHADOW_FIELD_RW(GUEST_CS_LIMIT)
  47. SHADOW_FIELD_RW(GUEST_CS_AR_BYTES)
  48. SHADOW_FIELD_RW(GUEST_INTERRUPTIBILITY_INFO)
  49. SHADOW_FIELD_RW(VMX_PREEMPTION_TIMER_VALUE)
  50. /* Natural width */
  51. SHADOW_FIELD_RO(EXIT_QUALIFICATION)
  52. SHADOW_FIELD_RO(GUEST_LINEAR_ADDRESS)
  53. SHADOW_FIELD_RW(GUEST_RIP)
  54. SHADOW_FIELD_RW(GUEST_RSP)
  55. SHADOW_FIELD_RW(GUEST_CR0)
  56. SHADOW_FIELD_RW(GUEST_CR3)
  57. SHADOW_FIELD_RW(GUEST_CR4)
  58. SHADOW_FIELD_RW(GUEST_RFLAGS)
  59. SHADOW_FIELD_RW(GUEST_CS_BASE)
  60. SHADOW_FIELD_RW(GUEST_ES_BASE)
  61. SHADOW_FIELD_RW(CR0_GUEST_HOST_MASK)
  62. SHADOW_FIELD_RW(CR0_READ_SHADOW)
  63. SHADOW_FIELD_RW(CR4_READ_SHADOW)
  64. SHADOW_FIELD_RW(HOST_FS_BASE)
  65. SHADOW_FIELD_RW(HOST_GS_BASE)
  66. /* 64-bit */
  67. SHADOW_FIELD_RO(GUEST_PHYSICAL_ADDRESS)
  68. SHADOW_FIELD_RO(GUEST_PHYSICAL_ADDRESS_HIGH)
  69. #undef SHADOW_FIELD_RO
  70. #undef SHADOW_FIELD_RW