aboutsummaryrefslogtreecommitdiff
path: root/w9x/inc/vmm.h
blob: eb8f8341abf241b795422ca8a5cf75a74fb7ca88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#ifndef VMM_H
#define VMM_H

/** VMM VxD services and types.
 *  Manually generated for now. */

#include <stdint.h>

#define PAGESHIFT  12
#define PAGESIZE   (1 << PAGESHIFT)

/** Timeout handle, see Set_*_Time_Out, Cancel_Time_Out services. */
typedef void* HTIMEOUT;

static inline unsigned short Get_VMM_Version(void);
#pragma aux Get_VMM_Version = \
	"int 0x20" \
	"dd ( 1 shl 16 ) + 0" \
	__parm caller [] __value [ax]

static inline void Release_Time_Slice(void);
#pragma aux Release_Time_Slice = \
	"int 0x20" \
	"dd ( 1 shl 16 ) + 56" \
	__parm caller __modify []

static inline void Time_Slice_Sleep(uint32_t ms);
#pragma aux Time_Slice_Sleep = \
	"int 0x20" \
	"dd ( 1 shl 16 ) + 353" \
	__parm caller [eax] __modify []

typedef void (Global_Time_Out_Proc)(void *VMHandle, uint32_t tardiness, uint32_t ref_data);
#pragma aux Global_Time_Out_Proc __parm [ebx] [ecx] [edx]

static inline HTIMEOUT Set_Global_Time_Out(Global_Time_Out_Proc *proc, uint32_t ms, uint32_t refData);
#pragma aux Set_Global_Time_Out = \
	"int 0x20" \
	"dd ( 1 shl 16 ) + 60" \
	__parm caller [esi] __value [esi] __modify [ecx edx]

static inline void Cancel_Time_Out(HTIMEOUT timeout);
#pragma aux Cancel_Time_Out = \
	"int 0x20" \
	"dd ( 1 shl 16 ) + 62" \
	__parm caller [esi] __modify [eax ecx edx]

typedef void (Async_Time_Out_Proc)(uint32_t tardiness, uint32_t ref_data);
#pragma aux Async_Time_Out_Proc __parm [ecx] [edx]

static inline HTIMEOUT Set_Async_Time_Out(Async_Time_Out_Proc *proc, uint32_t ms, uint32_t refData);
#pragma aux Set_Async_Time_Out = \
	"int 0x20" \
	"dd ( 1 shl 16 ) + 254" \
	__parm caller [esi] [eax] [edx] __value [esi] __modify [ecx edx]

static inline uint32_t Get_System_Time(void);
#pragma aux Get_System_Time = \
	"int 0x20" \
	"dd ( 1 shl 16 ) + 63" \
	__parm caller __value [eax] __modify []

static inline uint32_t Get_Last_Updated_System_Time(void);
#pragma aux Get_Last_Updated_System_Time = \
	"int 0x20" \
	"dd ( 1 shl 16 ) + 207" \
	__parm caller __value [eax] __modify []

static inline uint32_t * Get_System_Time_Address(void);
#pragma aux Get_System_Time_Address = \
	"int 0x20" \
	"dd ( 1 shl 16 ) + 324" \
	__parm caller __value [eax] __modify []

enum {
	HEAPZEROINIT = 0x0001,
	HEAPZEROREINIT = 0x0002,
	HEAPNOCOPY = 0x0004,
	HEAPLOCKEDIFDP = 0x0100,
	HEAPSWAP = 0x0200,
	HEAPINIT = 0x0400,
	HEAPCLEAN = 0x0800
};

static inline void * HeapAllocate(unsigned long bytes, unsigned long flags);
#pragma aux HeapAllocate = \
	"int 0x20" \
	"dd ( 1 shl 16 ) + 79" \
	__parm caller [] __value [eax] __modify [ecx edx]

static inline unsigned long HeapFree(void *addr, unsigned long flags);
#pragma aux HeapFree = \
	"int 0x20" \
	"dd ( 1 shl 16 ) + 81" \
	__parm caller [] __value [eax] __modify [ecx edx]

enum page_allocate_types {
	PG_VM = 0,
	PG_SYS = 1,
	PG_RESERVED1 = 2,
	PG_PRIVATE = 3,
	PG_RESERVED2 = 4,
	PG_RELOCK = 5,
	PG_INSTANCE = 6,
	PG_HOOKED = 7
};

enum page_allocate_flags {
	PAGEZEROINIT = 0x00000001,
	PAGEUSEALIGN = 0x00000002,
	PAGECONTIG = 0x00000004,
	PAGEFIXED = 0x00000008,
	PAGEDEBUGNULFAULT = 0x00000010,
	PAGEZEROREINIT = 0x00000020,
	PAGENOCOPY = 0x00000040,
	PAGELOCKED = 0x00000080,
	PAGELOCKEDIFDP = 0x00000100,
	PAGESETV86PAGEABLE = 0x00000200,
	PAGECLEARV86PAGEABLE = 0x00000400,
	PAGESETV86INTSLOCKED = 0x00000800,
	PAGECLEARV86INTSLOCKED = 0x00001000,
	PAGEMARKPAGEOUT = 0x00002000,
	PAGEPDPSETBASE = 0x00004000,
	PAGEPDPCLEARBASE = 0x00008000,
	PAGEDISCARD = 0x00010000,
	PAGEPDPQUERYDIRTY = 0x00020000,
	PAGEMAPFREEPHYSREG = 0x00040000,
	PAGENOMOVE = 0x10000000,
	PAGEMAPGLOBAL = 0x40000000,
	PAGEMARKDIRTY = 0x80000000
};

static inline void * PageAllocate(unsigned long npages, unsigned long type, unsigned long vm,
                                  unsigned long alignMask, unsigned long minPhys, unsigned long maxPhys,
                                  uint32_t *physAddr, unsigned long flags);
#pragma aux PageAllocate = \
	"int 0x20" \
	"dd ( 1 shl 16 ) + 83" \
	__parm caller [] __value [eax] __modify [ecx edx]

static inline unsigned long PageFree(void *addr, unsigned long flags);
#pragma aux PageFree = \
	"int 0x20" \
	"dd ( 1 shl 16 ) + 85" \
	__parm caller [] __value [eax] __modify [ecx edx]

static inline char Hook_Device_Service(uint32_t service, void *hook);
#pragma aux Hook_Device_Service = \
	"int 0x20" \
	"dd ( 1 shl 16 ) + 144" \
	"setc al" \
	__parm caller [eax] [esi] __value [al] __modify [ecx edx]

static inline char Unhook_Device_Service(uint32_t service, void *hook);
#pragma aux Unhook_Device_Service = \
	"int 0x20" \
	"dd ( 1 shl 16 ) + 284" \
	"setc al" \
	__parm caller [eax] [esi] __value [al] __modify [ecx edx]

#endif // VMM_H