ReactOS  0.4.14-dev-41-g31d7680
memory.c File Reference
#include "ntvdm.h"
#include <debug.h>
#include "emulator.h"
#include "memory.h"
Include dependency graph for memory.c:

Go to the source code of this file.

Classes

struct  _MEM_HOOK
 

Macros

#define NDEBUG
 

Typedefs

typedef struct _MEM_HOOK MEM_HOOK
 
typedef struct _MEM_HOOKPMEM_HOOK
 

Functions

static VOID MemFastMoveMemory (OUT VOID UNALIGNED *Destination, IN const VOID UNALIGNED *Source, IN SIZE_T Length)
 
static VOID ReadPage (PMEM_HOOK Hook, ULONG Address, PVOID Buffer, ULONG Size)
 
static VOID WritePage (PMEM_HOOK Hook, ULONG Address, PVOID Buffer, ULONG Size)
 
VOID FASTCALL EmulatorReadMemory (PFAST486_STATE State, ULONG Address, PVOID Buffer, ULONG Size)
 
VOID FASTCALL EmulatorWriteMemory (PFAST486_STATE State, ULONG Address, PVOID Buffer, ULONG Size)
 
VOID FASTCALL EmulatorCopyMemory (PFAST486_STATE State, ULONG DestAddress, ULONG SrcAddress, ULONG Size)
 
VOID EmulatorSetA20 (BOOLEAN Enabled)
 
BOOLEAN EmulatorGetA20 (VOID)
 
VOID MemExceptionHandler (ULONG FaultAddress, BOOLEAN Writing)
 
BOOL MemInstallFastMemoryHook (PVOID Address, ULONG Size, PMEMORY_READ_HANDLER ReadHandler, PMEMORY_WRITE_HANDLER WriteHandler)
 
BOOL MemRemoveFastMemoryHook (PVOID Address, ULONG Size)
 
BOOLEAN MemQueryMemoryZone (ULONG StartAddress, PULONG Length, PBOOLEAN Hooked)
 
PBYTE WINAPI Sim32pGetVDMPointer (IN ULONG Address, IN BOOLEAN ProtectedMode)
 
PBYTE WINAPI MGetVdmPointer (IN ULONG Address, IN ULONG Size, IN BOOLEAN ProtectedMode)
 
PVOID WINAPI VdmMapFlat (IN USHORT Segment, IN ULONG Offset, IN VDM_MODE Mode)
 
BOOL WINAPI VdmFlushCache (IN USHORT Segment, IN ULONG Offset, IN ULONG Size, IN VDM_MODE Mode)
 
BOOL WINAPI VdmUnmapFlat (IN USHORT Segment, IN ULONG Offset, IN PVOID Buffer, IN VDM_MODE Mode)
 
BOOL WINAPI VDDInstallMemoryHook (IN HANDLE hVdd, IN PVOID pStart, IN DWORD dwCount, IN PVDD_MEMORY_HANDLER MemoryHandler)
 
BOOL WINAPI VDDDeInstallMemoryHook (IN HANDLE hVdd, IN PVOID pStart, IN DWORD dwCount)
 
BOOL WINAPI VDDAllocMem (IN HANDLE hVdd, IN PVOID Address, IN ULONG Size)
 
BOOL WINAPI VDDFreeMem (IN HANDLE hVdd, IN PVOID Address, IN ULONG Size)
 
BOOL WINAPI VDDIncludeMem (IN HANDLE hVdd, IN PVOID Address, IN ULONG Size)
 
BOOL WINAPI VDDExcludeMem (IN HANDLE hVdd, IN PVOID Address, IN ULONG Size)
 
BOOLEAN MemInitialize (VOID)
 
VOID MemCleanup (VOID)
 

Variables

static LIST_ENTRY HookList
 
static PMEM_HOOK PageTable [TOTAL_PAGES] = { NULL }
 
static BOOLEAN A20Line = FALSE
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file memory.c.

Typedef Documentation

◆ MEM_HOOK

◆ PMEM_HOOK

Function Documentation

◆ EmulatorCopyMemory()

VOID FASTCALL EmulatorCopyMemory ( PFAST486_STATE  State,
ULONG  DestAddress,
ULONG  SrcAddress,
ULONG  Size 
)

Definition at line 216 of file memory.c.

217 {
218  /*
219  * Guest-to-guest memory copy
220  */
221 
222  // FIXME: This is a temporary implementation of a more useful functionality
223  // which should be a merge of EmulatorReadMemory & EmulatorWriteMemory without
224  // any local external buffer.
225  // NOTE: Process heap is by default serialized (unless one specifies it shouldn't).
226  static BYTE StaticBuffer[8192]; // Smallest static buffer we can use.
227  static PVOID HeapBuffer = NULL; // Always-growing heap buffer. Use it in case StaticBuffer is too small.
228  static ULONG HeapBufferSize = 0;
229  PVOID LocalBuffer; // Points to either StaticBuffer or HeapBuffer
230 
231  if (Size <= sizeof(StaticBuffer))
232  {
233  /* Use the static buffer */
234  LocalBuffer = StaticBuffer;
235  }
236  else if (/* sizeof(StaticBuffer) <= Size && */ Size <= HeapBufferSize)
237  {
238  /* Use the heap buffer */
239  ASSERT(HeapBufferSize > 0 && HeapBuffer != NULL);
240  LocalBuffer = HeapBuffer;
241  }
242  else // if (Size > HeapBufferSize)
243  {
244  /* Enlarge the heap buffer and use it */
245 
246  if (HeapBuffer == NULL)
247  {
248  /* First allocation */
249  LocalBuffer = RtlAllocateHeap(RtlGetProcessHeap(), 0, Size);
250  }
251  else
252  {
253  /* Reallocation */
254  LocalBuffer = RtlReAllocateHeap(RtlGetProcessHeap(), 0 /* HEAP_GENERATE_EXCEPTIONS */, HeapBuffer, Size);
255  }
256  ASSERT(LocalBuffer != NULL); // We must succeed! TODO: Handle it more properly.
257  HeapBuffer = LocalBuffer; // HeapBuffer is now reallocated.
258  HeapBufferSize = Size;
259  }
260 
261  /* Perform memory copy */
262  EmulatorReadMemory( State, SrcAddress , LocalBuffer, Size);
263  EmulatorWriteMemory(State, DestAddress, LocalBuffer, Size);
264 
265  // if (LocalBuffer != StaticBuffer)
266  // RtlFreeHeap(RtlGetProcessHeap(), 0, LocalBuffer);
267 
268  // Note that we don't free HeapBuffer since it's an always-growing buffer.
269  // It is freed when NTVDM termiantes.
270 }
VOID FASTCALL EmulatorWriteMemory(PFAST486_STATE State, ULONG Address, PVOID Buffer, ULONG Size)
Definition: memory.c:183
NTSYSAPI PVOID WINAPI RtlReAllocateHeap(HANDLE, ULONG, PVOID, SIZE_T)
Definition: heap.c:2561
smooth NULL
Definition: ftsmooth.c:416
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
unsigned char BYTE
Definition: mem.h:68
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
unsigned int ULONG
Definition: retypes.h:1
VOID FASTCALL EmulatorReadMemory(PFAST486_STATE State, ULONG Address, PVOID Buffer, ULONG Size)
Definition: memory.c:139

