mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-29 04:13:32 +00:00
[NTVDM]
- Initialize the BIOS Configuration Table, see http://www.ctyme.com/intr/rb-1594.htm for more information. - Implement INT 15h, AH=C0h "GET CONFIGURATION". svn path=/trunk/; revision=63367
This commit is contained in:
@@ -37,6 +37,7 @@ static BOOLEAN Bios32Loaded = FALSE;
|
||||
|
||||
static CALLBACK16 __BiosContext;
|
||||
PBIOS_DATA_AREA Bda;
|
||||
PBIOS_CONFIG_TABLE Bct;
|
||||
|
||||
/* PRIVATE FUNCTIONS **********************************************************/
|
||||
|
||||
@@ -134,8 +135,10 @@ BiosInitialize(IN LPCSTR BiosFileName)
|
||||
/* Disable interrupts */
|
||||
setIF(0);
|
||||
|
||||
/* Initialize the BDA pointer */
|
||||
Bda = (PBIOS_DATA_AREA)SEG_OFF_TO_PTR(BDA_SEGMENT, 0);
|
||||
/* Initialize the BDA and the BCT pointers */
|
||||
Bda = (PBIOS_DATA_AREA)SEG_OFF_TO_PTR(BDA_SEGMENT, 0x0000);
|
||||
// The BCT is found at F000:E6F5 for 100% compatible BIOSes.
|
||||
Bct = (PBIOS_CONFIG_TABLE)SEG_OFF_TO_PTR(BIOS_SEGMENT, 0xE6F5);
|
||||
|
||||
/* Register the BIOS support BOPs */
|
||||
RegisterBop(BOP_BIOSINIT , BiosInitBop);
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
|
||||
#define BIOS_EQUIPMENT_LIST 0x2C // HACK: Disable FPU for now
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
/*
|
||||
* BIOS Data Area at 0040:XXXX
|
||||
*
|
||||
@@ -29,7 +31,6 @@
|
||||
* and: http://www.bioscentral.com/misc/bda.htm
|
||||
* for more information.
|
||||
*/
|
||||
#pragma pack(push, 1)
|
||||
typedef struct
|
||||
{
|
||||
WORD SerialPorts[4]; // 0x00
|
||||
@@ -96,13 +97,30 @@ typedef struct
|
||||
BYTE Reserved17[15]; // 0x121
|
||||
BYTE Reserved18[3]; // 0x130
|
||||
} BIOS_DATA_AREA, *PBIOS_DATA_AREA;
|
||||
#pragma pack(pop)
|
||||
|
||||
C_ASSERT(sizeof(BIOS_DATA_AREA) == 0x133);
|
||||
|
||||
/*
|
||||
* BIOS Configuration Table at F000:E6F5 for 100% compatible BIOSes.
|
||||
*
|
||||
* See: http://www.ctyme.com/intr/rb-1594.htm
|
||||
* for more information.
|
||||
*/
|
||||
typedef struct _BIOS_CONFIG_TABLE
|
||||
{
|
||||
WORD Length; // 0x00
|
||||
BYTE Model; // 0x02
|
||||
BYTE SubModel; // 0x03
|
||||
BYTE BiosRevision; // 0x04
|
||||
BYTE BiosFeature[5]; // 0x05 -- 0x09
|
||||
// Other BIOSes may extend this table. We don't.
|
||||
} BIOS_CONFIG_TABLE, *PBIOS_CONFIG_TABLE;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
/* FUNCTIONS ******************************************************************/
|
||||
|
||||
extern PBIOS_DATA_AREA Bda;
|
||||
extern PBIOS_CONFIG_TABLE Bct;
|
||||
|
||||
VOID WINAPI BiosEquipmentService(LPWORD Stack);
|
||||
VOID WINAPI BiosGetMemorySize(LPWORD Stack);
|
||||
|
||||
@@ -112,6 +112,20 @@ static VOID WINAPI BiosMiscService(LPWORD Stack)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Get Configuration */
|
||||
case 0xC0:
|
||||
{
|
||||
/* Return the BIOS ROM Configuration Table address in ES:BX */
|
||||
setES(HIWORD(Bct));
|
||||
setBX(LOWORD(Bct));
|
||||
|
||||
/* Call successful; clear CF */
|
||||
setAH(0x00);
|
||||
Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
DPRINT1("BIOS Function INT 15h, AH = 0x%02X NOT IMPLEMENTED\n",
|
||||
@@ -336,26 +350,23 @@ static VOID InitializeBiosInt32(VOID)
|
||||
((PULONG)BaseAddress)[0x49] = (ULONG)NULL;
|
||||
}
|
||||
|
||||
/* PUBLIC FUNCTIONS ***********************************************************/
|
||||
|
||||
/*
|
||||
* The BIOS POST (Power On-Self Test)
|
||||
*/
|
||||
BOOLEAN Bios32Initialize(VOID)
|
||||
static VOID InitializeBiosInfo(VOID)
|
||||
{
|
||||
Bct->Length = sizeof(*Bct);
|
||||
Bct->Model = 0xFC; // PC-AT; see http://www.ctyme.com/intr/rb-1594.htm#Table515
|
||||
Bct->SubModel = 0x00;
|
||||
Bct->BiosRevision = 0x01;
|
||||
Bct->BiosFeature[0] = 0x64; // At the moment we don't support "INT 15/AH=4Fh called upon INT 09h" nor "wait for external event (INT 15/AH=41h) supported"; see http://www.ctyme.com/intr/rb-1594.htm#Table510
|
||||
Bct->BiosFeature[1] = 0x00; // We don't support anything from here; see http://www.ctyme.com/intr/rb-1594.htm#Table511
|
||||
Bct->BiosFeature[2] = 0x00;
|
||||
Bct->BiosFeature[3] = 0x00;
|
||||
Bct->BiosFeature[4] = 0x00;
|
||||
}
|
||||
|
||||
static VOID InitializeBiosData(VOID)
|
||||
{
|
||||
BOOLEAN Success;
|
||||
UCHAR Low, High;
|
||||
|
||||
/* Initialize the stack */
|
||||
// That's what says IBM... (stack at 30:00FF going downwards)
|
||||
// setSS(0x0000);
|
||||
// setSP(0x0400);
|
||||
setSS(0x0050); // Stack at 50:0400, going downwards
|
||||
setSP(0x0400);
|
||||
|
||||
/* Set data segment */
|
||||
setDS(BDA_SEGMENT);
|
||||
|
||||
/* Initialize the BDA contents */
|
||||
Bda->EquipmentList = BIOS_EQUIPMENT_LIST;
|
||||
|
||||
@@ -368,6 +379,30 @@ BOOLEAN Bios32Initialize(VOID)
|
||||
IOWriteB(CMOS_ADDRESS_PORT, CMOS_REG_BASE_MEMORY_HIGH);
|
||||
High = IOReadB(CMOS_DATA_PORT);
|
||||
Bda->MemorySize = MAKEWORD(Low, High);
|
||||
}
|
||||
|
||||
/* PUBLIC FUNCTIONS ***********************************************************/
|
||||
|
||||
/*
|
||||
* The BIOS POST (Power On-Self Test)
|
||||
*/
|
||||
BOOLEAN Bios32Initialize(VOID)
|
||||
{
|
||||
BOOLEAN Success;
|
||||
|
||||
/* Initialize the stack */
|
||||
// That's what says IBM... (stack at 30:00FF going downwards)
|
||||
// setSS(0x0000);
|
||||
// setSP(0x0400);
|
||||
setSS(0x0050); // Stack at 50:0400, going downwards
|
||||
setSP(0x0400);
|
||||
|
||||
/* Set data segment */
|
||||
setDS(BDA_SEGMENT);
|
||||
|
||||
/* Initialize the BDA and the BIOS ROM Information */
|
||||
InitializeBiosData();
|
||||
InitializeBiosInfo();
|
||||
|
||||
/* Register the BIOS 32-bit Interrupts */
|
||||
InitializeBiosInt32();
|
||||
|
||||
Reference in New Issue
Block a user