Fixed definition of the RtlMemory functions. Use macros internally and
[wine.git] / include / miscemu.h
blobfbc278777d1ba856923c6de56c348119075eb17e
1 /*
2 * Misc. emulation definitions
4 * Copyright 1995 Alexandre Julliard
5 */
7 #ifndef __WINE_MISCEMU_H
8 #define __WINE_MISCEMU_H
10 #include "winnt.h"
11 #include "ldt.h"
13 /* msdos/dosconf.c */
14 extern int DOSCONF_ReadConfig(void);
16 /* msdos/dosmem.c */
17 #include "pshpack1.h"
19 typedef struct
21 WORD Com1Addr; /* 00: COM1 I/O address */
22 WORD Com2Addr; /* 02: COM2 I/O address */
23 WORD Com3Addr; /* 04: COM3 I/O address */
24 WORD Com4Addr; /* 06: COM4 I/O address */
25 WORD Lpt1Addr; /* 08: LPT1 I/O address */
26 WORD Lpt2Addr; /* 0a: LPT2 I/O address */
27 WORD Lpt3Addr; /* 0c: LPT3 I/O address */
28 WORD Lpt4Addr; /* 0e: LPT4 I/O address */
29 WORD InstalledHardware; /* 10: Installed hardware flags */
30 BYTE POSTstatus; /* 12: Power-On Self Test status */
31 WORD MemSize WINE_PACKED; /* 13: Base memory size in Kb */
32 WORD unused1 WINE_PACKED; /* 15: Manufacturing test scratch pad */
33 BYTE KbdFlags1; /* 17: Keyboard flags 1 */
34 BYTE KbdFlags2; /* 18: Keyboard flags 2 */
35 BYTE unused2; /* 19: Keyboard driver workspace */
36 WORD NextKbdCharPtr; /* 1a: Next character in kbd buffer */
37 WORD FirstKbdCharPtr; /* 1c: First character in kbd buffer */
38 WORD KbdBuffer[16]; /* 1e: Keyboard buffer */
39 BYTE DisketteStatus1; /* 3e: Diskette recalibrate status */
40 BYTE DisketteStatus2; /* 3f: Diskette motor status */
41 BYTE DisketteStatus3; /* 40: Diskette motor timeout */
42 BYTE DisketteStatus4; /* 41: Diskette last operation status */
43 BYTE DiskStatus[7]; /* 42: Disk status/command bytes */
44 BYTE VideoMode; /* 49: Video mode */
45 WORD VideoColumns; /* 4a: Number of columns */
46 WORD VideoPageSize; /* 4c: Video page size in bytes */
47 WORD VideoPageStartAddr; /* 4e: Video page start address */
48 BYTE VideoCursorPos[16]; /* 50: Cursor position for 8 pages */
49 WORD VideoCursorType; /* 60: Video cursor type */
50 BYTE VideoCurPage; /* 62: Video current page */
51 WORD VideoCtrlAddr WINE_PACKED; /* 63: Video controller address */
52 BYTE VideoReg1; /* 65: Video mode select register */
53 BYTE VideoReg2; /* 66: Video CGA palette register */
54 DWORD ResetEntry WINE_PACKED; /* 67: Warm reset entry point */
55 BYTE LastIRQ; /* 6b: Last unexpected interrupt */
56 DWORD Ticks; /* 6c: Ticks since midnight */
57 BYTE TicksOverflow; /* 70: Timer overflow if past midnight */
58 BYTE CtrlBreakFlag; /* 71: Ctrl-Break flag */
59 WORD ResetFlag; /* 72: POST Reset flag */
60 BYTE DiskOpStatus; /* 74: Last hard-disk operation status */
61 BYTE NbHardDisks; /* 75: Number of hard disks */
62 BYTE DiskCtrlByte; /* 76: Disk control byte */
63 BYTE DiskIOPort; /* 77: Disk I/O port offset */
64 BYTE LptTimeout[4]; /* 78: Timeouts for parallel ports */
65 BYTE ComTimeout[4]; /* 7c: Timeouts for serial ports */
66 WORD KbdBufferStart; /* 80: Keyboard buffer start */
67 WORD KbdBufferEnd; /* 82: Keyboard buffer end */
68 BYTE RowsOnScreenMinus1; /* 84: EGA only */
69 WORD BytesPerChar WINE_PACKED; /* 85: EGA only */
70 BYTE ModeOptions; /* 87: EGA only */
71 BYTE FeatureBitsSwitches; /* 88: EGA only */
72 BYTE VGASettings; /* 89: VGA misc settings */
73 BYTE DisplayCombination; /* 8A: VGA display combinations */
74 BYTE DiskDataRate; /* 8B: Last disk data rate selected */
75 } BIOSDATA;
77 #include "poppack.h"
79 extern HANDLE16 DOSMEM_BiosDataSeg;
80 extern HANDLE16 DOSMEM_BiosSysSeg;
81 extern BIOSDATA * DOSMEM_BiosData();
82 extern BYTE * DOSMEM_BiosSys();
84 extern DWORD DOSMEM_CollateTable;
86 extern DWORD DOSMEM_ErrorCall;
87 extern DWORD DOSMEM_ErrorBuffer;
89 extern DWORD DOS_LOLSeg;
90 extern struct _DOS_LISTOFLISTS * DOSMEM_LOL();
92 extern BOOL DOSMEM_Init(HMODULE16 hModule);
93 extern void DOSMEM_Tick(WORD timer);
94 extern WORD DOSMEM_AllocSelector(WORD);
95 extern char * DOSMEM_MemoryBase(HMODULE16 hModule);
96 extern LPVOID DOSMEM_GetBlock(HMODULE16 hModule, UINT size, UINT16* p);
97 extern BOOL DOSMEM_FreeBlock(HMODULE16 hModule, void* ptr);
98 extern LPVOID DOSMEM_ResizeBlock(HMODULE16 hModule, void* ptr, UINT size, UINT16* p);
99 extern UINT DOSMEM_Available(HMODULE16 hModule);
100 extern LPVOID DOSMEM_MapRealToLinear(DWORD); /* real-mode to linear */
101 extern LPVOID DOSMEM_MapDosToLinear(UINT); /* linear DOS to Wine */
102 extern UINT DOSMEM_MapLinearToDos(LPVOID); /* linear Wine to DOS */
104 /* memory/instr.c */
105 extern BOOL INSTR_EmulateInstruction( CONTEXT86 *context );
107 /* msdos/devices.c */
108 extern void DOSDEV_InstallDOSDevices(void);
109 extern DWORD DOSDEV_Console(void);
110 extern DWORD DOSDEV_FindCharDevice(char*name);
111 extern int DOSDEV_Peek(DWORD dev, BYTE*data);
112 extern int DOSDEV_Read(DWORD dev, DWORD buf, int buflen);
113 extern int DOSDEV_Write(DWORD dev, DWORD buf, int buflen, int verify);
114 extern int DOSDEV_IoctlRead(DWORD dev, DWORD buf, int buflen);
115 extern int DOSDEV_IoctlWrite(DWORD dev, DWORD buf, int buflen);
117 /* msdos/interrupts.c */
118 extern FARPROC16 INT_GetPMHandler( BYTE intnum );
119 extern void INT_SetPMHandler( BYTE intnum, FARPROC16 handler );
120 extern FARPROC16 INT_GetRMHandler( BYTE intnum );
121 extern void INT_SetRMHandler( BYTE intnum, FARPROC16 handler );
122 extern FARPROC16 INT_CtxGetHandler( CONTEXT86 *context, BYTE intnum );
123 extern void INT_CtxSetHandler( CONTEXT86 *context, BYTE intnum, FARPROC16 handler );
124 extern int INT_RealModeInterrupt( BYTE intnum, CONTEXT86 *context );
126 /* msdos/ioports.c */
127 extern void IO_port_init (void);
128 extern DWORD IO_inport( int port, int count );
129 extern void IO_outport( int port, int count, DWORD value );
131 /* msdos/int09.c */
132 extern void WINAPI INT_Int09Handler(CONTEXT86*);
133 extern void WINAPI INT_Int09SendScan(BYTE);
134 extern BYTE WINAPI INT_Int09ReadScan(void);
136 /* msdos/int10.c */
137 extern void WINAPI INT_Int10Handler(CONTEXT86*);
139 /* msdos/int11.c */
140 extern void WINAPI INT_Int11Handler(CONTEXT86*);
142 /* msdos/int12.c */
143 extern void WINAPI INT_Int12Handler(CONTEXT86*);
145 /* msdos/int13.c */
146 extern void WINAPI INT_Int13Handler(CONTEXT86*);
148 /* msdos/int15.c */
149 extern void WINAPI INT_Int15Handler(CONTEXT86*);
151 /* msdos/int16.c */
152 extern void WINAPI INT_Int16Handler(CONTEXT86*);
153 extern int WINAPI INT_Int16ReadChar(BYTE*ascii,BYTE*scan,BOOL peek);
154 extern int WINAPI INT_Int16AddChar(BYTE ascii,BYTE scan);
156 /* msdos/int17.c */
157 extern void WINAPI INT_Int17Handler(CONTEXT86*);
159 /* msdos/int19.c */
160 extern void WINAPI INT_Int19Handler(CONTEXT86*);
162 /* msdos/int1a.c */
163 extern DWORD INT1A_GetTicksSinceMidnight(void);
164 extern void WINAPI INT_Int1aHandler(CONTEXT86*);
166 /* msdos/int20.c */
167 extern void WINAPI INT_Int20Handler(CONTEXT86*);
169 /* msdos/int25.c */
170 extern void WINAPI INT_Int25Handler(CONTEXT86*);
172 /* msdos/int26.c */
173 extern void WINAPI INT_Int26Handler(CONTEXT86*);
175 /* msdos/int29.c */
176 extern void WINAPI INT_Int29Handler(CONTEXT86*);
178 /* msdos/int2a.c */
179 extern void WINAPI INT_Int2aHandler(CONTEXT86*);
181 /* msdos/int2f.c */
182 extern void WINAPI INT_Int2fHandler(CONTEXT86*);
184 /* msdos/int33.c */
185 extern void WINAPI INT_Int33Handler(CONTEXT86*);
186 extern void WINAPI INT_Int33Message(UINT,WPARAM,LPARAM);
188 /* msdos/dpmi.c */
189 typedef void WINAPI (*RMCBPROC)(CONTEXT86*);
190 extern void WINAPI INT_Int31Handler(CONTEXT86*);
191 extern FARPROC16 WINAPI DPMI_AllocInternalRMCB(RMCBPROC);
192 extern void WINAPI DPMI_FreeInternalRMCB(FARPROC16);
193 extern int DPMI_CallRMProc(CONTEXT86*,LPWORD,int,int);
195 /* msdos/xms.c */
196 extern void WINAPI XMS_Handler(CONTEXT86*);
198 /* misc/aspi.c */
199 extern void ASPI_DOS_HandleInt(CONTEXT86 *context);
201 /* NOTE: Interrupts might get called from three modes: real mode, 16-bit, and
202 * (via DeviceIoControl) 32-bit. For automatic conversion of pointer
203 * parameters, interrupt handlers should use CTX_SEG_OFF_TO_LIN with
204 * the contents of a segement register as second and the contents of
205 * a *32-bit* general register as third parameter, e.g.
206 * CTX_SEG_OFF_TO_LIN( context, DS_reg(context), EDX_reg(context) )
207 * This will generate a linear pointer in all three cases:
208 * Real-Mode: Seg*16 + LOWORD(Offset) + V86BASE
209 * 16-bit: convert (Seg, LOWORD(Offset)) to linear
210 * 32-bit: use Offset as linear address (DeviceIoControl!)
212 * Real-mode is recognized by checking the V86 bit in the flags register,
213 * 32-bit mode is recognized by checking whether 'seg' is a system selector
214 * (0 counts also as 32-bit segment).
216 #define CTX_SEG_OFF_TO_LIN(context,seg,off) \
217 (ISV86(context) ? (void*)(V86BASE(context)+((seg)<<4)+(off&0xffff)) : \
218 (!seg || IS_SELECTOR_SYSTEM(seg))? (void *)off : PTR_SEG_OFF_TO_LIN(seg,off&0xffff))
220 #define INT_BARF(context,num) \
221 ERR( "int%x: unknown/not implemented parameters:\n" \
222 "int%x: AX %04x, BX %04x, CX %04x, DX %04x, " \
223 "SI %04x, DI %04x, DS %04x, ES %04x\n", \
224 (num), (num), AX_reg(context), BX_reg(context), CX_reg(context), \
225 DX_reg(context), SI_reg(context), DI_reg(context), \
226 (WORD)DS_reg(context), (WORD)ES_reg(context) )
228 #endif /* __WINE_MISCEMU_H */