VirtualBox

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

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

Added support for GIM Hyper-V hypercalls and guest debugging.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.2 KB
Line 
1/** @file
2 * GIM - Guest Interface Manager.
3 */
4
5/*
6 * Copyright (C) 2014-2015 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#include <VBox/vmm/pdmifs.h>
35
36/** The value used to specify that VirtualBox must use the newest
37 * implementation version of the GIM provider. */
38#define GIM_VERSION_LATEST UINT32_C(0)
39
40RT_C_DECLS_BEGIN
41
42/** @defgroup grp_gim The Guest Interface Manager API
43 * @{
44 */
45
46/**
47 * GIM Provider Identifiers.
48 * @remarks Part of saved state!
49 */
50typedef enum GIMPROVIDERID
51{
52 /** None. */
53 GIMPROVIDERID_NONE = 0,
54 /** Minimal. */
55 GIMPROVIDERID_MINIMAL,
56 /** Microsoft Hyper-V. */
57 GIMPROVIDERID_HYPERV,
58 /** Linux KVM Interface. */
59 GIMPROVIDERID_KVM
60} GIMPROVIDERID;
61AssertCompileSize(GIMPROVIDERID, sizeof(uint32_t));
62
63
64/**
65 * A GIM MMIO2 region record.
66 */
67typedef struct GIMMMIO2REGION
68{
69 /** The region index. */
70 uint8_t iRegion;
71 /** Whether an RC mapping is required. */
72 bool fRCMapping;
73 /** Whether this region has been registered. */
74 bool fRegistered;
75 /** Whether this region is currently mapped. */
76 bool fMapped;
77 /** Alignment padding. */
78 uint8_t au8Alignment0[3];
79 /** Size of the region (must be page aligned). */
80 uint32_t cbRegion;
81 /** Alignment padding. */
82 uint32_t u32Alignment0;
83 /** The host ring-0 address of the first page in the region. */
84 R0PTRTYPE(void *) pvPageR0;
85 /** The host ring-3 address of the first page in the region. */
86 R3PTRTYPE(void *) pvPageR3;
87 /** The ring-context address of the first page in the region. */
88 RCPTRTYPE(void *) pvPageRC;
89 /** The guest-physical address of the first page in the region. */
90 RTGCPHYS GCPhysPage;
91 /** The description of the region. */
92 char szDescription[32];
93} GIMMMIO2REGION;
94/** Pointer to a GIM MMIO2 region. */
95typedef GIMMMIO2REGION *PGIMMMIO2REGION;
96/** Pointer to a const GIM MMIO2 region. */
97typedef GIMMMIO2REGION const *PCGIMMMIO2REGION;
98AssertCompileMemberAlignment(GIMMMIO2REGION, cbRegion, 8);
99AssertCompileMemberAlignment(GIMMMIO2REGION, pvPageR0, 8);
100
101#if 0
102/**
103 * A GIM Hypercall handler.
104 *
105 * @param pVM Pointer to the VMCPU.
106 * @param pCtx Pointer to the guest-CPU context.
107 */
108typedef DECLCALLBACK(int) FNGIMHYPERCALL(PVMCPU pVCpu, PCPUMCTX pCtx);
109/** Pointer to a GIM hypercall handler. */
110typedef FNGIMHYPERCALL *PFNGIMHYPERCALL;
111
112/**
113 * A GIM MSR-read handler.
114 *
115 * @returns VBox status code.
116 * @param pVM Pointer to the VMCPU.
117 * @param idMsr The MSR being read.
118 * @param pRange The range that the MSR belongs to.
119 * @param puValue Where to store the value of the MSR.
120 */
121typedef DECLCALLBACK(int) FNGIMRDMSR(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue);
122/** Pointer to a GIM MSR-read handler. */
123typedef FNGIMRDMSR *PFNGIMRDMSR;
124
125/**
126 * A GIM MSR-write handler.
127 *
128 * @returns VBox status code.
129 * @param pVM Pointer to the VMCPU.
130 * @param idMsr The MSR being written.
131 * @param pRange The range that the MSR belongs to.
132 * @param uValue The value to set, ignored bits masked.
133 * @param uRawValue The raw value with the ignored bits not masked.
134 */
135typedef DECLCALLBACK(int) FNGIMWRMSR(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue);
136/** Pointer to a GIM MSR-write handler. */
137typedef FNGIMWRMSR *PFNGIMWRMSR;
138#endif
139
140
141#ifdef IN_RC
142/** @defgroup grp_gim_rc The GIM Raw-mode Context API
143 * @{
144 */
145/** @} */
146#endif /* IN_RC */
147
148#ifdef IN_RING0
149/** @defgroup grp_gim_r0 The GIM Host Context Ring-0 API
150 * @{
151 */
152VMMR0_INT_DECL(int) GIMR0InitVM(PVM pVM);
153VMMR0_INT_DECL(int) GIMR0TermVM(PVM pVM);
154VMMR0_INT_DECL(int) GIMR0UpdateParavirtTsc(PVM pVM, uint64_t u64Offset);
155/** @} */
156#endif /* IN_RING0 */
157
158
159#ifdef IN_RING3
160/** @defgroup grp_gim_r3 The GIM Host Context Ring-3 API
161 * @{
162 */
163VMMR3_INT_DECL(int) GIMR3Init(PVM pVM);
164VMMR3_INT_DECL(int) GIMR3InitCompleted(PVM pVM);
165VMMR3_INT_DECL(int) GIMR3Term(PVM pVM);
166VMMR3_INT_DECL(void) GIMR3Reset(PVM pVM);
167VMMR3DECL(void) GIMR3GimDeviceRegister(PVM pVM, PPDMDEVINS pDevInsR3, PPDMISTREAM pDebugStreamR3);
168VMMR3DECL(PGIMMMIO2REGION) GIMR3GetMmio2Regions(PVM pVM, uint32_t *pcRegions);
169/** @} */
170#endif /* IN_RING3 */
171
172VMMDECL(bool) GIMIsEnabled(PVM pVM);
173VMMDECL(GIMPROVIDERID) GIMGetProvider(PVM pVM);
174VMM_INT_DECL(bool) GIMIsParavirtTscEnabled(PVM pVM);
175VMM_INT_DECL(bool) GIMAreHypercallsEnabled(PVMCPU pVCpu);
176VMM_INT_DECL(int) GIMHypercall(PVMCPU pVCpu, PCPUMCTX pCtx);
177VMM_INT_DECL(int) GIMXcptUD(PVMCPU pVCpu, PCPUMCTX pCtx, PDISCPUSTATE pDis);
178VMM_INT_DECL(bool) GIMShouldTrapXcptUD(PVMCPU pVCpu);
179VMM_INT_DECL(VBOXSTRICTRC) GIMReadMsr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t *puValue);
180VMM_INT_DECL(VBOXSTRICTRC) GIMWriteMsr(PVMCPU pVCpu, uint32_t idMsr, PCCPUMMSRRANGE pRange, uint64_t uValue, uint64_t uRawValue);
181/** @} */
182
183RT_C_DECLS_END
184
185#endif
186
Note: See TracBrowser for help on using the repository browser.

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