ReactOS 0.4.15-dev-8096-ga0eec98
bios.h File Reference
#include "kbdbios.h"
#include "vidbios.h"
Include dependency graph for bios.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  BIOS_DATA_AREA
 
struct  USER_DATA_AREA
 
struct  _BIOS_CONFIG_TABLE
 

Macros

#define BOP_RESET   0x00
 
#define BOP_EQUIPLIST   0x11
 
#define BOP_GETMEMSIZE   0x12
 
#define BDA_SEGMENT   0x40
 
#define BIOS_SEGMENT   0xF000
 

Typedefs

typedef struct BIOS_DATA_AREAPBIOS_DATA_AREA
 
typedef struct USER_DATA_AREAPUSER_DATA_AREA
 
typedef struct _BIOS_CONFIG_TABLE BIOS_CONFIG_TABLE
 
typedef struct _BIOS_CONFIG_TABLEPBIOS_CONFIG_TABLE
 

Functions

 C_ASSERT (sizeof(BIOS_DATA_AREA)==0x100)
 
 C_ASSERT (sizeof(USER_DATA_AREA)==0x34)
 
VOID WINAPI BiosEquipmentService (LPWORD Stack)
 
VOID WINAPI BiosGetMemorySize (LPWORD Stack)
 
BOOLEAN BiosInitialize (IN LPCSTR BiosFileName, IN LPCSTR RomFiles OPTIONAL)
 
VOID BiosCleanup (VOID)
 

Variables

PBIOS_DATA_AREA Bda
 
PBIOS_CONFIG_TABLE Bct
 

Macro Definition Documentation

◆ BDA_SEGMENT

#define BDA_SEGMENT   0x40

Definition at line 28 of file bios.h.

◆ BIOS_SEGMENT

#define BIOS_SEGMENT   0xF000

Definition at line 29 of file bios.h.

◆ BOP_EQUIPLIST

#define BOP_EQUIPLIST   0x11

Definition at line 22 of file bios.h.

◆ BOP_GETMEMSIZE

#define BOP_GETMEMSIZE   0x12

Definition at line 23 of file bios.h.

◆ BOP_RESET

#define BOP_RESET   0x00

Definition at line 20 of file bios.h.

Typedef Documentation

◆ BIOS_CONFIG_TABLE

◆ PBIOS_CONFIG_TABLE

◆ PBIOS_DATA_AREA

◆ PUSER_DATA_AREA

Function Documentation

◆ BiosCleanup()

VOID BiosCleanup ( VOID  )

Definition at line 153 of file bios.c.

154{
156
158}
VOID Bios32Cleanup(VOID)
Definition: bios32.c:1289
static BOOLEAN Bios32Loaded
Definition: bios.c:40
VOID UmaMgrCleanup(VOID)
Definition: umamgr.c:616

Referenced by VdmShutdown().

◆ BiosEquipmentService()

VOID WINAPI BiosEquipmentService ( LPWORD  Stack)

Definition at line 200 of file bios32.c.

201{
202 /* Return the equipment list */
204}
WORD EquipmentList
Definition: bios.h:45
PBIOS_DATA_AREA Bda
Definition: bios.c:42
VOID WINAPI setAX(USHORT)
Definition: registers.c:121

Referenced by BiosInitialize(), and InitializeBiosInt32().

◆ BiosGetMemorySize()

VOID WINAPI BiosGetMemorySize ( LPWORD  Stack)

Definition at line 206 of file bios32.c.

207{
208 /* Return the conventional memory size in kB, typically 640 kB */
210}
WORD MemorySize
Definition: bios.h:47

Referenced by BiosInitialize(), and InitializeBiosInt32().

◆ BiosInitialize()

BOOLEAN BiosInitialize ( IN LPCSTR  BiosFileName,
IN LPCSTR RomFiles  OPTIONAL 
)

Definition at line 60 of file bios.c.

