staticint __init fpe_init(void)
{ if (sizeof(FPA11) > sizeof(union fp_state)) {
pr_err("nwfpe: bad structure size\n"); return -EINVAL;
}
if (sizeof(FPREG) != 12) {
pr_err("nwfpe: bad register size\n"); return -EINVAL;
} if (fpe_type[0] && strcmp(fpe_type, "nwfpe")) return 0;
/* Display title, version and copyright information. */
pr_info("NetWinder Floating Point Emulator V0.97 ("
NWFPE_BITS " precision)\n");
thread_register_notifier(&nwfpe_notifier_block);
/* Save pointer to the old FP handler and then patch ourselves in */
orig_fp_enter = kern_fp_enter;
kern_fp_enter = nwfpe_enter;
return 0;
}
staticvoid __exit fpe_exit(void)
{
thread_unregister_notifier(&nwfpe_notifier_block); /* Restore the values we saved earlier. */
kern_fp_enter = orig_fp_enter;
}
/* ScottB: November 4, 1998
Moved this function out of softfloat-specialize into fpmodule.c. This effectively isolates all the changes required for integrating with the Linux kernel into fpmodule.c. Porting to NetBSD should only require modifying fpmodule.c to integrate with the NetBSD kernel (I hope!).
[1/1/99: Not quite true any more unfortunately. There is Linux-specific code to access data in user space in some other source files at the moment (grep for get_user / put_user calls). --philb]
This function is called by the SoftFloat routines to raise a floating point exception. We check the trap enable byte in the FPSR, and raise a SIGFPE exception if necessary. If not the relevant bits in the cumulative exceptions flag byte are set and we return.
*/
#ifdef CONFIG_DEBUG_USER /* By default, ignore inexact errors as there are far too many of them to log */ staticint debug = ~BIT_IXC; #endif
#ifdef CONFIG_DEBUG_USER if (flags & debug)
printk(KERN_DEBUG "NWFPE: %s[%d] takes exception %08x at %ps from %08lx\n",
current->comm, current->pid, flags,
__builtin_return_address(0), GET_USERREG()->ARM_pc); #endif
/* Read fpsr and initialize the cumulativeTraps. */
fpsr = readFPSR();
cumulativeTraps = 0;
/* For each type of exception, the cumulative trap exception bit is only
set if the corresponding trap enable bit is not set. */ if ((!(fpsr & BIT_IXE)) && (flags & BIT_IXC))
cumulativeTraps |= BIT_IXC; if ((!(fpsr & BIT_UFE)) && (flags & BIT_UFC))
cumulativeTraps |= BIT_UFC; if ((!(fpsr & BIT_OFE)) && (flags & BIT_OFC))
cumulativeTraps |= BIT_OFC; if ((!(fpsr & BIT_DZE)) && (flags & BIT_DZC))
cumulativeTraps |= BIT_DZC; if ((!(fpsr & BIT_IOE)) && (flags & BIT_IOC))
cumulativeTraps |= BIT_IOC;
/* Set the cumulative exceptions flags. */ if (cumulativeTraps)
writeFPSR(fpsr | cumulativeTraps);
/* Raise an exception if necessary. */ if (fpsr & (flags << 16))
fp_send_sig(SIGFPE, current, 1);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.