news 2026/10/21 1:21:45

000ResetVector_resetVector

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
000ResetVector_resetVector

ResetVector

查阅处理器相关规范,了解到x86架构的计算机上电或者重启后,会跳转到0xFFFFFFF0(Reset Vector)处执行指令,OVMF平台reset vector代码(OvmfPkg\ResetVector\Ia16\ResetVectorVtf0.asm)如下:

resetVector: ; ; Reset Vector ; ; This is where the processor will begin execution ; ; In IA32 we follow the standard reset vector flow. While in X64, Td guest ; may be supported. Td guest requires the startup mode to be 32-bit ; protected mode but the legacy VM startup mode is 16-bit real mode. ; To make NASM generate such shared entry code that behaves correctly in ; both 16-bit and 32-bit mode, more BITS directives are added. ; %ifdef ARCH_IA32 nop nop jmp EarlyBspInitReal16
  • NOP:根据SDM手册,对于多核处理器。第一个执行NOP指令的核,被设置为BSP,负责执行指令。第二个NOP负责占位,保证16位对齐。

ResetVector.bin

查阅ResetVector.inf module经编译后的二进制文件ResetVector.bin(Build\Ovmf3264\NOOPT_VS2019\IA32\OvmfPkg\ResetVector\ResetVector\OUTPUT\ResetVector.bin),我们可以看到。上述代码对应的机器指令是90 90 E9 5B FF。

ResetVector.lst

EDK2在编译ResetVector.inf的时候,会将其先翻译成ResetVector.lst(Build\Ovmf3264\NOOPT_VS2019\IA32\OvmfPkg\ResetVector\ResetVector\OUTPUT\ResetVector.lst),我们可以比较方便查阅上述代码编译后的机器码,如下:

179<1>resetVector:180<1>;181<1>;Reset Vector182<1>;183<1>;This is where the processor will begin execution184<1>;185<1>;In IA32 we follow the standard reset vector flow. WhileinX64, Td guest186<1>;may be supported. Td guest requires the startup mode to be32-bit187<1>;protected mode but the legacy VM startup mode is16-bit real mode.188<1>;TomakeNASM generate such shared entry code that behaves correctlyin189<1>;both16-bit and32-bit mode,moreBITS directives are added.190<1>;191<1>%ifdef ARCH_IA321920000056090<1>nop1930000056190<1>nop19400000562 E95BFF<1>jmp EarlyBspInitReal16

通过WinDbg查询内存地址0xFFFFFFF0位置的指令,可以看到和上述一致:

参考

  • Intel SDM

    Upon completion of the BIST, the logical processors use a hardware-defined selection mechanism toselectthe BSP and the APs from the available logical processors on the system bus. The BSP selection mechanism differs depending on the family, model, and stepping IDs of the processors, as follows: — Later generations of IA processors within family 0FH(see Section9.4), IA processors with system bus(family=06H,extended_model=0, model>=0EH), or all other modern Intel processors(family=06H, extended_model>0): • The logical processors begin monitoring the BNR# signal, which is toggling. When the BNR# pin stopstoggling, each processor attempts to issue a NOP special cycle on the system bus. • The logical processor with the highest arbitration priority succeedsinissuing a NOP special cycle and is nominated the BSP. This processor sets the BSP flaginits IA32_APIC_BASE MSR,thenfetches and begins executing BIOS boot-strap code, beginning at the reset vector(physical address FFFF FFF0H). • The remaining logical processors(that failedinissuing a NOP special cycle)are designated as APs. They leave their BSP flagsintheclearstate and enter a “wait-for-SIPI state.”
  • OVMF_ResetVector

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

RT-Thread安防IPC无线联网方案:WIFI与4G模组选型适配实战

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

作者头像 李华
网站建设 2026/10/21 1:20:47

UFS 3.1协议学习路径:从第11章切入掌握UPIU与命令队列

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

作者头像 李华
网站建设 2026/10/21 1:20:43

第八章:进入Redis的SET的核心

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

作者头像 李华
网站建设 2026/10/21 1:20:43

5000+工厂蓝图:戴森球计划工厂建造,从新手到戴森球一步到位

5000工厂蓝图&#xff1a;戴森球计划工厂建造&#xff0c;从新手到戴森球一步到位 【免费下载链接】FactoryBluePrints 游戏戴森球计划的**工厂**蓝图仓库 项目地址: https://gitcode.com/GitHub_Trending/fa/FactoryBluePrints 花了三小时规划产线&#xff0c;结果传送…

作者头像 李华
网站建设 2026/10/21 1:20:25

第四章:分析 Redis 性能高原因和核心字符串类型命令

/* MD / 富文本中的 .toc(含博客园搬家等嵌套结构);.toc-box 在侧栏,不受影响 */#content_views .toc,/* 编辑器常在目录前后插入空 p(:empty 仍占 20px),一并去掉避免顶空隙 */#content_views.markdown_views > p:empty:has(+ .toc),#content_views.markdown_views …

作者头像 李华
网站建设 2026/10/21 1:19:33

Ubuntu 18.04 显卡驱动与CUDA环境配置完整指南

1. 为什么在 Ubuntu 18.04 上装显卡驱动这件事值得单独写一篇笔记如果你刚装完 Ubuntu 18.04&#xff0c;满心欢喜地准备跑深度学习训练或者做点 GPU 加速的计算&#xff0c;结果发现nvidia-smi报错、torch.cuda.is_available()返回False&#xff0c;那你大概率卡在了显卡驱动和…

作者头像 李华