OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [lib/] [libcpu/] [m68k/] [m68040/] [fpsp/] [x_fline.S] - Blame information for rev 173

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.