biosemu.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /****************************************************************************
  2. *
  3. * BIOS emulator and interface
  4. * to Realmode X86 Emulator Library
  5. *
  6. * Copyright (C) 1996-1999 SciTech Software, Inc.
  7. *
  8. * ========================================================================
  9. *
  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.
  19. *
  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.
  27. *
  28. * ========================================================================
  29. *
  30. * Language: ANSI C
  31. * Environment: Any
  32. * Developer: Kendall Bennett
  33. *
  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
  39. * the VESA BIOS).
  40. *
  41. ****************************************************************************/
  42. #ifndef __BIOSEMU_H
  43. #define __BIOSEMU_H
  44. #include "x86emu.h"
  45. #include "pmapi.h"
  46. #include "pcilib.h"
  47. /*---------------------- Macros and type definitions ----------------------*/
  48. #pragma pack(1)
  49. /****************************************************************************
  50. REMARKS:
  51. Data structure used to describe the details specific to a particular VGA
  52. controller. This information is used to allow the VGA controller to be
  53. swapped on the fly within the BIOS emulator.
  54. HEADER:
  55. biosemu.h
  56. MEMBERS:
  57. pciInfo - PCI device information block for the controller
  58. BIOSImage - Pointer to a read/write copy of the BIOS image
  59. BIOSImageLen - Length of the BIOS image
  60. LowMem - Copy of key low memory areas
  61. ****************************************************************************/
  62. typedef struct {
  63. PCIDeviceInfo *pciInfo;
  64. void *BIOSImage;
  65. ulong BIOSImageLen;
  66. uchar LowMem[1536];
  67. } BE_VGAInfo;
  68. /****************************************************************************
  69. REMARKS:
  70. Data structure used to describe the details for the BIOS emulator system
  71. environment as used by the X86 emulator library.
  72. HEADER:
  73. biosemu.h
  74. MEMBERS:
  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. ****************************************************************************/
  80. typedef struct {
  81. BE_VGAInfo vgaInfo;
  82. ulong biosmem_base;
  83. ulong biosmem_limit;
  84. ulong busmem_base;
  85. } BE_sysEnv;
  86. /****************************************************************************
  87. REMARKS:
  88. Structure defining all the BIOS Emulator API functions as exported from
  89. the Binary Portable DLL.
  90. {secret}
  91. ****************************************************************************/
  92. typedef struct {
  93. ulong dwSize;
  94. ibool (PMAPIP BE_init)(u32 debugFlags,int memSize,BE_VGAInfo *info);
  95. void (PMAPIP BE_setVGA)(BE_VGAInfo *info);
  96. void (PMAPIP BE_getVGA)(BE_VGAInfo *info);
  97. void * (PMAPIP BE_mapRealPointer)(uint r_seg,uint r_off);
  98. void * (PMAPIP BE_getVESABuf)(uint *len,uint *rseg,uint *roff);
  99. void (PMAPIP BE_callRealMode)(uint seg,uint off,RMREGS *regs,RMSREGS *sregs);
  100. int (PMAPIP BE_int86)(int intno,RMREGS *in,RMREGS *out);
  101. int (PMAPIP BE_int86x)(int intno,RMREGS *in,RMREGS *out,RMSREGS *sregs);
  102. void * reserved1;
  103. void (PMAPIP BE_exit)(void);
  104. } BE_exports;
  105. /****************************************************************************
  106. REMARKS:
  107. Function pointer type for the Binary Portable DLL initialisation entry point.
  108. {secret}
  109. ****************************************************************************/
  110. typedef BE_exports * (PMAPIP BE_initLibrary_t)(PM_imports *PMImp);
  111. #pragma pack()
  112. /*---------------------------- Global variables ---------------------------*/
  113. #ifdef __cplusplus
  114. extern "C" { /* Use "C" linkage when in C++ mode */
  115. #endif
  116. /* {secret} Global BIOS emulator system environment */
  117. extern BE_sysEnv _BE_env;
  118. /*-------------------------- Function Prototypes --------------------------*/
  119. /* BIOS emulator library entry points */
  120. ibool PMAPI BE_init(u32 debugFlags,int memSize,BE_VGAInfo *info);
  121. void PMAPI BE_setVGA(BE_VGAInfo *info);
  122. void PMAPI BE_getVGA(BE_VGAInfo *info);
  123. void PMAPI BE_setDebugFlags(u32 debugFlags);
  124. void * PMAPI BE_mapRealPointer(uint r_seg,uint r_off);
  125. void * PMAPI BE_getVESABuf(uint *len,uint *rseg,uint *roff);
  126. void PMAPI BE_callRealMode(uint seg,uint off,RMREGS *regs,RMSREGS *sregs);
  127. int PMAPI BE_int86(int intno,RMREGS *in,RMREGS *out);
  128. int PMAPI BE_int86x(int intno,RMREGS *in,RMREGS *out,RMSREGS *sregs);
  129. void PMAPI BE_exit(void);
  130. #ifdef __cplusplus
  131. } /* End of "C" linkage for C++ */
  132. #endif
  133. #endif /* __BIOSEMU_H */