62{
64 BOOLEAN Success2 = FALSE;
65 LPCSTR RomFile;
66 LPSTR ptr;
67 ULONG_PTR RomAddress;
68 CHAR RomFileName[MAX_PATH + 10 + 1];
69
70 /* Disable interrupts */
71 setIF(0);
72
73 /* Initialize the BDA and the BCT pointers */
75 // The BCT is found at F000:E6F5 for 100% compatible BIOSes.
77
78 /* Register the BIOS support BOPs */
79 RegisterBop(BOP_RESET, WinNtVdmBiosReset); // Needed for Windows NTVDM (SoftPC) BIOS.
80 RegisterBop(BOP_EQUIPLIST , BiosEquipmentService); // Needed by Windows NTVDM (SoftPC) BIOS
81 RegisterBop(BOP_GETMEMSIZE, BiosGetMemorySize); // and also NTDOS!!
82
83 if (BiosFileName == NULL)
84 {
86 }
87 else if (BiosFileName[0] != '\0')
88 {
89 PVOID BiosLocation = NULL;
90
91 Success = LoadBios(BiosFileName, &BiosLocation, NULL);
92 DPRINT1("BIOS file '%s' loading %s at address 0x%08x; GetLastError() = %u\n",
93 BiosFileName, Success ? "succeeded" : "failed", BiosLocation, GetLastError());
94 }
95 else // if (BiosFileName[0] == '\0')
96 {
97 /* Do nothing */
98 Success = TRUE;
99 }
100
101 /* Bail out now if we failed to load any BIOS file */
102 if (!Success) return FALSE;
103
104 /* Load optional ROMs */
105 if (RomFiles)
106 {
107 RomFile = RomFiles;
108 while (*RomFile)
109 {
110 strncpy(RomFileName, RomFile, ARRAYSIZE(RomFileName));
111 RomFileName[ARRAYSIZE(RomFileName)-1] = '\0';
112
113 ptr = strchr(RomFileName, '|'); // Since '|' is forbidden as a valid file name, we use it as a separator for the ROM address.
114 if (!ptr) goto Skip;
115 *ptr++ = '\0';
116
117 RomAddress = strtoul(ptr, NULL, 0); // ROM segment
118 RomAddress <<= 4; // Convert to real address
119 if (RomAddress == 0) goto Skip;
120
121 Success2 = LoadRom(RomFileName, (PVOID)RomAddress, NULL);
122 DPRINT1("ROM file '%s' loading %s at address 0x%08x; GetLastError() = %u\n",
123 RomFileName, Success2 ? "succeeded" : "failed", RomAddress, GetLastError());
124
125Skip:
126 RomFile += strlen(RomFile) + 1;
127 }
128 }
129
130 /*
131 * Boot it up.
132 * The CPU is already in reset-mode so that
133 * CS:IP points to F000:FFF0 as required.
134 */
135 // DisplayMessage(L"CS:IP=%04X:%04X", getCS(), getIP());
136 // setCS(0xF000);
137 // setIP(0xFFF0);
138
139 // /* Enable interrupts */
140 // setIF(1);
141
142 /* Initialize the Upper Memory Area Manager */
143 if (!UmaMgrInitialize())
144 {
145 wprintf(L"FATAL: Failed to initialize the UMA manager.\n");
146 return FALSE;
147 }
148
149 return Success;
150}
unsigned char BOOLEAN
UINT32 strtoul(const char *String, char **Terminator, UINT32 Base)
Definition: utclib.c:696
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strncpy(char *DstString, const char *SrcString, ACPI_SIZE Count)
Definition: utclib.c:427
char * strchr(const char *String, int ch)
Definition: utclib.c:501
#define DPRINT1
Definition: precomp.h:8
BOOLEAN Bios32Initialize(VOID)
Definition: bios32.c:1246
#define BIOS_SEGMENT
Definition: bios.h:29
#define BDA_SEGMENT
Definition: bios.h:28
VOID WINAPI BiosEquipmentService(LPWORD Stack)
Definition: bios32.c:200
VOID WINAPI BiosGetMemorySize(LPWORD Stack)
Definition: bios32.c:206
struct BIOS_DATA_AREA * PBIOS_DATA_AREA
struct _BIOS_CONFIG_TABLE * PBIOS_CONFIG_TABLE
VOID RegisterBop(BYTE BopCode, EMULATOR_BOP_PROC BopHandler)
Definition: bop.c:29
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define MAX_PATH
Definition: compat.h:34
#define SEG_OFF_TO_PTR(seg, off)
Definition: emulator.h:32
@ Success
Definition: eventcreate.c:712
static PVOID ptr
Definition: dispmode.c:27
#define L(x)
Definition: ntvdm.h:50
BOOLEAN LoadBios(IN PCSTR BiosFileName, OUT PVOID *BiosLocation OPTIONAL, OUT PULONG BiosSize OPTIONAL)
Definition: rom.c:169
BOOLEAN LoadRom(IN PCSTR RomFileName, IN PVOID RomLocation, OUT PULONG RomSize OPTIONAL)
Definition: rom.c:214
VOID WINAPI WinNtVdmBiosReset(LPWORD Stack)
Definition: bios.c:50
#define BOP_GETMEMSIZE
Definition: bios.c:36
#define BOP_EQUIPLIST
Definition: bios.c:35
#define BOP_RESET
Definition: bios.c:33
PBIOS_CONFIG_TABLE Bct
Definition: bios.c:43
uint32_t ULONG_PTR
Definition: typedefs.h:65
BOOLEAN UmaMgrInitialize(VOID)
Definition: umamgr.c:375
VOID WINAPI setIF(ULONG)
Definition: registers.c:643
#define wprintf(...)
Definition: whoami.c:18
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
const char * LPCSTR
Definition: xmlstorage.h:183
char * LPSTR
Definition: xmlstorage.h:182
char CHAR
Definition: xmlstorage.h:175

Referenced by wmain().

◆ C_ASSERT() [1/2]

C_ASSERT ( sizeof(BIOS_DATA_AREA = =0x100)

◆ C_ASSERT() [2/2]

C_ASSERT ( sizeof(USER_DATA_AREA = =0x34)

Variable Documentation

◆ Bct

PBIOS_CONFIG_TABLE Bct
extern

Definition at line 43 of file bios.c.

Referenced by BiosInitialize().

◆ Bda