VirtualBox

source: vbox/trunk/include/VBox/vmm/gcm.h

Last change on this file was 106061, checked in by vboxsync, 2 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
1/** @file
2 * GCM - Guest Compatibility Manager.
3 */
4
5/*
6 * Copyright (C) 2022-2024 Oracle and/or its affiliates.
7 *
8 * This file is part of VirtualBox base platform packages, as
9 * available from https://www.virtualbox.org.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation, in version 3 of the
14 * License.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, see <https://www.gnu.org/licenses>.
23 *
24 * The contents of this file may alternatively be used under the terms
25 * of the Common Development and Distribution License Version 1.0
26 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
27 * in the VirtualBox distribution, in which case the provisions of the
28 * CDDL are applicable instead of those of the GPL.
29 *
30 * You may elect to license modified versions of this file under the
31 * terms and conditions of either the GPL or the CDDL or both.
32 *
33 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
34 */
35
36#ifndef VBOX_INCLUDED_vmm_gcm_h
37#define VBOX_INCLUDED_vmm_gcm_h
38#ifndef RT_WITHOUT_PRAGMA_ONCE
39# pragma once
40#endif
41
42#include <VBox/types.h>
43
44RT_C_DECLS_BEGIN
45
46/** @defgroup grp_gcm The Guest Compatibility Manager API
47 * @ingroup grp_vmm
48 * @{
49 */
50
51#ifdef IN_RING3
52/** @defgroup grp_gcm_r3 The GCM Host Context Ring-3 API
53 * @{
54 */
55VMMR3_INT_DECL(int) GCMR3Init(PVM pVM);
56VMMR3_INT_DECL(int) GCMR3Term(PVM pVM);
57VMMR3_INT_DECL(void) GCMR3Reset(PVM pVM);
58/** @} */
59#endif /* IN_RING3 */
60
61VMM_INT_DECL(bool) GCMIsInterceptingXcptDE(PVMCPUCC pVCpu);
62VMM_INT_DECL(int) GCMXcptDE(PVMCPUCC pVCpu, PCPUMCTX pCtx);
63
64VMM_INT_DECL(bool) GCMIsInterceptingXcptGP(PVMCPUCC pVCpu);
65VMM_INT_DECL(int) GCMXcptGP(PVMCPUCC pVCpu, PCPUMCTX pCtx);
66
67VMM_INT_DECL(VBOXSTRICTRC) GCMInterceptedIOPortRead(PVMCPUCC pVCpu, PCPUMCTX pCtx, uint16_t u16Port, uint8_t cbReg);
68VMM_INT_DECL(bool) GCMIsInterceptingIOPortReadSlow(PVMCPUCC pVCpu, uint16_t u16Port, uint8_t cbReg);
69
70/**
71 * Checks if the given IN instruction is intercepted.
72 */
73DECLINLINE(bool) GCMIsInterceptingIOPortRead(PVMCPUCC pVCpu, uint16_t u16Port, uint8_t cbReg)
74{
75 return u16Port == 0x5658 /* vmware hypervisor port */
76 && cbReg == 4
77 && GCMIsInterceptingIOPortReadSlow(pVCpu, u16Port, cbReg);
78}
79
80#if 0 /* If we need to deal with high speed vmware hypervisor calls */
81VMM_INT_DECL(bool) GCMIsInterceptingIOPortReadStringSlow(PVMCPUCC pVCpu, uint16_t u16Port, uint8_t cbReg);
82VMM_INT_DECL(bool) GCMIsInterceptingIOPortWriteStringSlow(PVMCPUCC pVCpu, uint16_t u16Port, uint8_t cbReg);
83
84/**
85 * Checks if the given INS instruction is intercepted.
86 */
87DECLINLINE(bool) GCMIsInterceptingIOPortReadString(PVMCPUCC pVCpu, uint16_t u16Port, uint8_t cbReg)
88{
89 return u16Port == 0x5659 /* new vmware hypervisor port */
90 && cbReg == 1
91 && GCMIsInterceptingIOPortReadStringSlow(pVCpu, u16Port, cbReg);
92}
93
94/**
95 * Checks if the given OUTS instruction is intercepted.
96 */
97DECLINLINE(bool) GCMIsInterceptingIOPortWriteString(PVMCPUCC pVCpu, uint16_t u16Port, uint8_t cbReg)
98{
99 return u16Port == 0x5659 /* new vmware hypervisor port */
100 && cbReg == 1
101 && GCMIsInterceptingIOPortWriteStringSlow(pVCpu, u16Port, cbReg);
102}
103#endif
104
105/** @} */
106
107RT_C_DECLS_END
108
109#endif /* !VBOX_INCLUDED_vmm_gcm_h */
110
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