fpa11.h 2.8 KB

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