【发布时间】:2013-09-23 15:22:31
【问题描述】:
我正在尝试在 64 位 Intel Atom 处理器 (x86_64) 上学习基本的操作系统开发。我无法让中断处理程序正常工作——我认为它没有在中断向量表中正确注册。
这是我加载到引导扇区的全部代码:
; The code in the boot sector of the disk is loaded by the BIOS at 0000:7c00
mov ax, 0x07c0
mov ds, ax
; Set es register to 0x0000
xor ax, ax
mov es, ax
; Register IRQ 0x69 handler in the Interrupt Vector Table
cli
mov dx, int_prog
mov [es:0x69*4], dx
mov ax, cs
mov [es:0x69*4+2], ax
sti
; Call interrupt handler for IRQ 0x69
nop
int 0x69
; Busy loop to allow time for human to look at screen
hang:
jmp hang
; Interrupt Handler
int_prog:
pusha
; Print red 'A' to screen
mov ax, 0xB800
mov es, ax
mov [es:0], word 0x441
popa
iret
; Pad with zeroes and add signature at end
times 510-($-$$) db 0
dw 0x55AA
我预计屏幕左角会出现一个红色的“A”,但什么也没有出现。在屏幕上打印红色“A”的部分在中断处理程序之外工作正常,所以这不是问题。
我只能假设处理器永远不会进入中断处理程序——但我明确地用int 0x69 调用它。
我的代码中是否缺少某种 x86 特定 设置?
【问题讨论】:
标签: assembly x86 kernel nasm bootloader