2 * Misc. emulation definitions
4 * Copyright 1995 Alexandre Julliard
7 #ifndef __WINE_MISCEMU_H
8 #define __WINE_MISCEMU_H
15 extern HANDLE16 DOSMEM_BiosSeg;
16 extern DWORD DOSMEM_CollateTable;
18 extern DWORD DOSMEM_ErrorCall;
19 extern DWORD DOSMEM_ErrorBuffer;
21 extern BOOL32 DOSMEM_Init(HMODULE16 hModule);
22 extern void DOSMEM_Tick(void);
23 extern WORD DOSMEM_AllocSelector(WORD);
24 extern char * DOSMEM_MemoryBase(HMODULE16 hModule);
25 extern LPVOID DOSMEM_GetBlock(HMODULE16 hModule, UINT32 size, UINT16* p);
26 extern BOOL32 DOSMEM_FreeBlock(HMODULE16 hModule, void* ptr);
27 extern LPVOID DOSMEM_ResizeBlock(HMODULE16 hModule, void* ptr, UINT32 size, UINT16* p);
28 extern UINT32 DOSMEM_Available(HMODULE16 hModule);
29 extern LPVOID DOSMEM_MapRealToLinear(DWORD); /* real-mode to linear */
30 extern LPVOID DOSMEM_MapDosToLinear(UINT32); /* linear DOS to Wine */
31 extern UINT32 DOSMEM_MapLinearToDos(LPVOID); /* linear Wine to DOS */
33 /* msdos/interrupts.c */
34 extern FARPROC16 INT_GetPMHandler( BYTE intnum );
35 extern void INT_SetPMHandler( BYTE intnum, FARPROC16 handler );
36 extern FARPROC16 INT_GetRMHandler( BYTE intnum );
37 extern void INT_SetRMHandler( BYTE intnum, FARPROC16 handler );
38 extern FARPROC16 INT_CtxGetHandler( CONTEXT *context, BYTE intnum );
39 extern void INT_CtxSetHandler( CONTEXT *context, BYTE intnum, FARPROC16 handler );
40 extern int INT_RealModeInterrupt( BYTE intnum, PCONTEXT context );
43 extern void IO_port_init (void);
44 extern DWORD IO_inport( int port, int count );
45 extern void IO_outport( int port, int count, DWORD value );
48 extern void WINAPI INT_Int10Handler(CONTEXT*);
51 extern void WINAPI INT_Int11Handler(CONTEXT*);
54 extern void WINAPI INT_Int13Handler(CONTEXT*);
57 extern void WINAPI INT_Int16Handler(CONTEXT*);
60 extern void WINAPI INT_Int17Handler(CONTEXT*);
63 extern void WINAPI INT_Int19Handler(CONTEXT*);
66 extern DWORD INT1A_GetTicksSinceMidnight(void);
67 extern void WINAPI INT_Int1aHandler(CONTEXT*);
70 extern void WINAPI INT_Int20Handler(CONTEXT*);
73 extern void WINAPI INT_Int25Handler(CONTEXT*);
76 extern void WINAPI INT_Int26Handler(CONTEXT*);
79 extern void WINAPI INT_Int29Handler(CONTEXT*);
82 extern void WINAPI INT_Int2fHandler(CONTEXT*);
85 extern void WINAPI INT_Int31Handler(CONTEXT*);
88 extern void WINAPI XMS_Handler(CONTEXT*);
91 extern BOOL32 SIGNAL_Init(void);
92 extern void SIGNAL_SetHandler( int sig, void (*func)(), int flags );
93 extern void SIGNAL_MaskAsyncEvents( BOOL32 flag );
96 extern BOOL32 SIGNAL_InitEmulator(void);
99 extern void ASPI_DOS_HandleInt(CONTEXT *context);
101 /* NOTE: Interrupts might get called from three modes: real mode, 16-bit, and
102 * (via DeviceIoControl) 32-bit. For automatic conversion of pointer
103 * parameters, interrupt handlers should use CTX_SEG_OFF_TO_LIN with
104 * the contents of a segement register as second and the contents of
105 * a *32-bit* general register as third parameter, e.g.
106 * CTX_SEG_OFF_TO_LIN( context, DS_reg(context), EDX_reg(context) )
107 * This will generate a linear pointer in all three cases:
108 * Real-Mode: Seg*16 + LOWORD(Offset) + V86BASE
109 * 16-bit: convert (Seg, LOWORD(Offset)) to linear
110 * 32-bit: use Offset as linear address (DeviceIoControl!)
112 * Real-mode is recognized by checking the V86 bit in the flags register,
113 * 32-bit mode is recognized by checking whether 'seg' is a system selector
114 * (0 counts also as 32-bit segment).
116 #define CTX_SEG_OFF_TO_LIN(context,seg,off) \
117 (ISV86(context) ? (void*)(V86BASE(context)+((seg)<<4)+(off&0xffff)) : \
118 (!seg || IS_SELECTOR_SYSTEM(seg))? (void *)off : PTR_SEG_OFF_TO_LIN(seg,off&0xffff))
120 #define INT_BARF(context,num) \
121 fprintf( stderr, "int%x: unknown/not implemented parameters:\n" \
122 "int%x: AX %04x, BX %04x, CX %04x, DX %04x, " \
123 "SI %04x, DI %04x, DS %04x, ES %04x\n", \
124 (num), (num), AX_reg(context), BX_reg(context), CX_reg(context), \
125 DX_reg(context), SI_reg(context), DI_reg(context), \
126 (WORD)DS_reg(context), (WORD)ES_reg(context) )
128 #endif /* __WINE_MISCEMU_H */