1 | // |
---|
2 | // |
---|
3 | // x_fline.sa 3.3 1/10/91 |
---|
4 | // |
---|
5 | // fpsp_fline --- FPSP handler for fline exception |
---|
6 | // |
---|
7 | // First determine if the exception is one of the unimplemented |
---|
8 | // floating point instructions. If so, let fpsp_unimp handle it. |
---|
9 | // Next, determine if the instruction is an fmovecr with a non-zero |
---|
10 | // <ea> field. If so, handle here and return. Otherwise, it |
---|
11 | // must be a real F-line exception. |
---|
12 | // |
---|
13 | |
---|
14 | // Copyright (C) Motorola, Inc. 1990 |
---|
15 | // All Rights Reserved |
---|
16 | // |
---|
17 | // THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF MOTOROLA |
---|
18 | // The copyright notice above does not evidence any |
---|
19 | // actual or intended publication of such source code. |
---|
20 | |
---|
21 | X_FLINE: //idnt 2,1 | Motorola 040 Floating Point Software Package |
---|
22 | |
---|
23 | |section 8 |
---|
24 | |
---|
25 | #include "fpsp.defs" |
---|
26 | |
---|
27 | |xref real_fline |
---|
28 | |xref fpsp_unimp |
---|
29 | |xref uni_2 |
---|
30 | |xref mem_read |
---|
31 | |xref fpsp_fmt_error |
---|
32 | |
---|
33 | .global fpsp_fline |
---|
34 | fpsp_fline: |
---|
35 | // |
---|
36 | // check for unimplemented vector first. Use EXC_VEC-4 because |
---|
37 | // the equate is valid only after a 'link a6' has pushed one more |
---|
38 | // long onto the stack. |
---|
39 | // |
---|
40 | cmpw #UNIMP_VEC,EXC_VEC-4(%a7) |
---|
41 | beql fpsp_unimp |
---|
42 | |
---|
43 | // |
---|
44 | // fmovecr with non-zero <ea> handling here |
---|
45 | // |
---|
46 | subl #4,%a7 //4 accounts for 2-word difference |
---|
47 | // ;between six word frame (unimp) and |
---|
48 | // ;four word frame |
---|
49 | link %a6,#-LOCAL_SIZE |
---|
50 | fsave -(%a7) |
---|
51 | moveml %d0-%d1/%a0-%a1,USER_DA(%a6) |
---|
52 | moveal EXC_PC+4(%a6),%a0 //get address of fline instruction |
---|
53 | leal L_SCR1(%a6),%a1 //use L_SCR1 as scratch |
---|
54 | movel #4,%d0 |
---|
55 | addl #4,%a6 //to offset the sub.l #4,a7 above so that |
---|
56 | // ;a6 can point correctly to the stack frame |
---|
57 | // ;before branching to mem_read |
---|
58 | bsrl mem_read |
---|
59 | subl #4,%a6 |
---|
60 | movel L_SCR1(%a6),%d0 //d0 contains the fline and command word |
---|
61 | bfextu %d0{#4:#3},%d1 //extract coprocessor id |
---|
62 | cmpib #1,%d1 //check if cpid=1 |
---|
63 | bne not_mvcr //exit if not |
---|
64 | bfextu %d0{#16:#6},%d1 |
---|
65 | cmpib #0x17,%d1 //check if it is an FMOVECR encoding |
---|
66 | bne not_mvcr |
---|
67 | // ;if an FMOVECR instruction, fix stack |
---|
68 | // ;and go to FPSP_UNIMP |
---|
69 | fix_stack: |
---|
70 | cmpib #VER_40,(%a7) //test for orig unimp frame |
---|
71 | bnes ck_rev |
---|
72 | subl #UNIMP_40_SIZE-4,%a7 //emulate an orig fsave |
---|
73 | moveb #VER_40,(%a7) |
---|
74 | moveb #UNIMP_40_SIZE-4,1(%a7) |
---|
75 | clrw 2(%a7) |
---|
76 | bras fix_con |
---|
77 | ck_rev: |
---|
78 | cmpib #VER_41,(%a7) //test for rev unimp frame |
---|
79 | bnel fpsp_fmt_error //if not $40 or $41, exit with error |
---|
80 | subl #UNIMP_41_SIZE-4,%a7 //emulate a rev fsave |
---|
81 | moveb #VER_41,(%a7) |
---|
82 | moveb #UNIMP_41_SIZE-4,1(%a7) |
---|
83 | clrw 2(%a7) |
---|
84 | fix_con: |
---|
85 | movew EXC_SR+4(%a6),EXC_SR(%a6) //move stacked sr to new position |
---|
86 | movel EXC_PC+4(%a6),EXC_PC(%a6) //move stacked pc to new position |
---|
87 | fmovel EXC_PC(%a6),%FPIAR //point FPIAR to fline inst |
---|
88 | movel #4,%d1 |
---|
89 | addl %d1,EXC_PC(%a6) //increment stacked pc value to next inst |
---|
90 | movew #0x202c,EXC_VEC(%a6) //reformat vector to unimp |
---|
91 | clrl EXC_EA(%a6) //clear the EXC_EA field |
---|
92 | movew %d0,CMDREG1B(%a6) //move the lower word into CMDREG1B |
---|
93 | clrl E_BYTE(%a6) |
---|
94 | bsetb #UFLAG,T_BYTE(%a6) |
---|
95 | moveml USER_DA(%a6),%d0-%d1/%a0-%a1 //restore data registers |
---|
96 | bral uni_2 |
---|
97 | |
---|
98 | not_mvcr: |
---|
99 | moveml USER_DA(%a6),%d0-%d1/%a0-%a1 //restore data registers |
---|
100 | frestore (%a7)+ |
---|
101 | unlk %a6 |
---|
102 | addl #4,%a7 |
---|
103 | bral real_fline |
---|
104 | |
---|
105 | |end |
---|