Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:49

0001 #include "fpsp-namespace.h"
0002 //
0003 //
0004 //  x_unimp.sa 3.3 7/1/91
0005 //
0006 //  fpsp_unimp --- FPSP handler for unimplemented instruction
0007 //  exception.
0008 //
0009 // Invoked when the user program encounters a floating-point
0010 // op-code that hardware does not support.  Trap vector# 11
0011 // (See table 8-1 MC68030 User's Manual).
0012 //
0013 //
0014 // Note: An fsave for an unimplemented inst. will create a short
0015 // fsave stack.
0016 //
0017 //  Input: 1. Six word stack frame for unimplemented inst, four word
0018 //            for illegal
0019 //            (See table 8-7 MC68030 User's Manual).
0020 //         2. Unimp (short) fsave state frame created here by fsave
0021 //            instruction.
0022 //
0023 //
0024 //      Copyright (C) Motorola, Inc. 1990
0025 //          All Rights Reserved
0026 //
0027 //  THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA
0028 //  The copyright notice above does not evidence any
0029 //  actual or intended publication of such source code.
0030 
0031 X_UNIMP:    //idnt    2,1 | Motorola 040 Floating Point Software Package
0032 
0033     |section    8
0034 
0035 #include "fpsp.defs"
0036 
0037     |xref   get_op
0038     |xref   do_func
0039     |xref   sto_res
0040     |xref   gen_except
0041     |xref   fpsp_fmt_error
0042 
0043     .global fpsp_unimp
0044     .global uni_2
0045 fpsp_unimp:
0046     link        %a6,#-LOCAL_SIZE
0047     fsave       -(%a7)
0048 uni_2:
0049     moveml      %d0-%d1/%a0-%a1,USER_DA(%a6)
0050     fmovemx %fp0-%fp3,USER_FP0(%a6)
0051     fmoveml %fpcr/%fpsr/%fpiar,USER_FPCR(%a6)
0052     moveb       (%a7),%d0       //test for valid version num
0053     andib       #0xf0,%d0       //test for $4x
0054     cmpib       #VER_4,%d0  //must be $4x or exit
0055     bnel        fpsp_fmt_error
0056 //
0057 //  Temporary D25B Fix
0058 //  The following lines are used to ensure that the FPSR
0059 //  exception byte and condition codes are clear before proceeding
0060 //
0061     movel       USER_FPSR(%a6),%d0
0062     andl        #0xFF00FF,%d0   //clear all but accrued exceptions
0063     movel       %d0,USER_FPSR(%a6)
0064     fmovel      #0,%FPSR //clear all user bits
0065     fmovel      #0,%FPCR    //clear all user exceptions for FPSP
0066 
0067     clrb        UFLG_TMP(%a6)   //clr flag for unsupp data
0068 
0069     bsrl        get_op      //go get operand(s)
0070     clrb        STORE_FLG(%a6)
0071     bsrl        do_func     //do the function
0072     fsave       -(%a7)      //capture possible exc state
0073     tstb        STORE_FLG(%a6)
0074     bnes        no_store    //if STORE_FLG is set, no store
0075     bsrl        sto_res     //store the result in user space
0076 no_store:
0077     bral        gen_except  //post any exceptions and return
0078 
0079     |end