Lines Matching +full:sw +full:- +full:exception
1 // SPDX-License-Identifier: GPL-2.0
2 /*---------------------------------------------------------------------------+
5 | The error handling functions for wm-FPU-emu |
9 | E-mail billm@jacobi.maths.monash.edu.au |
12 +---------------------------------------------------------------------------*/
14 /*---------------------------------------------------------------------------+
19 +---------------------------------------------------------------------------*/
27 #include "exception.h"
68 EXCEPTION(EX_Invalid);
126 printk("SW: backward compatibility\n"); in FPU_printall()
128 printk("SW: condition bit 3\n"); in FPU_printall()
130 printk("SW: condition bit 2\n"); in FPU_printall()
132 printk("SW: condition bit 1\n"); in FPU_printall()
134 printk("SW: condition bit 0\n"); in FPU_printall()
136 printk("SW: exception summary\n"); in FPU_printall()
138 printk("SW: stack fault\n"); in FPU_printall()
140 printk("SW: loss of precision\n"); in FPU_printall()
142 printk("SW: underflow\n"); in FPU_printall()
144 printk("SW: overflow\n"); in FPU_printall()
146 printk("SW: divide by zero\n"); in FPU_printall()
148 printk("SW: denormalized operand\n"); in FPU_printall()
150 printk("SW: invalid operation\n"); in FPU_printall()
153 …printk(" SW: b=%d st=%d es=%d sf=%d cc=%d%d%d%d ef=%d%d%d%d%d%d\n", partial_status & 0x8000 ? 1 : … in FPU_printall()
191 printk("st(%d) %c .%04lx %04lx %04lx %04lx e%+-6d ", i, in FPU_printall()
192 getsign(r) ? '-' : '+', in FPU_printall()
193 (long)(r->sigh >> 16), in FPU_printall()
194 (long)(r->sigh & 0xFFFF), in FPU_printall()
195 (long)(r->sigl >> 16), in FPU_printall()
196 (long)(r->sigl & 0xFFFF), in FPU_printall()
197 exponent(r) - EXP_BIAS + 1); in FPU_printall()
313 int_type = n - EX_INTERNAL; in FPU_exception()
315 /* Set lots of exception bits! */ in FPU_exception()
320 /* Set the corresponding exception bit */ in FPU_exception()
322 /* Set summary bits iff exception isn't masked */ in FPU_exception()
327 /* This bit distinguishes over- from underflow for a stack fault, in FPU_exception()
328 and roundup from round-down for precision loss. */ in FPU_exception()
343 printk("FP Exception: %s!\n", exception_names[i].name); in FPU_exception()
346 printk("FPU emulator: Unknown Exception: 0x%04x!\n", n); in FPU_exception()
359 * The 80486 generates an interrupt on the next non-control FPU in FPU_exception()
373 /* Returns < 0 if the exception is unmasked */
378 isNaN = (exponent(a) == EXP_OVER) && (a->sigh & 0x80000000); in real_1op_NaN()
382 signalling = isNaN && !(a->sigh & 0x40000000); in real_1op_NaN()
385 if (!isNaN) { /* pseudo-NaN, or other unsupported? */ in real_1op_NaN()
390 EXCEPTION(EX_Invalid); in real_1op_NaN()
399 if (!(a->sigh & 0x80000000)) { /* pseudo-NaN ? */ in real_1op_NaN()
403 a->sigh |= 0x40000000; in real_1op_NaN()
406 EXCEPTION(EX_Invalid); in real_1op_NaN()
412 /* Returns < 0 if the exception is unmasked */
430 && (a->sigh & 0x80000000))) in real_2op_NaN()
432 && !((exponent(b) == EXP_OVER) && (b->sigh & 0x80000000))); in real_2op_NaN()
438 EXCEPTION(EX_Invalid); in real_2op_NaN()
446 signalling = !(a->sigh & b->sigh & 0x40000000); in real_2op_NaN()
456 signalling = !(a->sigh & 0x40000000); in real_2op_NaN()
463 signalling = !(b->sigh & 0x40000000); in real_2op_NaN()
469 EXCEPTION(EX_INTERNAL | 0x113); in real_2op_NaN()
478 if (!(x->sigh & 0x80000000)) /* pseudo-NaN ? */ in real_2op_NaN()
487 dest->sigh |= 0x40000000; in real_2op_NaN()
490 EXCEPTION(EX_Invalid); in real_2op_NaN()
496 /* Returns < 0 if the exception is unmasked */
500 EXCEPTION(EX_Invalid); in arith_invalid()
524 EXCEPTION(EX_ZeroDiv); in FPU_divide_by_zero()
538 EXCEPTION(flags); in set_precision_flag()
549 EXCEPTION(EX_Precision | SW_C1); in set_precision_flag_up()
559 EXCEPTION(EX_Precision); in set_precision_flag_down()
568 EXCEPTION(EX_Denormal); in denormal_operand()
584 addexponent(dest, (-3 * (1 << 13))); in arith_overflow()
587 EXCEPTION(EX_Overflow); in arith_overflow()
589 /* The overflow exception is masked. */ in arith_overflow()
593 EXCEPTION(EX_Precision | SW_C1); in arith_overflow()
607 if (exponent16(dest) <= EXP_UNDER - 63) { in arith_underflow()
619 EXCEPTION(EX_Underflow); in arith_underflow()
621 /* The underflow exception is masked. */ in arith_underflow()
622 EXCEPTION(EX_Precision); in arith_underflow()
635 top--; in FPU_stack_overflow()
639 EXCEPTION(EX_StackOver); in FPU_stack_overflow()
653 EXCEPTION(EX_StackUnder); in FPU_stack_underflow()
667 EXCEPTION(EX_StackUnder); in FPU_stack_underflow_i()
682 EXCEPTION(EX_StackUnder); in FPU_stack_underflow_pop()