/* See COPYRIGHT for copyright information. */ #include #include #include #include ################################################################### # exceptions/interrupts ################################################################### /* For certain traps the CPU automatically pushes an error code, for * all other traps the IDTFUNC_NOEC() pushes a 0 in place of the error code, * so the trap frame has the same format. */ #define IDTFNC(name,num,dpl) .text; \ ENTRY(name) pushl $(num); jmp _alltraps; \ .data; \ .long num; .long name; .long dpl #define IDTFNC_NOEC(name,num,dpl) .text; \ ENTRY(name) pushl $0; pushl $(num); jmp _alltraps; \ .data; \ .long num; .long name; .long dpl .data .global pseudoidt pseudoidt: IDTFNC_NOEC(i_divide, T_DIVIDE, 0) IDTFNC_NOEC(i_debug, T_DEBUG, 0) IDTFNC_NOEC(i_nmi, T_NMI, 0) IDTFNC_NOEC(i_brkpt, T_BRKPT, 3) IDTFNC_NOEC(i_oflow, T_OFLOW, 0) IDTFNC_NOEC(i_bound, T_BOUND, 0) IDTFNC_NOEC(i_illop, T_ILLOP, 0) IDTFNC_NOEC(i_device, T_DEVICE, 0) IDTFNC(i_dblflt, T_DBLFLT, 0) IDTFNC(i_tss, T_TSS, 0) IDTFNC(i_segnp, T_SEGNP, 0) IDTFNC(i_stack, T_STACK, 0) IDTFNC(i_gpflt, T_GPFLT, 0) IDTFNC(i_pgflt, T_PGFLT, 0) IDTFNC_NOEC(i_fperr, T_FPERR, 0) IDTFNC(i_align, T_ALIGN, 0) IDTFNC_NOEC(i_mchk, T_MCHK, 0) IDTFNC_NOEC(i_syscall, T_SYSCALL, 3) IDTFNC_NOEC(i_default, T_DEFAULT, 0) /* pseudoidt terminator entry */ .data .long 0 .long 0 .long 0 .text _alltraps: pushl %ds pushl %es pushal movw $GD_KD, %ax movw %ax, %ds movw %ax, %es pushl %esp call trap popl %eax popal popl %es popl %ds addl $8,%esp iret