免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 728 | 回复: 0
打印 上一主题 下一主题

asm.s [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-08-03 17:05 |只看该作者 |倒序浏览

/*
* linux/kernel/asm.s
*
* (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.
*/
.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
_divide_error:
    pushl $_do_divide_error
no_error_code:
    xchgl %eax,(%esp)
    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
    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:
    pushl $_do_int3        # _do_debug
    jmp no_error_code
_nmi:
    pushl $_do_nmi
    jmp no_error_code
_int3:
    pushl $_do_int3
    jmp no_error_code
_overflow:
    pushl $_do_overflow
    jmp no_error_code
_bounds:
    pushl $_do_bounds
    jmp no_error_code
_invalid_op:
    pushl $_do_invalid_op
    jmp no_error_code
_coprocessor_segment_overrun:
    pushl $_do_coprocessor_segment_overrun
    jmp no_error_code
_reserved:
    pushl $_do_reserved
    jmp no_error_code
_irq13:
    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
_double_fault:
    pushl $_do_double_fault
error_code:
    xchgl %eax,4(%esp)        # error code -> %eax
    xchgl %ebx,(%esp)        # &function -> %ebx
    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:
    pushl $_do_invalid_TSS
    jmp error_code
_segment_not_present:
    pushl $_do_segment_not_present
    jmp error_code
_stack_segment:
    pushl $_do_stack_segment
    jmp error_code
_general_protection:
    pushl $_do_general_protection
    jmp error_code


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/90876/showart_2016495.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP