当前位置: 首页 > news >正文

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

http://www.jsqmd.com/news/366831/

相关文章:

  • 青云对象存储python sdk 示例
  • 5.C++顺序表
  • 主管护师考前押题卷准吗?深度复盘2026年Top3押题卷命中率,快收藏! - 医考机构品牌测评专家
  • 基于单片机的两路PWM信号输出及频率占空比相位差调节系统 - 指南
  • 从零开始:亚洲美女-造相Z-Turbo的完整使用流程解析
  • Webpack Module Federation 微前端 + Monorepo 大仓架构 结合 物料化低代码平台 实战落地
  • 2026年热门的椰壳活性炭/柱状活性炭供应商推荐怎么联系(畅销) - 品牌宣传支持者
  • 2026四川墙面地面辅材实力榜:抗裂砂浆腻子粉领衔,找平石膏、瓷砖胶、自流平全系优选 - 深度智识库
  • 2026主管护师机构2月最新测评:3梯队实力排行出炉,适配不同考生需求 - 医考机构品牌测评专家
  • 2026主管护师培训机构怎么选?3大红榜机构深度解析,一篇文章给你答案! - 医考机构品牌测评专家
  • 2026年评价高的纺织软件/软件市场占有率排名推荐 - 品牌宣传支持者
  • 2026年比较好的无油铜套/自润滑铜套直销厂家价格参考怎么选 - 品牌宣传支持者
  • 2026年质量好的高碘值活性炭/Vocs 活性炭制造厂家选购指南怎么选(精选) - 品牌宣传支持者
  • 基础差也能过!2026 主管护师零基础备考全攻略,稳扎稳打提分 - 医考机构品牌测评专家
  • 2026年PE管厂家最新推荐榜,技术实力与市场口碑深度解析PE管/PVC管/复合管公司推荐 - 深度智识库
  • 健康白酒排行榜最新出炉!毛铺草本酒登顶,百元内口粮酒首选 - 资讯焦点
  • 2026基础薄弱备考主管护师?3大策略+4类资源助考生稳步逆袭 - 医考机构品牌测评专家
  • 2026年质量好的定制工厂静音轨道/全屋定制静音轨道直销厂家采购指南如何选 - 品牌宣传支持者
  • 6.C嘎嘎STL vector
  • 3D打印机,走出极客圈
  • 节日送礼酒水推荐:选酒不踩坑,毛铺紫荞酒首选更体面 - 资讯焦点
  • 树莓派兼容的文字处理软件推荐
  • 3.空间复杂度
  • 2026年靠谱的橡塑隔热棉/橡塑隔音材料哪家质量好厂家实力参考 - 品牌宣传支持者
  • 【课程设计/毕业设计】基于springboot的学生档案管理系统用于各类学校档案管理提升校园信息化水平【附源码、数据库、万字文档】
  • 百元内口感柔和的白酒首选!毛铺绿荞领衔,自饮宴请都合适 - 资讯焦点
  • 2026年评价高的大提花工艺培训/梭织鞋面培训实操强化课程推荐 - 品牌宣传支持者
  • 2026年比较好的定制工厂零角度铰链/德国高端零角度铰链高评价直销厂家采购指南推荐(高评价) - 品牌宣传支持者
  • 计算机Java毕设实战-基于springboot的软件测试管理系统的设计与实现【完整源码+LW+部署说明+演示视频,全bao一条龙等】
  • 2026年2月金属检测机厂家推荐,资质齐全、售后完善的供应商精选 - 品牌鉴赏师