/*
* linux/kernel/asm.s
* 對Intel中int0-int16的處理,即大部分的硬件故障處理過程
* (C) 1991 Linus Torvalds
*/
/*
* asm.s contains the low-level code for most hardware faults.
* page_exception is handled by the mm, so that isn't here. This
* file also handles (hopefully) fpu-exceptions due to TS-bit, as
* the fpu must be properly saved/resored. This hasn't been tested.
*/
/*在trap.c中說明的全局函數名*/
.globl _divide_error,_debug,_nmi,_int3,_overflow,_bounds,_invalid_op
.globl _double_fault,_coprocessor_segment_overrun
.globl _invalid_TSS,_segment_not_present,_stack_segment
.globl _general_protection,_coprocessor_error,_irq13,_reserved
.globl _alignment_check
_divide_error: !--int0
pushl $_do_divide_error !--函數do_divide_error的入口地址
no_error_code: !--無錯處理的入口地址
xchgl %eax,(%esp) !--do_divide_error->eax
pushl %ebx
pushl %ecx
pushl %edx
pushl %edi
pushl %esi
pushl %ebp
push %ds
push %es
push %fs
pushl $0 # "error code"
lea 44(%esp),%edx !--中斷返回地址
pushl %edx
movl $0x10,%edx
mov %dx,%ds
mov %dx,%es
mov %dx,%fs
call *%eax !--調用eax指向地址的函數
addl $8,%esp
pop %fs
pop %es
pop %ds
popl %ebp
popl %esi
popl %edi
popl %edx
popl %ecx
popl %ebx
popl %eax
iret
_debug: !--int1,debug調試中斷入口點
pushl $_do_int3 # _do_debug !--do_debug函數
jmp no_error_code
_nmi: !--int2,非屏蔽中斷調用入口點
pushl $_do_nmi
jmp no_error_code
_int3: !--int3,斷點指令引起中斷的入口點
pushl $_do_int3
jmp no_error_code
_overflow: !--int4,溢出出錯處理中斷入口
pushl $_do_overflow
jmp no_error_code
_bounds: !--int5,邊界檢查出錯中斷入口
pushl $_do_bounds
jmp no_error_code
_invalid_op: !--int6,無效操作指令出錯中斷入口
pushl $_do_invalid_op
jmp no_error_code
_coprocessor_segment_overrun: !--int9,協處理器段超出出錯中斷入口點
pushl $_do_coprocessor_segment_overrun
jmp no_error_code
_reserved: !--int15,其他Intel保留中斷的入口點
pushl $_do_reserved
jmp no_error_code
_irq13: !--int45,Linux設置的數學協處理器硬件中斷
pushl %eax
xorb %al,%al
outb %al,$0xF0
movb $0x20,%al
outb %al,$0x20
jmp 1f
1: jmp 1f
1: outb %al,$0xA0
popl %eax
jmp _coprocessor_error !--system_call.s中
_double_fault: !--int8,雙出錯故障
pushl $_do_double_fault
error_code:
xchgl %eax,4(%esp) # error code <-> %eax !--A
xchgl %ebx,(%esp) # &function <-> %ebx !--B
pushl %ecx
pushl %edx
pushl %edi
pushl %esi
pushl %ebp
push %ds
push %es
push %fs
pushl %eax # error code
lea 44(%esp),%eax # offset
pushl %eax
movl $0x10,%eax
mov %ax,%ds
mov %ax,%es
mov %ax,%fs
call *%ebx
addl $8,%esp
pop %fs
pop %es
pop %ds
popl %ebp
popl %esi
popl %edi
popl %edx
popl %ecx
popl %ebx
popl %eax
iret
_invalid_TSS: !--int10,無效的任務狀態段
pushl $_do_invalid_TSS
jmp error_code
_segment_not_present: !--int11,段不存在
pushl $_do_segment_not_present
jmp error_code
_stack_segment: !--int12,堆棧段錯誤
pushl $_do_stack_segment
jmp error_code
_general_protection: !--int13,一般保護性出錯
pushl $_do_general_protection
jmp error_code
_alignment_check: !--int17,邊界檢查出錯
pushl $_do_alignment_check
jmp error_code
|xGv00|fcc8d4de8197f69fde70263fb4d52380