Referenced by VidBiosScrollWindow().

◆ EmulatorGetA20()

BOOLEAN EmulatorGetA20 ( VOID  )

Definition at line 277 of file memory.c.

278 {
279  return A20Line;
280 }
static BOOLEAN A20Line
Definition: memory.c:41

Referenced by PS2WriteControl(), and XmsBopProcedure().

◆ EmulatorReadMemory()

VOID FASTCALL EmulatorReadMemory ( PFAST486_STATE  State,
ULONG  Address,
PVOID  Buffer,
ULONG  Size 
)

Definition at line 139 of file memory.c.

140 {
141  ULONG i, Offset, Length;
142  ULONG FirstPage, LastPage;
143 
145 
146  /* Mirror 0x000FFFF0 at 0xFFFFFFF0 */
147  if (Address >= 0xFFFFFFF0) Address -= 0xFFF00000;
148 
149  /* If the A20 line is disabled, mask bit 20 */
150  if (!A20Line) Address &= ~(1 << 20);
151 
152  if ((Address + Size - 1) >= MAX_ADDRESS)
153  {
154  ULONG ExtraStart = (Address < MAX_ADDRESS) ? MAX_ADDRESS - Address : 0;
155 
156  /* Fill the memory that was above the limit with 0xFF */
157  RtlFillMemory((PVOID)((ULONG_PTR)Buffer + ExtraStart), Size - ExtraStart, 0xFF);
158 
160  else return;
161  }
162 
163  FirstPage = Address >> 12;
164  LastPage = (Address + Size - 1) >> 12;
165 
166  if (FirstPage == LastPage)
167  {
168  ReadPage(PageTable[FirstPage], Address, Buffer, Size);
169  }
170  else
171  {
172  for (i = FirstPage; i <= LastPage; i++)
173  {
174  Offset = (i == FirstPage) ? (Address & (PAGE_SIZE - 1)) : 0;
175  Length = ((i == LastPage) ? (Address + Size - (LastPage << 12)) : PAGE_SIZE) - Offset;
176 
177  ReadPage(PageTable[i], (i << 12) + Offset, Buffer, Length);
179  }
180  }
181 }
static PMEM_HOOK PageTable[TOTAL_PAGES]
Definition: memory.c:40
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define MAX_ADDRESS
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
static WCHAR Address[46]
Definition: ping.c:68
Definition: bufpool.h:45
void * PVOID
Definition: retypes.h:9
static VOID ReadPage(PMEM_HOOK Hook, ULONG Address, PVOID Buffer, ULONG Size)
Definition: memory.c:115
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define PAGE_SIZE
Definition: env_spec_w32.h:49
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
unsigned int ULONG
Definition: retypes.h:1
static BOOLEAN A20Line
Definition: memory.c:41
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:593

Referenced by CpuInitialize(), DmaRequest(), DosWriteFile(), EmulatorCopyMemory(), PaintMouseCursor(), VidBiosDrawGlyph(), VidBiosVideoService(), and WriteDisk().

◆ EmulatorSetA20()

VOID EmulatorSetA20 ( BOOLEAN  Enabled)

Definition at line 272 of file memory.c.

273 {
274  A20Line = Enabled;
275 }
static BOOLEAN A20Line
Definition: memory.c:41

Referenced by PS2WriteData(), XmsLocalDisableA20(), and XmsLocalEnableA20().

◆ EmulatorWriteMemory()

VOID FASTCALL EmulatorWriteMemory ( PFAST486_STATE  State,
ULONG  Address,
PVOID  Buffer,
ULONG  Size 
)

Definition at line 183 of file memory.c.

184 {
185  ULONG i, Offset, Length;
186  ULONG FirstPage, LastPage;
187 
189 
190  /* If the A20 line is disabled, mask bit 20 */
191  if (!A20Line) Address &= ~(1 << 20);
192 
193  if (Address >= MAX_ADDRESS) return;
195 
196  FirstPage = Address >> 12;
197  LastPage = (Address + Size - 1) >> 12;
198 
199  if (FirstPage == LastPage)
200  {
201  WritePage(PageTable[FirstPage], Address, Buffer, Size);
202  }
203  else
204  {
205  for (i = FirstPage; i <= LastPage; i++)
206  {
207  Offset = (i == FirstPage) ? (Address & (PAGE_SIZE - 1)) : 0;
208  Length = ((i == LastPage) ? (Address + Size - (LastPage << 12)) : PAGE_SIZE) - Offset;
209 
210  WritePage(PageTable[i], (i << 12) + Offset, Buffer, Length);
212  }
213  }
214 }
static PMEM_HOOK PageTable[TOTAL_PAGES]
Definition: memory.c:40
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define MAX_ADDRESS
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
static WCHAR Address[46]
Definition: ping.c:68
Definition: bufpool.h:45
void * PVOID
Definition: retypes.h:9
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
static VOID WritePage(PMEM_HOOK Hook, ULONG Address, PVOID Buffer, ULONG Size)
Definition: memory.c:126
#define PAGE_SIZE
Definition: env_spec_w32.h:49
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define min(a, b)
Definition: monoChain.cc:55
unsigned int ULONG
Definition: retypes.h:1
static BOOLEAN A20Line
Definition: memory.c:41

