VirtualBox

source: vbox/trunk/src/VBox/VMM/include/NEMInternal.h@ 70979

Last change on this file since 70979 was 70979, checked in by vboxsync, 7 years ago

NEM: Working on the EM loops. bugref:9044

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.1 KB
Line 
1/* $Id: NEMInternal.h 70979 2018-02-13 01:38:48Z vboxsync $ */
2/** @file
3 * NEM - Internal header file.
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#ifndef ___NEMInternal_h
19#define ___NEMInternal_h
20
21#include <VBox/cdefs.h>
22#include <VBox/types.h>
23#include <VBox/vmm/nem.h>
24#include <VBox/vmm/cpum.h> /* For CPUMCPUVENDOR. */
25#include <VBox/vmm/stam.h>
26#include <VBox/vmm/vmapi.h>
27
28RT_C_DECLS_BEGIN
29
30
31/** @defgroup grp_nem_int Internal
32 * @ingroup grp_nem
33 * @internal
34 * @{
35 */
36
37/**
38 * NEM VM Instance data.
39 */
40typedef struct NEM
41{
42 /** NEM_MAGIC. */
43 uint32_t u32Magic;
44
45 /** Set if enabled. */
46 bool fEnabled;
47#ifdef RT_OS_WINDOWS
48 /** Set if we've created the EMTs. */
49 bool fCreatedEmts;
50 /** WHvRunVpExitReasonX64Cpuid is supported. */
51 bool fExtendedMsrExit;
52 /** WHvRunVpExitReasonX64MsrAccess is supported. */
53 bool fExtendedCpuIdExit;
54 /** WHvRunVpExitReasonException is supported. */
55 bool fExtendedXcptExit;
56 /** The reported CPU vendor. */
57 CPUMCPUVENDOR enmCpuVendor;
58 /** Cache line flush size as a power of two. */
59 uint8_t cCacheLineFlushShift;
60 /** The result of WHvCapabilityCodeProcessorFeatures. */
61 union
62 {
63 /** 64-bit view. */
64 uint64_t u64;
65# ifdef _WINHVAPIDEFS_H_
66 /** Interpreed features. */
67 WHV_PROCESSOR_FEATURES u;
68# endif
69 } uCpuFeatures;
70
71 /** The partition handle. */
72# ifdef _WINHVAPIDEFS_H_
73 WHV_PARTITION_HANDLE
74# else
75 RTHCUINTPTR
76# endif
77 hPartition;
78 /** The device handle for the partition, for use with Vid APIs or direct I/O
79 * controls. */
80 RTR3PTR hPartitionDevice;
81#endif
82
83} NEM;
84/** Pointer to NEM VM instance data. */
85typedef NEM *PNEM;
86
87/** NEM::u32Magic value. */
88#define NEM_MAGIC UINT32_C(0x004d454e)
89/** NEM::u32Magic value after termination. */
90#define NEM_MAGIC_DEAD UINT32_C(0xdead1111)
91
92
93/**
94 * NEM VMCPU Instance data.
95 */
96typedef struct NEMCPU
97{
98 /** NEMCPU_MAGIC. */
99 uint32_t u32Magic;
100
101} NEMCPU;
102/** Pointer to NEM VMCPU instance data. */
103typedef NEMCPU *PNEMCPU;
104
105/** NEMCPU::u32Magic value. */
106#define NEMCPU_MAGIC UINT32_C(0x4d454e20)
107/** NEMCPU::u32Magic value after termination. */
108#define NEMCPU_MAGIC_DEAD UINT32_C(0xdead2222)
109
110#ifdef IN_RING3
111int nemR3NativeInit(PVM pVM, bool fFallback, bool fForced);
112int nemR3NativeInitAfterCPUM(PVM pVM);
113int nemR3NativeInitCompleted(PVM pVM, VMINITCOMPLETED enmWhat);
114int nemR3NativeTerm(PVM pVM);
115void nemR3NativeReset(PVM pVM);
116void nemR3NativeResetCpu(PVMCPU pVCpu);
117VBOXSTRICTRC nemR3NativeRunGC(PVM pVM, PVMCPU pVCpu);
118bool nemR3NativeCanExecuteGuest(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
119bool nemR3NativeSetSingleInstruction(PVM pVM, PVMCPU pVCpu, bool fEnable);
120
121int nemR3NativeNotifyPhysRamRegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb);
122int nemR3NativeNotifyPhysMmioExMap(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, uint32_t fFlags, void *pvMmio2);
123int nemR3NativeNotifyPhysMmioExUnmap(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, uint32_t fFlags);
124int nemR3NativeNotifyPhysRomRegisterEarly(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, uint32_t fFlags);
125int nemR3NativeNotifyPhysRomRegisterLate(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, uint32_t fFlags);
126void nemR3NativeNotifySetA20(PVMCPU pVCpu, bool fEnabled);
127/* NEMHCNotifyXxxx for ring-3: */
128void nemR3NativeNotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb);
129void nemR3NativeNotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb,
130 int fRestoreAsRAM, bool fRestoreAsRAM2);
131void nemR3NativeNotifyHandlerPhysicalModify(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhysOld,
132 RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fRestoreAsRAM);
133int nemR3NativeNotifyPhysPageAllocated(PVM pVM, RTGCPHYS GCPhys, RTHCPHYS HCPhys, uint32_t fPageProt,
134 PGMPAGETYPE enmType, uint8_t *pu2State);
135void nemR3NativeNotifyPhysPageProtChanged(PVM pVM, RTGCPHYS GCPhys, RTHCPHYS HCPhys, uint32_t fPageProt,
136 PGMPAGETYPE enmType, uint8_t *pu2State);
137void nemR3NativeNotifyPhysPageChanged(PVM pVM, RTGCPHYS GCPhys, RTHCPHYS HCPhysPrev, RTHCPHYS HCPhysNew, uint32_t fPageProt,
138 PGMPAGETYPE enmType, uint8_t *pu2State);
139#endif
140
141
142/** @} */
143
144RT_C_DECLS_END
145
146#endif
147
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette