Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

202 lines
8.5 KiB

  1. //##########################################################################
  2. //**
  3. //** Copyright (C) 1996-2000 Intel Corporation. All rights reserved.
  4. //**
  5. //** The information and source code contained herein is the exclusive
  6. //** property of Intel Corporation and may not be disclosed, examined
  7. //** or reproduced in whole or in part without explicit written authorization
  8. //** from the company.
  9. //**
  10. //###########################################################################
  11. /*****************************************************************************
  12. * fpieee_flt.h - include file for the FP IEEE exception filter routine
  13. *
  14. *
  15. * History:
  16. * Marius Cornea 09/07/00
  17. * marius.cornea@intel.com
  18. *
  19. *****************************************************************************/
  20. #include <stdio.h>
  21. #include <stdlib.h>
  22. #include <fpieee.h>
  23. #include <float.h>
  24. #include <wtypes.h>
  25. #define rc_rn 0
  26. #define rc_rm 1
  27. #define rc_rp 2
  28. #define rc_rz 3
  29. #define sf_single 0
  30. #define sf_double 2
  31. #define sf_double_extended 3
  32. #define EXCEPTION_MAXIMUM_PARAMETERS 15 /* maximum nr of exception parameters */
  33. /******************************************************************
  34. macro that helps add the LL on platforms other than NT
  35. *******************************************************************/
  36. #ifndef CONST_FORMAT
  37. #ifndef WIN32
  38. #define CONST_FORMAT(num) num##LL
  39. #else
  40. #define CONST_FORMAT(num) num
  41. #endif
  42. #endif
  43. /* Define the masks and patterns for the different faulting FP instructions
  44. * Note: Fn_MIN_MASK and Fn_PATTERN need to be checked if new opcodes
  45. * are inserted in this function
  46. */
  47. #define F1_MIN_MASK CONST_FORMAT(0x010000000000)
  48. #define F1_PATTERN CONST_FORMAT(0x010000000000)
  49. #define F1_MASK CONST_FORMAT(0x01F000000000)
  50. #define FMA_PATTERN CONST_FORMAT(0x010000000000)
  51. #define FMA_S_PATTERN CONST_FORMAT(0x011000000000)
  52. #define FMA_D_PATTERN CONST_FORMAT(0x012000000000)
  53. #define FPMA_PATTERN CONST_FORMAT(0x013000000000)
  54. #define FMS_PATTERN CONST_FORMAT(0x014000000000)
  55. #define FMS_S_PATTERN CONST_FORMAT(0x015000000000)
  56. #define FMS_D_PATTERN CONST_FORMAT(0x016000000000)
  57. #define FPMS_PATTERN CONST_FORMAT(0x017000000000)
  58. #define FNMA_PATTERN CONST_FORMAT(0x018000000000)
  59. #define FNMA_S_PATTERN CONST_FORMAT(0x019000000000)
  60. #define FNMA_D_PATTERN CONST_FORMAT(0x01A000000000)
  61. #define FPNMA_PATTERN CONST_FORMAT(0x01B000000000)
  62. #define F4_MIN_MASK CONST_FORMAT(0x018000000000)
  63. #define F4_PATTERN CONST_FORMAT(0x008000000000)
  64. #define F4_MASK CONST_FORMAT(0x01F200001000)
  65. #define FCMP_EQ_PATTERN CONST_FORMAT(0x008000000000)
  66. #define FCMP_LT_PATTERN CONST_FORMAT(0x009000000000)
  67. #define FCMP_LE_PATTERN CONST_FORMAT(0x008200000000)
  68. #define FCMP_UNORD_PATTERN CONST_FORMAT(0x009200000000)
  69. #define FCMP_EQ_UNC_PATTERN CONST_FORMAT(0x008000001000)
  70. #define FCMP_LT_UNC_PATTERN CONST_FORMAT(0x009000001000)
  71. #define FCMP_LE_UNC_PATTERN CONST_FORMAT(0x008200001000)
  72. #define FCMP_UNORD_UNC_PATTERN CONST_FORMAT(0x009200001000)
  73. #define F6_MIN_MASK CONST_FORMAT(0x019200000000)
  74. #define F6_PATTERN CONST_FORMAT(0x000200000000)
  75. #define F6_MASK CONST_FORMAT(0x01F200000000)
  76. #define FRCPA_PATTERN CONST_FORMAT(0x000200000000)
  77. #define FPRCPA_PATTERN CONST_FORMAT(0x002200000000)
  78. #define F7_MIN_MASK CONST_FORMAT(0x019200000000)
  79. #define F7_PATTERN CONST_FORMAT(0x001200000000)
  80. #define F7_MASK CONST_FORMAT(0x01F200000000)
  81. #define FRSQRTA_PATTERN CONST_FORMAT(0x001200000000)
  82. #define FPRSQRTA_PATTERN CONST_FORMAT(0x003200000000)
  83. #define F8_MIN_MASK CONST_FORMAT(0x018240000000)
  84. #define F8_PATTERN CONST_FORMAT(0x000000000000)
  85. #define F8_MASK CONST_FORMAT(0x01E3F8000000)
  86. #define FMIN_PATTERN CONST_FORMAT(0x0000A0000000)
  87. #define FMAX_PATTERN CONST_FORMAT(0x0000A8000000)
  88. #define FAMIN_PATTERN CONST_FORMAT(0x0000B0000000)
  89. #define FAMAX_PATTERN CONST_FORMAT(0x0000B8000000)
  90. #define FPMIN_PATTERN CONST_FORMAT(0x0020A0000000)
  91. #define FPMAX_PATTERN CONST_FORMAT(0x0020A8000000)
  92. #define FPAMIN_PATTERN CONST_FORMAT(0x0020B0000000)
  93. #define FPAMAX_PATTERN CONST_FORMAT(0x0020B8000000)
  94. #define FPCMP_EQ_PATTERN CONST_FORMAT(0x002180000000)
  95. #define FPCMP_LT_PATTERN CONST_FORMAT(0x002188000000)
  96. #define FPCMP_LE_PATTERN CONST_FORMAT(0x002190000000)
  97. #define FPCMP_UNORD_PATTERN CONST_FORMAT(0x002198000000)
  98. #define FPCMP_NEQ_PATTERN CONST_FORMAT(0x0021A0000000)
  99. #define FPCMP_NLT_PATTERN CONST_FORMAT(0x0021A8000000)
  100. #define FPCMP_NLE_PATTERN CONST_FORMAT(0x0021B0000000)
  101. #define FPCMP_ORD_PATTERN CONST_FORMAT(0x0021B8000000)
  102. #define F10_MIN_MASK CONST_FORMAT(0x018240000000)
  103. #define F10_PATTERN CONST_FORMAT(0x000040000000)
  104. #define F10_MASK CONST_FORMAT(0x01E3F8000000)
  105. #define FCVT_FX_PATTERN CONST_FORMAT(0x0000C0000000)
  106. #define FCVT_FXU_PATTERN CONST_FORMAT(0x0000C8000000)
  107. #define FCVT_FX_TRUNC_PATTERN CONST_FORMAT(0x0000D0000000)
  108. #define FCVT_FXU_TRUNC_PATTERN CONST_FORMAT(0x0000D8000000)
  109. #define FPCVT_FX_PATTERN CONST_FORMAT(0x0020C0000000)
  110. #define FPCVT_FXU_PATTERN CONST_FORMAT(0x0020C8000000)
  111. #define FPCVT_FX_TRUNC_PATTERN CONST_FORMAT(0x0020D0000000)
  112. #define FPCVT_FXU_TRUNC_PATTERN CONST_FORMAT(0x0020D8000000)
  113. /* Masks for the rounding control bits */
  114. #define RC_MASK CONST_FORMAT(0x03)
  115. #define RN_MASK CONST_FORMAT(0x00)
  116. #define RM_MASK CONST_FORMAT(0x01)
  117. #define RP_MASK CONST_FORMAT(0x02)
  118. #define RZ_MASK CONST_FORMAT(0x03)
  119. /* Masks for the precision control bits */
  120. #define PC_MASK CONST_FORMAT(0x03)
  121. #define SGL_MASK CONST_FORMAT(0x00)
  122. #define DBL_MASK CONST_FORMAT(0x02)
  123. #define DBL_EXT_MASK CONST_FORMAT(0x03)
  124. // opcodes for instructions that take one input operand (for run1args)
  125. #define FPRSQRTA 1 [not used - fprsqrta not re-executed]
  126. #define FPCVT_FX 2
  127. #define FPCVT_FXU 3
  128. #define FPCVT_FX_TRUNC 4
  129. #define FPCVT_FXU_TRUNC 5
  130. // opcodes for instructions that take two input operands (for run2args)
  131. #define FPRCPA 1 [not used - fprcpa not re-executed]
  132. #define FPCMP_EQ 2
  133. #define FPCMP_LT 3
  134. #define FPCMP_LE 4
  135. #define FPCMP_UNORD 5
  136. #define FPCMP_NEQ 6
  137. #define FPCMP_NLT 7
  138. #define FPCMP_NLE 8
  139. #define FPCMP_ORD 9
  140. #define FPMIN 10
  141. #define FPMAX 11
  142. #define FPAMIN 12
  143. #define FPAMAX 13
  144. // opcodes for instructions that take three input operands (for run3args)
  145. #define FPMA 1
  146. #define FPMS 2
  147. #define FPNMA 3
  148. /* prototypes for helpers from support files written in asm */
  149. void __get_fpsr (unsigned __int64 *);
  150. void __set_fpsr (unsigned __int64 *);
  151. void _xrun1args (int, unsigned __int64 *, _FP128 *, _FP128 *);
  152. void _xrun2args (int, unsigned __int64 *, _FP128 *, _FP128 *, _FP128 *);
  153. void _xrun3args (int, unsigned __int64 *, _FP128 *, _FP128 *, _FP128 *, _FP128 *);
  154. void _thmB (_FP32 *, _FP32 *, _FP32 *, unsigned __int64 *);
  155. void _thmH (_FP32 *, _FP32 *, unsigned __int64 *);