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