VirtualBox

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

Last change on this file since 91848 was 91848, checked in by vboxsync, 3 years ago

VMM/NEM,PGM: First bunch changes for watered down guest memory managment for NEM. (Gets stuck in bios.) bugref:10122

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.7 KB
Line 
1/* $Id: NEMAll.cpp 91848 2021-10-19 23:18:13Z 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) NEMHCNotifyHandlerPhysicalModify(PVMCC pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhysOld,
66 RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fRestoreAsRAM)
67{
68#ifdef VBOX_WITH_NATIVE_NEM
69 if (VM_IS_NEM_ENABLED(pVM))
70 nemHCNativeNotifyHandlerPhysicalModify(pVM, enmKind, GCPhysOld, GCPhysNew, cb, fRestoreAsRAM);
71#else
72 RT_NOREF(pVM, enmKind, GCPhysOld, GCPhysNew, cb, fRestoreAsRAM);
73#endif
74}
75
76
77VMM_INT_DECL(int) NEMHCNotifyPhysPageAllocated(PVMCC pVM, RTGCPHYS GCPhys, RTHCPHYS HCPhys, uint32_t fPageProt,
78 PGMPAGETYPE enmType, uint8_t *pu2State)
79{
80 Assert(VM_IS_NEM_ENABLED(pVM));
81#ifdef VBOX_WITH_NATIVE_NEM
82 return nemHCNativeNotifyPhysPageAllocated(pVM, GCPhys, HCPhys, fPageProt, enmType, pu2State);
83#else
84 RT_NOREF(pVM, GCPhys, HCPhys, fPageProt, enmType, pu2State);
85 return VINF_SUCCESS;
86#endif
87}
88
89
90#ifndef VBOX_WITH_NATIVE_NEM
91VMM_INT_DECL(int) NEMImportStateOnDemand(PVMCPUCC pVCpu, uint64_t fWhat)
92{
93 RT_NOREF(pVCpu, fWhat);
94 return VERR_NEM_IPE_9;
95}
96#endif
97
98
99#ifndef VBOX_WITH_NATIVE_NEM
100VMM_INT_DECL(int) NEMHCQueryCpuTick(PVMCPUCC pVCpu, uint64_t *pcTicks, uint32_t *puAux)
101{
102 RT_NOREF(pVCpu, pcTicks, puAux);
103 AssertFailed();
104 return VERR_NEM_IPE_9;
105}
106#endif
107
108
109#ifndef VBOX_WITH_NATIVE_NEM
110VMM_INT_DECL(int) NEMHCResumeCpuTickOnAll(PVMCC pVM, PVMCPUCC pVCpu, uint64_t uPausedTscValue)
111{
112 RT_NOREF(pVM, pVCpu, uPausedTscValue);
113 AssertFailed();
114 return VERR_NEM_IPE_9;
115}
116#endif
117
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