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 ****************************************************************************/
54 /*---------------------- Macros and type definitions ----------------------*/
59 /****************************************************************************
61 Data structure used to describe the details specific to a particular VGA
62 controller. This information is used to allow the VGA controller to be
63 swapped on the fly within the BIOS emulator.
69 pciInfo - PCI device information block for the controller
70 BIOSImage - Pointer to a read/write copy of the BIOS image
71 BIOSImageLen - Length of the BIOS image
72 LowMem - Copy of key low memory areas
73 ****************************************************************************/
75 PCIDeviceInfo *pciInfo;
81 /****************************************************************************
83 Data structure used to describe the details for the BIOS emulator system
84 environment as used by the X86 emulator library.
90 vgaInfo - VGA BIOS information structure
91 biosmem_base - Base of the BIOS image
92 biosmem_limit - Limit of the BIOS image
93 busmem_base - Base of the VGA bus memory
94 ****************************************************************************/
107 #endif /* __KERNEL__ */
109 #define CRT_C 24 /* 24 CRT Controller Registers */
110 #define ATT_C 21 /* 21 Attribute Controller Registers */
111 #define GRA_C 9 /* 9 Graphics Controller Registers */
112 #define SEQ_C 5 /* 5 Sequencer Registers */
113 #define PAL_C 768 /* 768 Palette Registers */
115 /****************************************************************************
117 Data structure used to describe the details for the BIOS emulator system
118 environment as used by the X86 emulator library.
124 vgaInfo - VGA BIOS information structure
125 biosmem_base - Base of the BIOS image
126 biosmem_limit - Limit of the BIOS image
127 busmem_base - Base of the VGA bus memory
128 timer - Timer used to emulate PC timer ports
129 timer0 - Latched value for timer 0
130 timer0Latched - True if timer 0 value was just latched
131 timer2 - Current value for timer 2
132 emulateVGA - True to emulate VGA I/O and memory accesses
133 ****************************************************************************/
172 /* Define some types when compiling for the Linux kernel that normally
173 * come from the SciTech PM library.
176 /****************************************************************************
178 Structure describing the 32-bit extended x86 CPU registers
184 eax - Value of the EAX register
185 ebx - Value of the EBX register
186 ecx - Value of the ECX register
187 edx - Value of the EDX register
188 esi - Value of the ESI register
189 edi - Value of the EDI register
190 cflag - Value of the carry flag
191 ****************************************************************************/
202 /****************************************************************************
204 Structure describing the 16-bit x86 CPU registers
210 ax - Value of the AX register
211 bx - Value of the BX register
212 cx - Value of the CX register
213 dx - Value of the DX register
214 si - Value of the SI register
215 di - Value of the DI register
216 cflag - Value of the carry flag
217 ****************************************************************************/
218 #ifdef __BIG_ENDIAN__
240 /****************************************************************************
242 Structure describing the 8-bit x86 CPU registers
248 al - Value of the AL register
249 ah - Value of the AH register
250 bl - Value of the BL register
251 bh - Value of the BH register
252 cl - Value of the CL register
253 ch - Value of the CH register
254 dl - Value of the DL register
255 dh - Value of the DH register
256 ****************************************************************************/
257 #ifdef __BIG_ENDIAN__
285 /****************************************************************************
287 Structure describing all the x86 CPU registers
293 e - Member to access registers as 32-bit values
294 x - Member to access registers as 16-bit values
295 h - Member to access registers as 8-bit values
296 ****************************************************************************/
303 /****************************************************************************
305 Structure describing all the x86 segment registers
311 es - ES segment register
312 cs - CS segment register
313 ss - SS segment register
314 ds - DS segment register
315 fs - FS segment register
316 gs - GS segment register
317 ****************************************************************************/
327 #endif /* __KERNEL__ */
331 /****************************************************************************
333 Structure defining all the BIOS Emulator API functions as exported from
334 the Binary Portable DLL.
336 ****************************************************************************/
339 ibool(PMAPIP BE_init) (u32 debugFlags, int memSize, BE_VGAInfo * info);
340 void (PMAPIP BE_setVGA) (BE_VGAInfo * info);
341 void (PMAPIP BE_getVGA) (BE_VGAInfo * info);
342 void *(PMAPIP BE_mapRealPointer) (uint r_seg, uint r_off);
343 void *(PMAPIP BE_getVESABuf) (uint * len, uint * rseg, uint * roff);
344 void (PMAPIP BE_callRealMode) (uint seg, uint off, RMREGS * regs,
346 int (PMAPIP BE_int86) (int intno, RMREGS * in, RMREGS * out);
347 int (PMAPIP BE_int86x) (int intno, RMREGS * in, RMREGS * out,
350 void (PMAPIP BE_exit) (void);
353 /****************************************************************************
355 Function pointer type for the Binary Portable DLL initialisation entry point.
357 ****************************************************************************/
358 typedef BE_exports *(PMAPIP BE_initLibrary_t) (PM_imports * PMImp);
363 /*---------------------------- Global variables ---------------------------*/
366 extern "C" { /* Use "C" linkage when in C++ mode */
369 /* {secret} Global BIOS emulator system environment */
370 extern BE_sysEnv _BE_env;
372 /*-------------------------- Function Prototypes --------------------------*/
374 /* BIOS emulator library entry points */
375 int X86API BE_init(u32 debugFlags, int memSize, BE_VGAInfo * info,
377 void X86API BE_setVGA(BE_VGAInfo * info);
378 void X86API BE_getVGA(BE_VGAInfo * info);
379 void X86API BE_setDebugFlags(u32 debugFlags);
380 void *X86API BE_mapRealPointer(uint r_seg, uint r_off);
381 void *X86API BE_getVESABuf(uint * len, uint * rseg, uint * roff);
382 void X86API BE_callRealMode(uint seg, uint off, RMREGS * regs,
384 int X86API BE_int86(int intno, RMREGS * in, RMREGS * out);
385 int X86API BE_int86x(int intno, RMREGS * in, RMREGS * out,
387 void X86API BE_exit(void);
390 } /* End of "C" linkage for C++ */
392 #endif /* __BIOSEMU_H */