Referenced by CpuInitialize(), DmaRequest(), DosReadFile(), EmulatorCopyMemory(), EraseMouseCursor(), PaintMouseCursor(), ReadDisk(), VidBiosClearScreen(), VidBiosDrawGlyph(), and VidBiosScrollWindow().

◆ MemCleanup()

VOID MemCleanup ( VOID  )

Definition at line 780 of file memory.c.

781 {
784  PLIST_ENTRY Pointer;
785 
786  while (!IsListEmpty(&HookList))
787  {
788  Pointer = RemoveHeadList(&HookList);
789  RtlFreeHeap(RtlGetProcessHeap(), 0, CONTAINING_RECORD(Pointer, MEM_HOOK, Entry));
790  }
791 
792  /* Decommit the VDM memory */
794  &BaseAddress,
795  &MemorySize,
796 #ifndef STANDALONE
798 #else
800 #endif
801  );
802  if (!NT_SUCCESS(Status))
803  {
804  DPRINT1("NTVDM: Failed to decommit VDM memory, Status 0x%08lx\n", Status);
805  }
806 }
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
#define STANDALONE
Definition: testlist.c:3
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
#define MAX_ADDRESS
#define MEM_DECOMMIT
Definition: nt_native.h:1315
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
static LIST_ENTRY HookList
Definition: memory.c:39
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define NtCurrentProcess()
Definition: nt_native.h:1657
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static CONST DWORD MemorySize[]
Definition: svga.c:32
Definition: typedefs.h:117
Status
Definition: gdiplustypes.h:24
ULONG_PTR SIZE_T
Definition: typedefs.h:78
#define DPRINT1
Definition: precomp.h:8
#define MEM_RELEASE
Definition: nt_native.h:1316
base of all file and directory entries
Definition: entries.h:82
NTSTATUS NTAPI NtFreeVirtualMemory(IN HANDLE ProcessHandle, IN PVOID *UBaseAddress, IN PSIZE_T URegionSize, IN ULONG FreeType)
Definition: virtual.c:5090

Referenced by EmulatorCleanup().

◆ MemExceptionHandler()

VOID MemExceptionHandler ( ULONG  FaultAddress,
BOOLEAN  Writing 
)

Definition at line 283 of file memory.c.

284 {
285  PMEM_HOOK Hook = PageTable[FaultAddress >> 12];
286  DPRINT("The memory at 0x%08X could not be %s.\n", FaultAddress, Writing ? "written" : "read");
287 
288  /* Exceptions are only supposed to happen when using VDD-style memory hooks */
289  ASSERT(FaultAddress < MAX_ADDRESS && Hook != NULL && Hook->hVdd != NULL);
290 
291  /* Call the VDD handler */
292  Hook->VddHandler(REAL_TO_PHYS(FaultAddress), (ULONG)Writing);
293 }
static PMEM_HOOK PageTable[TOTAL_PAGES]
Definition: memory.c:40
#define REAL_TO_PHYS(ptr)
Definition: emulator.h:33
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
unsigned int ULONG
Definition: retypes.h:1
PVDD_MEMORY_HANDLER VddHandler
Definition: memory.c:29
HANDLE hVdd
Definition: testvdd.c:87

Referenced by CpuExceptionFilter().

◆ MemFastMoveMemory()

static VOID MemFastMoveMemory ( OUT VOID UNALIGNED Destination,
IN const VOID UNALIGNED Source,
IN SIZE_T  Length 
)
inlinestatic

Definition at line 46 of file memory.c.

49 {
50 #if 1
51  /*
52  * We use a switch here to detect small moves of memory, as these
53  * constitute the bulk of our moves.
54  * Using RtlMoveMemory for all these small moves would be slow otherwise.
55  */
56  switch (Length)
57  {
58  case 0:
59  return;
60 
61  case sizeof(UCHAR):
63  return;
64 
65  case sizeof(USHORT):
67  return;
68 
69  case sizeof(ULONG):
71  return;
72 
73  case sizeof(ULONGLONG):
75  return;
76 
77  default:
78 #if defined(__GNUC__)
79  __builtin_memmove(Destination, Source, Length);
80 #else
82 #endif
83  }
84 
85 #else // defined(_MSC_VER)
86 
87  PUCHAR Dest = (PUCHAR)Destination;
88  PUCHAR Src = (PUCHAR)Source;
89 
91 
92  /* Move dword */
93  Count = NewSize >> 2; // NewSize / sizeof(ULONG);
94  NewSize = NewSize & 3; // NewSize % sizeof(ULONG);
95  __movsd(Dest, Src, Count);
96  Dest += Count << 2; // Count * sizeof(ULONG);
97  Src += Count << 2;
98 
99  /* Move word */
100  Count = NewSize >> 1; // NewSize / sizeof(USHORT);
101  NewSize = NewSize & 1; // NewSize % sizeof(USHORT);
102  __movsw(Dest, Src, Count);
103  Dest += Count << 1; // Count * sizeof(USHORT);
104  Src += Count << 1;
105 
106  /* Move byte */
107  Count = NewSize; // NewSize / sizeof(UCHAR);
108  // NewSize = NewSize; // NewSize % sizeof(UCHAR);
109  __movsb(Dest, Src, Count);
110 
111 #endif
112 }
unsigned char * PUCHAR
Definition: retypes.h:3
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
PPC_QUAL void __movsb(unsigned char *Destination, const unsigned char *Source, unsigned long Count)
Definition: intrin_ppc.h:323
uint64_t ULONGLONG
Definition: typedefs.h:65
_In_ PUNICODE_STRING _Inout_ PUNICODE_STRING Destination
Definition: rtlfuncs.h:2891
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
unsigned char UCHAR
Definition: xmlstorage.h:181
_Must_inspect_result_ _In_ USHORT NewSize
Definition: fltkernel.h:975
ULONG_PTR SIZE_T
Definition: typedefs.h:78
PPC_QUAL void __movsw(unsigned short *Destination, const unsigned short *Source, unsigned long Count)
Definition: intrin_ppc.h:328
unsigned short USHORT
Definition: pedump.c:61
unsigned int * PULONG
Definition: retypes.h:1
PPC_QUAL void __movsd(unsigned long *Destination, const unsigned long *Source, unsigned long Count)
Definition: intrin_ppc.h:333
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
Definition: ntbasedef.h:390
unsigned int ULONG
Definition: retypes.h:1
_In_ UINT _In_ UINT _In_ PNDIS_PACKET Source
Definition: ndis.h:3167
unsigned short * PUSHORT
Definition: retypes.h:2

