VirtualBox

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

Last change on this file since 84823 was 82968, checked in by vboxsync, 5 years ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.1 KB
Line 
1/* $Id: NEMAll.cpp 82968 2020-02-04 10:35:17Z vboxsync $ */
2/** @file
3 * NEM - Native execution manager, R0 and R3 context code.
4 */
5
6/*
7 * Copyright (C) 2018-2020 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18
19/*********************************************************************************************************************************
20* Header Files *
21*********************************************************************************************************************************/
22#define LOG_GROUP LOG_GROUP_NEM
23#include <VBox/vmm/nem.h>
24#include "NEMInternal.h"
25#include <VBox/vmm/vmcc.h>
26#include <VBox/err.h>
27
28
29/**
30 * Checks if this VM is in NEM mode and is long-mode capable.
31 *
32 * Use VMR3IsLongModeAllowed() instead of this, when possible.
33 *
34 * @returns true if long mode is allowed, false otherwise.
35 * @param pVM The cross context VM structure.
36 * @sa VMR3IsLongModeAllowed, HMIsLongModeAllowed
37 */
38VMM_INT_DECL(bool) NEMHCIsLongModeAllowed(PVMCC pVM)
39{
40 return pVM->nem.s.fAllow64BitGuests && VM_IS_NEM_ENABLED(pVM);
41}
42
43
44/**
45 * Physical access handler registration notification.
46 *
47 * @param pVM The cross context VM structure.
48 * @param enmKind The kind of access handler.
49 * @param GCPhys Start of the access handling range.
50 * @param cb Length of the access handling range.
51 *
52 * @note Called while holding down the PGM lock.
53 */
54VMM_INT_DECL(void) NEMHCNotifyHandlerPhysicalRegister(PVMCC pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb)
55{
56#ifdef VBOX_WITH_NATIVE_NEM
57 if (VM_IS_NEM_ENABLED(pVM))
58 nemHCNativeNotifyHandlerPhysicalRegister(pVM, enmKind, GCPhys, cb);
59#else
60 RT_NOREF(pVM, enmKind, GCPhys, cb);
61#endif
62}
63
64
65VMM_INT_DECL(void) NEMHCNotifyHandlerPhysicalDeregister(PVMCC pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb,
66 int fRestoreAsRAM, bool fRestoreAsRAM2)
67{
68#ifdef VBOX_WITH_NATIVE_NEM
69 if (VM_IS_NEM_ENABLED(pVM))
70 nemHCNativeNotifyHandlerPhysicalDeregister(pVM, enmKind, GCPhys, cb, fRestoreAsRAM, fRestoreAsRAM2);
71#else
72 RT_NOREF(pVM, enmKind, GCPhys, cb, fRestoreAsRAM, fRestoreAsRAM2);
73#endif
74}
75
76
77VMM_INT_DECL(void) NEMHCNotifyHandlerPhysicalModify(PVMCC pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhysOld,
78 RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fRestoreAsRAM)
79{
80#ifdef VBOX_WITH_NATIVE_NEM
81 if (VM_IS_NEM_ENABLED(pVM))
82 nemHCNativeNotifyHandlerPhysicalModify(pVM, enmKind, GCPhysOld, GCPhysNew, cb, fRestoreAsRAM);
83#else
84 RT_NOREF(pVM, enmKind, GCPhysOld, GCPhysNew, cb, fRestoreAsRAM);
85#endif
86}
87
88
89VMM_INT_DECL(int) NEMHCNotifyPhysPageAllocated(PVMCC pVM, RTGCPHYS GCPhys, RTHCPHYS HCPhys, uint32_t fPageProt,
90 PGMPAGETYPE enmType, uint8_t *pu2State)
91{
92 Assert(VM_IS_NEM_ENABLED(pVM));
93#ifdef VBOX_WITH_NATIVE_NEM
94 return nemHCNativeNotifyPhysPageAllocated(pVM, GCPhys, HCPhys, fPageProt, enmType, pu2State);
95#else
96 RT_NOREF(pVM, GCPhys, HCPhys, fPageProt, enmType, pu2State);
97 return VINF_SUCCESS;
98#endif
99}
100
101
102VMM_INT_DECL(void) NEMHCNotifyPhysPageProtChanged(PVMCC pVM, RTGCPHYS GCPhys, RTHCPHYS HCPhys, uint32_t fPageProt,
103 PGMPAGETYPE enmType, uint8_t *pu2State)
104{
105 Assert(VM_IS_NEM_ENABLED(pVM));
106#ifdef VBOX_WITH_NATIVE_NEM
107 nemHCNativeNotifyPhysPageProtChanged(pVM, GCPhys, HCPhys, fPageProt, enmType, pu2State);
108#else
109 RT_NOREF(pVM, GCPhys, HCPhys, fPageProt, enmType, pu2State);
110#endif
111}
112
113
114VMM_INT_DECL(void) NEMHCNotifyPhysPageChanged(PVMCC pVM, RTGCPHYS GCPhys, RTHCPHYS HCPhysPrev, RTHCPHYS HCPhysNew,
115 uint32_t fPageProt, PGMPAGETYPE enmType, uint8_t *pu2State)
116{
117 Assert(VM_IS_NEM_ENABLED(pVM));
118#ifdef VBOX_WITH_NATIVE_NEM
119 nemHCNativeNotifyPhysPageChanged(pVM, GCPhys, HCPhysPrev, HCPhysNew, fPageProt, enmType, pu2State);
120#else
121 RT_NOREF(pVM, GCPhys, HCPhysPrev, HCPhysNew, fPageProt, enmType, pu2State);
122#endif
123}
124
125
126#ifndef VBOX_WITH_NATIVE_NEM
127VMM_INT_DECL(int) NEMImportStateOnDemand(PVMCPUCC pVCpu, uint64_t fWhat)
128{
129 RT_NOREF(pVCpu, fWhat);
130 return VERR_NEM_IPE_9;
131}
132#endif
133
134
135#ifndef VBOX_WITH_NATIVE_NEM
136VMM_INT_DECL(int) NEMHCQueryCpuTick(PVMCPUCC pVCpu, uint64_t *pcTicks, uint32_t *puAux)
137{
138 RT_NOREF(pVCpu, pcTicks, puAux);
139 AssertFailed();
140 return VERR_NEM_IPE_9;
141}
142#endif
143
144
145#ifndef VBOX_WITH_NATIVE_NEM
146VMM_INT_DECL(int) NEMHCResumeCpuTickOnAll(PVMCC pVM, PVMCPUCC pVCpu, uint64_t uPausedTscValue)
147{
148 RT_NOREF(pVM, pVCpu, uPausedTscValue);
149 AssertFailed();
150 return VERR_NEM_IPE_9;
151}
152#endif
153
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