cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

vmcs_shadow_fields.h (3115B)


      1#if !defined(SHADOW_FIELD_RO) && !defined(SHADOW_FIELD_RW)
      2BUILD_BUG_ON(1)
      3#endif
      4
      5#ifndef SHADOW_FIELD_RO
      6#define SHADOW_FIELD_RO(x, y)
      7#endif
      8#ifndef SHADOW_FIELD_RW
      9#define SHADOW_FIELD_RW(x, y)
     10#endif
     11
     12/*
     13 * We do NOT shadow fields that are modified when L0
     14 * traps and emulates any vmx instruction (e.g. VMPTRLD,
     15 * VMXON...) executed by L1.
     16 * For example, VM_INSTRUCTION_ERROR is read
     17 * by L1 if a vmx instruction fails (part of the error path).
     18 * Note the code assumes this logic. If for some reason
     19 * we start shadowing these fields then we need to
     20 * force a shadow sync when L0 emulates vmx instructions
     21 * (e.g. force a sync if VM_INSTRUCTION_ERROR is modified
     22 * by nested_vmx_failValid)
     23 *
     24 * When adding or removing fields here, note that shadowed
     25 * fields must always be synced by prepare_vmcs02, not just
     26 * prepare_vmcs02_rare.
     27 */
     28
     29/*
     30 * Keeping the fields ordered by size is an attempt at improving
     31 * branch prediction in vmcs12_read_any and vmcs12_write_any.
     32 */
     33
     34/* 16-bits */
     35SHADOW_FIELD_RW(GUEST_INTR_STATUS, guest_intr_status)
     36SHADOW_FIELD_RW(GUEST_PML_INDEX, guest_pml_index)
     37SHADOW_FIELD_RW(HOST_FS_SELECTOR, host_fs_selector)
     38SHADOW_FIELD_RW(HOST_GS_SELECTOR, host_gs_selector)
     39
     40/* 32-bits */
     41SHADOW_FIELD_RO(VM_EXIT_REASON, vm_exit_reason)
     42SHADOW_FIELD_RO(VM_EXIT_INTR_INFO, vm_exit_intr_info)
     43SHADOW_FIELD_RO(VM_EXIT_INSTRUCTION_LEN, vm_exit_instruction_len)
     44SHADOW_FIELD_RO(IDT_VECTORING_INFO_FIELD, idt_vectoring_info_field)
     45SHADOW_FIELD_RO(IDT_VECTORING_ERROR_CODE, idt_vectoring_error_code)
     46SHADOW_FIELD_RO(VM_EXIT_INTR_ERROR_CODE, vm_exit_intr_error_code)
     47SHADOW_FIELD_RO(GUEST_CS_AR_BYTES, guest_cs_ar_bytes)
     48SHADOW_FIELD_RO(GUEST_SS_AR_BYTES, guest_ss_ar_bytes)
     49SHADOW_FIELD_RW(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control)
     50SHADOW_FIELD_RW(PIN_BASED_VM_EXEC_CONTROL, pin_based_vm_exec_control)
     51SHADOW_FIELD_RW(EXCEPTION_BITMAP, exception_bitmap)
     52SHADOW_FIELD_RW(VM_ENTRY_EXCEPTION_ERROR_CODE, vm_entry_exception_error_code)
     53SHADOW_FIELD_RW(VM_ENTRY_INTR_INFO_FIELD, vm_entry_intr_info_field)
     54SHADOW_FIELD_RW(VM_ENTRY_INSTRUCTION_LEN, vm_entry_instruction_len)
     55SHADOW_FIELD_RW(TPR_THRESHOLD, tpr_threshold)
     56SHADOW_FIELD_RW(GUEST_INTERRUPTIBILITY_INFO, guest_interruptibility_info)
     57SHADOW_FIELD_RW(VMX_PREEMPTION_TIMER_VALUE, vmx_preemption_timer_value)
     58
     59/* Natural width */
     60SHADOW_FIELD_RO(EXIT_QUALIFICATION, exit_qualification)
     61SHADOW_FIELD_RO(GUEST_LINEAR_ADDRESS, guest_linear_address)
     62SHADOW_FIELD_RW(GUEST_RIP, guest_rip)
     63SHADOW_FIELD_RW(GUEST_RSP, guest_rsp)
     64SHADOW_FIELD_RW(GUEST_CR0, guest_cr0)
     65SHADOW_FIELD_RW(GUEST_CR3, guest_cr3)
     66SHADOW_FIELD_RW(GUEST_CR4, guest_cr4)
     67SHADOW_FIELD_RW(GUEST_RFLAGS, guest_rflags)
     68SHADOW_FIELD_RW(CR0_GUEST_HOST_MASK, cr0_guest_host_mask)
     69SHADOW_FIELD_RW(CR0_READ_SHADOW, cr0_read_shadow)
     70SHADOW_FIELD_RW(CR4_READ_SHADOW, cr4_read_shadow)
     71SHADOW_FIELD_RW(HOST_FS_BASE, host_fs_base)
     72SHADOW_FIELD_RW(HOST_GS_BASE, host_gs_base)
     73
     74/* 64-bit */
     75SHADOW_FIELD_RO(GUEST_PHYSICAL_ADDRESS, guest_physical_address)
     76SHADOW_FIELD_RO(GUEST_PHYSICAL_ADDRESS_HIGH, guest_physical_address)
     77
     78#undef SHADOW_FIELD_RO
     79#undef SHADOW_FIELD_RW