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()
189 printk("st(%d) %c .%04lx %04lx %04lx %04lx e%+-6d ", i, in FPU_printall()
190 getsign(r) ? '-' : '+', in FPU_printall()
191 (long)(r->sigh >> 16), in FPU_printall()
192 (long)(r->sigh & 0xFFFF), in FPU_printall()
193 (long)(r->sigl >> 16), in FPU_printall()
194 (long)(r->sigl & 0xFFFF), in FPU_printall()
195 exponent(r) - EXP_BIAS + 1); in FPU_printall()
312 int_type = n - EX_INTERNAL; in FPU_exception()
314 /* Set lots of exception bits! */ in FPU_exception()
319 /* Set the corresponding exception bit */ in FPU_exception()
321 /* Set summary bits iff exception isn't masked */ in FPU_exception()
326 /* This bit distinguishes over- from underflow for a stack fault, in FPU_exception()
327 and roundup from round-down for precision loss. */ in FPU_exception()
342 printk("FP Exception: %s!\n", exception_names[i].name); in FPU_exception()
345 printk("FPU emulator: Unknown Exception: 0x%04x!\n", n); in FPU_exception()
358 * The 80486 generates an interrupt on the next non-control FPU in FPU_exception()
372 /* Returns < 0 if the exception is unmasked */
377 isNaN = (exponent(a) == EXP_OVER) && (a->sigh & 0x80000000); in real_1op_NaN()
381 signalling = isNaN && !(a->sigh & 0x40000000); in real_1op_NaN()
384 if (!isNaN) { /* pseudo-NaN, or other unsupported? */ in real_1op_NaN()
389 EXCEPTION(EX_Invalid); in real_1op_NaN()
398 if (!(a->sigh & 0x80000000)) { /* pseudo-NaN ? */ in real_1op_NaN()
402 a->sigh |= 0x40000000; in real_1op_NaN()
405 EXCEPTION(EX_Invalid); in real_1op_NaN()
411 /* Returns < 0 if the exception is unmasked */
429 && (a->sigh & 0x80000000))) in real_2op_NaN()
431 && !((exponent(b) == EXP_OVER) && (b->sigh & 0x80000000))); in real_2op_NaN()
437 EXCEPTION(EX_Invalid); in real_2op_NaN()
445 signalling = !(a->sigh & b->sigh & 0x40000000); in real_2op_NaN()
455 signalling = !(a->sigh & 0x40000000); in real_2op_NaN()
462 signalling = !(b->sigh & 0x40000000); in real_2op_NaN()
468 EXCEPTION(EX_INTERNAL | 0x113); in real_2op_NaN()
477 if (!(x->sigh & 0x80000000)) /* pseudo-NaN ? */ in real_2op_NaN()
486 dest->sigh |= 0x40000000; in real_2op_NaN()
489 EXCEPTION(EX_Invalid); in real_2op_NaN()
495 /* Returns < 0 if the exception is unmasked */
499 EXCEPTION(EX_Invalid); in arith_invalid()
523 EXCEPTION(EX_ZeroDiv); in FPU_divide_by_zero()
537 EXCEPTION(flags); in set_precision_flag()
548 EXCEPTION(EX_Precision | SW_C1); in set_precision_flag_up()
558 EXCEPTION(EX_Precision); in set_precision_flag_down()
567 EXCEPTION(EX_Denormal); in denormal_operand()
583 addexponent(dest, (-3 * (1 << 13))); in arith_overflow()
586 EXCEPTION(EX_Overflow); in arith_overflow()
588 /* The overflow exception is masked. */ in arith_overflow()
592 EXCEPTION(EX_Precision | SW_C1); in arith_overflow()
606 if (exponent16(dest) <= EXP_UNDER - 63) { in arith_underflow()
618 EXCEPTION(EX_Underflow); in arith_underflow()
620 /* The underflow exception is masked. */ in arith_underflow()
621 EXCEPTION(EX_Precision); in arith_underflow()
634 top--; in FPU_stack_overflow()
638 EXCEPTION(EX_StackOver); in FPU_stack_overflow()
652 EXCEPTION(EX_StackUnder); in FPU_stack_underflow()
666 EXCEPTION(EX_StackUnder); in FPU_stack_underflow_i()
681 EXCEPTION(EX_StackUnder); in FPU_stack_underflow_pop()