18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/*---------------------------------------------------------------------------+ 38c2ecf20Sopenharmony_ci | exception.h | 48c2ecf20Sopenharmony_ci | | 58c2ecf20Sopenharmony_ci | Copyright (C) 1992 W. Metzenthen, 22 Parker St, Ormond, Vic 3163, | 68c2ecf20Sopenharmony_ci | Australia. E-mail billm@vaxc.cc.monash.edu.au | 78c2ecf20Sopenharmony_ci | | 88c2ecf20Sopenharmony_ci +---------------------------------------------------------------------------*/ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#ifndef _EXCEPTION_H_ 118c2ecf20Sopenharmony_ci#define _EXCEPTION_H_ 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#ifdef __ASSEMBLY__ 148c2ecf20Sopenharmony_ci#define Const_(x) $##x 158c2ecf20Sopenharmony_ci#else 168c2ecf20Sopenharmony_ci#define Const_(x) x 178c2ecf20Sopenharmony_ci#endif 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci#ifndef SW_C1 208c2ecf20Sopenharmony_ci#include "fpu_emu.h" 218c2ecf20Sopenharmony_ci#endif /* SW_C1 */ 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci#define FPU_BUSY Const_(0x8000) /* FPU busy bit (8087 compatibility) */ 248c2ecf20Sopenharmony_ci#define EX_ErrorSummary Const_(0x0080) /* Error summary status */ 258c2ecf20Sopenharmony_ci/* Special exceptions: */ 268c2ecf20Sopenharmony_ci#define EX_INTERNAL Const_(0x8000) /* Internal error in wm-FPU-emu */ 278c2ecf20Sopenharmony_ci#define EX_StackOver Const_(0x0041|SW_C1) /* stack overflow */ 288c2ecf20Sopenharmony_ci#define EX_StackUnder Const_(0x0041) /* stack underflow */ 298c2ecf20Sopenharmony_ci/* Exception flags: */ 308c2ecf20Sopenharmony_ci#define EX_Precision Const_(0x0020) /* loss of precision */ 318c2ecf20Sopenharmony_ci#define EX_Underflow Const_(0x0010) /* underflow */ 328c2ecf20Sopenharmony_ci#define EX_Overflow Const_(0x0008) /* overflow */ 338c2ecf20Sopenharmony_ci#define EX_ZeroDiv Const_(0x0004) /* divide by zero */ 348c2ecf20Sopenharmony_ci#define EX_Denormal Const_(0x0002) /* denormalized operand */ 358c2ecf20Sopenharmony_ci#define EX_Invalid Const_(0x0001) /* invalid operation */ 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#define PRECISION_LOST_UP Const_((EX_Precision | SW_C1)) 388c2ecf20Sopenharmony_ci#define PRECISION_LOST_DOWN Const_(EX_Precision) 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__ 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci#ifdef DEBUG 438c2ecf20Sopenharmony_ci#define EXCEPTION(x) { printk("exception in %s at line %d\n", \ 448c2ecf20Sopenharmony_ci __FILE__, __LINE__); FPU_exception(x); } 458c2ecf20Sopenharmony_ci#else 468c2ecf20Sopenharmony_ci#define EXCEPTION(x) FPU_exception(x) 478c2ecf20Sopenharmony_ci#endif 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci#endif /* __ASSEMBLY__ */ 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci#endif /* _EXCEPTION_H_ */ 52