xref: /reactos/subsystems/mvdm/ntvdm/memory.h (revision c2c66aff)
1 /*
2  * COPYRIGHT:       GPLv2+ - See COPYING in the top level directory
3  * PROJECT:         ReactOS Virtual DOS Machine
4  * FILE:            subsystems/mvdm/ntvdm/memory.h
5  * PURPOSE:         Memory Management
6  * PROGRAMMERS:     Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
7  */
8 
9 #ifndef _MEMORY_H_
10 #define _MEMORY_H_
11 
12 /* DEFINITIONS ****************************************************************/
13 
14 #define TOTAL_PAGES (MAX_ADDRESS / PAGE_SIZE)
15 
16 typedef VOID
17 (FASTCALL *PMEMORY_READ_HANDLER)
18 (
19     ULONG Address,
20     PVOID Buffer,
21     ULONG Size
22 );
23 
24 typedef BOOLEAN
25 (FASTCALL *PMEMORY_WRITE_HANDLER)
26 (
27     ULONG Address,
28     PVOID Buffer,
29     ULONG Size
30 );
31 
32 /* FUNCTIONS ******************************************************************/
33 
34 BOOLEAN MemInitialize(VOID);
35 VOID MemCleanup(VOID);
36 VOID MemExceptionHandler(ULONG FaultAddress, BOOLEAN Writing);
37 
38 VOID
39 FASTCALL
40 EmulatorReadMemory
41 (
42     PFAST486_STATE State,
43     ULONG Address,
44     PVOID Buffer,
45     ULONG Size
46 );
47 
48 VOID
49 FASTCALL
50 EmulatorWriteMemory
51 (
52     PFAST486_STATE State,
53     ULONG Address,
54     PVOID Buffer,
55     ULONG Size
56 );
57 
58 VOID
59 FASTCALL
60 EmulatorCopyMemory
61 (
62     PFAST486_STATE State,
63     ULONG DestAddress,
64     ULONG SrcAddress,
65     ULONG Size
66 );
67 
68 VOID EmulatorSetA20(BOOLEAN Enabled);
69 BOOLEAN EmulatorGetA20(VOID);
70 
71 BOOL
72 MemInstallFastMemoryHook
73 (
74     PVOID Address,
75     ULONG Size,
76     PMEMORY_READ_HANDLER ReadHandler,
77     PMEMORY_WRITE_HANDLER WriteHandler
78 );
79 
80 BOOL
81 MemRemoveFastMemoryHook
82 (
83     PVOID Address,
84     ULONG Size
85 );
86 
87 BOOLEAN
88 MemQueryMemoryZone
89 (
90     ULONG StartAddress,
91     PULONG Length,
92     PBOOLEAN Hooked
93 );
94 
95 #endif /* _MEMORY_H_ */
96