linux-asm.s

/*
*  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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值