1 | #include "fpsp-namespace.h" |
---|
2 | // |
---|
3 | // |
---|
4 | // x_unsupp.sa 3.3 7/1/91 |
---|
5 | // |
---|
6 | // fpsp_unsupp --- FPSP handler for unsupported data type exception |
---|
7 | // |
---|
8 | // Trap vector #55 (See table 8-1 Mc68030 User's manual). |
---|
9 | // Invoked when the user program encounters a data format (packed) that |
---|
10 | // hardware does not support or a data type (denormalized numbers or un- |
---|
11 | // normalized numbers). |
---|
12 | // Normalizes denorms and unnorms, unpacks packed numbers then stores |
---|
13 | // them back into the machine to let the 040 finish the operation. |
---|
14 | // |
---|
15 | // Unsupp calls two routines: |
---|
16 | // 1. get_op - gets the operand(s) |
---|
17 | // 2. res_func - restore the function back into the 040 or |
---|
18 | // if fmove.p fpm,<ea> then pack source (fpm) |
---|
19 | // and store in users memory <ea>. |
---|
20 | // |
---|
21 | // Input: Long fsave stack frame |
---|
22 | // |
---|
23 | // |
---|
24 | |
---|
25 | // Copyright (C) Motorola, Inc. 1990 |
---|
26 | // All Rights Reserved |
---|
27 | // |
---|
28 | // THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA |
---|
29 | // The copyright notice above does not evidence any |
---|
30 | // actual or intended publication of such source code. |
---|
31 | |
---|
32 | X_UNSUPP: //idnt 2,1 | Motorola 040 Floating Point Software Package |
---|
33 | |
---|
34 | |section 8 |
---|
35 | |
---|
36 | #include "fpsp.defs" |
---|
37 | |
---|
38 | |xref get_op |
---|
39 | |xref res_func |
---|
40 | |xref gen_except |
---|
41 | |xref fpsp_fmt_error |
---|
42 | |
---|
43 | .global fpsp_unsupp |
---|
44 | fpsp_unsupp: |
---|
45 | // |
---|
46 | link %a6,#-LOCAL_SIZE |
---|
47 | fsave -(%a7) |
---|
48 | moveml %d0-%d1/%a0-%a1,USER_DA(%a6) |
---|
49 | fmovemx %fp0-%fp3,USER_FP0(%a6) |
---|
50 | fmoveml %fpcr/%fpsr/%fpiar,USER_FPCR(%a6) |
---|
51 | |
---|
52 | |
---|
53 | moveb (%a7),VER_TMP(%a6) //save version number |
---|
54 | moveb (%a7),%d0 //test for valid version num |
---|
55 | andib #0xf0,%d0 //test for $4x |
---|
56 | cmpib #VER_4,%d0 //must be $4x or exit |
---|
57 | bnel fpsp_fmt_error |
---|
58 | |
---|
59 | fmovel #0,%FPSR //clear all user status bits |
---|
60 | fmovel #0,%FPCR //clear all user control bits |
---|
61 | // |
---|
62 | // The following lines are used to ensure that the FPSR |
---|
63 | // exception byte and condition codes are clear before proceeding, |
---|
64 | // except in the case of fmove, which leaves the cc's intact. |
---|
65 | // |
---|
66 | unsupp_con: |
---|
67 | movel USER_FPSR(%a6),%d1 |
---|
68 | btst #5,CMDREG1B(%a6) //looking for fmove out |
---|
69 | bne fmove_con |
---|
70 | andl #0xFF00FF,%d1 //clear all but aexcs and qbyte |
---|
71 | bras end_fix |
---|
72 | fmove_con: |
---|
73 | andl #0x0FFF40FF,%d1 //clear all but cc's, snan bit, aexcs, and qbyte |
---|
74 | end_fix: |
---|
75 | movel %d1,USER_FPSR(%a6) |
---|
76 | |
---|
77 | st UFLG_TMP(%a6) //set flag for unsupp data |
---|
78 | |
---|
79 | bsrl get_op //everything okay, go get operand(s) |
---|
80 | bsrl res_func //fix up stack frame so can restore it |
---|
81 | clrl -(%a7) |
---|
82 | moveb VER_TMP(%a6),(%a7) //move idle fmt word to top of stack |
---|
83 | bral gen_except |
---|
84 | // |
---|
85 | |end |
---|