【发布时间】: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