github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/cpvmm/vmm/include/vmm_callback.h (about)

     1  /*
     2   * Copyright (c) 2013 Intel Corporation
     3   *
     4   * Licensed under the Apache License, Version 2.0 (the "License");
     5   * you may not use this file except in compliance with the License.
     6   * You may obtain a copy of the License at
     7   *     http://www.apache.org/licenses/LICENSE-2.0
     8   * Unless required by applicable law or agreed to in writing, software
     9   * distributed under the License is distributed on an "AS IS" BASIS,
    10   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    11   * See the License for the specific language governing permissions and
    12   * limitations under the License.
    13   */
    14  
    15  #ifndef _VMM_CALLBACK_H
    16  #define _VMM_CALLBACK_H
    17  
    18  #include "vmm_defs.h"
    19  #include "vmm_objects.h"
    20  #include "vmx_vmcs.h"
    21  #include "vmm_arch_defs.h"
    22  
    23  #ifndef INVALID_GUEST_ID
    24  #define INVALID_GUEST_ID    ((GUEST_ID) -1)
    25  #endif
    26  
    27  typedef void* VMM_IDENTIFICATION_DATA;
    28  
    29  typedef struct _GUEST_VCPU {
    30      GUEST_ID guest_id;
    31      CPU_ID   guest_cpu_id; // guest cpu id and not host
    32  } GUEST_VCPU;
    33  
    34  typedef struct _GUEST_DATA {
    35      BOOLEAN primary_guest;
    36      GUEST_ID guest_id;
    37      UINT16 padding;
    38  }GUEST_DATA;
    39  
    40  typedef struct _REPORT_INITIALIZATION_DATA {
    41      UINT16 num_of_cpus;
    42      UINT16 padding[3];
    43      GUEST_DATA guest_data[VMM_MAX_GUESTS_SUPPORTED];
    44  }REPORT_INITIALIZATION_DATA;
    45  
    46  typedef struct _REPORT_EPT_VIOLATION_DATA {
    47  	UINT64 qualification;
    48      UINT64 guest_linear_address;
    49      UINT64 guest_physical_address;
    50  }REPORT_EPT_VIOLATION_DATA;
    51  
    52  typedef struct _REPORT_CR_ACCESS_DATA {
    53      UINT64 qualification;
    54  }REPORT_CR_DR_LOAD_ACCESS_DATA;
    55  
    56  typedef struct _REPORT_DTR_ACCESS_DATA {
    57      UINT64 qualification;
    58      UINT32 instruction_info;
    59      UINT32 padding;
    60  }REPORT_DTR_ACCESS_DATA;
    61  
    62  typedef struct _REPORT_MSR_WRITE_ACCESS_DATA {
    63      UINT32 msr_id;
    64  }REPORT_MSR_WRITE_ACCESS_DATA;
    65  
    66  #ifdef API_NOT_USED
    67  typedef struct _REPORT_MSR_READ_ACCESS_DATA {
    68      UINT32 msr_id;
    69  }REPORT_MSR_READ_ACCESS_DATA;
    70  #endif
    71  
    72  typedef struct _REPORT_SET_ACTIVE_EPTP_DATA {
    73      UINT64 eptp_list_index;
    74      BOOLEAN update_hw;
    75      UINT32 padding;
    76  }REPORT_SET_ACTIVE_EPTP_DATA;
    77  
    78  typedef struct _REPORT_INITIAL_VMEXIT_CHECK_DATA {
    79      UINT64 current_cpu_rip;
    80      UINT32 vmexit_reason;
    81      UINT32 padding;
    82  }REPORT_INITIAL_VMEXIT_CHECK_DATA;
    83  
    84  typedef struct _UVMM_LOG_EVENT_DATA {
    85      UINT32 vector;
    86      UINT32 padding;
    87  }REPORT_VMM_LOG_EVENT_DATA;
    88  
    89  typedef struct _REPORT_VMM_TEARDOWN_DATA {
    90      UINT64 nonce;
    91  }REPORT_VMM_TEARDOWN_DATA;
    92  
    93  typedef struct _REPORT_FAST_VIEW_SWITCH_DATA {
    94      UINT64 reg;
    95  }REPORT_FAST_VIEW_SWITCH_DATA;
    96  
    97  /* UVMM REPORTED EVENTS
    98   * This enumeration specify the supported events reported by uVMM to the
    99   * supporting modules.
   100   */
   101  #ifndef UVMM_EVENT
   102  typedef enum {
   103      // Initialization before the APs have started
   104      UVMM_EVENT_INITIALIZATION_BEFORE_APS_STARTED,
   105  
   106      // Initialization after the APs have launched the guest
   107      UVMM_EVENT_INITIALIZATION_AFTER_APS_STARTED,
   108  
   109      // EPT Violation
   110      UVMM_EVENT_EPT_VIOLATION,
   111  
   112      // MTF VMExit
   113      UVMM_EVENT_MTF_VMEXIT,
   114  
   115      // CR Access VMExit
   116      UVMM_EVENT_CR_ACCESS,
   117  
   118      // DR Load Access VMExit
   119      UVMM_EVENT_DR_LOAD_ACCESS,
   120  
   121      // LDTR Load Access VMExit
   122      UVMM_EVENT_LDTR_LOAD_ACCESS,
   123  
   124      // GDTR Load Access VMExit
   125      UVMM_EVENT_GDTR_IDTR_ACCESS,
   126  
   127      // MSR Read Access VMExit
   128      UVMM_EVENT_MSR_READ_ACCESS,
   129  
   130      // MSR Write Access VMExit
   131      UVMM_EVENT_MSR_WRITE_ACCESS,
   132  
   133      // Set Active View (for Fast View Switch)
   134      UVMM_EVENT_SET_ACTIVE_EPTP,
   135  
   136      // Check for MTF at the start of VMExit
   137      UVMM_EVENT_INITIAL_VMEXIT_CHECK,
   138  
   139      // Check for single stepping
   140      UVMM_EVENT_SINGLE_STEPPING_CHECK,
   141  
   142      // VMM Teardown VMExit
   143      UVMM_EVENT_VMM_TEARDOWN,
   144  
   145      // Fast View Switch Event
   146      UVMM_EVENT_INVALID_FAST_VIEW_SWITCH,
   147  
   148      // VMX Timer VMExit
   149      UVMM_EVENT_VMX_PREEMPTION_TIMER,
   150  
   151      // Halt Instruction VMExit
   152      UVMM_EVENT_HALT_INSTRUCTION,
   153  
   154      // IO Instruction VMExit
   155      UVMM_EVENT_IO_INSTRUCTION,
   156  
   157      // NMI event handling
   158      UVMM_EVENT_NMI,
   159  
   160      // Event log
   161      UVMM_EVENT_LOG,
   162  
   163      // Update active view
   164      UVMM_EVENT_UPDATE_ACTIVE_VIEW,
   165  
   166      // VMM_ASSERT handling
   167      UVMM_EVENT_VMM_ASSERT,
   168  
   169      UVMM_EVENT_MAX_COUNT
   170  } UVMM_EVENT;
   171  #endif
   172  
   173  extern BOOLEAN report_uvmm_event(UVMM_EVENT event, VMM_IDENTIFICATION_DATA gcpu, const GUEST_VCPU *vcpu_id, void *event_specific_data);
   174  
   175  #endif //_VMM_CALLBACK_H