【发布时间】:2013-11-07 14:07:18
【问题描述】:
我无法完全掌握 jmp/call 远/近版本的细节。据我了解, jmp/call 指令附近使用指令本身的相对偏移量作为操作数。 Far jmp/call 指令使用绝对地址作为操作数。
1) 在保护模式下,这个绝对地址只是编译器放置的虚拟地址。
2)在实模式下你通常写:
jmp [new number of code segment][proc name as offset]
那么绝对地址由公式计算:
address = new number * 10h + offset
这实际上是实模式下的物理地址。
执行 far jmp/call 时 CPU 会自动更新 CS 吗? 例如当 BIOS 代码跳转到加载的引导扇区代码时。我在引导扇区文件的源代码中没有看到设置 CS 值。
在保护模式下:cs = index in descriptor table = absolute address / page size
实模式:cs = segment index in RAM = specified "new number of code segment"
我的假设是否正确?
【问题讨论】:
标签: assembly x86 real-mode memory-segmentation