VirtualBox

source: vbox/trunk/src/VBox/VMM/VMMAll/NEMAll.cpp@ 96860

Last change on this file since 96860 was 96407, checked in by vboxsync, 22 months ago

scm copyright and license note update

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 KB
RevLine 
[70955]1/* $Id: NEMAll.cpp 96407 2022-08-22 17:43:14Z vboxsync $ */
2/** @file
3 * NEM - Native execution manager, R0 and R3 context code.
4 */
5
6/*
[96407]7 * Copyright (C) 2018-2022 Oracle and/or its affiliates.
[70955]8 *
[96407]9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
[70955]26 */
27
28
29/*********************************************************************************************************************************
30* Header Files *
31*********************************************************************************************************************************/
32#define LOG_GROUP LOG_GROUP_NEM
33#include <VBox/vmm/nem.h>
34#include "NEMInternal.h"
[80239]35#include <VBox/vmm/vmcc.h>
[76397]36#include <VBox/err.h>
[70955]37
38
[72343]39/**
40 * Checks if this VM is in NEM mode and is long-mode capable.
41 *
42 * Use VMR3IsLongModeAllowed() instead of this, when possible.
43 *
44 * @returns true if long mode is allowed, false otherwise.
45 * @param pVM The cross context VM structure.
46 * @sa VMR3IsLongModeAllowed, HMIsLongModeAllowed
47 */
[80239]48VMM_INT_DECL(bool) NEMHCIsLongModeAllowed(PVMCC pVM)
[72343]49{
50 return pVM->nem.s.fAllow64BitGuests && VM_IS_NEM_ENABLED(pVM);
51}
[70955]52
[72343]53
[70955]54/**
55 * Physical access handler registration notification.
56 *
57 * @param pVM The cross context VM structure.
58 * @param enmKind The kind of access handler.
59 * @param GCPhys Start of the access handling range.
60 * @param cb Length of the access handling range.
61 *
62 * @note Called while holding down the PGM lock.
63 */
[80239]64VMM_INT_DECL(void) NEMHCNotifyHandlerPhysicalRegister(PVMCC pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb)
[70955]65{
[72272]66#ifdef VBOX_WITH_NATIVE_NEM
[70977]67 if (VM_IS_NEM_ENABLED(pVM))
[71152]68 nemHCNativeNotifyHandlerPhysicalRegister(pVM, enmKind, GCPhys, cb);
[70955]69#else
70 RT_NOREF(pVM, enmKind, GCPhys, cb);
71#endif
72}
73
74
[80239]75VMM_INT_DECL(void) NEMHCNotifyHandlerPhysicalModify(PVMCC pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhysOld,
[70955]76 RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fRestoreAsRAM)
77{
[72272]78#ifdef VBOX_WITH_NATIVE_NEM
[70977]79 if (VM_IS_NEM_ENABLED(pVM))
[71152]80 nemHCNativeNotifyHandlerPhysicalModify(pVM, enmKind, GCPhysOld, GCPhysNew, cb, fRestoreAsRAM);
[70977]81#else
[70955]82 RT_NOREF(pVM, enmKind, GCPhysOld, GCPhysNew, cb, fRestoreAsRAM);
[70977]83#endif
[70955]84}
85
[70977]86
[80239]87VMM_INT_DECL(int) NEMHCNotifyPhysPageAllocated(PVMCC pVM, RTGCPHYS GCPhys, RTHCPHYS HCPhys, uint32_t fPageProt,
[70977]88 PGMPAGETYPE enmType, uint8_t *pu2State)
89{
90 Assert(VM_IS_NEM_ENABLED(pVM));
[72272]91#ifdef VBOX_WITH_NATIVE_NEM
[71152]92 return nemHCNativeNotifyPhysPageAllocated(pVM, GCPhys, HCPhys, fPageProt, enmType, pu2State);
[70977]93#else
94 RT_NOREF(pVM, GCPhys, HCPhys, fPageProt, enmType, pu2State);
95 return VINF_SUCCESS;
96#endif
97}
98
99
[72484]100#ifndef VBOX_WITH_NATIVE_NEM
[92449]101VMM_INT_DECL(uint32_t) NEMHCGetFeatures(PVMCC pVM)
102{
103 RT_NOREF(pVM);
104 return 0;
105}
106#endif
107
108
109#ifndef VBOX_WITH_NATIVE_NEM
[80239]110VMM_INT_DECL(int) NEMImportStateOnDemand(PVMCPUCC pVCpu, uint64_t fWhat)
[72484]111{
[72917]112 RT_NOREF(pVCpu, fWhat);
[72484]113 return VERR_NEM_IPE_9;
114}
115#endif
116
[72546]117
[72522]118#ifndef VBOX_WITH_NATIVE_NEM
[80239]119VMM_INT_DECL(int) NEMHCQueryCpuTick(PVMCPUCC pVCpu, uint64_t *pcTicks, uint32_t *puAux)
[72522]120{
121 RT_NOREF(pVCpu, pcTicks, puAux);
122 AssertFailed();
123 return VERR_NEM_IPE_9;
124}
125#endif
126
[72546]127
128#ifndef VBOX_WITH_NATIVE_NEM
[80319]129VMM_INT_DECL(int) NEMHCResumeCpuTickOnAll(PVMCC pVM, PVMCPUCC pVCpu, uint64_t uPausedTscValue)
[72546]130{
131 RT_NOREF(pVM, pVCpu, uPausedTscValue);
132 AssertFailed();
133 return VERR_NEM_IPE_9;
134}
135#endif
136
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use