在我的 MIT OS 课程 (686) 中,我发现了一些我不理解的代码。我试图理解boot / boot.Sinb $0x64, %al
中的指令。我的理解是它从数据端口 0x64 读取一个字节到AL,端口 0x64 是什么?它正在测试哪个设备或机制繁忙?我对代码忙碌中的评论感到困惑?评论是什么意思,它指的是什么?
# Enable A20:
# For fascinating historical reasons (related to the fact that
# the earliest 8086-based PCs could only address 1MB of physical memory
# and subsequent 80286-based PCs wanted to retain maximum compatibility),
# physical address line 20 is tied to low when the machine boots.
# Obviously this a bit of a drag for us, especially when trying to
# address memory above 1MB. This code undoes this.
seta20.1: inb $0x64,%al # Get status
testb $0x2,%al # Busy?
jnz seta20.1 # Yes
movb $0xd1,%al # Command: Write
outb %al,$0x64 # output port
seta20.2: inb $0x64,%al # Get status
testb $0x2,%al # Busy?
jnz seta20.2 # Yes
movb $0xdf,%al # Enable
outb %al,$0x60 # A20