gpt4 book ai didi

x86 - 多重引导 1 引导信息总大小

转载 作者:行者123 更新时间:2023-12-02 03:06:35 25 4
gpt4 key购买 nike

有没有一种快速可靠的方法可以找出内存中 Multiboot 1 启动信息的总大小?

只是澄清一下:我不是在询问 EBX 寄存器中的值所指向的结构的大小,而是在询问内存中所有信息的总大小。

我目前正在开发 x86 Multiboot 1 兼容内核。该标准不保证 GRUB 将在何处放置此信息或其总大小。标准规定:

"The Multiboot information structure and its related substructures may be placed anywhere in memory by the boot loader (with the exception of the memory reserved for the kernel and boot modules, of course). It is the operating system’s responsibility to avoid overwriting this memory until it is done using it."

实际上,这似乎总是加载在最低的 1MB 内存中。到目前为止,在引导过程中,我使用最低 1MB 的标识映射来初始化引导分页结构,以确保可以访问多重引导信息。找出这个结构的位置很简单,但我还没有找到任何关于找到准确尺寸的信息。 (最好不要走遍整个结构)。

最佳答案

从那时起我开始意识到,Multiboot 信息结构指向的数据不能保证连续存储,并且不是 GRUB 加载到内存中的唯一数据。因此,如果不手动遍历结构,就没有可靠的方法来测量该内存的总大小或位置。

考虑到这一限制,最好的做法似乎是确保在实现分页之前将多重引导结构所需的所有数据复制到已知位置。

关于x86 - 多重引导 1 引导信息总大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58897445/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com