fpu.h revision 1.1.14.2 1 1.1.14.2 yamt /* $NetBSD: fpu.h,v 1.1.14.2 2006/06/21 14:52:48 yamt Exp $ */
2 1.1.14.2 yamt
3 1.1.14.2 yamt /*-
4 1.1.14.2 yamt * Copyright (c) 1998 Doug Rabson
5 1.1.14.2 yamt * All rights reserved.
6 1.1.14.2 yamt *
7 1.1.14.2 yamt * Redistribution and use in source and binary forms, with or without
8 1.1.14.2 yamt * modification, are permitted provided that the following conditions
9 1.1.14.2 yamt * are met:
10 1.1.14.2 yamt * 1. Redistributions of source code must retain the above copyright
11 1.1.14.2 yamt * notice, this list of conditions and the following disclaimer.
12 1.1.14.2 yamt * 2. Redistributions in binary form must reproduce the above copyright
13 1.1.14.2 yamt * notice, this list of conditions and the following disclaimer in the
14 1.1.14.2 yamt * documentation and/or other materials provided with the distribution.
15 1.1.14.2 yamt *
16 1.1.14.2 yamt * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 1.1.14.2 yamt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 1.1.14.2 yamt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 1.1.14.2 yamt * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 1.1.14.2 yamt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 1.1.14.2 yamt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 1.1.14.2 yamt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 1.1.14.2 yamt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 1.1.14.2 yamt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 1.1.14.2 yamt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 1.1.14.2 yamt * SUCH DAMAGE.
27 1.1.14.2 yamt *
28 1.1.14.2 yamt * $FreeBSD$
29 1.1.14.2 yamt */
30 1.1.14.2 yamt
31 1.1.14.2 yamt #ifndef _MACHINE_FPU_H_
32 1.1.14.2 yamt #define _MACHINE_FPU_H_
33 1.1.14.2 yamt
34 1.1.14.2 yamt /*
35 1.1.14.2 yamt * Floating point status register bits.
36 1.1.14.2 yamt */
37 1.1.14.2 yamt
38 1.1.14.2 yamt #define IA64_FPSR_TRAP_VD 0x0000000000000001L
39 1.1.14.2 yamt #define IA64_FPSR_TRAP_DD 0x0000000000000002L
40 1.1.14.2 yamt #define IA64_FPSR_TRAP_ZD 0x0000000000000004L
41 1.1.14.2 yamt #define IA64_FPSR_TRAP_OD 0x0000000000000008L
42 1.1.14.2 yamt #define IA64_FPSR_TRAP_UD 0x0000000000000010L
43 1.1.14.2 yamt #define IA64_FPSR_TRAP_ID 0x0000000000000020L
44 1.1.14.2 yamt #define IA64_FPSR_SF(i,v) ((v) << ((i)*13+6))
45 1.1.14.2 yamt
46 1.1.14.2 yamt #define IA64_SF_FTZ 0x0001L
47 1.1.14.2 yamt #define IA64_SF_WRE 0x0002L
48 1.1.14.2 yamt #define IA64_SF_PC 0x000cL
49 1.1.14.2 yamt #define IA64_SF_PC_0 0x0000L
50 1.1.14.2 yamt #define IA64_SF_PC_1 0x0004L
51 1.1.14.2 yamt #define IA64_SF_PC_2 0x0008L
52 1.1.14.2 yamt #define IA64_SF_PC_3 0x000cL
53 1.1.14.2 yamt #define IA64_SF_RC 0x0030L
54 1.1.14.2 yamt #define IA64_SF_RC_NEAREST 0x0000L
55 1.1.14.2 yamt #define IA64_SF_RC_NEGINF 0x0010L
56 1.1.14.2 yamt #define IA64_SF_RC_POSINF 0x0020L
57 1.1.14.2 yamt #define IA64_SF_RC_TRUNC 0x0030L
58 1.1.14.2 yamt #define IA64_SF_TD 0x0040L
59 1.1.14.2 yamt #define IA64_SF_V 0x0080L
60 1.1.14.2 yamt #define IA64_SF_D 0x0100L
61 1.1.14.2 yamt #define IA64_SF_Z 0x0200L
62 1.1.14.2 yamt #define IA64_SF_O 0x0400L
63 1.1.14.2 yamt #define IA64_SF_U 0x0800L
64 1.1.14.2 yamt #define IA64_SF_I 0x1000L
65 1.1.14.2 yamt
66 1.1.14.2 yamt #define IA64_SF_DEFAULT (IA64_SF_PC_3 | IA64_SF_RC_NEAREST)
67 1.1.14.2 yamt
68 1.1.14.2 yamt #define IA64_FPSR_DEFAULT (IA64_FPSR_TRAP_VD \
69 1.1.14.2 yamt | IA64_FPSR_TRAP_DD \
70 1.1.14.2 yamt | IA64_FPSR_TRAP_ZD \
71 1.1.14.2 yamt | IA64_FPSR_TRAP_OD \
72 1.1.14.2 yamt | IA64_FPSR_TRAP_UD \
73 1.1.14.2 yamt | IA64_FPSR_TRAP_ID \
74 1.1.14.2 yamt | IA64_FPSR_SF(0, IA64_SF_DEFAULT) \
75 1.1.14.2 yamt | IA64_FPSR_SF(1, (IA64_SF_DEFAULT \
76 1.1.14.2 yamt | IA64_SF_TD \
77 1.1.14.2 yamt | IA64_SF_WRE)) \
78 1.1.14.2 yamt | IA64_FPSR_SF(2, (IA64_SF_DEFAULT \
79 1.1.14.2 yamt | IA64_SF_TD)) \
80 1.1.14.2 yamt | IA64_FPSR_SF(3, (IA64_SF_DEFAULT \
81 1.1.14.2 yamt | IA64_SF_TD)))
82 1.1.14.2 yamt
83 1.1.14.2 yamt struct fpswa_ret {
84 1.1.14.2 yamt unsigned long status;
85 1.1.14.2 yamt unsigned long err1;
86 1.1.14.2 yamt unsigned long err2;
87 1.1.14.2 yamt unsigned long err3;
88 1.1.14.2 yamt };
89 1.1.14.2 yamt
90 1.1.14.2 yamt struct fpswa_bundle {
91 1.1.14.2 yamt long double bits; /* Force 16-byte alignment. */
92 1.1.14.2 yamt };
93 1.1.14.2 yamt
94 1.1.14.2 yamt struct fpswa_fpctx {
95 1.1.14.2 yamt unsigned long mask_low; /* f63 - f2 */
96 1.1.14.2 yamt unsigned long mask_high; /* f127 - f64 */
97 1.1.14.2 yamt union _ia64_fpreg *fp_low_preserved; /* f2 - f5 */
98 1.1.14.2 yamt union _ia64_fpreg *fp_low_volatile; /* f6 - f15 */
99 1.1.14.2 yamt union _ia64_fpreg *fp_high_preserved; /* f16 - f31 */
100 1.1.14.2 yamt union _ia64_fpreg *fp_high_volatile; /* f32 - f127 */
101 1.1.14.2 yamt };
102 1.1.14.2 yamt
103 1.1.14.2 yamt struct fpswa_iface {
104 1.1.14.2 yamt unsigned int if_rev;
105 1.1.14.2 yamt unsigned int __res;
106 1.1.14.2 yamt struct fpswa_ret (*if_fpswa)(unsigned long, struct fpswa_bundle *,
107 1.1.14.2 yamt unsigned long *, unsigned long *, unsigned long *, unsigned long *,
108 1.1.14.2 yamt unsigned long *, struct fpswa_fpctx *);
109 1.1.14.2 yamt };
110 1.1.14.2 yamt
111 1.1.14.2 yamt #endif /* ! _MACHINE_FPU_H_ */
112