]> git.proxmox.com Git - qemu.git/blame - linux-user/arm/nwfpe/fpa11.h
fpu: move public header file to include/fpu
[qemu.git] / linux-user / arm / nwfpe / fpa11.h
CommitLineData
00406dff
FB
1/*
2 NetWinder Floating Point Emulator
3 (c) Rebel.com, 1998-1999
3b46e624 4
00406dff
FB
5 Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
6
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.
11
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.
16
17 You should have received a copy of the GNU General Public License
70539e18 18 along with this program; if not, see <http://www.gnu.org/licenses/>.
00406dff
FB
19*/
20
21#ifndef __FPA11_H__
22#define __FPA11_H__
23
a8d3431a
FB
24#include <stdlib.h>
25#include <stdio.h>
26#include <errno.h>
27
19b045de
PB
28#include <cpu.h>
29
00406dff
FB
30#define GET_FPA11() (qemufpa)
31
32/*
33 * The processes registers are always at the very top of the 8K
34 * stack+task struct. Use the same method as 'current' uses to
35 * reach them.
36 */
19b045de 37extern CPUARMState *user_registers;
00406dff
FB
38
39#define GET_USERREG() (user_registers)
40
41/* Need task_struct */
42//#include <linux/sched.h>
43
44/* includes */
45#include "fpsr.h" /* FP control and status register definitions */
6b4c305c 46#include "fpu/softfloat.h"
00406dff
FB
47
48#define typeNone 0x00
49#define typeSingle 0x01
50#define typeDouble 0x02
51#define typeExtended 0x03
52
53/*
54 * This must be no more and no less than 12 bytes.
55 */
56typedef union tagFPREG {
57 floatx80 fExtended;
58 float64 fDouble;
59 float32 fSingle;
60} FPREG;
61
62/*
63 * FPA11 device model.
64 *
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.
70 *
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.
74 */
75typedef 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 none
81 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. */
20495218 87 float_status fp_status; /* QEMU float emulator status */
00406dff
FB
88} FPA11;
89
90extern FPA11* qemufpa;
91
64b85a8f
BS
92void resetFPA11(void);
93void SetRoundingMode(const unsigned int);
94void SetRoundingPrecision(const unsigned int);
00406dff 95
00406dff
FB
96static inline unsigned int readRegister(unsigned int reg)
97{
19b045de 98 return (user_registers->regs[(reg)]);
00406dff
FB
99}
100
101static inline void writeRegister(unsigned int x, unsigned int y)
102{
103#if 0
104 printf("writing %d to r%d\n",y,x);
105#endif
19b045de 106 user_registers->regs[(x)]=(y);
00406dff
FB
107}
108
109static inline void writeConditionCodes(unsigned int x)
110{
19b045de 111 cpsr_write(user_registers,x,CPSR_NZCV);
00406dff
FB
112}
113
7cb4db8f 114#define ARM_REG_PC 15
00406dff 115
19b045de 116unsigned int EmulateAll(unsigned int opcode, FPA11* qfpa, CPUARMState* qregs);
00406dff 117
65a650c2
PB
118unsigned int EmulateCPDO(const unsigned int);
119unsigned int EmulateCPDT(const unsigned int);
120unsigned int EmulateCPRT(const unsigned int);
121
122unsigned int SingleCPDO(const unsigned int opcode);
123unsigned int DoubleCPDO(const unsigned int opcode);
124unsigned int ExtendedCPDO(const unsigned int opcode);
125
126
a8d3431a
FB
127/* included only for get_user/put_user macros */
128#include "qemu.h"
129
00406dff 130#endif