Chinaunix首页 | 论坛 | 博客
  • 博客访问: 577773
  • 博文数量: 137
  • 博客积分: 4040
  • 博客等级: 上校
  • 技术积分: 1584
  • 用 户 组: 普通用户
  • 注册时间: 2009-01-08 13:05
文章分类

全部博文(137)

文章存档

2011年(10)

2010年(23)

2009年(104)

分类: LINUX

2009-08-12 10:22:20

/*
 * 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);
}

阅读(872) | 评论(0) | 转发(0) |
0

上一篇:serial.c

下一篇:buffer.c

给主人留下些什么吧!~~