我试图了解操作系统的基础知识,并在OCW中找到了一门课程(名为6.828).我在课程的实验中找到了bootloader的代码,我试过但不理解代码的以下部分:
# Enable A20:
# For backwards compatibility with the earliest PCs, physical
# address line 20 is tied low, so that addresses higher than
# 1MB wrap around to zero by default. This code undoes this.
seta20.1:
inb $0x64,%al # Wait for not busy
testb $0x2,%al
jnz seta20.1
movb $0xd1,%al # 0xd1 -> port 0x64
outb %al,$0x64
seta20.2:
inb $0x64,%al # Wait for not busy
testb $0x2,%al
jnz seta20.2
movb $0xdf,%al # 0xdf -> port 0x60
outb %al,$0x60
Run Code Online (Sandbox Code Playgroud)
我们如何检查端口0x64是否忙,以及为什么该端口用于启用A20位?为了使芯片运行到32位模式,GDT的配置如下: …