Referenced by ReadPage(), and WritePage().

◆ MemInitialize()

BOOLEAN MemInitialize ( VOID  )

Definition at line 720 of file memory.c.

721 {
723  SIZE_T MemorySize = MAX_ADDRESS; // See: kernel32/client/vdm.c!BaseGetVdmConfigInfo
724 
726 
727 #ifndef STANDALONE
728 
729  /*
730  * The reserved region starts from the very first page.
731  * We need to commit the reserved first 16 MB virtual address.
732  *
733  * NOTE: NULL has another signification for NtAllocateVirtualMemory.
734  */
735  BaseAddress = (PVOID)1;
736 
737  /*
738  * Since to get NULL, we allocated from 0x1, account for this.
739  * See also: kernel32/client/proc.c!CreateProcessInternalW
740  */
741  MemorySize -= 1;
742 
743 #else
744 
745  /* Allocate it anywhere */
746  BaseAddress = NULL;
747 
748 #endif
749 
751  &BaseAddress,
752  0,
753  &MemorySize,
754 #ifndef STANDALONE
755  MEM_COMMIT,
756 #else
758 #endif
760  if (!NT_SUCCESS(Status))
761  {
762  wprintf(L"FATAL: Failed to commit VDM memory, Status 0x%08lx\n", Status);
763  return FALSE;
764  }
765 
766 #ifndef STANDALONE
767  ASSERT(BaseAddress == NULL);
768 #endif
769 
770  /*
771  * For diagnostics purposes, we fill the memory with INT 0x03 codes
772  * so that if a program wants to execute random code in memory, we can
773  * retrieve the exact CS:IP where the problem happens.
774  */
776  return TRUE;
777 }
#define TRUE
Definition: types.h:120
LONG NTSTATUS
Definition: precomp.h:26
#define wprintf(...)
Definition: whoami.c:18
#define MEM_COMMIT
Definition: nt_native.h:1313
#define STANDALONE
Definition: testlist.c:3
#define MAX_ADDRESS
#define MEM_RESERVE
Definition: nt_native.h:1314
smooth NULL
Definition: ftsmooth.c:416
void * PVOID
Definition: retypes.h:9
static LIST_ENTRY HookList
Definition: memory.c:39
#define NtCurrentProcess()
Definition: nt_native.h:1657
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static const WCHAR L[]
Definition: oid.c:1250
static CONST DWORD MemorySize[]
Definition: svga.c:32
Status
Definition: gdiplustypes.h:24
ULONG_PTR SIZE_T
Definition: typedefs.h:78
NTSTATUS NTAPI NtAllocateVirtualMemory(IN HANDLE ProcessHandle, IN OUT PVOID *UBaseAddress, IN ULONG_PTR ZeroBits, IN OUT PSIZE_T URegionSize, IN ULONG AllocationType, IN ULONG Protect)
Definition: virtual.c:4367
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define PAGE_EXECUTE_READWRITE
Definition: nt_native.h:1308
#define RtlFillMemory(Dest, Length, Fill)
Definition: winternl.h:593

Referenced by EmulatorInitialize().

◆ MemInstallFastMemoryHook()

BOOL MemInstallFastMemoryHook ( PVOID  Address,
ULONG  Size,
PMEMORY_READ_HANDLER  ReadHandler,
PMEMORY_WRITE_HANDLER  WriteHandler 
)

Definition at line 296 of file memory.c.

300 {
301  PMEM_HOOK Hook;
302  ULONG i;
303  ULONG FirstPage = (ULONG_PTR)Address >> 12;
304  ULONG LastPage = ((ULONG_PTR)Address + Size - 1) >> 12;
305  PLIST_ENTRY Pointer;
306 
307  /* Make sure none of these pages are already allocated */
308  for (i = FirstPage; i <= LastPage; i++)
309  {
310  if (PageTable[i] != NULL) return FALSE;
311  }
312 
313  for (Pointer = HookList.Flink; Pointer != &HookList; Pointer = Pointer->Flink)
314  {
315  Hook = CONTAINING_RECORD(Pointer, MEM_HOOK, Entry);
316 
317  if (Hook->hVdd == NULL
318  && Hook->FastReadHandler == ReadHandler
319  && Hook->FastWriteHandler == WriteHandler)
320  {
321  break;
322  }
323  }
324 
325  if (Pointer == &HookList)
326  {
327  /* Create and initialize a new hook entry... */
328  Hook = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(*Hook));
329  if (Hook == NULL) return FALSE;
330 
331  Hook->hVdd = NULL;
332  Hook->Count = 0;
333  Hook->FastReadHandler = ReadHandler;
334  Hook->FastWriteHandler = WriteHandler;
335 
336  /* ... and add it to the list of hooks */
337  InsertTailList(&HookList, &Hook->Entry);
338  }
339 
340  /* Increase the number of pages this hook has */
341  Hook->Count += LastPage - FirstPage + 1;
342 
343  /* Add the hook entry to the page table */
344  for (i = FirstPage; i <= LastPage; i++) PageTable[i] = Hook;
345 
346  return TRUE;
347 }
#define TRUE
Definition: types.h:120
static PMEM_HOOK PageTable[TOTAL_PAGES]
Definition: memory.c:40
ULONG Count
Definition: memory.c:25
LIST_ENTRY Entry
Definition: memory.c:23
#define InsertTailList(ListHead, Entry)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
static WCHAR Address[46]
Definition: ping.c:68
static LIST_ENTRY HookList
Definition: memory.c:39
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
HANDLE hVdd
Definition: memory.c:24
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
Definition: typedefs.h:117
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
PMEMORY_READ_HANDLER FastReadHandler
Definition: memory.c:33
unsigned int ULONG
Definition: retypes.h:1
#define ULONG_PTR
Definition: config.h:101
PMEMORY_WRITE_HANDLER FastWriteHandler
Definition: memory.c:34
base of all file and directory entries
Definition: entries.h:82

