【问题标题】:overriding the interrupt vector table 8086 nothing happens覆盖中断向量表 8086 没有任何反应
【发布时间】:2017-03-14 18:55:13
【问题描述】:

我正在构建一个小型操作系统作为对自己的挑战。我在网上看了很多文章说要覆盖中断向量表需要更改0000的物理地址:中断号*4和0000:(中断号*4)+2。 我写了一段代码,但当试图在虚拟机上运行它时,什么也没有发生。你们中的任何人都可以分享他们的知识并告诉我哪里错了吗?这是我的代码:

mov ax,0
mov es,ax
mov ax,cs ;; set ax to the current segment
mov [es:01a6h], ax ;; change 0000:(interrupt number*4)+2
mov ax,interrupt1 ;; set ax to the offset of the interrupt  
mov [es:01a4h], ax ;; change 0000:(interrupt number*4)
int 69h
jmp $

这是中断:

interrupt1: MOV ah,09h mov al,'c' ;;; its function is to write down the letter c in red mov bx,0004 MOV cx,1 int 10h iret

我正在使用 nasm 和 Oracle Virtual box。

【问题讨论】:

  • 0x69*4=0x1a4 在我的计算器中。
  • 注意到这是我得到之前的代码,我之前确实修复过它并没有帮助
  • 确保您的org 设置正确。发布完整的minimal reproducible example
  • @Jester 你能详细说明一下吗?我根本没有使用过 org,因为我的操作系统的引导加载程序将它加载到 ram 的下一部分并跳转到它
  • 我想我在这里中了大奖,我可以从另一个中断内部调用一个中断吗?

标签: assembly operating-system nasm interrupt x86-16


【解决方案1】:

显然要在中断中使用中断,您需要使用 sti 打开中断标志,因为它会自动禁用

【讨论】:

  • 这是不真实的。您需要使用 STI 打开外部中断才能触发外部中断。您无需打开中断即可启动软件中断(如int 10h)。
  • 出于好奇,问题中的代码还有更多内容。例如,您是否碰巧重新映射了 PIC,以便将主 PIC 放置在中断 0x68 处?我的假设是您有并且打算在每次按下键盘时使用int 10h 打印一个字符?
  • 我实际上正在构建自己的小操作系统,我正在使用软件中断作为内核...
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-12-22
  • 2018-04-23
  • 1970-01-01
相关资源
最近更新 更多