Annotation of sys/arch/m88k/m88k/m88110_fp.S, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: m88110_fp.S,v 1.2 2004/08/09 20:52:11 miod Exp $ */
2: /*
3: * Copyright (c) 1999 Steve Murphree, Jr.
4: * All rights reserved.
5: *
6: * Redistribution and use in source and binary forms, with or without
7: * modification, are permitted provided that the following conditions
8: * are met:
9: * 1. Redistributions of source code must retain the above copyright
10: * notice, this list of conditions and the following disclaimer.
11: * 2. Redistributions in binary form must reproduce the above copyright
12: * notice, this list of conditions and the following disclaimer in the
13: * documentation and/or other materials provided with the distribution.
14: * 3. All advertising materials mentioning features or use of this software
15: * must display the following acknowledgement:
16: * This product includes software developed by Christopher G. Demetriou.
17: * 4. The name of the author may not be used to endorse or promote products
18: * derived from this software without specific prior written permission
19: *
20: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30: */
31:
32: /* Floating point trouble routines */
33: /*
34: * August 1, 1999
35: * smurph@OpenBSD.org
36: *
37: * Additions to support MVME197 (mc88110) mmu routines.
38: */
39:
40: /*
41: * This is cheesy. I'm using the TCFP features of the mc88110
42: * because it was easy. It is not 100% IEEE. But it may be
43: * close enough. We shall see... XXXsmurph
44: * Err... TCFP == "Time Critical Floating Point"
45: *
46: * The only two SFU1 exceptions that can occure in TCFP mode are:
47: * 1) Unimplemented Floating Point Instruction
48: * 2) Floating Point Privilege Violation
49: */
50:
51: #include "assym.h"
52: #include <machine/trap.h>
53: #include <machine/asm.h>
54:
55: ASENTRY(m88110_Xfp_precise)
56: or r29, r3, r0 /* r29 is now the E.F. */
57: subu r31, r31, 16
58: st r1, r31, 0
59: st r29, r31, 4
60:
61: ld r2, r29, EF_FPSR * 4
62: ld r3, r29, EF_FPCR * 4
63: ld r4, r29, EF_FPECR * 4
64:
65: /*
66: * Load into r1 the return address for the 0 handlers. Looking
67: * at FPECR, branch to the appropriate 0 handler. However,
68: * if none of the 0 bits are enabled, then a floating point
69: * instruction was issued with the floating point unit disabled. This
70: * will cause an unimplemented opcode 0.
71: */
72:
73: bb0 6,r4, 2f /* branch to m88110_FPunimp if bit set */
74: br _ASM_LABEL(m88110_FPuimp)
75: 2: bb0 5,r4, 3f /* branch to m88110_FPpriviol if bit set */
76: br _ASM_LABEL(m88110_FPpriviol)
77: 3:
78: or.u r4, r4, 0xffff
79:
80: ASLOCAL(m88110_FPuimp)
81: subu r31,r31,16 /* allocate stack */
82: st r1,r31,4 /* save return address */
83: st r3,r31,0 /* save exception frame */
84: or r2,r0,T_FPEPFLT /* load trap type */
85: bsr.n _C_LABEL(m88110_trap) /* trap */
86: or r3, r29, r0
87: ld r1,r31,4 /* recover return address */
88: jmp.n r1
89: addu r31,r31,16 /* deallocate stack */
90:
91: ASLOCAL(m88110_FPpriviol)
92: subu r31,r31,16 /* allocate stack */
93: st r1,r31,4 /* save return address */
94: st r3,r31,0 /* save exception frame */
95: or r2,r0,T_PRIVINFLT /* load trap type */
96: bsr.n _C_LABEL(m88110_trap) /* trap */
97: or r3, r29, r0
98: ld r1,r31,4 /* recover return address */
99: jmp.n r1
100: addu r31,r31,16 /* deallocate stack */
101:
102: ENTRY(set_tcfp)
103: or.u r2, r0, hi16(0x200000)
104: or r2, r2, lo16(0x200000)
105: jmp.n r1
106: fstcr r2, fcr0
CVSweb