Referenced by EmsDrvInitialize(), VgaWriteGc(), VgaWritePort(), and WriteProtectRom().

◆ MemQueryMemoryZone()

BOOLEAN MemQueryMemoryZone ( ULONG  StartAddress,
PULONG  Length,
PBOOLEAN  Hooked 
)

Definition at line 378 of file memory.c.

379 {
380  ULONG Page = StartAddress >> 12;
381  if (Page >= TOTAL_PAGES) return FALSE;
382 
383  *Length = 0;
384  *Hooked = PageTable[Page] != NULL;
385 
386  while (Page < TOTAL_PAGES && (PageTable[Page] != NULL) == *Hooked)
387  {
388  *Length += PAGE_SIZE;
389  Page++;
390  }
391 
392  return TRUE;
393 }
#define TRUE
Definition: types.h:120
static PMEM_HOOK PageTable[TOTAL_PAGES]
Definition: memory.c:40
smooth NULL
Definition: ftsmooth.c:416
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define TOTAL_PAGES
Definition: memory.h:14
unsigned int ULONG
Definition: retypes.h:1

Referenced by BiosMiscService().

◆ MemRemoveFastMemoryHook()

BOOL MemRemoveFastMemoryHook ( PVOID  Address,
ULONG  Size 
)

Definition at line 350 of file memory.c.

351 {
352  PMEM_HOOK Hook;
353  ULONG i;
354  ULONG FirstPage = (ULONG_PTR)Address >> 12;
355  ULONG LastPage = ((ULONG_PTR)Address + Size - 1) >> 12;
356 
357  if (Size == 0) return FALSE;
358 
359  for (i = FirstPage; i <= LastPage; i++)
360  {
361  Hook = PageTable[i];
362  if (Hook == NULL || Hook->hVdd != NULL) continue;
363 
364  if (--Hook->Count == 0)
365  {
366  /* This hook has no more pages */
367  RemoveEntryList(&Hook->Entry);
368  RtlFreeHeap(RtlGetProcessHeap(), 0, Hook);
369  }
370 
371  PageTable[i] = NULL;
372  }
373 
374  return TRUE;
375 }
#define TRUE
Definition: types.h:120
static PMEM_HOOK PageTable[TOTAL_PAGES]
Definition: memory.c:40
ULONG Count
Definition: memory.c:25
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
LIST_ENTRY Entry
Definition: memory.c:23
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
static WCHAR Address[46]
Definition: ping.c:68
HANDLE hVdd
Definition: memory.c:24
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
unsigned int ULONG
Definition: retypes.h:1
#define ULONG_PTR
Definition: config.h:101

Referenced by EmsDrvCleanup(), VgaCleanup(), VgaWriteGc(), VgaWritePort(), and WriteUnProtectRom().

◆ MGetVdmPointer()

PBYTE WINAPI MGetVdmPointer ( IN ULONG  Address,
IN ULONG  Size,
IN BOOLEAN  ProtectedMode 
)

Definition at line 413 of file memory.c.

