github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/cpvmm/vmm/include/vmcs_actual.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 _VMCS_HW_OBJECT_H_ 16 #define _VMCS_HW_OBJECT_H_ 17 18 #include "vmm_objects.h" 19 #include "vmcs_api.h" 20 21 // 22 // VMCS Instruction error 23 // 24 typedef enum _VMCS_INSTRUCTION_ERROR { 25 VMCS_INSTR_NO_INSTRUCTION_ERROR = 0, // VMxxxxx 26 VMCS_INSTR_VMCALL_IN_ROOT_ERROR, // VMCALL 27 VMCS_INSTR_VMCLEAR_INVALID_PHYSICAL_ADDRESS_ERROR, // VMCLEAR 28 VMCS_INSTR_VMCLEAR_WITH_CURRENT_CONTROLLING_PTR_ERROR, // VMCLEAR 29 VMCS_INSTR_VMLAUNCH_WITH_NON_CLEAR_VMCS_ERROR, // VMLAUNCH 30 VMCS_INSTR_VMRESUME_WITH_NON_LAUNCHED_VMCS_ERROR, // VMRESUME 31 VMCS_INSTR_VMRESUME_WITH_NON_CHILD_VMCS_ERROR, // VMRESUME 32 VMCS_INSTR_VMENTER_BAD_CONTROL_FIELD_ERROR, // VMENTER 33 VMCS_INSTR_VMENTER_BAD_MONITOR_STATE_ERROR, // VMENTER 34 VMCS_INSTR_VMPTRLD_INVALID_PHYSICAL_ADDRESS_ERROR, // VMPTRLD 35 VMCS_INSTR_VMPTRLD_WITH_CURRENT_CONTROLLING_PTR_ERROR, // VMPTRLD 36 VMCS_INSTR_VMPTRLD_WITH_BAD_REVISION_ID_ERROR, // VMPTRLD 37 VMCS_INSTR_VMREAD_OR_VMWRITE_OF_UNSUPPORTED_COMPONENT_ERROR, // VMREAD 38 VMCS_INSTR_VMWRITE_OF_READ_ONLY_COMPONENT_ERROR, // VMWRITE 39 VMCS_INSTR_VMWRITE_INVALID_FIELD_VALUE_ERROR, // VMWRITE 40 VMCS_INSTR_VMXON_IN_VMX_ROOT_OPERATION_ERROR, // VMXON 41 VMCS_INSTR_VMENTRY_WITH_BAD_OSV_CONTROLLING_VMCS_ERROR, // VMENTER 42 VMCS_INSTR_VMENTRY_WITH_NON_LAUNCHED_OSV_CONTROLLING_VMCS_ERROR, // VMENTER 43 VMCS_INSTR_VMENTRY_WITH_NON_ROOT_OSV_CONTROLLING_VMCS_ERROR, // VMENTER 44 VMCS_INSTR_VMCALL_WITH_NON_CLEAR_VMCS_ERROR, // VMCALL 45 VMCS_INSTR_VMCALL_WITH_BAD_VMEXIT_FIELDS_ERROR, // VMCALL 46 VMCS_INSTR_VMCALL_WITH_INVALID_MSEG_MSR_ERROR, // VMCALL 47 VMCS_INSTR_VMCALL_WITH_INVALID_MSEG_REVISION_ERROR, // VMCALL 48 VMCS_INSTR_VMXOFF_WITH_CONFIGURED_SMM_MONITOR_ERROR, // VMXOFF 49 VMCS_INSTR_VMCALL_WITH_BAD_SMM_MONITOR_FEATURES_ERROR, // VMCALL 50 VMCS_INSTR_RETURN_FROM_SMM_WITH_BAD_VM_EXECUTION_CONTROLS_ERROR, // Return from SMM 51 VMCS_INSTR_VMENTRY_WITH_EVENTS_BLOCKED_BY_MOV_SS_ERROR, // VMENTER 52 VMCS_INSTR_BAD_ERROR_CODE, // Bad error code 53 VMCS_INSTR_INVALIDATION_WITH_INVALID_OPERAND // INVEPT, INVVPID 54 } VMCS_INSTRUCTION_ERROR; 55 56 57 struct _VMCS_OBJECT * vmcs_act_create(GUEST_CPU_HANDLE gcpu); 58 59 // Functions which are not a part of general VMCS API, 60 // but are specific to VMCS applied to real hardware 61 void vmcs_clear_cache( VMCS_OBJECT *); 62 void vmcs_activate(VMCS_OBJECT *); 63 void vmcs_deactivate(VMCS_OBJECT *); 64 BOOLEAN vmcs_launch_required(const VMCS_OBJECT *); 65 void vmcs_set_launch_required(VMCS_OBJECT *); 66 void vmcs_set_launched(VMCS_OBJECT *); 67 void vmcs_nmi_handler(struct _VMCS_OBJECT *vmcs); 68 void vmcs_write_nmi_window_bit(struct _VMCS_OBJECT *vmcs, BOOLEAN value); 69 BOOLEAN vmcs_read_nmi_window_bit(struct _VMCS_OBJECT *vmcs); 70 71 void nmi_window_update_before_vmresume(struct _VMCS_OBJECT *vmcs); 72 VMCS_INSTRUCTION_ERROR vmcs_last_instruction_error_code( 73 const VMCS_OBJECT* obj, const char** error_message); 74 75 #endif // _VMCS_HW_OBJECT_H_ 76