]>
git.saurik.com Git - apple/xnu.git/blob - EXTERNAL_HEADERS/architecture/ppc/fp_regs.h
ef2d868e9c779a62d2870fb3eb8f95da2f979ca5
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
30 /* Copyright (c) 1996 NeXT Software, Inc. All rights reserved.
32 * File: architecture/ppc/fp_regs.h
33 * Author: Doug Mitchell, NeXT Software, Inc.
35 * ppc floating point registers.
38 * 29-Dec-96 Umesh Vaishampayan (umeshv@NeXT.com)
40 * 05-Nov-92 Doug Mitchell at NeXT
44 #ifndef _ARCH_PPC_FP_REGS_H_
45 #define _ARCH_PPC_FP_REGS_H_
47 #include <architecture/ppc/reg_help.h>
49 #if !defined(__ASSEMBLER__)
51 * Floating point status and control register.
53 * This struct is aligned to an 8-byte boundary because 64-bit
54 * load/store instructions (lfd/stfd) are used to access it. The
55 * FPSCR can only be read/written through other FP registers.
58 unsigned unused
[1] __attribute__(( aligned(8) ));
59 unsigned fx
:BIT_WIDTH(31), // exception summary
60 fex
:BIT_WIDTH(30), // enabled exception summary
61 vx
:BIT_WIDTH(29), // invalid op exception
63 ox
:BIT_WIDTH(28), // overflow exception
64 ux
:BIT_WIDTH(27), // underflow exception
65 zx
:BIT_WIDTH(26), // divide by zero exception
66 xx
:BIT_WIDTH(25), // inexact exception
67 vx_snan
:BIT_WIDTH(24), // not a number exception
68 vx_isi
:BIT_WIDTH(23), // exception
69 vx_idi
:BIT_WIDTH(22), // exception
70 vx_zdz
:BIT_WIDTH(21), // exception
71 vx_imz
:BIT_WIDTH(20), // exception
72 vx_xvc
:BIT_WIDTH(19), // exception
73 fr
:BIT_WIDTH(18), // fraction rounded
74 fi
:BIT_WIDTH(17), // fraction inexact
75 class:BIT_WIDTH(16), // class descriptor
76 fl
:BIT_WIDTH(15), // negative
77 fg
:BIT_WIDTH(14), // positive
78 fe
:BIT_WIDTH(13), // equal or zero
79 fu
:BIT_WIDTH(12), // not a number
80 rsvd1
:BIT_WIDTH(11), // reserved
81 vx_soft
:BIT_WIDTH(10), // software request exception
82 rsvd2
:BIT_WIDTH(9), // reserved
83 vx_cvi
:BIT_WIDTH(8), // invalid integer convert
85 ve
:BIT_WIDTH(7), // invalid op exception enable
86 oe
:BIT_WIDTH(6), // overflow exception enable
87 ue
:BIT_WIDTH(5), // underflow exception enable
88 ze
:BIT_WIDTH(4), // divide by zero exception
90 xe
:BIT_WIDTH(3), // inexact exception enable
91 ni
:BIT_WIDTH(2), // non-IEEE exception enable
92 rn
:BITS_WIDTH(1,0); // rounding control
96 * Values for fp_scr_t.rn (rounding control).
106 * ppc_fpf_t -- data types that MAY be in floating point register file
107 * Actual data types supported is implementation dependent
110 float f
; // 32 bit IEEE single
111 double d
; // 64 bit IEEE double
114 * Insure compiler aligns struct appropriately
116 unsigned x
[2] __attribute__(( aligned(8) ));
120 * Number of FP registers.
122 #define PPC_NFP_REGS 32
126 * FIXME - these don't work, you need to go thru a fp register.
133 static __inline__ ppc_fp_scr_t
138 __asm__
volatile ("mffs. %0 /* mffs */" \
139 : "=f" (__fp_un
.__dbl
));
140 return (__fp_un
.__scr
);
143 static __inline__
void
144 set_fp_scr(ppc_fp_scr_t fp_scr
)
148 __fp_un
.__scr
= fp_scr
;
149 __asm__
volatile ("mtfsf 0xff, %0; /* mtfsf */ " \
150 : : "f" (__fp_un
.__dbl
));
153 #endif /* ! __ASSEMBLER__ */
155 #endif /* _ARCH_PPC_FP_REGS_H_ */