⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bochs.c

📁 winNT技术操作系统,国外开放的原代码和LIUX一样
💻 C
字号:
/*
 * COPYRIGHT:       See COPYING in the top level directory
 * PROJECT:         ReactOS kernel
 * FILE:            ntoskrnl/kd/wrappers/bochs.c
 * PURPOSE:         BOCHS Wrapper for Kd
 *
 * PROGRAMMERS:     Alex Ionescu (alex@relsoft.net)
 */

#include <ntoskrnl.h>
#define NDEBUG
#include <internal/debug.h>

/* bochs debug output */
#define BOCHS_LOGGER_PORT (0xe9)

/* FUNCTIONS *****************************************************************/

VOID
STDCALL
KdpBochsDebugPrint(IN PCH Message,
                   IN ULONG Length)
{
    if (!KdpDebugMode.Bochs) return;

    while (*Message != 0)
    {
        if (*Message == '\n')
        {
           __outbyte(BOCHS_LOGGER_PORT, '\r');
        }
        __outbyte(BOCHS_LOGGER_PORT, *Message);
        Message++;
    }
}

VOID
STDCALL
KdpBochsInit(PKD_DISPATCH_TABLE DispatchTable,
             ULONG BootPhase)
{
    UCHAR Value;
    if (!KdpDebugMode.Bochs) return;

    if (BootPhase == 0)
    {
        Value = __inbyte(BOCHS_LOGGER_PORT);
        if (Value != BOCHS_LOGGER_PORT)
        {
           KdpDebugMode.Bochs = FALSE;
           return;
        }

        /* Write out the functions that we support for now */
        DispatchTable->KdpInitRoutine = KdpBochsInit;
        DispatchTable->KdpPrintRoutine = KdpBochsDebugPrint;

        /* Register as a Provider */
        InsertTailList(&KdProviders, &DispatchTable->KdProvidersList);
    }
    else if (BootPhase == 2)
    {
        HalDisplayString("\n   Bochs debugging enabled\n\n");
    }
}

/* EOF */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -