我建立一个小型操作系统对我自己来说是一个挑战。我在网上阅读了很多文章说要覆盖中断向量表,你需要更改物理地址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。
答案 0 :(得分:0)
显然要在中断中使用中断,你需要使用sti打开中断标志,因为它是自动禁用的