diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2006-06-14 12:56:19 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2006-06-14 12:56:19 +0000 |
commit | 6ea83fedc802c6d678e36c380d72733d89d17bba (patch) | |
tree | 7402d140330477cf8301925589966fb4c104066a /target-mips/op_helper.c | |
parent | 180b700dc7227d454d30656662912c79ffc3a62f (diff) |
MIPS FPU support (Marius Goeger)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1964 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-mips/op_helper.c')
-rw-r--r-- | target-mips/op_helper.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/target-mips/op_helper.c b/target-mips/op_helper.c index fbd693fb23..37f260430c 100644 --- a/target-mips/op_helper.c +++ b/target-mips/op_helper.c @@ -529,6 +529,47 @@ void do_mtc0 (int reg, int sel) return; } +#ifdef MIPS_USES_FPU +#include "softfloat.h" + +void fpu_handle_exception(void) +{ +#ifdef CONFIG_SOFTFLOAT + int flags = get_float_exception_flags(&env->fp_status); + unsigned int cpuflags = 0, enable, cause = 0; + + enable = GET_FP_ENABLE(env->fcr31); + + /* determine current flags */ + if (flags & float_flag_invalid) { + cpuflags |= FP_INVALID; + cause |= FP_INVALID & enable; + } + if (flags & float_flag_divbyzero) { + cpuflags |= FP_DIV0; + cause |= FP_DIV0 & enable; + } + if (flags & float_flag_overflow) { + cpuflags |= FP_OVERFLOW; + cause |= FP_OVERFLOW & enable; + } + if (flags & float_flag_underflow) { + cpuflags |= FP_UNDERFLOW; + cause |= FP_UNDERFLOW & enable; + } + if (flags & float_flag_inexact) { + cpuflags |= FP_INEXACT; + cause |= FP_INEXACT & enable; + } + SET_FP_FLAGS(env->fcr31, cpuflags); + SET_FP_CAUSE(env->fcr31, cause); +#else + SET_FP_FLAGS(env->fcr31, 0); + SET_FP_CAUSE(env->fcr31, 0); +#endif +} +#endif /* MIPS_USES_FPU */ + /* TLB management */ #if defined(MIPS_USES_R4K_TLB) static void invalidate_tlb (int idx) |