news 2026/6/23 2:43:56

Boot Debugger Using的来源BlOsLoader函数中的BdInitDebugger和D:\srv03rtm\base\boot\loader_dbg.inc文件的关系----特别重要

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
Boot Debugger Using的来源BlOsLoader函数中的BdInitDebugger和D:\srv03rtm\base\boot\loader_dbg.inc文件的关系----特别重要

Boot Debugger Using的来源BlOsLoader函数中的BdInitDebugger和D:\srv03rtm\base\boot\loader_dbg.inc文件的关系----特别重要

ntldr改为ntldr_bak,然后ntldr_dbg改为ntldr

后可以调试NTLDR了!!!

第一部分:

第二部分:

D:\srv03rtm\base\boot>grep "Boot Debug" -nr D:\srv03rtm\base\boot
D:\srv03rtm\base\boot/bd/i386/port.c:58: TEXT("\nBoot Debugger Using: COM%d (Baud Rate %d)\n"),
D:\srv03rtm\base\boot/bd/ia64/miscc.c:11: This module contains utility functions used by IA-64 Boot Debugger.
D:\srv03rtm\base\boot/bd/ia64/port.c:60: TEXT("\r\nBoot Debugger Using: COM%d (Baud Rate %d)\r\n"),
D:\srv03rtm\base\boot/bd/init.c:156: DbgPrint("BD: Boot Debugger Initialized\n");


LOGICAL
BdPortInitialize(
IN ULONG BaudRate,
IN ULONG PortNumber,
OUT PULONG BdFileId
)

/*++

Routine Description:

This functions initializes the boot debugger com port.

Arguments:

BaudRate - Supplies an optional baud rate.

PortNumber - supplies an optinal port number.

Returned Value:

TRUE - If a debug port is found.

--*/

{
//
// Initialize the specified port.
//
if (!BlPortInitialize(BaudRate, PortNumber, NULL, FALSE, BdFileId)) {
return FALSE;
}
_stprintf(DebugMessage,
TEXT("\nBoot Debugger Using: COM%d (Baud Rate %d)\n"),
PortNumber,
BaudRate);

//
// We cannot use BlPrint() at this time because BlInitStdIo() has not been called, which is
// required to use the Arc emulator code.
//
TextStringOut(DebugMessage);
return TRUE;
}

