ReactOS  0.4.14-dev-606-g14ebc0b
callback.h
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: GPL - See COPYING in the top level directory
3  * PROJECT: ReactOS Virtual DOS Machine
4  * FILE: subsystems/mvdm/ntvdm/cpu/callback.h
5  * PURPOSE: 32-bit Interrupt Handlers
6  * PROGRAMMERS: Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
7  * Hermes Belusca-Maito (hermes.belusca@sfr.fr)
8  */
9 
10 #ifndef _CALLBACK_H_
11 #define _CALLBACK_H_
12 
13 /* DEFINES ********************************************************************/
14 
15 #define BOP(num) LOBYTE(EMULATOR_BOP), HIBYTE(EMULATOR_BOP), (num)
16 #define UnSimulate16(trap) \
17 do { \
18  *(PUSHORT)(trap) = EMULATOR_BOP; \
19  (trap) += sizeof(USHORT); \
20  *(trap) = BOP_UNSIMULATE; \
21 } while(0)
22 // #define UnSimulate16 MAKELONG(EMULATOR_BOP, BOP_UNSIMULATE) // BOP(BOP_UNSIMULATE)
23 
24 #define TRAMPOLINE_SIZE sizeof(ULONGLONG)
25 
26 typedef struct _CALLBACK16
27 {
28  ULONG TrampolineFarPtr; // Where the trampoline zone is placed
29  ULONG TrampolineSize; // Size of the trampoline zone
33 
34 /* FUNCTIONS ******************************************************************/
35 
36 VOID
38  IN ULONG TrampolineSize,
40  IN USHORT Offset);
41 
42 VOID
45  IN USHORT Offset);
46 
47 VOID
49  IN USHORT Offset);
50 
51 VOID
53  IN ULONG FarPtr);
54 
55 ULONG
57  IN LPBYTE CallbackCode,
58  IN SIZE_T CallbackSize,
59  OUT PSIZE_T CodeSize OPTIONAL);
60 
61 #endif /* _CALLBACK_H_ */
VOID InitializeContext(IN PCALLBACK16 Context, IN USHORT Segment, IN USHORT Offset)
Definition: callback.c:60
#define IN
Definition: typedefs.h:38
VOID RunCallback16(IN PCALLBACK16 Context, IN ULONG FarPtr)
Definition: callback.c:93
ULONG RegisterCallback16(IN ULONG FarPtr, IN LPBYTE CallbackCode, IN SIZE_T CallbackSize, OUT PSIZE_T CodeSize OPTIONAL)
Definition: callback.c:120
USHORT NextOffset
Definition: callback.h:31
unsigned char * LPBYTE
Definition: typedefs.h:52
ULONG_PTR * PSIZE_T
Definition: typedefs.h:78
_In_ ULONG _In_ ULONG Offset
Definition: ntddpcm.h:101
ULONG TrampolineFarPtr
Definition: callback.h:28
_Inout_ PVOID Segment
Definition: exfuncs.h:893
USHORT Segment
Definition: callback.h:30
struct _CALLBACK16 * PCALLBACK16
struct _CALLBACK16 CALLBACK16
ULONG_PTR SIZE_T
Definition: typedefs.h:78
unsigned short USHORT
Definition: pedump.c:61
#define OUT
Definition: typedefs.h:39
unsigned int ULONG
Definition: retypes.h:1
VOID Call16(IN USHORT Segment, IN USHORT Offset)
Definition: callback.c:71
VOID InitializeContextEx(IN PCALLBACK16 Context, IN ULONG TrampolineSize, IN USHORT Segment, IN USHORT Offset)
Definition: callback.c:48
ULONG TrampolineSize
Definition: callback.h:29
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68