18c2ecf20Sopenharmony_ci| 28c2ecf20Sopenharmony_ci| x_unsupp.sa 3.3 7/1/91 38c2ecf20Sopenharmony_ci| 48c2ecf20Sopenharmony_ci| fpsp_unsupp --- FPSP handler for unsupported data type exception 58c2ecf20Sopenharmony_ci| 68c2ecf20Sopenharmony_ci| Trap vector #55 (See table 8-1 Mc68030 User's manual). 78c2ecf20Sopenharmony_ci| Invoked when the user program encounters a data format (packed) that 88c2ecf20Sopenharmony_ci| hardware does not support or a data type (denormalized numbers or un- 98c2ecf20Sopenharmony_ci| normalized numbers). 108c2ecf20Sopenharmony_ci| Normalizes denorms and unnorms, unpacks packed numbers then stores 118c2ecf20Sopenharmony_ci| them back into the machine to let the 040 finish the operation. 128c2ecf20Sopenharmony_ci| 138c2ecf20Sopenharmony_ci| Unsupp calls two routines: 148c2ecf20Sopenharmony_ci| 1. get_op - gets the operand(s) 158c2ecf20Sopenharmony_ci| 2. res_func - restore the function back into the 040 or 168c2ecf20Sopenharmony_ci| if fmove.p fpm,<ea> then pack source (fpm) 178c2ecf20Sopenharmony_ci| and store in users memory <ea>. 188c2ecf20Sopenharmony_ci| 198c2ecf20Sopenharmony_ci| Input: Long fsave stack frame 208c2ecf20Sopenharmony_ci| 218c2ecf20Sopenharmony_ci| 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci| Copyright (C) Motorola, Inc. 1990 248c2ecf20Sopenharmony_ci| All Rights Reserved 258c2ecf20Sopenharmony_ci| 268c2ecf20Sopenharmony_ci| For details on the license for this file, please see the 278c2ecf20Sopenharmony_ci| file, README, in this same directory. 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ciX_UNSUPP: |idnt 2,1 | Motorola 040 Floating Point Software Package 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci |section 8 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci#include "fpsp.h" 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ci |xref get_op 368c2ecf20Sopenharmony_ci |xref res_func 378c2ecf20Sopenharmony_ci |xref gen_except 388c2ecf20Sopenharmony_ci |xref fpsp_fmt_error 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci .global fpsp_unsupp 418c2ecf20Sopenharmony_cifpsp_unsupp: 428c2ecf20Sopenharmony_ci| 438c2ecf20Sopenharmony_ci link %a6,#-LOCAL_SIZE 448c2ecf20Sopenharmony_ci fsave -(%a7) 458c2ecf20Sopenharmony_ci moveml %d0-%d1/%a0-%a1,USER_DA(%a6) 468c2ecf20Sopenharmony_ci fmovemx %fp0-%fp3,USER_FP0(%a6) 478c2ecf20Sopenharmony_ci fmoveml %fpcr/%fpsr/%fpiar,USER_FPCR(%a6) 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci moveb (%a7),VER_TMP(%a6) |save version number 518c2ecf20Sopenharmony_ci moveb (%a7),%d0 |test for valid version num 528c2ecf20Sopenharmony_ci andib #0xf0,%d0 |test for $4x 538c2ecf20Sopenharmony_ci cmpib #VER_4,%d0 |must be $4x or exit 548c2ecf20Sopenharmony_ci bnel fpsp_fmt_error 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci fmovel #0,%FPSR |clear all user status bits 578c2ecf20Sopenharmony_ci fmovel #0,%FPCR |clear all user control bits 588c2ecf20Sopenharmony_ci| 598c2ecf20Sopenharmony_ci| The following lines are used to ensure that the FPSR 608c2ecf20Sopenharmony_ci| exception byte and condition codes are clear before proceeding, 618c2ecf20Sopenharmony_ci| except in the case of fmove, which leaves the cc's intact. 628c2ecf20Sopenharmony_ci| 638c2ecf20Sopenharmony_ciunsupp_con: 648c2ecf20Sopenharmony_ci movel USER_FPSR(%a6),%d1 658c2ecf20Sopenharmony_ci btst #5,CMDREG1B(%a6) |looking for fmove out 668c2ecf20Sopenharmony_ci bne fmove_con 678c2ecf20Sopenharmony_ci andl #0xFF00FF,%d1 |clear all but aexcs and qbyte 688c2ecf20Sopenharmony_ci bras end_fix 698c2ecf20Sopenharmony_cifmove_con: 708c2ecf20Sopenharmony_ci andl #0x0FFF40FF,%d1 |clear all but cc's, snan bit, aexcs, and qbyte 718c2ecf20Sopenharmony_ciend_fix: 728c2ecf20Sopenharmony_ci movel %d1,USER_FPSR(%a6) 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci st UFLG_TMP(%a6) |set flag for unsupp data 758c2ecf20Sopenharmony_ci 768c2ecf20Sopenharmony_ci bsrl get_op |everything okay, go get operand(s) 778c2ecf20Sopenharmony_ci bsrl res_func |fix up stack frame so can restore it 788c2ecf20Sopenharmony_ci clrl -(%a7) 798c2ecf20Sopenharmony_ci moveb VER_TMP(%a6),(%a7) |move idle fmt word to top of stack 808c2ecf20Sopenharmony_ci bral gen_except 818c2ecf20Sopenharmony_ci| 828c2ecf20Sopenharmony_ci |end 83