[FAST486]
[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 typedef struct _CALLBACK16
19 {
20 ULONG TrampolineFarPtr; // Where the trampoline zone is placed
21 ULONG TrampolineSize; // Size of the trampoline zone
22 USHORT Segment;
23 USHORT NextOffset;
24 } CALLBACK16, *PCALLBACK16;
25
26 extern const ULONG Int16To32StubSize;
27
28 /* FUNCTIONS ******************************************************************/
29
30 typedef VOID (WINAPI *EMULATOR_INT32_PROC)(LPWORD Stack);
31
32 VOID
33 InitializeContext(IN PCALLBACK16 Context,
34 IN USHORT Segment,
35 IN USHORT Offset);
36
37 VOID
38 Call16(IN USHORT Segment,
39 IN USHORT Offset);
40
41 ULONG
42 RegisterCallback16(IN ULONG FarPtr,
43 IN LPBYTE CallbackCode,
44 IN SIZE_T CallbackSize,
45 OUT PSIZE_T CodeSize OPTIONAL);
46
47 VOID
48 RunCallback16(IN PCALLBACK16 Context,
49 IN ULONG FarPtr);
50
51 ULONG
52 RegisterInt16(IN ULONG FarPtr,
53 IN BYTE IntNumber,
54 IN LPBYTE CallbackCode,
55 IN SIZE_T CallbackSize,
56 OUT PSIZE_T CodeSize OPTIONAL);
57
58 ULONG
59 RegisterInt32(IN ULONG FarPtr,
60 IN BYTE IntNumber,
61 IN EMULATOR_INT32_PROC IntHandler,
62 OUT PSIZE_T CodeSize OPTIONAL);
63
64 VOID
65 Int32Call(IN PCALLBACK16 Context,
66 IN BYTE IntNumber);
67
68 VOID WINAPI Int32Dispatch(LPWORD Stack);
69 VOID InitializeCallbacks(VOID);
70
71 #endif // _CALLBACK_H_
72
73 /* EOF */