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