D:\srv03rtm\base\boot>grep "BdPortInitialize" -nr D:\srv03rtm\base\boot
D:\srv03rtm\base\boot/bd/bd.h:161:BdPortInitialize(
D:\srv03rtm\base\boot/bd/i386/port.c:26:BdPortInitialize(
D:\srv03rtm\base\boot/bd/ia64/port.c:28:BdPortInitialize(
D:\srv03rtm\base\boot/bd/init.c:126: if (BdPortInitialize(BaudRate, PortNumber, &BdFileId) == FALSE) {

第三部分:

VOID
BdInitDebugger (
IN PCHAR LoaderName,
IN PVOID LoaderBase,
IN PCHAR Options
)

/*++

Routine Description:

This routine initializes the boot kernel debugger.

Arguments:

Options - Supplies a pointer to the the boot options.

Stop - Supplies a logical value that determines whether a debug message
and breakpoint are generated.

Return Value:

None.

--*/

{


//
// Attempt to initialize the debug port.
//
if (BdPortInitialize(BaudRate, PortNumber, &BdFileId)== FALSE) {
return;
}

第四部分:


D:\srv03rtm\base\boot>grep "BdInitDebugger" -nr D:\srv03rtm\base\boot
D:\srv03rtm\base\boot/bd/init.c:38:BdInitDebugger (
D:\srv03rtm\base\boot/bldr/i386/parsboot.c:579: // pass to BdInitDebugger to handle.
D:\srv03rtm\base\boot/bldr/i386/parsboot.c:592: BdInitDebugger((PCHAR)OsLoaderName, (PVOID)OsLoaderBase, pCurrent);
D:\srv03rtm\base\boot/bldr/osloader.c:1118: DBGTRACE( TEXT("About to BdInitDebugger. Base = %x\r\n"), LoaderBase );
D:\srv03rtm\base\boot/bldr/osloader.c:1120: BdInitDebugger((PCHAR)OsLoaderName, LoaderBase, ENABLE_LOADER_DEBUG);
D:\srv03rtm\base\boot/bldr/osloader.c:1122: DBGTRACE( TEXT("Back From BdInitDebugger.\r\n") );
D:\srv03rtm\base\boot/bldr/osloader.c:1126: BdInitDebugger((PCHAR)OsLoaderName, 0, NULL);
D:\srv03rtm\base\boot/inc/bldr.h:422:BdInitDebugger (
D:\srv03rtm\base\boot/lib/i386/memory.c:849: BdInitDebugger((PCHAR)OsLoaderName, (PVOID)OsLoaderBase, ENABLE_LOADER_DEBUG);
D:\srv03rtm\base\boot/lib/i386/memory.c:851: BdInitDebugger((PCHAR)OsLoaderName, (PVOID)OsLoaderBase, NULL);
D:\srv03rtm\base\boot/oschoice/oschoice.c:1254: BdInitDebugger("oschoice.exe", LoaderBase, ENABLE_LOADER_DEBUG);
D:\srv03rtm\base\boot/oschoice/oschoice.c:1258: BdInitDebugger("oschoice.exe", LoaderBase, NULL);
D:\srv03rtm\base\boot/setup/setup.c:565: BdInitDebugger((PCHAR)OsLoaderName, LoaderBase, ENABLE_LOADER_DEBUG);
D:\srv03rtm\base\boot/setup/setup.c:569: BdInitDebugger((PCHAR)OsLoaderName, 0, NULL);

ARC_STATUS
BlOsLoader (
IN ULONG Argc,
IN CHAR * FIRMWARE_PTR * FIRMWARE_PTR Argv,
IN CHAR * FIRMWARE_PTR * FIRMWARE_PTR Envp
)

/*++

Routine Description:

This is the main routine that controls the loading of the NT operating
system on an ARC compliant system. It opens the system partition,
the boot partition, the console input device, and the console output
device. The NT operating system and all its DLLs are loaded and bound
together. Control is then transfered to the loaded system.

Arguments:

Argc - Supplies the number of arguments that were provided on the
command that invoked this program.

Argv - Supplies a pointer to a vector of pointers to null terminated
argument strings.

Envp - Supplies a pointer to a vector of pointers to null terminated
environment variables.

Return Value:

EBADF is returned if the specified OS image cannot be loaded.

--*/

{

。。。

//
// Initialize the OS loader console input and output.
//
Status = BlInitStdio(Argc, Argv);

if (Status != ESUCCESS) {
return Status;
}


//
// Initialize the boot debugger for platforms that directly load the
// OS Loader.
//
// N.B. This must occur after the console input and output have been
// initialized so debug messages can be printed on the console
// output device.
//

#if defined(_ALPHA_) || defined(ARCI386) || defined(_IA64_)
//
// Locate the memory descriptor for the OS Loader.
//

ProgramDescriptor = NULL;
while ((ProgramDescriptor = ArcGetMemoryDescriptor(ProgramDescriptor)) != NULL) {
if (ProgramDescriptor->MemoryType == MemoryLoadedProgram) {
break;
}
}

//
// If the program memory descriptor was found, then compute the base
// address of the OS Loader for use by the debugger.
//

LoaderBase = &__ImageBase;

//
// Initialize traps and the boot debugger.
//
#if defined(ENABLE_LOADER_DEBUG)

#if defined(_ALPHA_)
BdInitializeTraps();
#endif

DBGTRACE( TEXT("About to BdInitDebugger. Base = %x\r\n"), LoaderBase );

BdInitDebugger((PCHAR)OsLoaderName, LoaderBase, ENABLE_LOADER_DEBUG);

DBGTRACE( TEXT("Back From BdInitDebugger.\r\n") );

#else

BdInitDebugger((PCHAR)OsLoaderName, 0, NULL);

#endif

#endif

第五部分:D:\srv03rtm\base\boot\loader_dbg.inc文件内容:

#
# set the flags necessary to build debug enabled boot loaders
#

#
# the ; is a temporary hack to make this compile until is made
# clear how to make the ##'s not get translated into CR's
#

ENABLE_LOADER_DEBUG=debugport=com1;debugbaudrate=115200

#
#
#

!include $(PROJECT_ROOT)\boot\loader.inc

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/6/19 21:30:41

树莓派兼容的文字处理软件推荐

本文为大家推荐多款可在树莓派上流畅运行的优质文字处理软件及办公套件,详细介绍各款工具的核心优势、功能亮点与适用场景,助力大家为树莓派挑选适配的文档编辑与创作工具。 如今,将树莓派作为日常使用的电脑已不再小众,众多用户将…

作者头像 李华
网站建设 2026/6/19 21:30:38

基于Python的膳食健康系统_96e1ff52

文章目录一、项目技术二、项目内容和功能介绍三、核心代码四、效果图五 、资料获取一、项目技术 开发语言:Python python框架:Django 软件版本:python3.7/python3.8 数据库:mysql 5.7或更高版本 数据库工具:Navicat11…

作者头像 李华
网站建设 2026/6/19 21:30:36

还在愁论文?AI 写论文软件排行榜你真会选吗?

先给你最关键的结论 —— 按需求选对工具才是核心&#xff0c;不是盲目追 “榜一”。中文降重选PaperRed&#xff08;语义级改写&#xff0c;AI 率稳 < 5%&#xff09;&#xff0c;国内毕业全流程选毕业之家&#xff08;格式精修 合规降重&#xff09;&#xff0c;通用初稿…

作者头像 李华
网站建设 2026/6/19 21:30:34

TEASOFT驱动Keysight示波器自动截图:一键获取波形图并嵌入CSDN

前言 在编写电子电路、信号处理相关的技术博客时&#xff0c;经常需要将示波器屏幕截图插入到文章中。传统的手动截图方式效率低下&#xff1a;需要手动操作示波器保存截图、选择文件、上传图片、手动调整格式。今天介绍一个基于Python的自动化工具 keysightpf.py&#xff0c;可…

作者头像 李华
网站建设 2026/6/22 0:15:42

精密制造QMS解决方案:海岸线PQM破解质量追溯与交付难题

一、精密制造质量困境&#xff1a;数据孤岛难解&#xff0c;QMS数字化破局关键当前&#xff0c;精密制造企业数字化转型普遍陷入两难&#xff1a;系统投入持续增加&#xff0c;数据孤岛却愈发突出&#xff1b;流程文件不断细化&#xff0c;一线执行抵触情绪加剧&#xff1b;管理…

作者头像 李华
网站建设 2026/6/22 23:09:35

如何在没有备份的情况下从 iPad 恢复照片?

许多因素都可能导致 iPad 上的照片丢失&#xff0c;例如意外删除、病毒攻击、 iOS更新失败等等。随着近年来科技的发展&#xff0c;在没有备份的情况下丢失 iPad 上的照片已不再是噩梦。您可以借助以下两种行之有效的方法&#xff0c;快速恢复没有备份的 iPad 上的照片。第 1 部…

作者头像 李华