ReactOS 0.4.15-dev-7842-g558ab78
int32.h File Reference
#include "cpu/callback.h"
Include dependency graph for int32.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define EMULATOR_MAX_INT32_NUM   0xFF + 1
 
#define STACK_INT_NUM   0
 
#define STACK_IP   1
 
#define STACK_CS   2
 
#define STACK_FLAGS   3
 
#define Int16To32StubSize   17
 

Typedefs

typedef VOID(WINAPIEMULATOR_INT32_PROC) (LPWORD Stack)
 

Functions

ULONG RegisterInt16 (IN ULONG FarPtr, IN BYTE IntNumber, IN LPBYTE CallbackCode, IN SIZE_T CallbackSize, OUT PSIZE_T CodeSize OPTIONAL)
 
ULONG RegisterInt32 (IN ULONG FarPtr, IN BYTE IntNumber, IN EMULATOR_INT32_PROC IntHandler, OUT PSIZE_T CodeSize OPTIONAL)
 
VOID Int32Call (IN PCALLBACK16 Context, IN BYTE IntNumber)
 
VOID InitializeInt32 (VOID)
 

Macro Definition Documentation

◆ EMULATOR_MAX_INT32_NUM

#define EMULATOR_MAX_INT32_NUM   0xFF + 1

Definition at line 20 of file int32.h.

◆ Int16To32StubSize

#define Int16To32StubSize   17

Definition at line 38 of file int32.h.

◆ STACK_CS

#define STACK_CS   2

Definition at line 34 of file int32.h.

◆ STACK_FLAGS

#define STACK_FLAGS   3

Definition at line 35 of file int32.h.

◆ STACK_INT_NUM

#define STACK_INT_NUM   0

Definition at line 30 of file int32.h.

◆ STACK_IP

#define STACK_IP   1

Definition at line 33 of file int32.h.

Typedef Documentation

◆ EMULATOR_INT32_PROC

typedef VOID(WINAPI * EMULATOR_INT32_PROC) (LPWORD Stack)

Definition at line 42 of file int32.h.

Function Documentation

◆ InitializeInt32()

VOID InitializeInt32 ( VOID  )

Definition at line 194 of file int32.c.

195{
196 /* Register the Control BOP */
198}
VOID RegisterBop(BYTE BopCode, EMULATOR_BOP_PROC BopHandler)
Definition: bop.c:29
#define BOP_CONTROL
Definition: int32.c:31
static VOID WINAPI ControlBop(LPWORD Stack)
Definition: int32.c:80

Referenced by EmulatorInitialize().

◆ Int32Call()

VOID Int32Call ( IN PCALLBACK16  Context,
IN BYTE  IntNumber 
)

*Trampoline++ = 0x90; // nop

Definition at line 151 of file int32.c.

153{
154 /*
155 * TODO: This function has almost the same code as RunCallback16.
156 * Something that may be nice is to have a common interface to
157 * build the trampoline...
158 */
159
160 PUCHAR TrampolineBase = (PUCHAR)FAR_POINTER(Context->TrampolineFarPtr);
161 PUCHAR Trampoline = TrampolineBase;
162 UCHAR OldTrampoline[INT16_TRAMPOLINE_SIZE];
163
164 DPRINT("Int32Call(0x%02X)\n", IntNumber);
165
166 ASSERT(Context->TrampolineSize == INT16_TRAMPOLINE_SIZE);
167
168 /* Save the old trampoline */
169 ((PULONGLONG)&OldTrampoline)[0] = ((PULONGLONG)TrampolineBase)[0];
170
171 /* Build the generic entry-point for 16-bit calls */
172 if (IntNumber == 0x03)
173 {
174 /* We are redefining for INT 03h */
175 *Trampoline++ = 0xCC; // Call INT 03h
177 }
178 else
179 {
180 /* Normal interrupt */
181 *Trampoline++ = 0xCD; // Call INT XXh
182 *Trampoline++ = IntNumber;
183 }
184 UnSimulate16(Trampoline);
185
186 /* Perform the call */
187 Call16(HIWORD(Context->TrampolineFarPtr),
188 LOWORD(Context->TrampolineFarPtr));
189
190 /* Restore the old trampoline */
191 ((PULONGLONG)TrampolineBase)[0] = ((PULONGLONG)&OldTrampoline)[0];
192}
#define FAR_POINTER(x)
Definition: emulator.h:35
#define INT16_TRAMPOLINE_SIZE
Definition: int32.c:35
#define ASSERT(a)
Definition: mode.c:44
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
Definition: ntbasedef.h:383
#define LOWORD(l)
Definition: pedump.c:82
#define DPRINT
Definition: sndvol32.h:71
VOID Call16(IN USHORT Segment, IN USHORT Offset)
Definition: callback.c:71
#define UnSimulate16(trap)
Definition: callback.h:16
unsigned char * PUCHAR
Definition: typedefs.h:53
#define HIWORD(l)
Definition: typedefs.h:247
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by BiosCharPrint(), BiosKeyboardIrq(), BiosPs2Service(), BiosTimerIrq(), ConDrvInputStatus(), ConDrvReadInput(), ConDrvWriteOutput(), Dem_BiosCharPrint(), DosControlBreak(), DosFastConOut(), and VbeService().

