1 /* 2 * vddsvc.h 3 * 4 * Windows NT Device Driver Kit 5 * 6 * This file is part of the ReactOS DDK package. 7 * 8 * Contributors: 9 * Hermes Belusca-Maito (hermes.belusca@sfr.fr) 10 * 11 * THIS SOFTWARE IS NOT COPYRIGHTED 12 * 13 * This source code is offered for use in the public domain. You may 14 * use, modify or distribute it freely. 15 * 16 * This code is distributed in the hope that it will be useful but 17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY 18 * DISCLAIMED. This includes but is not limited to warranties of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 20 * 21 */ 22 23 #pragma once 24 25 #ifndef _NT_VDD 26 #include <nt_vdd.h> 27 #endif 28 29 /* 30 * Interrupts services 31 */ 32 #define ICA_MASTER 0 33 #define ICA_SLAVE 1 34 35 VOID 36 WINAPI 37 call_ica_hw_interrupt( 38 _In_ INT ms, 39 _In_ BYTE line, 40 _In_ INT count); 41 42 #define VDDSimulateInterrupt(ms, line, count) \ 43 call_ica_hw_interrupt((ms), (line), (count)) // Windows specifies a count of 1 ... 44 45 46 /* 47 * Memory services 48 */ 49 50 #ifdef i386 51 52 PBYTE 53 WINAPI 54 MGetVdmPointer( 55 _In_ ULONG Address, 56 _In_ ULONG Size, 57 _In_ BOOLEAN ProtectedMode); 58 59 #define Sim32GetVDMPointer(Address, Size, Mode) \ 60 MGetVdmPointer((Address), (Size), (Mode)) 61 62 #define Sim32FlushVDMPointer(Address, Size, Buffer, Mode) TRUE 63 64 #else 65 66 PBYTE 67 WINAPI 68 Sim32GetVDMPointer( 69 _In_ ULONG Address, 70 _In_ ULONG Size, 71 _In_ BOOLEAN ProtectedMode); 72 73 BOOLEAN 74 WINAPI 75 Sim32FlushVDMPointer( 76 _In_ ULONG Address, 77 _In_ ULONG Size, 78 _In_ PBYTE Buffer, 79 _In_ BOOLEAN ProtectedMode); 80 81 #endif 82 83 PBYTE 84 WINAPI 85 Sim32pGetVDMPointer( 86 _In_ ULONG Address, 87 _In_ BOOLEAN ProtectedMode); 88 89 /* This API appears to have never been implemented anywhere... */ 90 #define Sim32FreeVDMPointer(Address, Size, Buffer, Mode) TRUE 91 92 #define GetVDMAddress(usSeg, usOff) (((ULONG)(usSeg) << 4) + (ULONG)(usOff)) 93 94 #define GetVDMPointer(Address, Size, Mode) \ 95 Sim32GetVDMPointer(Address, Size, Mode) 96 97 #define FlushVDMPointer(Address, Size, Buffer, Mode) \ 98 Sim32FlushVDMPointer(Address, Size, Buffer, Mode) 99 100 #define FreeVDMPointer(Address, Size, Buffer, Mode) \ 101 Sim32FreeVDMPointer(Address, Size, Buffer, Mode) 102 103 104 /* 105 * Registers manipulation 106 */ 107 PVOID WINAPI getIntelRegistersPointer(VOID); 108 109 #ifndef _M_MIPS 110 111 ULONG WINAPI getEAX(VOID); 112 VOID WINAPI setEAX(ULONG); 113 USHORT WINAPI getAX(VOID); 114 VOID WINAPI setAX(USHORT); 115 UCHAR WINAPI getAH(VOID); 116 VOID WINAPI setAH(UCHAR); 117 UCHAR WINAPI getAL(VOID); 118 VOID WINAPI setAL(UCHAR); 119 120 ULONG WINAPI getEBX(VOID); 121 VOID WINAPI setEBX(ULONG); 122 USHORT WINAPI getBX(VOID); 123 VOID WINAPI setBX(USHORT); 124 UCHAR WINAPI getBH(VOID); 125 VOID WINAPI setBH(UCHAR); 126 UCHAR WINAPI getBL(VOID); 127 VOID WINAPI setBL(UCHAR); 128 129 ULONG WINAPI getECX(VOID); 130 VOID WINAPI setECX(ULONG); 131 USHORT WINAPI getCX(VOID); 132 VOID WINAPI setCX(USHORT); 133 UCHAR WINAPI getCH(VOID); 134 VOID WINAPI setCH(UCHAR); 135 UCHAR WINAPI getCL(VOID); 136 VOID WINAPI setCL(UCHAR); 137 138 ULONG WINAPI getEDX(VOID); 139 VOID WINAPI setEDX(ULONG); 140 USHORT WINAPI getDX(VOID); 141 VOID WINAPI setDX(USHORT); 142 UCHAR WINAPI getDH(VOID); 143 VOID WINAPI setDH(UCHAR); 144 UCHAR WINAPI getDL(VOID); 145 VOID WINAPI setDL(UCHAR); 146 147 148 149 ULONG WINAPI getESP(VOID); 150 VOID WINAPI setESP(ULONG); 151 USHORT WINAPI getSP(VOID); 152 VOID WINAPI setSP(USHORT); 153 154 ULONG WINAPI getEBP(VOID); 155 VOID WINAPI setEBP(ULONG); 156 USHORT WINAPI getBP(VOID); 157 VOID WINAPI setBP(USHORT); 158 159 ULONG WINAPI getESI(VOID); 160 VOID WINAPI setESI(ULONG); 161 USHORT WINAPI getSI(VOID); 162 VOID WINAPI setSI(USHORT); 163 164 ULONG WINAPI getEDI(VOID); 165 VOID WINAPI setEDI(ULONG); 166 USHORT WINAPI getDI(VOID); 167 VOID WINAPI setDI(USHORT); 168 169 ULONG WINAPI getEIP(VOID); 170 VOID WINAPI setEIP(ULONG); 171 USHORT WINAPI getIP(VOID); 172 VOID WINAPI setIP(USHORT); 173 174 USHORT WINAPI getCS(VOID); 175 VOID WINAPI setCS(USHORT); 176 USHORT WINAPI getSS(VOID); 177 VOID WINAPI setSS(USHORT); 178 USHORT WINAPI getDS(VOID); 179 VOID WINAPI setDS(USHORT); 180 USHORT WINAPI getES(VOID); 181 VOID WINAPI setES(USHORT); 182 USHORT WINAPI getFS(VOID); 183 VOID WINAPI setFS(USHORT); 184 USHORT WINAPI getGS(VOID); 185 VOID WINAPI setGS(USHORT); 186 187 ULONG WINAPI getCF(VOID); 188 VOID WINAPI setCF(ULONG); 189 ULONG WINAPI getPF(VOID); 190 VOID WINAPI setPF(ULONG); 191 ULONG WINAPI getAF(VOID); 192 VOID WINAPI setAF(ULONG); 193 ULONG WINAPI getZF(VOID); 194 VOID WINAPI setZF(ULONG); 195 ULONG WINAPI getSF(VOID); 196 VOID WINAPI setSF(ULONG); 197 ULONG WINAPI getIF(VOID); 198 VOID WINAPI setIF(ULONG); 199 ULONG WINAPI getDF(VOID); 200 VOID WINAPI setDF(ULONG); 201 ULONG WINAPI getOF(VOID); 202 VOID WINAPI setOF(ULONG); 203 204 ULONG WINAPI getEFLAGS(VOID); 205 VOID WINAPI setEFLAGS(ULONG); 206 207 USHORT WINAPI getMSW(VOID); 208 VOID WINAPI setMSW(USHORT); 209 210 #else 211 212 ULONG WINAPI c_getEAX(VOID); 213 VOID WINAPI c_setEAX(ULONG); 214 USHORT WINAPI c_getAX(VOID); 215 VOID WINAPI c_setAX(USHORT); 216 UCHAR WINAPI c_getAH(VOID); 217 VOID WINAPI c_setAH(UCHAR); 218 UCHAR WINAPI c_getAL(VOID); 219 VOID WINAPI c_setAL(UCHAR); 220 221 ULONG WINAPI c_getEBX(VOID); 222 VOID WINAPI c_setEBX(ULONG); 223 USHORT WINAPI c_getBX(VOID); 224 VOID WINAPI c_setBX(USHORT); 225 UCHAR WINAPI c_getBH(VOID); 226 VOID WINAPI c_setBH(UCHAR); 227 UCHAR WINAPI c_getBL(VOID); 228 VOID WINAPI c_setBL(UCHAR); 229 230 ULONG WINAPI c_getECX(VOID); 231 VOID WINAPI c_setECX(ULONG); 232 USHORT WINAPI c_getCX(VOID); 233 VOID WINAPI c_setCX(USHORT); 234 UCHAR WINAPI c_getCH(VOID); 235 VOID WINAPI c_setCH(UCHAR); 236 UCHAR WINAPI c_getCL(VOID); 237 VOID WINAPI c_setCL(UCHAR); 238 239 ULONG WINAPI c_getEDX(VOID); 240 VOID WINAPI c_setEDX(ULONG); 241 USHORT WINAPI c_getDX(VOID); 242 VOID WINAPI c_setDX(USHORT); 243 UCHAR WINAPI c_getDH(VOID); 244 VOID WINAPI c_setDH(UCHAR); 245 UCHAR WINAPI c_getDL(VOID); 246 VOID WINAPI c_setDL(UCHAR); 247 248 249 250 ULONG WINAPI c_getESP(VOID); 251 VOID WINAPI c_setESP(ULONG); 252 USHORT WINAPI c_getSP(VOID); 253 VOID WINAPI c_setSP(USHORT); 254 255 ULONG WINAPI c_getEBP(VOID); 256 VOID WINAPI c_setEBP(ULONG); 257 USHORT WINAPI c_getBP(VOID); 258 VOID WINAPI c_setBP(USHORT); 259 260 ULONG WINAPI c_getESI(VOID); 261 VOID WINAPI c_setESI(ULONG); 262 USHORT WINAPI c_getSI(VOID); 263 VOID WINAPI c_setSI(USHORT); 264 265 ULONG WINAPI c_getEDI(VOID); 266 VOID WINAPI c_setEDI(ULONG); 267 USHORT WINAPI c_getDI(VOID); 268 VOID WINAPI c_setDI(USHORT); 269 270 ULONG WINAPI c_getEIP(VOID); 271 VOID WINAPI c_setEIP(ULONG); 272 USHORT WINAPI c_getIP(VOID); 273 VOID WINAPI c_setIP(USHORT); 274 275 USHORT WINAPI c_getCS(VOID); 276 VOID WINAPI c_setCS(USHORT); 277 USHORT WINAPI c_getSS(VOID); 278 VOID WINAPI c_setSS(USHORT); 279 USHORT WINAPI c_getDS(VOID); 280 VOID WINAPI c_setDS(USHORT); 281 USHORT WINAPI c_getES(VOID); 282 VOID WINAPI c_setES(USHORT); 283 USHORT WINAPI c_getFS(VOID); 284 VOID WINAPI c_setFS(USHORT); 285 USHORT WINAPI c_getGS(VOID); 286 VOID WINAPI c_setGS(USHORT); 287 288 ULONG WINAPI c_getCF(VOID); 289 VOID WINAPI c_setCF(ULONG); 290 ULONG WINAPI c_getPF(VOID); 291 VOID WINAPI c_setPF(ULONG); 292 ULONG WINAPI c_getAF(VOID); 293 VOID WINAPI c_setAF(ULONG); 294 ULONG WINAPI c_getZF(VOID); 295 VOID WINAPI c_setZF(ULONG); 296 ULONG WINAPI c_getSF(VOID); 297 VOID WINAPI c_setSF(ULONG); 298 ULONG WINAPI c_getIF(VOID); 299 VOID WINAPI c_setIF(ULONG); 300 ULONG WINAPI c_getDF(VOID); 301 VOID WINAPI c_setDF(ULONG); 302 ULONG WINAPI c_getOF(VOID); 303 VOID WINAPI c_setOF(ULONG); 304 305 USHORT WINAPI c_getMSW(VOID); 306 VOID WINAPI c_setMSW(USHORT); 307 308 #endif 309 310 /* EOF */ 311