Linux Audio

Check our new training course

Loading...
v5.4
  1/* SPDX-License-Identifier: GPL-2.0-or-later */
  2/*
  3    NetWinder Floating Point Emulator
  4    (c) Rebel.com, 1998-1999
  5    
  6    Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
  7
 
 
 
 
 
 
 
 
 
 
 
 
 
  8*/
  9
 10#ifndef __FPA11_H__
 11#define __FPA11_H__
 12
 13#define GET_FPA11() ((FPA11 *)(&current_thread_info()->fpstate))
 14
 15/*
 16 * The processes registers are always at the very top of the 8K
 17 * stack+task struct.  Use the same method as 'current' uses to
 18 * reach them.
 19 */
 20#define GET_USERREG() ((struct pt_regs *)(THREAD_START_SP + (unsigned long)current_thread_info()) - 1)
 21
 22#include <linux/thread_info.h>
 23
 24/* includes */
 25#include "fpsr.h"		/* FP control and status register definitions */
 26#include "milieu.h"
 27
 28struct roundingData {
 29    int8 mode;
 30    int8 precision;
 31    signed char exception;
 32};
 33
 34#include "softfloat.h"
 35
 36#define		typeNone		0x00
 37#define		typeSingle		0x01
 38#define		typeDouble		0x02
 39#define		typeExtended		0x03
 40
 41/*
 42 * This must be no more and no less than 12 bytes.
 43 */
 44typedef union tagFPREG {
 45	float32 fSingle;
 46	float64 fDouble;
 47#ifdef CONFIG_FPE_NWFPE_XP
 48	floatx80 fExtended;
 49#else
 50	u32 padding[3];
 51#endif
 52} __attribute__ ((packed,aligned(4))) FPREG;
 53
 54/*
 55 * FPA11 device model.
 56 *
 57 * This structure is exported to user space.  Do not re-order.
 58 * Only add new stuff to the end, and do not change the size of
 59 * any element.  Elements of this structure are used by user
 60 * space, and must match struct user_fp in <asm/user.h>.
 61 * We include the byte offsets below for documentation purposes.
 62 *
 63 * The size of this structure and FPREG are checked by fpmodule.c
 64 * on initialisation.  If the rules have been broken, NWFPE will
 65 * not initialise.
 66 */
 67typedef struct tagFPA11 {
 68/*   0 */ FPREG fpreg[8];	/* 8 floating point registers */
 69/*  96 */ FPSR fpsr;		/* floating point status register */
 70/* 100 */ FPCR fpcr;		/* floating point control register */
 71/* 104 */ unsigned char fType[8];	/* type of floating point value held in
 72					   floating point registers.  One of
 73					   none, single, double or extended. */
 74/* 112 */ int initflag;		/* this is special.  The kernel guarantees
 75				   to set it to 0 when a thread is launched,
 76				   so we can use it to detect whether this
 77				   instance of the emulator needs to be
 78				   initialised. */
 79} __attribute__ ((packed,aligned(4))) FPA11;
 80
 81extern int8 SetRoundingMode(const unsigned int);
 82extern int8 SetRoundingPrecision(const unsigned int);
 83extern void nwfpe_init_fpa(union fp_state *fp);
 84
 85extern unsigned int EmulateAll(unsigned int opcode);
 86
 87extern unsigned int EmulateCPDT(const unsigned int opcode);
 88extern unsigned int EmulateCPDO(const unsigned int opcode);
 89extern unsigned int EmulateCPRT(const unsigned int opcode);
 90
 91/* fpa11_cpdt.c */
 92extern unsigned int PerformLDF(const unsigned int opcode);
 93extern unsigned int PerformSTF(const unsigned int opcode);
 94extern unsigned int PerformLFM(const unsigned int opcode);
 95extern unsigned int PerformSFM(const unsigned int opcode);
 96
 97/* single_cpdo.c */
 98
 99extern unsigned int SingleCPDO(struct roundingData *roundData,
100			       const unsigned int opcode, FPREG * rFd);
101/* double_cpdo.c */
102extern unsigned int DoubleCPDO(struct roundingData *roundData,
103			       const unsigned int opcode, FPREG * rFd);
104
105/* extneded_cpdo.c */
106extern unsigned int ExtendedCPDO(struct roundingData *roundData,
107				 const unsigned int opcode, FPREG * rFd);
108
109#endif
v3.5.6
 
  1/*
  2    NetWinder Floating Point Emulator
  3    (c) Rebel.com, 1998-1999
  4    
  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
 18    along with this program; if not, write to the Free Software
 19    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 20*/
 21
 22#ifndef __FPA11_H__
 23#define __FPA11_H__
 24
 25#define GET_FPA11() ((FPA11 *)(&current_thread_info()->fpstate))
 26
 27/*
 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.
 31 */
 32#define GET_USERREG() ((struct pt_regs *)(THREAD_START_SP + (unsigned long)current_thread_info()) - 1)
 33
 34#include <linux/thread_info.h>
 35
 36/* includes */
 37#include "fpsr.h"		/* FP control and status register definitions */
 38#include "milieu.h"
 39
 40struct roundingData {
 41    int8 mode;
 42    int8 precision;
 43    signed char exception;
 44};
 45
 46#include "softfloat.h"
 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	float32 fSingle;
 58	float64 fDouble;
 59#ifdef CONFIG_FPE_NWFPE_XP
 60	floatx80 fExtended;
 61#else
 62	u32 padding[3];
 63#endif
 64} __attribute__ ((packed,aligned(4))) FPREG;
 65
 66/*
 67 * FPA11 device model.
 68 *
 69 * This structure is exported to user space.  Do not re-order.
 70 * Only add new stuff to the end, and do not change the size of
 71 * any element.  Elements of this structure are used by user
 72 * space, and must match struct user_fp in <asm/user.h>.
 73 * We include the byte offsets below for documentation purposes.
 74 *
 75 * The size of this structure and FPREG are checked by fpmodule.c
 76 * on initialisation.  If the rules have been broken, NWFPE will
 77 * not initialise.
 78 */
 79typedef struct tagFPA11 {
 80/*   0 */ FPREG fpreg[8];	/* 8 floating point registers */
 81/*  96 */ FPSR fpsr;		/* floating point status register */
 82/* 100 */ FPCR fpcr;		/* floating point control register */
 83/* 104 */ unsigned char fType[8];	/* type of floating point value held in
 84					   floating point registers.  One of
 85					   none, single, double or extended. */
 86/* 112 */ int initflag;		/* this is special.  The kernel guarantees
 87				   to set it to 0 when a thread is launched,
 88				   so we can use it to detect whether this
 89				   instance of the emulator needs to be
 90				   initialised. */
 91} __attribute__ ((packed,aligned(4))) FPA11;
 92
 93extern int8 SetRoundingMode(const unsigned int);
 94extern int8 SetRoundingPrecision(const unsigned int);
 95extern void nwfpe_init_fpa(union fp_state *fp);
 96
 97extern unsigned int EmulateAll(unsigned int opcode);
 98
 99extern unsigned int EmulateCPDT(const unsigned int opcode);
100extern unsigned int EmulateCPDO(const unsigned int opcode);
101extern unsigned int EmulateCPRT(const unsigned int opcode);
102
103/* fpa11_cpdt.c */
104extern unsigned int PerformLDF(const unsigned int opcode);
105extern unsigned int PerformSTF(const unsigned int opcode);
106extern unsigned int PerformLFM(const unsigned int opcode);
107extern unsigned int PerformSFM(const unsigned int opcode);
108
109/* single_cpdo.c */
110
111extern unsigned int SingleCPDO(struct roundingData *roundData,
112			       const unsigned int opcode, FPREG * rFd);
113/* double_cpdo.c */
114extern unsigned int DoubleCPDO(struct roundingData *roundData,
115			       const unsigned int opcode, FPREG * rFd);
116
117/* extneded_cpdo.c */
118extern unsigned int ExtendedCPDO(struct roundingData *roundData,
119				 const unsigned int opcode, FPREG * rFd);
120
121#endif