Пример #1
0
VOID
HalDisplayString (
    PUCHAR String
)

/*++

Routine Description:

    This routine displays a character string on the display screen.

Arguments:

    String - Supplies a pointer to the characters that are to be displayed.

Return Value:

    None.

--*/

{
    if (!HalpDisplayInitialized && HalpOwnsDisplay) {

        //
        // If somebody has called HalDisplayString before Phase 0
        // initialization, we need to make sure we get our message out
        // anyway.  So we initialize the display before HalInitSystem does.
        // HalpInitializeDisplay is smart enough to only map the video
        // buffer and clear the screen the first time it is called.
        //

        HalpInitializeDisplay();
    }

    //
    // Synchronize access to the display so that MP systems won't
    // get garbage output due to simultaneous calls.  It also prevents
    // two processors from attempting to call BIOS and reset the display
    // simultaneously.
    //

    KiAcquireSpinLock(&HalpDisplayLock);

    if (HalpOwnsDisplay == FALSE) {

        //
        // The display has been put in graphics mode, and we need to
        // reset it to text mode before we can display any text on it.
        //

        if (HalpResetDisplayParameters) {
            HalpOwnsDisplay = HalpResetDisplayParameters(COLS, ROWS);
        }

        if (HalpOwnsDisplay == FALSE) {
            HalpBiosDisplayReset();
        }

        HalpOwnsDisplay = TRUE;
        HalpDoingCrashDump = TRUE;
        HalpClearDisplay();
    }

    while (*String) {

        switch (*String) {
        case '\n':
            HalpNextLine();
            break;
        case '\r':
            HalpCursorX = 0;
            break;
        default:
            HalpPutCharacter(*String);
            if (++HalpCursorX == COLS) {
                HalpNextLine();
            }
        }
        ++String;
    }

    KiReleaseSpinLock(&HalpDisplayLock);
    return;
}
Пример #2
0
VOID
NTAPI
HalInitializeBios(ULONG Unknown, PLOADER_PARAMETER_BLOCK LoaderBlock)
{
    PPFN_NUMBER PfnArray;
    PFN_NUMBER Pfn, Last;
    PMEMORY_ALLOCATION_DESCRIPTOR Descriptor;
    PLIST_ENTRY ListEntry;
    PMDL Mdl;

    /* Allocate an MDL for 1MB */
    Mdl = IoAllocateMdl(NULL, 0x100000, FALSE, FALSE, NULL);
    if (!Mdl)
    {
        ASSERT(FALSE);
    }

    /* Get pointer to the pfn array */
    PfnArray = MmGetMdlPfnArray(Mdl);

    /* Fill the array with low memory PFNs */
    for (Pfn = 0; Pfn < 0x100; Pfn++)
    {
        PfnArray[Pfn] = Pfn;
    }

    /* Loop the memory descriptors */
    for (ListEntry = LoaderBlock->MemoryDescriptorListHead.Flink;
         ListEntry != &LoaderBlock->MemoryDescriptorListHead;
         ListEntry = ListEntry->Flink)
    {
        /* Get the memory descriptor */
        Descriptor = CONTAINING_RECORD(ListEntry,
                                       MEMORY_ALLOCATION_DESCRIPTOR,
                                       ListEntry);

        /* Check if the memory is in the low range */
        if (Descriptor->BasePage < 0x100)
        {
            /* Check if the memory type is firmware */
            if (Descriptor->MemoryType != LoaderFirmwarePermanent &&
                Descriptor->MemoryType != LoaderSpecialMemory)
            {
                /* It's something else, so don't use it! */
                Last = min(Descriptor->BasePage + Descriptor->PageCount, 0x100);
                for (Pfn = Descriptor->BasePage; Pfn < Last; Pfn++)
                {
                    /* Set each page to the default page */
                    PfnArray[Pfn] = DEFAULT_PAGE;
                }
            }
        }
    }

    Mdl->MdlFlags = MDL_PAGES_LOCKED;

    /* Map the MDL to system space */
    x86BiosMemoryMapping = MmGetSystemAddressForMdlSafe(Mdl, HighPagePriority);
    ASSERT(x86BiosMemoryMapping);

    DPRINT1("memory: %p, %p\n", *(PVOID*)x86BiosMemoryMapping, *(PVOID*)(x86BiosMemoryMapping + 8));
    //DbgDumpPage(x86BiosMemoryMapping, 0xc351);

    x86BiosIsInitialized = TRUE;
    
    HalpBiosDisplayReset();
}