1 | /* $Id: NEMAll.cpp 71152 2018-02-28 12:36:04Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * NEM - Native execution manager, R0 and R3 context code.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2018 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/vm.h>
|
---|
26 |
|
---|
27 |
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * Physical access handler registration notification.
|
---|
31 | *
|
---|
32 | * @param pVM The cross context VM structure.
|
---|
33 | * @param enmKind The kind of access handler.
|
---|
34 | * @param GCPhys Start of the access handling range.
|
---|
35 | * @param cb Length of the access handling range.
|
---|
36 | *
|
---|
37 | * @note Called while holding down the PGM lock.
|
---|
38 | */
|
---|
39 | VMM_INT_DECL(void) NEMHCNotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb)
|
---|
40 | {
|
---|
41 | #if defined(VBOX_WITH_NATIVE_NEM) && defined(IN_RING3)
|
---|
42 | if (VM_IS_NEM_ENABLED(pVM))
|
---|
43 | nemHCNativeNotifyHandlerPhysicalRegister(pVM, enmKind, GCPhys, cb);
|
---|
44 | #else
|
---|
45 | RT_NOREF(pVM, enmKind, GCPhys, cb);
|
---|
46 | #endif
|
---|
47 | }
|
---|
48 |
|
---|
49 |
|
---|
50 | VMM_INT_DECL(void) NEMHCNotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb,
|
---|
51 | int fRestoreAsRAM, bool fRestoreAsRAM2)
|
---|
52 | {
|
---|
53 | #if defined(VBOX_WITH_NATIVE_NEM) && defined(IN_RING3)
|
---|
54 | if (VM_IS_NEM_ENABLED(pVM))
|
---|
55 | nemHCNativeNotifyHandlerPhysicalDeregister(pVM, enmKind, GCPhys, cb, fRestoreAsRAM, fRestoreAsRAM2);
|
---|
56 | #else
|
---|
57 | RT_NOREF(pVM, enmKind, GCPhys, cb, fRestoreAsRAM, fRestoreAsRAM2);
|
---|
58 | #endif
|
---|
59 | }
|
---|
60 |
|
---|
61 |
|
---|
62 | VMM_INT_DECL(void) NEMHCNotifyHandlerPhysicalModify(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhysOld,
|
---|
63 | RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fRestoreAsRAM)
|
---|
64 | {
|
---|
65 | #if defined(VBOX_WITH_NATIVE_NEM) && defined(IN_RING3)
|
---|
66 | if (VM_IS_NEM_ENABLED(pVM))
|
---|
67 | nemHCNativeNotifyHandlerPhysicalModify(pVM, enmKind, GCPhysOld, GCPhysNew, cb, fRestoreAsRAM);
|
---|
68 | #else
|
---|
69 | RT_NOREF(pVM, enmKind, GCPhysOld, GCPhysNew, cb, fRestoreAsRAM);
|
---|
70 | #endif
|
---|
71 | }
|
---|
72 |
|
---|
73 |
|
---|
74 | VMM_INT_DECL(int) NEMHCNotifyPhysPageAllocated(PVM pVM, RTGCPHYS GCPhys, RTHCPHYS HCPhys, uint32_t fPageProt,
|
---|
75 | PGMPAGETYPE enmType, uint8_t *pu2State)
|
---|
76 | {
|
---|
77 | Assert(VM_IS_NEM_ENABLED(pVM));
|
---|
78 | #if defined(VBOX_WITH_NATIVE_NEM) && defined(IN_RING3)
|
---|
79 | return nemHCNativeNotifyPhysPageAllocated(pVM, GCPhys, HCPhys, fPageProt, enmType, pu2State);
|
---|
80 | #else
|
---|
81 | RT_NOREF(pVM, GCPhys, HCPhys, fPageProt, enmType, pu2State);
|
---|
82 | return VINF_SUCCESS;
|
---|
83 | #endif
|
---|
84 | }
|
---|
85 |
|
---|
86 |
|
---|
87 | VMM_INT_DECL(void) NEMHCNotifyPhysPageProtChanged(PVM pVM, RTGCPHYS GCPhys, RTHCPHYS HCPhys, uint32_t fPageProt,
|
---|
88 | PGMPAGETYPE enmType, uint8_t *pu2State)
|
---|
89 | {
|
---|
90 | Assert(VM_IS_NEM_ENABLED(pVM));
|
---|
91 | #if defined(VBOX_WITH_NATIVE_NEM)
|
---|
92 | nemHCNativeNotifyPhysPageProtChanged(pVM, GCPhys, HCPhys, fPageProt, enmType, pu2State);
|
---|
93 | #else
|
---|
94 | RT_NOREF(pVM, GCPhys, HCPhys, fPageProt, enmType, pu2State);
|
---|
95 | #endif
|
---|
96 | }
|
---|
97 |
|
---|
98 |
|
---|
99 | VMM_INT_DECL(void) NEMHCNotifyPhysPageChanged(PVM pVM, RTGCPHYS GCPhys, RTHCPHYS HCPhysPrev, RTHCPHYS HCPhysNew,
|
---|
100 | uint32_t fPageProt, PGMPAGETYPE enmType, uint8_t *pu2State)
|
---|
101 | {
|
---|
102 | Assert(VM_IS_NEM_ENABLED(pVM));
|
---|
103 | #if defined(VBOX_WITH_NATIVE_NEM)
|
---|
104 | nemHCNativeNotifyPhysPageChanged(pVM, GCPhys, HCPhysPrev, HCPhysNew, fPageProt, enmType, pu2State);
|
---|
105 | #else
|
---|
106 | RT_NOREF(pVM, GCPhys, HCPhysPrev, HCPhysNew, fPageProt, enmType, pu2State);
|
---|
107 | #endif
|
---|
108 | }
|
---|
109 |
|
---|