Linux-2.6.12-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / nwfpe / fpa11.h
blob45cc65426a223a1b7f70fd1fb208bbf1065a40c0
1 /*
2 NetWinder Floating Point Emulator
3 (c) Rebel.com, 1998-1999
5 Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #ifndef __FPA11_H__
23 #define __FPA11_H__
25 #define GET_FPA11() ((FPA11 *)(&current_thread_info()->fpstate))
28 * The processes registers are always at the very top of the 8K
29 * stack+task struct. Use the same method as 'current' uses to
30 * reach them.
32 register unsigned long *user_registers asm("sl");
34 #define GET_USERREG() (user_registers)
36 #include <linux/config.h>
37 #include <linux/thread_info.h>
39 /* includes */
40 #include "fpsr.h" /* FP control and status register definitions */
41 #include "milieu.h"
42 #include "softfloat.h"
44 #define typeNone 0x00
45 #define typeSingle 0x01
46 #define typeDouble 0x02
47 #define typeExtended 0x03
50 * This must be no more and no less than 12 bytes.
52 typedef union tagFPREG {
53 float32 fSingle;
54 float64 fDouble;
55 #ifdef CONFIG_FPE_NWFPE_XP
56 floatx80 fExtended;
57 #else
58 int padding[3];
59 #endif
60 } FPREG;
63 * FPA11 device model.
65 * This structure is exported to user space. Do not re-order.
66 * Only add new stuff to the end, and do not change the size of
67 * any element. Elements of this structure are used by user
68 * space, and must match struct user_fp in include/asm-arm/user.h.
69 * We include the byte offsets below for documentation purposes.
71 * The size of this structure and FPREG are checked by fpmodule.c
72 * on initialisation. If the rules have been broken, NWFPE will
73 * not initialise.
75 typedef struct tagFPA11 {
76 /* 0 */ FPREG fpreg[8]; /* 8 floating point registers */
77 /* 96 */ FPSR fpsr; /* floating point status register */
78 /* 100 */ FPCR fpcr; /* floating point control register */
79 /* 104 */ unsigned char fType[8]; /* type of floating point value held in
80 floating point registers. One of
81 none, single, double or extended. */
82 /* 112 */ int initflag; /* this is special. The kernel guarantees
83 to set it to 0 when a thread is launched,
84 so we can use it to detect whether this
85 instance of the emulator needs to be
86 initialised. */
87 } FPA11;
89 extern void SetRoundingMode(const unsigned int);
90 extern void SetRoundingPrecision(const unsigned int);
91 extern void nwfpe_init_fpa(union fp_state *fp);
93 #endif