416 {
418  return Sim32pGetVDMPointer(Address, ProtectedMode);
419 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
static WCHAR Address[46]
Definition: ping.c:68
PBYTE WINAPI Sim32pGetVDMPointer(IN ULONG Address, IN BOOLEAN ProtectedMode)
Definition: memory.c:397
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359

◆ ReadPage()

static VOID ReadPage ( PMEM_HOOK  Hook,
ULONG  Address,
PVOID  Buffer,
ULONG  Size 
)
inlinestatic

Definition at line 115 of file memory.c.

116 {
117  if (Hook && !Hook->hVdd && Hook->FastReadHandler)
118  {
120  }
121 
123 }
#define REAL_TO_PHYS(ptr)
Definition: emulator.h:33
static WCHAR Address[46]
Definition: ping.c:68
Definition: bufpool.h:45
HANDLE hVdd
Definition: memory.c:24
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
PMEMORY_READ_HANDLER FastReadHandler
Definition: memory.c:33
static VOID MemFastMoveMemory(OUT VOID UNALIGNED *Destination, IN const VOID UNALIGNED *Source, IN SIZE_T Length)
Definition: memory.c:46

Referenced by EmulatorReadMemory().

◆ Sim32pGetVDMPointer()

PBYTE WINAPI Sim32pGetVDMPointer ( IN ULONG  Address,
IN BOOLEAN  ProtectedMode 
)

Definition at line 397 of file memory.c.

399 {
400  // FIXME
401  UNREFERENCED_PARAMETER(ProtectedMode);
402 
403  /*
404  * HIWORD(Address) == Segment (if ProtectedMode == FALSE)
405  * or Selector (if ProtectedMode == TRUE )
406  * LOWORD(Address) == Offset
407  */
408  return (PBYTE)FAR_POINTER(Address);
409 }
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
static WCHAR Address[46]
Definition: ping.c:68
#define FAR_POINTER(x)
Definition: emulator.h:31
BYTE * PBYTE
Definition: pedump.c:66

Referenced by MGetVdmPointer().

◆ VDDAllocMem()

BOOL WINAPI VDDAllocMem ( IN HANDLE  hVdd,
IN PVOID  Address,
IN ULONG  Size 
)

Definition at line 603 of file memory.c.

606 {
608  PMEM_HOOK Hook;
609  ULONG i;
610  ULONG FirstPage = (ULONG_PTR)PHYS_TO_REAL(Address) >> 12;
611  ULONG LastPage = ((ULONG_PTR)PHYS_TO_REAL(Address) + Size - 1) >> 12;
612  SIZE_T RealSize = (LastPage - FirstPage + 1) * PAGE_SIZE;
613 
614  /* Check validity of the VDD handle */
615  if (hVdd == NULL || hVdd == INVALID_HANDLE_VALUE)
616  {
618  return FALSE;
619  }
620 
621  if (Size == 0) return FALSE;
622 
623  /* Fixup the address */
624  Address = (PVOID)REAL_TO_PHYS(FirstPage * PAGE_SIZE);
625 
626  /* Be sure that all the region is held by the VDD */
627  for (i = FirstPage; i <= LastPage; i++)
628  {
629  Hook = PageTable[i];
630  if (Hook == NULL) return FALSE;
631 
632  if (Hook->hVdd != hVdd)
633  {
634  DPRINT1("VDDAllocMem: Page %u owned by someone else.\n", i);
635  return FALSE;
636  }
637  }
638 
639  /* OK, all the range is held by the VDD. Commit the pages. */
641  &Address,
642  0,
643  &RealSize,
644  MEM_COMMIT,
646  return NT_SUCCESS(Status);
647 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
static PMEM_HOOK PageTable[TOTAL_PAGES]
Definition: memory.c:40
LONG NTSTATUS
Definition: precomp.h:26
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
#define PHYS_TO_REAL(ptr)
Definition: emulator.h:34
#define MEM_COMMIT
Definition: nt_native.h:1313
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define REAL_TO_PHYS(ptr)
Definition: emulator.h:33
smooth NULL
Definition: ftsmooth.c:416
static WCHAR Address[46]
Definition: ping.c:68
void * PVOID
Definition: retypes.h:9
#define NtCurrentProcess()
Definition: nt_native.h:1657
HANDLE hVdd
Definition: memory.c:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SetLastError(x)
Definition: compat.h:409
#define PAGE_SIZE
Definition: env_spec_w32.h:49
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Status
Definition: gdiplustypes.h:24
ULONG_PTR SIZE_T
Definition: typedefs.h:78
NTSTATUS NTAPI NtAllocateVirtualMemory(IN HANDLE ProcessHandle, IN OUT PVOID *UBaseAddress, IN ULONG_PTR ZeroBits, IN OUT PSIZE_T URegionSize, IN ULONG AllocationType, IN ULONG Protect)
Definition: virtual.c:4367
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
#define ULONG_PTR
Definition: config.h:101
HANDLE hVdd
Definition: testvdd.c:87
#define PAGE_READWRITE
Definition: nt_native.h:1304

◆ VDDDeInstallMemoryHook()

BOOL WINAPI VDDDeInstallMemoryHook ( IN HANDLE  hVdd,
IN PVOID  pStart,
IN DWORD  dwCount 
)

Definition at line 547 of file memory.c.

550 {
552  PMEM_HOOK Hook;
553  ULONG i;
554  ULONG FirstPage = (ULONG_PTR)PHYS_TO_REAL(pStart) >> 12;
555  ULONG LastPage = ((ULONG_PTR)PHYS_TO_REAL(pStart) + dwCount - 1) >> 12;
556  PVOID Address = (PVOID)REAL_TO_PHYS(FirstPage * PAGE_SIZE);
557  SIZE_T Size = (LastPage - FirstPage + 1) * PAGE_SIZE;
558 
559  /* Check validity of the VDD handle */
560  if (hVdd == NULL || hVdd == INVALID_HANDLE_VALUE)
561  {
563  return FALSE;
564  }
565 
566  if (dwCount == 0) return FALSE;
567 
568  /* Commit the pages */
570  &Address,
571  0,
572  &Size,
573  MEM_COMMIT,
575  if (!NT_SUCCESS(Status)) return FALSE;
576 
577  for (i = FirstPage; i <= LastPage; i++)
578  {
579  Hook = PageTable[i];
580  if (Hook == NULL) continue;
581 
582  if (Hook->hVdd != hVdd)
583  {
584  DPRINT1("VDDDeInstallMemoryHook: Page %u owned by someone else.\n", i);
585  continue;
586  }
587 
588  if (--Hook->Count == 0)
589  {
590  /* This hook has no more pages */
591  RemoveEntryList(&Hook->Entry);
592  RtlFreeHeap(RtlGetProcessHeap(), 0, Hook);
593  }
594 
595  PageTable[i] = NULL;
596  }
597 
598  return TRUE;
599 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
static PMEM_HOOK PageTable[TOTAL_PAGES]
Definition: memory.c:40
ULONG Count
Definition: memory.c:25
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
LIST_ENTRY Entry
Definition: memory.c:23
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
#define PHYS_TO_REAL(ptr)
Definition: emulator.h:34
#define MEM_COMMIT
Definition: nt_native.h:1313
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define REAL_TO_PHYS(ptr)
Definition: emulator.h:33
smooth NULL
Definition: ftsmooth.c:416
static WCHAR Address[46]
Definition: ping.c:68
void * PVOID
Definition: retypes.h:9
#define NtCurrentProcess()
Definition: nt_native.h:1657
HANDLE hVdd
Definition: memory.c:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SetLastError(x)
Definition: compat.h:409
#define PAGE_SIZE
Definition: env_spec_w32.h:49
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Status
Definition: gdiplustypes.h:24
ULONG_PTR SIZE_T
Definition: typedefs.h:78
NTSTATUS NTAPI NtAllocateVirtualMemory(IN HANDLE ProcessHandle, IN OUT PVOID *UBaseAddress, IN ULONG_PTR ZeroBits, IN OUT PSIZE_T URegionSize, IN ULONG AllocationType, IN ULONG Protect)
Definition: virtual.c:4367
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
#define ULONG_PTR
Definition: config.h:101
HANDLE hVdd
Definition: testvdd.c:87
#define PAGE_READWRITE
Definition: nt_native.h:1304

◆ VDDExcludeMem()

BOOL WINAPI VDDExcludeMem ( IN HANDLE  hVdd,
IN PVOID  Address,
IN ULONG  Size 
)

Definition at line 708 of file memory.c.

711 {
712  // FIXME
714  return FALSE;
715 }
#define UNIMPLEMENTED
Definition: debug.h:114

◆ VDDFreeMem()

BOOL WINAPI VDDFreeMem ( IN HANDLE  hVdd,
IN PVOID  Address,
IN ULONG  Size 
)

Definition at line 651 of file memory.c.

654 {
656  PMEM_HOOK Hook;
657  ULONG i;
658  ULONG FirstPage = (ULONG_PTR)PHYS_TO_REAL(Address) >> 12;
659  ULONG LastPage = ((ULONG_PTR)PHYS_TO_REAL(Address) + Size - 1) >> 12;
660  SIZE_T RealSize = (LastPage - FirstPage + 1) * PAGE_SIZE;
661 
662  /* Check validity of the VDD handle */
663  if (hVdd == NULL || hVdd == INVALID_HANDLE_VALUE)
664  {
666  return FALSE;
667  }
668 
669  if (Size == 0) return FALSE;
670 
671  /* Fixup the address */
672  Address = (PVOID)REAL_TO_PHYS(FirstPage * PAGE_SIZE);
673 
674  /* Be sure that all the region is held by the VDD */
675  for (i = FirstPage; i <= LastPage; i++)
676  {
677  Hook = PageTable[i];
678  if (Hook == NULL) return FALSE;
679 
680  if (Hook->hVdd != hVdd)
681  {
682  DPRINT1("VDDFreeMem: Page %u owned by someone else.\n", i);
683  return FALSE;
684  }
685  }
686 
687  /* OK, all the range is held by the VDD. Decommit the pages. */
689  &Address,
690  &RealSize,
691  MEM_DECOMMIT);
692  return NT_SUCCESS(Status);
693 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
static PMEM_HOOK PageTable[TOTAL_PAGES]
Definition: memory.c:40
LONG NTSTATUS
Definition: precomp.h:26
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
#define PHYS_TO_REAL(ptr)
Definition: emulator.h:34
#define MEM_DECOMMIT
Definition: nt_native.h:1315
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define REAL_TO_PHYS(ptr)
Definition: emulator.h:33
smooth NULL
Definition: ftsmooth.c:416
static WCHAR Address[46]
Definition: ping.c:68
void * PVOID
Definition: retypes.h:9
#define NtCurrentProcess()
Definition: nt_native.h:1657
HANDLE hVdd
Definition: memory.c:24
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SetLastError(x)
Definition: compat.h:409
#define PAGE_SIZE
Definition: env_spec_w32.h:49
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Status
Definition: gdiplustypes.h:24
ULONG_PTR SIZE_T
Definition: typedefs.h:78
#define DPRINT1
Definition: precomp.h:8
unsigned int ULONG
Definition: retypes.h:1
#define ULONG_PTR
Definition: config.h:101
HANDLE hVdd
Definition: testvdd.c:87
NTSTATUS NTAPI NtFreeVirtualMemory(IN HANDLE ProcessHandle, IN PVOID *UBaseAddress, IN PSIZE_T URegionSize, IN ULONG FreeType)
Definition: virtual.c:5090

◆ VDDIncludeMem()

BOOL WINAPI VDDIncludeMem ( IN HANDLE  hVdd,
IN PVOID  Address,
IN ULONG  Size 
)

Definition at line 697 of file memory.c.

700 {
701  // FIXME
703  return FALSE;
704 }
#define UNIMPLEMENTED
Definition: debug.h:114

◆ VDDInstallMemoryHook()

BOOL WINAPI VDDInstallMemoryHook ( IN HANDLE  hVdd,
IN PVOID  pStart,
IN DWORD  dwCount,
IN PVDD_MEMORY_HANDLER  MemoryHandler 
)

Definition at line 467 of file memory.c.

471 {
473  PMEM_HOOK Hook;
474  ULONG i;
475  ULONG FirstPage = (ULONG_PTR)PHYS_TO_REAL(pStart) >> 12;
476  ULONG LastPage = ((ULONG_PTR)PHYS_TO_REAL(pStart) + dwCount - 1) >> 12;
477  PVOID Address = (PVOID)REAL_TO_PHYS(FirstPage * PAGE_SIZE);
478  SIZE_T Size = (LastPage - FirstPage + 1) * PAGE_SIZE;
479  PLIST_ENTRY Pointer;
480 
481  /* Check validity of the VDD handle */
482  if (hVdd == NULL || hVdd == INVALID_HANDLE_VALUE)
483  {
485  return FALSE;
486  }
487 
488  if (dwCount == 0) return FALSE;
489 
490  /* Make sure none of these pages are already allocated */
491  for (i = FirstPage; i <= LastPage; i++)
492  {
493  if (PageTable[i] != NULL) return FALSE;
494  }
495 
496  for (Pointer = HookList.Flink; Pointer != &HookList; Pointer = Pointer->Flink)
497  {
498  Hook = CONTAINING_RECORD(Pointer, MEM_HOOK, Entry);
499  if (Hook->hVdd == hVdd && Hook->VddHandler == MemoryHandler) break;
500  }
501 
502  if (Pointer == &HookList)
503  {
504  /* Create and initialize a new hook entry... */
505  Hook = RtlAllocateHeap(RtlGetProcessHeap(), 0, sizeof(*Hook));
506  if (Hook == NULL)
507  {
509  return FALSE;
510  }
511 
512  Hook->hVdd = hVdd;
513  Hook->Count = 0;
514  Hook->VddHandler = MemoryHandler;
515 
516  /* ... and add it to the list of hooks */
517  InsertTailList(&HookList, &Hook->Entry);
518  }
519 
520  /* Decommit the pages */
522  &Address,
523  &Size,
524  MEM_DECOMMIT);
525  if (!NT_SUCCESS(Status))
526  {
527  if (Pointer == &HookList)
528  {
529  RemoveEntryList(&Hook->Entry);
530  RtlFreeHeap(RtlGetProcessHeap(), 0, Hook);
531  }
532 
533  return FALSE;
534  }
535 
536  /* Increase the number of pages this hook has */
537  Hook->Count += LastPage - FirstPage + 1;
538 
539  /* Add the hook entry to the page table */
540  for (i = FirstPage; i <= LastPage; i++) PageTable[i] = Hook;
541 
542  return TRUE;
543 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define TRUE
Definition: types.h:120
static PMEM_HOOK PageTable[TOTAL_PAGES]
Definition: memory.c:40
ULONG Count
Definition: memory.c:25
LONG NTSTATUS
Definition: precomp.h:26
BOOLEAN NTAPI RtlFreeHeap(IN PVOID HeapHandle, IN ULONG Flags, IN PVOID HeapBase)
Definition: heap.c:606
LIST_ENTRY Entry
Definition: memory.c:23
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
#define PHYS_TO_REAL(ptr)
Definition: emulator.h:34
#define InsertTailList(ListHead, Entry)
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
#define MEM_DECOMMIT
Definition: nt_native.h:1315
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define REAL_TO_PHYS(ptr)
Definition: emulator.h:33
smooth NULL
Definition: ftsmooth.c:416
static WCHAR Address[46]
Definition: ping.c:68
void * PVOID
Definition: retypes.h:9
static LIST_ENTRY HookList
Definition: memory.c:39
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define NtCurrentProcess()
Definition: nt_native.h:1657
PVOID NTAPI RtlAllocateHeap(IN PVOID HeapHandle, IN ULONG Flags, IN SIZE_T Size)
Definition: heap.c:588
HANDLE hVdd
Definition: memory.c:24
struct _LIST_ENTRY * Flink
Definition: typedefs.h:119
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SetLastError(x)
Definition: compat.h:409
#define PAGE_SIZE
Definition: env_spec_w32.h:49
Definition: typedefs.h:117
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
Status
Definition: gdiplustypes.h:24
ULONG_PTR SIZE_T
Definition: typedefs.h:78
unsigned int ULONG
Definition: retypes.h:1
#define ULONG_PTR
Definition: config.h:101
VOID WINAPI MemoryHandler(IN PVOID FaultAddress, IN ULONG RWMode)
Definition: testvdd.c:217
base of all file and directory entries
Definition: entries.h:82
PVDD_MEMORY_HANDLER VddHandler
Definition: memory.c:29
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
HANDLE hVdd
Definition: testvdd.c:87
NTSTATUS NTAPI NtFreeVirtualMemory(IN HANDLE ProcessHandle, IN PVOID *UBaseAddress, IN PSIZE_T URegionSize, IN ULONG FreeType)
Definition: virtual.c:5090

◆ VdmFlushCache()

BOOL WINAPI VdmFlushCache ( IN USHORT  Segment,
IN ULONG  Offset,
IN ULONG  Size,
IN VDM_MODE  Mode 
)

Definition at line 437 of file memory.c.

441 {
442  // FIXME
444  return TRUE;
445 }
#define TRUE
Definition: types.h:120
#define UNIMPLEMENTED
Definition: debug.h:114

◆ VdmMapFlat()

PVOID WINAPI VdmMapFlat ( IN USHORT  Segment,
IN ULONG  Offset,
IN VDM_MODE  Mode 
)

Definition at line 423 of file memory.c.

426 {
427  // FIXME
429 
430  return SEG_OFF_TO_PTR(Segment, Offset);
431 }
_In_ ULONG Mode
Definition: hubbusif.h:303
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define SEG_OFF_TO_PTR(seg, off)
Definition: emulator.h:28
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
_Inout_ PVOID Segment
Definition: exfuncs.h:893

◆ VdmUnmapFlat()

BOOL WINAPI VdmUnmapFlat ( IN USHORT  Segment,
IN ULONG  Offset,
IN PVOID  Buffer,
IN VDM_MODE  Mode 
)

Definition at line 453 of file memory.c.

457 {
458  // FIXME
460  return TRUE;
461 }
#define TRUE
Definition: types.h:120
#define UNIMPLEMENTED
Definition: debug.h:114

◆ WritePage()

static VOID WritePage ( PMEM_HOOK  Hook,
ULONG  Address,
PVOID  Buffer,
ULONG  Size 
)
inlinestatic

Definition at line 126 of file memory.c.

127 {
128  if (!Hook
129  || Hook->hVdd
130  || !Hook->FastWriteHandler
131  || Hook->FastWriteHandler(Address, Buffer, Size))
132  {
134  }
135 }
#define REAL_TO_PHYS(ptr)
Definition: emulator.h:33
static WCHAR Address[46]
Definition: ping.c:68
Definition: bufpool.h:45
HANDLE hVdd
Definition: memory.c:24
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
PMEMORY_WRITE_HANDLER FastWriteHandler
Definition: memory.c:34
static VOID MemFastMoveMemory(OUT VOID UNALIGNED *Destination, IN const VOID UNALIGNED *Source, IN SIZE_T Length)
Definition: memory.c:46

Referenced by EmulatorWriteMemory(), and MmFinalizeSectionPageOut().

Variable Documentation

◆ A20Line

BOOLEAN A20Line = FALSE
static

Definition at line 41 of file memory.c.

Referenced by EmulatorGetA20(), EmulatorReadMemory(), EmulatorSetA20(), and EmulatorWriteMemory().

◆ HookList

LIST_ENTRY HookList
static

Definition at line 39 of file memory.c.

Referenced by MemCleanup(), MemInitialize(), MemInstallFastMemoryHook(), and VDDInstallMemoryHook().

◆ PageTable