syslinux加载内核后是否切换到保护模式?

发布于 2024-11-15 23:30:28 字数 53 浏览 5 评论 0原文

加载内核后syslinux是否切换到保护模式? syslinux 启动内核后机器状态是什么?

Does syslinux switch to protected mode after loading the kernel ? What is the machine state after syslinux boots a kernel.

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

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

发布评论

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

评论(1

逆光下的微笑 2024-11-22 23:30:28

我假设您正在谈论 syslinux 加载 Linux 内核。

看看Documentation/x86/boot.txt

Linux 内核有一个小的实模式设置代码(可在 arch/x86/boot/),它做了一些在转换到保护模式之前必须完成的事情(其中大部分查询实模式 BIOS 以获得一些信息)。引导加载程序将这部分加载到低内存(低于 640k)中。

较旧的内核足够小,可以容纳不到 640k 的连续低内存,因此引导加载程序将整个内核加载到低内存中,并且可以在实模式下执行所有操作。较新的内核更大(通常在 4M 左右),因此必须将它们加载到高内存(1M 以上)中。为此,引导加载程序必须更改为保护模式以将内核放在那里,更改回实模式以调用 BIOS 从磁盘读取更多扇区,并在跳转之前更改回实模式到内核​​设置代码(最后一次将再次转换到保护模式)。

因此,为了回答您的问题,它执行相反的操作:加载内核后,它从保护模式切换到实模式。

处理器状态如我上面链接的文档中所述:实模式 CS 指向实模式设置代码的开头加上 0x20(使 CS:IP 指向第二个 512 字节实模式设置代码扇区的开头) ,其余段寄存器指向实模式设置代码的开始(第一个扇区),以及填充在实模式设置代码的前两个扇区中找到的标头中的几个参数。通用寄存器的内容并不重要。

I am assuming you are talking about syslinux loading a Linux kernel.

Take a look at Documentation/x86/boot.txt.

The Linux kernel has a small real mode setup code (found at arch/x86/boot/), which does a few things which must be done before the transition to protected mode (most of it querying the real mode BIOS for a few pieces of information). The bootloader loads this part in low memory (below 640k).

Older kernels were small enough to fit in the less than 640k of contiguous low memory, so the bootloader loaded the whole kernel in low memory, and could do everything in real mode. Newer kernels are bigger (usually around 4M), so they have to be loaded in high memory (above 1M). To do this, the bootloader has to change to protected mode to put the kernel there, changing back to real mode to call the BIOS to read more sectors from the disk, and change back to real mode before jumping to the kernel setup code (which will again transition to protected mode one last time).

So, to answer your question, it does the opposite: it switches from protected mode to real mode after loading the kernel.

The processor state is as described in the documentation I linked to above: real mode CS pointing to the start of the real mode setup code plus 0x20 (making CS:IP point to the start of the second 512-byte real mode setup code sector), the rest of the segment registers pointing to the start of the real mode setup code (the first sector), and several parameters filled in the headers found in the first two sectors of the real mode setup code. The content of the general-purpose registers does not matter.

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