mirror of
https://github.com/MintCN/linux-insides-zh.git
synced 2026-04-25 11:11:20 +08:00
modify to the right instruction and revise the description
This commit is contained in:
@@ -336,12 +336,12 @@ cs = 0x1020
|
||||
段寄存器设置
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
在代码的一开始,就将 `ds` 和 `es` 段寄存器的内容设置成一样,并且使用指令 `sti` 来允许中断发生:
|
||||
首先,内核保证将 `ds` 和 `es` 段寄存器指向相同地址,随后,使用 `cld` 指令来清理方向标志位:
|
||||
|
||||
```assembly
|
||||
movw %ds, %ax
|
||||
movw %ax, %es
|
||||
sti
|
||||
cld
|
||||
```
|
||||
|
||||
就像我在上面一节中所写的, 为了能够跳转到 `_start` 标号出执行代码,grub2 将 `cs` 段寄存器的值设置成了 `0x1020`,这个值和其他段寄存器都是不一样的,因此下面的代码就是将 `cs` 段寄存器的值和其他段寄存器一致:
|
||||
|
||||
Reference in New Issue
Block a user