fpa11.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. #define GET_USERREG() ((struct pt_regs *)(THREAD_START_SP + (unsigned long)current_thread_info()) - 1)
  26. #include <linux/config.h>
  27. #include <linux/thread_info.h>
  28. /* includes */
  29. #include "fpsr.h" /* FP control and status register definitions */
  30. #include "milieu.h"
  31. struct roundingData {
  32. int8 mode;
  33. int8 precision;
  34. signed char exception;
  35. };
  36. #include "softfloat.h"
  37. #define typeNone 0x00
  38. #define typeSingle 0x01
  39. #define typeDouble 0x02
  40. #define typeExtended 0x03
  41. /*
  42. * This must be no more and no less than 12 bytes.
  43. */
  44. typedef union tagFPREG {
  45. float32 fSingle;
  46. float64 fDouble;
  47. #ifdef CONFIG_FPE_NWFPE_XP
  48. floatx80 fExtended;
  49. #else
  50. int padding[3];
  51. #endif
  52. } FPREG;
  53. /*
  54. * FPA11 device model.
  55. *
  56. * This structure is exported to user space. Do not re-order.
  57. * Only add new stuff to the end, and do not change the size of
  58. * any element. Elements of this structure are used by user
  59. * space, and must match struct user_fp in include/asm-arm/user.h.
  60. * We include the byte offsets below for documentation purposes.
  61. *
  62. * The size of this structure and FPREG are checked by fpmodule.c
  63. * on initialisation. If the rules have been broken, NWFPE will
  64. * not initialise.
  65. */
  66. typedef struct tagFPA11 {
  67. /* 0 */ FPREG fpreg[8]; /* 8 floating point registers */
  68. /* 96 */ FPSR fpsr; /* floating point status register */
  69. /* 100 */ FPCR fpcr; /* floating point control register */
  70. /* 104 */ unsigned char fType[8]; /* type of floating point value held in
  71. floating point registers. One of
  72. none, single, double or extended. */
  73. /* 112 */ int initflag; /* this is special. The kernel guarantees
  74. to set it to 0 when a thread is launched,
  75. so we can use it to detect whether this
  76. instance of the emulator needs to be
  77. initialised. */
  78. } FPA11;
  79. extern int8 SetRoundingMode(const unsigned int);
  80. extern int8 SetRoundingPrecision(const unsigned int);
  81. extern void nwfpe_init_fpa(union fp_state *fp);
  82. #endif