Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

180 lines
3.6 KiB

/*++
Copyright (c) 1992 Microsoft Corporation
Module Name:
initx86.c
Abstract:
Does any x86-specific initialization, then starts the common ARC osloader
Author:
John Vert (jvert) 4-Nov-1993
Revision History:
--*/
#include "bldrx86.h"
#include "msg.h"
#include "stdio.h"
VOID
BlInitializeTerminal(
VOID
);
UCHAR BootPartitionName[80];
UCHAR KernelBootDevice[80];
UCHAR OsLoadFilename[100];
UCHAR OsLoaderFilename[100];
UCHAR SystemPartition[100];
UCHAR OsLoadPartition[100];
UCHAR OsLoadOptions[100];
UCHAR ConsoleInputName[50];
UCHAR MyBuffer[SECTOR_SIZE+32];
UCHAR ConsoleOutputName[50];
UCHAR X86SystemPartition[sizeof("x86systempartition=") + sizeof(BootPartitionName)];
VOID
BlStartup(
IN PCHAR PartitionName
)
/*++
Routine Description:
Does x86-specific initialization, particularly presenting the boot.ini
menu and running NTDETECT, then calls to the common osloader.
Arguments:
PartitionName - Supplies the ARC name of the partition (or floppy) that
setupldr was loaded from.
Return Value:
Does not return
--*/
{
ULONG Argc = 0;
PUCHAR Argv[10];
ARC_STATUS Status;
ULONG BootFileId;
PCHAR BootFile;
ULONG Read;
PCHAR p;
ULONG i;
ULONG DriveId;
ULONG FileSize;
ULONG Count;
LARGE_INTEGER SeekPosition;
PCHAR LoadOptions = NULL;
BOOLEAN UseTimeOut=TRUE;
BOOLEAN AlreadyInitialized = FALSE;
extern BOOLEAN FwDescriptorsValid;
//
// Initialize ARC StdIo functionality
//
strcpy(ConsoleInputName,"consolein=multi(0)key(0)keyboard(0)");
strcpy(ConsoleOutputName,"consoleout=multi(0)video(0)monitor(0)");
Argv[0]=ConsoleInputName;
Argv[1]=ConsoleOutputName;
BlInitStdio (2, Argv);
//
// Initialize any dumb terminal that may be connected.
//
BlInitializeTerminal();
//
// Announce the loader
//
BlPrint(OsLoaderVersion);
//
// The main functionality of the OS chooser.
//
BlOsLoader( Argc, Argv, NULL );
//
// If we ever come back here, just wait to reboot.
//
if (!BlIsTerminalConnected()) {
//
// typical case. wait for user to press a key and then
// restart
//
while(!BlGetKey());
}
else {
//
// headless case. present user with mini sac
//
while(!BlTerminalHandleLoaderFailure());
}
ArcRestart();
}
VOID
BlInitializeTerminal(
VOID
)
/*++
Routine Description:
Does x86-specific initialization of a dumb terminal connected to a serial port.
Arguments:
None.
Return Value:
None.
--*/
{
//
// Clear any stale settings.
//
RtlZeroMemory( &LoaderRedirectionInformation, sizeof(HEADLESS_LOADER_BLOCK) );
//
// See if StartROM was redirecting.
//
if( (BOOLEAN)(BIOS_REDIRECT_SERVICE(1) != -1) ) {
//
// He is. Pick up his settings.
//
LoaderRedirectionInformation.PortNumber = (ULONG)BIOS_REDIRECT_SERVICE(1);
LoaderRedirectionInformation.BaudRate = (ULONG)BIOS_REDIRECT_SERVICE(2);
LoaderRedirectionInformation.Parity = (BOOLEAN)BIOS_REDIRECT_SERVICE(3);
LoaderRedirectionInformation.StopBits = (UCHAR)BIOS_REDIRECT_SERVICE(4);
}
//
// Try to initialize the headless port. Note that if we didn't get anything
// from startrom, then this call will go out and query the BIOS for an
// ACPI table to get settings from.
//
BlInitializeHeadlessPort();
}