启动后寄存器的状态

发布于 2024-07-05 06:00:52 字数 146 浏览 13 评论 0原文

我正在 x86 机器上开发引导加载程序。

当BIOS将MBR的内容复制到0x7c00并跳转到该地址时,寄存器的内容有标准的含义吗? 寄存器有标准值吗?

我知道段寄存器通常设置为 0,但有时会设置为 0x7c0。 其他硬件寄存器呢?

I'm working on a boot loader on an x86 machine.

When the BIOS copies the contents of the MBR to 0x7c00 and jumps to that address, is there a standard meaning to the contents of the registers? Do the registers have standard values?

I know that the segment registers are typically set to 0, but will sometimes be 0x7c0. What about the other hardware registers?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

人生百味 2024-07-12 06:00:52

这个早期执行环境是高度实现定义的,这意味着特定 BIOS 的实现。 切勿对寄存器的内容做出任何假设。 它们可能被初始化为 0,但它们也可能包含随机值。

来自 OS dev Wiki,这是我在玩我的玩具操作系统时获取信息的地方

This early execution environment is highly implementation defined, meaning the implementation of your particular BIOS. Never make any assumptions on the contents of registers. They might be initialized to 0, but they might contain a random value just as well.

from the OS dev Wiki, which is where I get information when I'm playing with my toy OS's

平安喜乐 2024-07-12 06:00:52

最好的选择是什么都不假设。 如果他们有意义,当你需要他们提供的信息时,你会从对方那里发现这一点。

Best option would be to assume nothing. If they have meaning, you will find that from the other side when you need the information they provide.

好菇凉咱不稀罕他 2024-07-12 06:00:52

未定义,我相信? 我认为这取决于主板和CPU,为了你自己的利益,应该将其视为随机的。

Undefined, I believe? I think it depends on the mainboard and CPU, and should be treated as random for your own good.

似梦非梦 2024-07-12 06:00:52

最安全的选择是假设未定义。

Safest bet is to assume undefined.

夏九 2024-07-12 06:00:52

始终假设未定义,否则如果您尝试移植架构,就会遇到严重问题。

没有什么比移植代码更痛苦的了,假设所有未初始化的内容都将设置为零。

Always assume undefined, otherwise you'll hit bad problems if you ever try to port architectures.

There is nothing quite like the pain of porting code that assumes everything uninitialized will be set to zero.

差↓一点笑了 2024-07-12 06:00:52

The only thing that I know to be well defined is the processor state immediately after reset.

For the record you can find that in Intel's Software Developer's Manual Vol 3 chapter 8: "PROCESSOR MANAGEMENT AND INITIALIZATION" in the table titled " IA-32 Processor States Following Power-up, Reset, or INIT"

知你几分 2024-07-12 06:00:52

您始终可以自己初始化它们以从已知状态开始。

You can always initialize them yourself to start with a known state.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文