如何在中断向量table中找到中断的物理地址?

How to find the physical address of interrupts in interrupt vector table?

如何计算 8086 微处理器中断向量 table 中任何给定中断(例如 INT22H 或 INT15H)的物理地址?

...calculate the physical address of any given interrupt (INT22H or INT15H for instance) in the interrupt vector table...

  • int 15h 指令找到它应该 call.
    的远指针的物理地址 这是中断向量 Table 内 的偏移量 ,因此给出了列表 {0,4,8,12, ... , 1016 中的物理地址,也称为线性地址,1020}.
    由于每个向量的长度为 4 个字节,因此只需将中断号乘以 4。

    mov  ax,0415h                  ;AL=Interrupt number, AH=4
    mul  ah                        ; -> Product in AX
    cwd                            ;(*) -> Result in DX:AX=[0,1023]
    

    (*) 我喜欢用 DX:AX 表示的所有线性地址。这就是为什么我使用看似不必要的 cwd 指令。

  • 最终处理 int 15h 的物理地址。
    这可以是 1MB 内存中的任何位置。 (在 上没有超过 1MB 的内存)。
    每个 4 字节向量由一个偏移字和一个段字组成。顺序很重要。
    线性地址由段值乘以16加上偏移值计算得到。

    mov  ax,16
    mul  word ptr [0015h * 4 + 2]  ;Segment in high word -> Product in DX:AX
    add  ax, [0015h * 4]           ;Offset in low word
    adc  dx, 0                     ; -> Result in DX:AX=[0,1048575]