1 /****************************************************************************
3 * BIOS emulator and interface
4 * to Realmode X86 Emulator Library
6 * Copyright (C) 1996-1999 SciTech Software, Inc.
8 * ========================================================================
10 * Permission to use, copy, modify, distribute, and sell this software and
11 * its documentation for any purpose is hereby granted without fee,
12 * provided that the above copyright notice appear in all copies and that
13 * both that copyright notice and this permission notice appear in
14 * supporting documentation, and that the name of the authors not be used
15 * in advertising or publicity pertaining to distribution of the software
16 * without specific, written prior permission. The authors makes no
17 * representations about the suitability of this software for any purpose.
18 * It is provided "as is" without express or implied warranty.
20 * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
21 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
22 * EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
23 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
24 * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
25 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
26 * PERFORMANCE OF THIS SOFTWARE.
28 * ========================================================================
32 * Developer: Kendall Bennett
34 * Description: Header file for the real mode x86 BIOS emulator, which is
35 * used to warmboot any number of VGA compatible PCI/AGP
36 * controllers under any OS, on any processor family that
37 * supports PCI. We also allow the user application to call
38 * real mode BIOS functions and Int 10h functions (including
41 ****************************************************************************/
46 #include <bios_emul.h>
56 /*---------------------- Macros and type definitions ----------------------*/
60 #define CRT_C 24 /* 24 CRT Controller Registers */
61 #define ATT_C 21 /* 21 Attribute Controller Registers */
62 #define GRA_C 9 /* 9 Graphics Controller Registers */
63 #define SEQ_C 5 /* 5 Sequencer Registers */
64 #define PAL_C 768 /* 768 Palette Registers */
66 /****************************************************************************
68 Data structure used to describe the details for the BIOS emulator system
69 environment as used by the X86 emulator library.
75 vgaInfo - VGA BIOS information structure
76 biosmem_base - Base of the BIOS image
77 biosmem_limit - Limit of the BIOS image
78 busmem_base - Base of the VGA bus memory
79 timer - Timer used to emulate PC timer ports
80 timer0 - Latched value for timer 0
81 timer0Latched - true if timer 0 value was just latched
82 timer2 - Current value for timer 2
83 emulateVGA - true to emulate VGA I/O and memory accesses
84 ****************************************************************************/
123 /* Define some types when compiling for the Linux kernel that normally
124 * come from the SciTech PM library.
127 /****************************************************************************
129 Structure describing the 32-bit extended x86 CPU registers
135 eax - Value of the EAX register
136 ebx - Value of the EBX register
137 ecx - Value of the ECX register
138 edx - Value of the EDX register
139 esi - Value of the ESI register
140 edi - Value of the EDI register
141 cflag - Value of the carry flag
142 ****************************************************************************/
153 /****************************************************************************
155 Structure describing the 16-bit x86 CPU registers
161 ax - Value of the AX register
162 bx - Value of the BX register
163 cx - Value of the CX register
164 dx - Value of the DX register
165 si - Value of the SI register
166 di - Value of the DI register
167 cflag - Value of the carry flag
168 ****************************************************************************/
169 #ifdef __BIG_ENDIAN__
191 /****************************************************************************
193 Structure describing the 8-bit x86 CPU registers
199 al - Value of the AL register
200 ah - Value of the AH register
201 bl - Value of the BL register
202 bh - Value of the BH register
203 cl - Value of the CL register
204 ch - Value of the CH register
205 dl - Value of the DL register
206 dh - Value of the DH register
207 ****************************************************************************/
208 #ifdef __BIG_ENDIAN__
236 /****************************************************************************
238 Structure describing all the x86 CPU registers
244 e - Member to access registers as 32-bit values
245 x - Member to access registers as 16-bit values
246 h - Member to access registers as 8-bit values
247 ****************************************************************************/
254 /****************************************************************************
256 Structure describing all the x86 segment registers
262 es - ES segment register
263 cs - CS segment register
264 ss - SS segment register
265 ds - DS segment register
266 fs - FS segment register
267 gs - GS segment register
268 ****************************************************************************/
278 #endif /* __KERNEL__ */
282 /****************************************************************************
284 Structure defining all the BIOS Emulator API functions as exported from
285 the Binary Portable DLL.
287 ****************************************************************************/
290 ibool(PMAPIP BE_init) (u32 debugFlags, int memSize, BE_VGAInfo * info);
291 void (PMAPIP BE_setVGA) (BE_VGAInfo * info);
292 void (PMAPIP BE_getVGA) (BE_VGAInfo * info);
293 void *(PMAPIP BE_mapRealPointer) (uint r_seg, uint r_off);
294 void *(PMAPIP BE_getVESABuf) (uint * len, uint * rseg, uint * roff);
295 void (PMAPIP BE_callRealMode) (uint seg, uint off, RMREGS * regs,
297 int (PMAPIP BE_int86) (int intno, RMREGS * in, RMREGS * out);
298 int (PMAPIP BE_int86x) (int intno, RMREGS * in, RMREGS * out,
301 void (PMAPIP BE_exit) (void);
304 /****************************************************************************
306 Function pointer type for the Binary Portable DLL initialisation entry point.
308 ****************************************************************************/
309 typedef BE_exports *(PMAPIP BE_initLibrary_t) (PM_imports * PMImp);
314 /*---------------------------- Global variables ---------------------------*/
317 extern "C" { /* Use "C" linkage when in C++ mode */
320 /* {secret} Global BIOS emulator system environment */
321 extern BE_sysEnv _BE_env;
323 /*-------------------------- Function Prototypes --------------------------*/
325 /* BIOS emulator library entry points */
326 int X86API BE_init(u32 debugFlags, int memSize, BE_VGAInfo * info,
328 void X86API BE_setVGA(BE_VGAInfo * info);
329 void X86API BE_getVGA(BE_VGAInfo * info);
330 void X86API BE_setDebugFlags(u32 debugFlags);
331 void *X86API BE_mapRealPointer(uint r_seg, uint r_off);
332 void *X86API BE_getVESABuf(uint * len, uint * rseg, uint * roff);
333 void X86API BE_callRealMode(uint seg, uint off, RMREGS * regs,
335 int X86API BE_int86(int intno, RMREGS * in, RMREGS * out);
336 int X86API BE_int86x(int intno, RMREGS * in, RMREGS * out,
338 void X86API BE_exit(void);
341 } /* End of "C" linkage for C++ */
343 #endif /* __BIOSEMU_H */