VirtualBox

source: vbox/trunk/include/VBox/vmm/gim.h@ 51934

Last change on this file since 51934 was 51797, checked in by vboxsync, 10 years ago

VMM/GIM/Minimal: OS X bits.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.5 KB
Line 
1/** @file
2 * GIM - Guest Interface Manager.
3 */
4
5/*
6 * Copyright (C) 2014 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef ___VBox_vmm_gim_h
27#define ___VBox_vmm_gim_h
28
29#include <VBox/cdefs.h>
30#include <VBox/types.h>
31#include <VBox/param.h>
32
33#include <VBox/vmm/cpum.h>
34
35/** The value used to specify that VirtualBox must use the newest
36 * implementation version of the GIM provider. */
37#define GIM_VERSION_LATEST UINT32_C(0)
38
39RT_C_DECLS_BEGIN
40
41/** @defgroup grp_gim The Guest Interface Manager API
42 * @{
43 */
44
45/**
46 * GIM Guest OS type Identifiers.
47 *
48 * Warning!! The enum values -must- be contiguous for less-than/greater-than
49 * range comparisons while casting from uint32_t.
50 *
51 * When adding OS X guest IDs, make sure to update GIMR3IsOSXGuest().
52 */
53typedef enum GIMOSID
54{
55 GIMOSID_UNKNOWN = 0,
56 GIMOSID_OSX,
57 GIMOSID_OSX_64,
58 GIMOSID_OSX_106,
59 GIMOSID_OSX_106_64,
60 GIMOSID_OSX_107,
61 GIMOSID_OSX_107_64,
62 GIMOSID_OSX_108,
63 GIMOSID_OSX_108_64,
64 GIMOSID_OSX_109,
65 GIMOSID_OSX_109_64,
66 /** End of valid Guest IDs. */
67 GIMOSID_END
68} GIMOSID;
69AssertCompileSize(GIMOSID, sizeof(uint32_t));
70
71
72/**
73 * GIM Provider Identifiers.
74 */
75typedef enum GIMPROVIDERID
76{
77 /** None. */
78 GIMPROVIDERID_NONE = 0,
79 /** Minimal. */
80 GIMPROVIDERID_MINIMAL,
81 /** Microsoft Hyper-V. */
82 GIMPROVIDERID_HYPERV,
83 /** Linux KVM Interface. */
84 GIMPROVIDERID_KVM
85} GIMPROVIDERID;
86AssertCompileSize(GIMPROVIDERID, sizeof(uint32_t));
87
88
89/**
90 * A GIM MMIO2 region record.
91 */
92typedef struct GIMMMIO2REGION
93{
94 /** The region index. */
95 uint8_t iRegion;
96 /** Whether an RC mapping is required. */
97 bool fRCMapping;
98 /** Whether this region has been registered. */
99 bool fRegistered;
100 /** Whether this region is currently mapped. */
101 bool fMapped;
102 /** Alignment padding. */
103 uint8_t au8Alignment0[3];
104 /** Size of the region (must be page aligned). */
105 uint32_t cbRegion;
106 /** Alignment padding. */
107 uint32_t u32Alignment0;
108 /** The host ring-0 address of the first page in the region. */
109 R0PTRTYPE(void *) pvPageR0;
110 /** The host ring-3 address of the first page in the region. */
111 R3PTRTYPE(void *) pvPageR3;
112 /** The ring-context address of the first page in the region. */
113 RCPTRTYPE(void *) pvPageRC;
114 /** The guest-physical address of the first page in the region. */
115 RTGCPHYS GCPhysPage;
116 /** The description of the region. */
117 char szDescription[32];
118} GIMMMIO2REGION;
119/** Pointer to a GIM MMIO2 region. */
120typedef GIMMMIO2REGION *PGIMMMIO2REGION;
121/** Pointer to a const GIM MMIO2 region. */
122typedef GIMMMIO2REGION const *PCGIMMMIO2REGION;
123AssertCompileMemberAlignment(GIMMMIO2REGION, cbRegion, 8);
124AssertCompileMemberAlignment(GIMMMIO2REGION, pvPageR0, 8);
125
126
127#if 0
128/**
129 * A GIM Hypercall handler.
130 *
131 * @param pVM Pointer to the VMCPU.
132 * @param pCtx Pointer to the guest-CPU context.
133 */
134typedef DECLCALLBACK(int) FNGIMHYPERCALL(PVMCPU pVCpu, PCPUMCTX pCtx);
135/** Pointer to a GIM hypercall handler. */
136typedef FNGIMHYPERCALL *PFNGIMHYPERCALL;
137
138/**
139 * A GIM MSR-read handler.
140 *
141 * @returns VBox status code.
142 * @param pVM Pointer to the VMCPU.
143 * @param idMsr The MSR being read.
144 * @param pRange The range that the MSR belongs to.
145 * @param puValue Where to store the value of the MSR.
146 */
147typedef DECLCALLBACK(int) FNGIMRDMSR(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue);
148/** Pointer to a GIM MSR-read handler. */
149typedef FNGIMRDMSR *PFNGIMRDMSR;
150
151/**
152 * A GIM MSR-write handler.
153 *
154 * @returns VBox status code.
155 * @param pVM Pointer to the VMCPU.
156 * @param idMsr The MSR being written.
157 * @param pRange The range that the MSR belongs to.
158 * @param uValue The value to set, ignored bits masked.
159 * @param uRawValue The raw value with the ignored bits not masked.
160 */
161typedef DECLCALLBACK(int) FNGIMWRMSR(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue);
162/** Pointer to a GIM MSR-write handler. */
163typedef FNGIMWRMSR *PFNGIMWRMSR;
164#endif
165
166
167#ifdef IN_RC
168/** @defgroup grp_gim_rc The GIM Raw-mode Context API
169 * @ingroup grp_gim
170 * @{
171 */
172/** @} */
173#endif /* IN_RC */
174
175#ifdef IN_RING0
176/** @defgroup grp_gim_r0 The GIM Host Context Ring-0 API
177 * @ingroup grp_gim
178 * @{
179 */
180VMMR0_INT_DECL(int) GIMR0InitVM(PVM pVM);
181VMMR0_INT_DECL(int) GIMR0TermVM(PVM pVM);
182VMMR0_INT_DECL(int) GIMR0UpdateParavirtTsc(PVM pVM, uint64_t u64Offset);
183/** @} */
184#endif /* IN_RING0 */
185
186
187#ifdef IN_RING3
188/** @defgroup grp_gim_r3 The GIM Host Context Ring-3 API
189 * @ingroup grp_gim
190 * @{
191 */
192VMMR3_INT_DECL(int) GIMR3Init(PVM pVM);
193VMMR3_INT_DECL(int) GIMR3Term(PVM pVM);
194VMMR3_INT_DECL(void) GIMR3Reset(PVM pVM);
195VMMR3DECL(void) GIMR3GimDeviceRegister(PVM pVM, PPDMDEVINS pDevIns);
196VMMR3DECL(PGIMMMIO2REGION) GIMR3GetMmio2Regions(PVM pVM, uint32_t *pcRegions);
197/** @} */
198#endif /* IN_RING3 */
199
200VMMDECL(bool) GIMIsEnabled(PVM pVM);
201VMMDECL(GIMPROVIDERID) GIMGetProvider(PVM pVM);
202VMMDECL(bool) GIMIsParavirtTscEnabled(PVM pVM);
203VMM_INT_DECL(int) GIMHypercall(PVMCPU pVCpu, PCPUMCTX pCtx);
204VMM_INT_DECL(int) GIMReadMsr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue);
205VMM_INT_DECL(int) GIMWriteMsr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue);
206
207/** @} */
208
209RT_C_DECLS_END
210
211#endif /* ___VBox_vmm_gim_h */
212
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette