免费注册 查看新帖 |

Chinaunix

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

math_emulate.c [复制链接]

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

/*
* linux/kernel/math/math_emulate.c
*
* (C) 1991 Linus Torvalds
*/
/*
* This directory should contain the math-emulation code.
* Currently only results in a signal.
*/
#include signal.h>
#include linux/sched.h>
#include linux/kernel.h>
#include asm/segment.h>
void math_emulate(long edi, long esi, long ebp, long sys_call_ret,
    long eax,long ebx,long ecx,long edx,
    unsigned short fs,unsigned short es,unsigned short ds,
    unsigned long eip,unsigned short cs,unsigned long eflags,
    unsigned short ss, unsigned long esp)//协处理器仿真函数,中断处理程序调用的C 函数,参见(kernel/system_call.s,169 行)。
{
    unsigned char first, second;
/* 0x0007 means user code space 表示用户代码空间*/
    if (cs != 0x000F) {
        printk("math_emulate: %04x:%08x\n\r",cs,eip);
        panic("Math emulation needed in kernel");
    }
    first = get_fs_byte((char *)((*&eip)++));
    second = get_fs_byte((char *)((*&eip)++));
    printk("%04x:%08x %02x %02x\n\r",cs,eip-2,first,second);
    current->signal |= 1(SIGFPE-1);
}
void math_error(void)//协处理器出错处理函数,中断处理程序调用的C 函数,参见(kernel/system_call.s,145 行)。
{
    __asm__("fnclex");
    if (last_task_used_math)
        last_task_used_math->signal |= 1(SIGFPE-1);
}


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

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP