Start source tree (final, I hope!) restructuration. Part 1/X
[reactos.git] / reactos / subsystems / mvdm / ntvdm / cpu / callback.h
1 /*
2 * COPYRIGHT: GPL - See COPYING in the top level directory
3 * PROJECT: ReactOS Virtual DOS Machine
4 * FILE: 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 typedef struct _CALLBACK16
25 {
26 ULONG TrampolineFarPtr; // Where the trampoline zone is placed
27 ULONG TrampolineSize; // Size of the trampoline zone
28 USHORT Segment;
29 USHORT NextOffset;
30 } CALLBACK16, *PCALLBACK16;
31
32 /* FUNCTIONS ******************************************************************/
33
34 VOID
35 InitializeContextEx(IN PCALLBACK16 Context,
36 IN ULONG TrampolineSize,
37 IN USHORT Segment,
38 IN USHORT Offset);
39
40 VOID
41 InitializeContext(IN PCALLBACK16 Context,
42 IN USHORT Segment,
43 IN USHORT Offset);
44
45 VOID
46 Call16(IN USHORT Segment,
47 IN USHORT Offset);
48
49 VOID
50 RunCallback16(IN PCALLBACK16 Context,
51 IN ULONG FarPtr);
52
53 ULONG
54 RegisterCallback16(IN ULONG FarPtr,
55 IN LPBYTE CallbackCode,
56 IN SIZE_T CallbackSize,
57 OUT PSIZE_T CodeSize OPTIONAL);
58
59 #endif // _CALLBACK_H_
60
61 /* EOF */