1 | /* |
---|
2 | * Done by Dietmar Hahn <dietmar.hahn@fujitsu-siemens.com> |
---|
3 | * This code is mostly taken from FreeBSD. |
---|
4 | * |
---|
5 | **************************************************************************** |
---|
6 | * |
---|
7 | * Redistribution and use in source and binary forms, with or without |
---|
8 | * modification, are permitted provided that the following conditions |
---|
9 | * are met: |
---|
10 | * 1. Redistributions of source code must retain the above copyright |
---|
11 | * notice, this list of conditions and the following disclaimer. |
---|
12 | * 2. Redistributions in binary form must reproduce the above copyright |
---|
13 | * notice, this list of conditions and the following disclaimer in the |
---|
14 | * documentation and/or other materials provided with the distribution. |
---|
15 | * |
---|
16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
---|
17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
---|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
---|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
---|
20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
---|
21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
---|
22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
---|
23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
---|
24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
---|
25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
---|
26 | * SUCH DAMAGE. |
---|
27 | * |
---|
28 | */ |
---|
29 | |
---|
30 | #ifndef _IA64_FPU_H_ |
---|
31 | #define _IA64_FPU_H_ |
---|
32 | |
---|
33 | #include "os.h" |
---|
34 | |
---|
35 | /* |
---|
36 | * Floating point status register bits. |
---|
37 | */ |
---|
38 | #define IA64_FPSR_TRAP_VD UL_CONST(0x0000000000000001) |
---|
39 | #define IA64_FPSR_TRAP_DD UL_CONST(0x0000000000000002) |
---|
40 | #define IA64_FPSR_TRAP_ZD UL_CONST(0x0000000000000004) |
---|
41 | #define IA64_FPSR_TRAP_OD UL_CONST(0x0000000000000008) |
---|
42 | #define IA64_FPSR_TRAP_UD UL_CONST(0x0000000000000010) |
---|
43 | #define IA64_FPSR_TRAP_ID UL_CONST(0x0000000000000020) |
---|
44 | #define IA64_FPSR_SF(i,v) ((v) << ((i)*13+6)) |
---|
45 | |
---|
46 | #define IA64_SF_FTZ UL_CONST(0x0001) |
---|
47 | #define IA64_SF_WRE UL_CONST(0x0002) |
---|
48 | #define IA64_SF_PC UL_CONST(0x000c) |
---|
49 | #define IA64_SF_PC_0 UL_CONST(0x0000) |
---|
50 | #define IA64_SF_PC_1 UL_CONST(0x0004) |
---|
51 | #define IA64_SF_PC_2 UL_CONST(0x0008) |
---|
52 | #define IA64_SF_PC_3 UL_CONST(0x000c) |
---|
53 | #define IA64_SF_RC UL_CONST(0x0030) |
---|
54 | #define IA64_SF_RC_NEAREST UL_CONST(0x0000) |
---|
55 | #define IA64_SF_RC_NEGINF UL_CONST(0x0010) |
---|
56 | #define IA64_SF_RC_POSINF UL_CONST(0x0020) |
---|
57 | #define IA64_SF_RC_TRUNC UL_CONST(0x0030) |
---|
58 | #define IA64_SF_TD UL_CONST(0x0040) |
---|
59 | #define IA64_SF_V UL_CONST(0x0080) |
---|
60 | #define IA64_SF_D UL_CONST(0x0100) |
---|
61 | #define IA64_SF_Z UL_CONST(0x0200) |
---|
62 | #define IA64_SF_O UL_CONST(0x0400) |
---|
63 | #define IA64_SF_U UL_CONST(0x0800) |
---|
64 | #define IA64_SF_I UL_CONST(0x1000) |
---|
65 | |
---|
66 | #define IA64_SF_DEFAULT (IA64_SF_PC_3 | IA64_SF_RC_NEAREST) |
---|
67 | |
---|
68 | #define IA64_FPSR_DEFAULT (IA64_FPSR_TRAP_VD \ |
---|
69 | | IA64_FPSR_TRAP_DD \ |
---|
70 | | IA64_FPSR_TRAP_ZD \ |
---|
71 | | IA64_FPSR_TRAP_OD \ |
---|
72 | | IA64_FPSR_TRAP_UD \ |
---|
73 | | IA64_FPSR_TRAP_ID \ |
---|
74 | | IA64_FPSR_SF(0, IA64_SF_DEFAULT) \ |
---|
75 | | IA64_FPSR_SF(1, (IA64_SF_DEFAULT \ |
---|
76 | | IA64_SF_TD \ |
---|
77 | | IA64_SF_WRE)) \ |
---|
78 | | IA64_FPSR_SF(2, (IA64_SF_DEFAULT \ |
---|
79 | | IA64_SF_TD)) \ |
---|
80 | | IA64_FPSR_SF(3, (IA64_SF_DEFAULT \ |
---|
81 | | IA64_SF_TD))) |
---|
82 | |
---|
83 | |
---|
84 | #ifndef __ASSEMBLY__ |
---|
85 | |
---|
86 | /* This is from sys/cdefs.h in FreeBSD */ |
---|
87 | #define __aligned(x) __attribute__((__aligned__(x))) |
---|
88 | |
---|
89 | /* A single Floating Point register. */ |
---|
90 | struct ia64_fpreg |
---|
91 | { |
---|
92 | uint8_t fpr_bits[16]; |
---|
93 | } __aligned(16); |
---|
94 | |
---|
95 | typedef struct ia64_fpreg ia64_fpreg_t; |
---|
96 | |
---|
97 | #endif /* __ASSEMBLY__ */ |
---|
98 | |
---|
99 | #endif /* _IA64_FPU_H_ */ |
---|