github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/cpvmm/vmm/vmx/vmcs_internal.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_INTERNAL_H
    16  #define VMCS_INTERNAL_H
    17  
    18  #include <vmm_defs.h>
    19  
    20  void vmcs_destroy_all_msr_lists_internal(struct _VMCS_OBJECT* vmcs,
    21                                           BOOLEAN addresses_are_in_hpa);
    22  
    23  void vmcs_add_msr_to_list(struct _VMCS_OBJECT* vmcs, UINT32 msr_index,
    24                            UINT64 value, VMCS_FIELD list_address,
    25                            VMCS_FIELD list_count, UINT32* max_msrs_counter,
    26                            BOOLEAN is_addres_hpa);
    27  
    28  void vmcs_delete_msr_from_list(struct _VMCS_OBJECT*  vmcs, UINT32  msr_index,
    29                                 VMCS_FIELD list_address, VMCS_FIELD list_count,
    30                                 BOOLEAN is_addres_hpa);
    31  
    32  
    33  INLINE void vmcs_add_msr_to_vmexit_store_list_internal(struct _VMCS_OBJECT* vmcs,
    34                  UINT32 msr_index, UINT64 value, BOOLEAN is_msr_list_addr_hpa) {
    35      vmcs_add_msr_to_list(vmcs, msr_index, value, VMCS_EXIT_MSR_STORE_ADDRESS, 
    36              VMCS_EXIT_MSR_STORE_COUNT, &vmcs->max_num_of_vmexit_store_msrs, 
    37              is_msr_list_addr_hpa);
    38  }
    39  
    40  INLINE void vmcs_add_msr_to_vmexit_load_list_internal(struct _VMCS_OBJECT* vmcs,
    41              UINT32 msr_index, UINT64 value, BOOLEAN is_msr_list_addr_hpa) {
    42      vmcs_add_msr_to_list(vmcs, msr_index, value, VMCS_EXIT_MSR_LOAD_ADDRESS, 
    43              VMCS_EXIT_MSR_LOAD_COUNT, &vmcs->max_num_of_vmexit_load_msrs, 
    44              is_msr_list_addr_hpa);
    45  }
    46  
    47  INLINE void vmcs_add_msr_to_vmenter_load_list_internal(struct _VMCS_OBJECT* vmcs,
    48              UINT32 msr_index, UINT64  value,
    49              BOOLEAN is_msr_list_addr_hpa) {
    50      vmcs_add_msr_to_list(vmcs, msr_index, value, VMCS_ENTER_MSR_LOAD_ADDRESS, 
    51              VMCS_ENTER_MSR_LOAD_COUNT, &vmcs->max_num_of_vmenter_load_msrs, 
    52              is_msr_list_addr_hpa);
    53  }
    54  
    55  
    56  void vmcs_add_msr_to_vmexit_store_and_vmenter_load_lists_internal(
    57              struct _VMCS_OBJECT* vmcs, UINT32 msr_index,
    58              UINT64 value, BOOLEAN is_msr_list_addr_hpa);
    59  
    60  
    61  INLINE void vmcs_delete_msr_from_vmexit_store_list_internal(
    62              struct _VMCS_OBJECT* vmcs, UINT32 msr_index,
    63              BOOLEAN is_msr_list_addr_hpa)
    64  {
    65      vmcs_delete_msr_from_list(vmcs, msr_index, VMCS_EXIT_MSR_STORE_ADDRESS, 
    66              VMCS_EXIT_MSR_STORE_COUNT, is_msr_list_addr_hpa);
    67  }
    68  
    69  
    70  INLINE void vmcs_delete_msr_from_vmexit_load_list_internal(
    71              struct _VMCS_OBJECT* vmcs, UINT32 msr_index,
    72              BOOLEAN is_msr_list_addr_hpa)
    73  {
    74      vmcs_delete_msr_from_list(vmcs, msr_index,VMCS_EXIT_MSR_LOAD_ADDRESS, 
    75                          VMCS_EXIT_MSR_LOAD_COUNT, is_msr_list_addr_hpa);
    76  }
    77  
    78  
    79  INLINE void vmcs_delete_msr_from_vmenter_load_list_internal(
    80              struct _VMCS_OBJECT* vmcs, UINT32 msr_index, 
    81              BOOLEAN is_msr_list_addr_hpa)
    82  {
    83      vmcs_delete_msr_from_list(vmcs, msr_index, VMCS_ENTER_MSR_LOAD_ADDRESS, 
    84              VMCS_ENTER_MSR_LOAD_COUNT, is_msr_list_addr_hpa);
    85  }
    86  
    87  
    88  void vmcs_delete_msr_from_vmexit_store_and_vmenter_load_lists_internal(
    89              struct _VMCS_OBJECT*  vmcs, UINT32 msr_index,
    90              BOOLEAN   is_msr_list_addr_hpa);
    91  
    92  
    93  typedef void (*VMCS_ADD_MSR_FUNC)(struct _VMCS_OBJECT *vmcs, UINT32 msr_index, UINT64 value);
    94  typedef void (*VMCS_CLEAR_MSR_LIST_FUNC)(struct _VMCS_OBJECT* vmcs);
    95  typedef BOOLEAN (*VMCS_IS_MSR_IN_LIST_FUNC)(struct _VMCS_OBJECT* vmcs, UINT32 msr_index);
    96  
    97  #endif