📄 intr.c
字号:
#include <i386/vector.h> /*regs_t*/
#include <i386/intr.h>
#include <asmcmd.h>
void common_interrupt(regs_t *regs)
{
static const char * const msg[] =
{
"divide error", "debug exception", "NMI", "INT3",
"INTO", "BOUND exception", "invalid opcode", "no coprocessor",
"double fault", "coprocessor segment overrun",
"bad TSS", "segment not present",
"stack fault", "GPF", "page fault", "xxx",
"coprocessor error", "alignment check", "xxx", "xxx",
"xxx", "xxx", "xxx", "xxx",
"xxx", "xxx", "xxx", "xxx",
"xxx", "xxx", "xxx", "xxx",
"IRQ0", "IRQ1", "IRQ2", "IRQ3",
"IRQ4", "IRQ5", "IRQ6", "IRQ7",
"IRQ8", "IRQ9", "IRQ10", "IRQ11",
"IRQ12", "IRQ13", "IRQ14", "IRQ15",
"syscall"
};
/**/
switch(regs->which_int)
{
/* this handler installed at compile-time
Keyboard handler is installed at run-time (see below) */
case 0x20: /* timer IRQ 0 */
print("Timer\n");
/* reset hardware interrupt at 8259 chip */
outportb(0x20, 0x20);
break;
default:
print("Exception occured: ");
print(msg[regs->which_int]);
cli();
halt();
while(1);
break;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -