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 30 USHORT Segment; 31 USHORT NextOffset; 32 } CALLBACK16, *PCALLBACK16; 33 34 /* FUNCTIONS ******************************************************************/ 35 36 VOID 37 InitializeContextEx(IN PCALLBACK16 Context, 38 IN ULONG TrampolineSize, 39 IN USHORT Segment, 40 IN USHORT Offset); 41 42 VOID 43 InitializeContext(IN PCALLBACK16 Context, 44 IN USHORT Segment, 45 IN USHORT Offset); 46 47 VOID 48 Call16(IN USHORT Segment, 49 IN USHORT Offset); 50 51 VOID 52 RunCallback16(IN PCALLBACK16 Context, 53 IN ULONG FarPtr); 54 55 ULONG 56 RegisterCallback16(IN ULONG FarPtr, 57 IN LPBYTE CallbackCode, 58 IN SIZE_T CallbackSize, 59 OUT PSIZE_T CodeSize OPTIONAL); 60 61 #endif /* _CALLBACK_H_ */ 62