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(WORD timer
);
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 typedef void WINAPI (*RMCBPROC
)(CONTEXT
*);
86 extern void WINAPI
INT_Int31Handler(CONTEXT
*);
87 extern FARPROC16 WINAPI
DPMI_AllocInternalRMCB(RMCBPROC
);
88 extern void WINAPI
DPMI_FreeInternalRMCB(FARPROC16
);
91 extern void WINAPI
XMS_Handler(CONTEXT
*);
94 extern BOOL32
SIGNAL_Init(void);
95 extern void SIGNAL_SetHandler( int sig
, void (*func
)(), int flags
);
96 extern void SIGNAL_MaskAsyncEvents( BOOL32 flag
);
99 extern BOOL32
SIGNAL_InitEmulator(void);
102 extern void ASPI_DOS_HandleInt(CONTEXT
*context
);
104 /* NOTE: Interrupts might get called from three modes: real mode, 16-bit, and
105 * (via DeviceIoControl) 32-bit. For automatic conversion of pointer
106 * parameters, interrupt handlers should use CTX_SEG_OFF_TO_LIN with
107 * the contents of a segement register as second and the contents of
108 * a *32-bit* general register as third parameter, e.g.
109 * CTX_SEG_OFF_TO_LIN( context, DS_reg(context), EDX_reg(context) )
110 * This will generate a linear pointer in all three cases:
111 * Real-Mode: Seg*16 + LOWORD(Offset) + V86BASE
112 * 16-bit: convert (Seg, LOWORD(Offset)) to linear
113 * 32-bit: use Offset as linear address (DeviceIoControl!)
115 * Real-mode is recognized by checking the V86 bit in the flags register,
116 * 32-bit mode is recognized by checking whether 'seg' is a system selector
117 * (0 counts also as 32-bit segment).
119 #define CTX_SEG_OFF_TO_LIN(context,seg,off) \
120 (ISV86(context) ? (void*)(V86BASE(context)+((seg)<<4)+(off&0xffff)) : \
121 (!seg || IS_SELECTOR_SYSTEM(seg))? (void *)off : PTR_SEG_OFF_TO_LIN(seg,off&0xffff))
123 #define INT_BARF(context,num) \
124 fprintf( stderr, "int%x: unknown/not implemented parameters:\n" \
125 "int%x: AX %04x, BX %04x, CX %04x, DX %04x, " \
126 "SI %04x, DI %04x, DS %04x, ES %04x\n", \
127 (num), (num), AX_reg(context), BX_reg(context), CX_reg(context), \
128 DX_reg(context), SI_reg(context), DI_reg(context), \
129 (WORD)DS_reg(context), (WORD)ES_reg(context) )
131 #endif /* __WINE_MISCEMU_H */