[BRANCHES]
[reactos.git] / reactos / subsystems / ntvdm / 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 /* 32-bit Interrupt Identifiers */
16 #define EMULATOR_MAX_INT32_NUM 0xFF + 1
17
18 #define INT_HANDLER_OFFSET 0x1000
19 #define COMMON_STUB_OFFSET 0x2000
20
21
22 typedef struct _CALLBACK16
23 {
24 ULONG TrampolineFarPtr; // Where the trampoline zone is placed
25 USHORT Segment;
26 USHORT NextOffset;
27 } CALLBACK16, *PCALLBACK16;
28
29
30 /* FUNCTIONS ******************************************************************/
31
32 typedef VOID (WINAPI *EMULATOR_INT32_PROC)(LPWORD Stack);
33
34 VOID
35 InitializeContext(IN PCALLBACK16 Context,
36 IN USHORT Segment,
37 IN USHORT Offset);
38
39 VOID
40 Call16(IN USHORT Segment,
41 IN USHORT Offset);
42
43 ULONG
44 RegisterCallback16(IN ULONG FarPtr,
45 IN LPBYTE CallbackCode,
46 IN SIZE_T CallbackSize,
47 OUT PSIZE_T CodeSize OPTIONAL);
48
49 VOID
50 RunCallback16(IN PCALLBACK16 Context,
51 IN ULONG FarPtr);
52
53 ULONG
54 RegisterInt16(IN ULONG FarPtr,
55 IN BYTE IntNumber,
56 IN LPBYTE CallbackCode,
57 IN SIZE_T CallbackSize,
58 OUT PSIZE_T CodeSize OPTIONAL);
59
60 ULONG
61 RegisterInt32(IN ULONG FarPtr,
62 IN BYTE IntNumber,
63 IN EMULATOR_INT32_PROC IntHandler,
64 OUT PSIZE_T CodeSize OPTIONAL);
65
66 VOID
67 Int32Call(IN PCALLBACK16 Context,
68 IN BYTE IntNumber);
69
70 VOID WINAPI Int32Dispatch(LPWORD Stack);
71 VOID InitializeCallbacks(VOID);
72
73 #endif // _CALLBACK_H_
74
75 /* EOF */