]> git.saurik.com Git - apple/xnu.git/blob - osfmk/i386/vmx/vmx_cpu.h
xnu-2050.18.24.tar.gz
[apple/xnu.git] / osfmk / i386 / vmx / vmx_cpu.h
1 /*
2 * Copyright (c) 2006 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
14 *
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
25 *
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28
29 #ifndef _I386_VMX_CPU_H_
30 #define _I386_VMX_CPU_H_
31
32 #include <mach/machine/vm_types.h>
33 #include <mach/boolean.h>
34 #include <i386/vmx/vmx_asm.h>
35
36 /*
37 * Physical CPU's VMX specifications
38 *
39 */
40 typedef struct vmx_specs {
41 boolean_t initialized; /* the specs have already been read */
42 boolean_t vmx_present; /* VMX feature available and enabled */
43 uint32_t vmcs_id; /* VMCS revision identifier */
44 uint8_t vmcs_mem_type; /* VMCS memory type, (see enum above) */
45 uint16_t vmcs_size; /* VMCS region size in bytes */
46 boolean_t act_halt; /* HLT activity state supported */
47 boolean_t act_shutdown; /* shutdown activity state supported */
48 boolean_t act_SIPI; /* wait-for-SIPI activity supported */
49 boolean_t act_CSTATE; /* C-state activity state supported */
50 uint8_t cr3_targs; /* CR3 target values supported */
51 uint32_t max_msrs; /* max MSRs to load/store on VMX transition */
52 uint32_t mseg_id; /* MSEG revision identifier for SMI */
53 /*
54 * Allowed settings for these controls are specified by
55 * a pair of bitfields: 0-settings contain 0 bits
56 * corresponding to controls thay may be 0; 1-settings
57 * contain 1 bits corresponding to controls that may be 1.
58 */
59 uint32_t pin_exctls_0; /* allowed 0s pin-based controls */
60 uint32_t pin_exctls_1; /* allowed 1s pin-based controls */
61
62 uint32_t proc_exctls_0; /* allowed 0s proc-based controls */
63 uint32_t proc_exctls_1; /* allowed 1s proc-based controls */
64
65 uint32_t sec_exctls_0; /* allowed 0s 2ndary proc-based ctrls */
66 uint32_t sec_exctls_1; /* allowed 1s 2ndary proc-based ctrls */
67
68 uint32_t exit_ctls_0; /* allowed 0s VM-exit controls */
69 uint32_t exit_ctls_1; /* allowed 1s VM-exit controls */
70
71 uint32_t enter_ctls_0; /* allowed 0s VM-entry controls */
72 uint32_t enter_ctls_1; /* allowed 1s VM-entry controls */
73
74 /*
75 * Fixed control register bits are specified by a pair of
76 * bitfields: 0-settings contain 0 bits corresponding to
77 * CR bits that may be 0; 1-settings contain 1 bits
78 * corresponding to CR bits that may be 1.
79 */
80 uint32_t cr0_fixed_0; /* allowed 0-settings for CR0 */
81 uint32_t cr0_fixed_1; /* allowed 1-settings for CR0 */
82
83 uint32_t cr4_fixed_0; /* allowed 0-settings for CR4 */
84 uint32_t cr4_fixed_1; /* allowed 1-settings for CR4 */
85 } vmx_specs_t;
86
87 typedef struct vmx_cpu {
88 vmx_specs_t specs; /* this phys CPU's VMX specifications */
89 void *vmxon_region; /* the logical address of the VMXON region page */
90 } vmx_cpu_t;
91
92 void vmx_get_specs(void);
93 void vmx_resume(void);
94 void vmx_suspend(void);
95
96 /*
97 * __vmxoff -- Leave VMX Operation
98 *
99 */
100 extern int __vmxoff(void);
101
102 /*
103 * __vmxon -- Enter VMX Operation
104 *
105 */
106 extern int __vmxon(addr64_t v);
107
108 #endif /* _I386_VMX_CPU_H_ */