◆ RegisterInt16()

ULONG RegisterInt16 ( IN ULONG  FarPtr,
IN BYTE  IntNumber,
IN LPBYTE  CallbackCode,
IN SIZE_T  CallbackSize,
OUT PSIZE_T CodeSize  OPTIONAL 
)

Definition at line 100 of file int32.c.

105{
106 /* Get a pointer to the IVT and set the corresponding entry (far pointer) */
107 LPDWORD IntVecTable = (LPDWORD)SEG_OFF_TO_PTR(0x0000, 0x0000);
108 IntVecTable[IntNumber] = FarPtr;
109
110 /* Register the 16-bit callback */
111 return RegisterCallback16(FarPtr,
112 CallbackCode,
113 CallbackSize,
114 CodeSize);
115}
#define SEG_OFF_TO_PTR(seg, off)
Definition: emulator.h:32
#define LPDWORD
Definition: nt_native.h:46
ULONG RegisterCallback16(IN ULONG FarPtr, IN LPBYTE CallbackCode, IN SIZE_T CallbackSize, OUT PSIZE_T CodeSize OPTIONAL)
Definition: callback.c:120
uint32_t * LPDWORD
Definition: typedefs.h:59

Referenced by RegisterInt32().

◆ RegisterInt32()

ULONG RegisterInt32 ( IN ULONG  FarPtr,
IN BYTE  IntNumber,
IN EMULATOR_INT32_PROC  IntHandler,
OUT PSIZE_T CodeSize  OPTIONAL 
)

Definition at line 118 of file int32.c.

122{
123 /* Array for holding our copy of the 16-bit interrupt callback */
124 BYTE IntCallback[sizeof(Int16To32)/sizeof(BYTE)];
125
126 /* Check whether the 32-bit interrupt was already registered */
127#if 0
128 if (Int32Proc[IntNumber] != NULL)
129 {
130 DPRINT1("RegisterInt32: Interrupt 0x%02X already registered!\n", IntNumber);
131 return 0;
132 }
133#endif
134
135 /* Register the 32-bit interrupt handler */
136 Int32Proc[IntNumber] = IntHandler;
137
138 /* Copy the generic 16-bit interrupt callback and patch it */
139 RtlCopyMemory(IntCallback, Int16To32, sizeof(Int16To32));
140 IntCallback[2] = IntNumber;
141
142 /* Register the 16-bit interrupt callback */
143 return RegisterInt16(FarPtr,
144 IntNumber,
145 IntCallback,
146 sizeof(IntCallback),
147 CodeSize);
148}
#define DPRINT1
Definition: precomp.h:8
#define NULL
Definition: types.h:112
static EMULATOR_INT32_PROC Int32Proc[EMULATOR_MAX_INT32_NUM]
Definition: int32.c:28
static BYTE Int16To32[]
Definition: int32.c:38
ULONG RegisterInt16(IN ULONG FarPtr, IN BYTE IntNumber, IN LPBYTE CallbackCode, IN SIZE_T CallbackSize, OUT PSIZE_T CodeSize OPTIONAL)
Definition: int32.c:100
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
unsigned char BYTE
Definition: xxhash.c:193

Referenced by DosMouseEnable(), DosMouseInitialize(), and EmsDrvInitialize().