github.com/jlmucb/cloudproxy@v0.0.0-20170830161738-b5aa0b619bc4/cpvmm/common/include/arch/ia32_low_level.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 _IA32_LOW_LEVEL_H_
    16  #define _IA32_LOW_LEVEL_H_
    17  
    18  #include "ia32_defs.h"
    19  
    20  UINT32 ia32_read_cr0(void);
    21  void   ia32_write_cr0(UINT32 value);
    22  UINT32 ia32_read_cr2(void);
    23  UINT32 ia32_read_cr3(void);
    24  void   ia32_write_cr3(UINT32 value);
    25  UINT32 ia32_read_cr4(void);
    26  void   ia32_write_cr4(UINT32 value);
    27  void   ia32_write_gdtr(IA32_GDTR *p_descriptor);
    28  void   ia32_read_gdtr(IA32_GDTR *p_descriptor);
    29  void   ia32_read_idtr(IA32_IDTR *p_descriptor);
    30  void   ia32_write_idtr(IA32_IDTR *p_descriptor);
    31  UINT16 ia32_read_ldtr(void);
    32  UINT16 ia32_read_tr(void);
    33  void   ia32_read_msr(UINT32 msr_id, UINT64 *p_value);
    34  void   ia32_write_msr(UINT32 msr_id, UINT64 *p_value);
    35  UINT32 ia32_read_eflags(void);
    36  UINT16 ia32_read_cs(void);
    37  UINT16 ia32_read_ds(void);
    38  UINT16 ia32_read_es(void);
    39  UINT16 ia32_read_fs(void);
    40  UINT16 ia32_read_gs(void);
    41  UINT16 ia32_read_ss(void);
    42  
    43  // CPUID
    44  extern void __cpuid(int CPUInfo[4], int InfoType);  // compiler intrinsic
    45  #define CPUID_EAX 0
    46  #define CPUID_EBX 1
    47  #define CPUID_ECX 2
    48  #define CPUID_EDX 3
    49  #define ia32_cpuid  __cpuid
    50  
    51  void CDECL ia32_cpu_id(int CPUInfo[4], int InfoType);
    52                 // This function is for use when the compiler intrinsic
    53                 // is not available
    54  #endif // _IA32_LOW_LEVEL_H_
    55