Source code of Windows XP (NT5)
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.

229 lines
4.4 KiB

  1. ;***
  2. ;elem87.inc -
  3. ;
  4. ; Copyright (c) 1988-2001, Microsoft Corporation. All rights reserved.
  5. ;
  6. ;Purpose: Include file for 8087 transcendental dunctions.
  7. ; Has jump table and common dispatch code definitions
  8. ;
  9. ;
  10. ;Revision History:
  11. ;
  12. ; 04/21/88 WAJ Added this header. Added wUser1/wUser2/bUser3 to
  13. ; common dispatch code stack frame. These are used
  14. ; for multi thread fortran.
  15. ;
  16. ; 08/25/88 WAJ 386 version
  17. ;
  18. ; 11/16/91 GDP put exception structure on stack frame
  19. ;
  20. ; 02/05/01 GDP modified DispLocals, added DOMAIN_QNAN
  21. ;
  22. ; 03/25/92 GDP added IEEE exception opcodes
  23. ;
  24. ; 09/06/94 CFW Replace MTHREAD with _MT.
  25. ;
  26. ; 08-28-96 JWM Added default_CW & DEFAULT_CW_without_precision for Intel mods.
  27. ;
  28. ;*******************************************************************************
  29. SBUFSIZE EQU 108 ; length of buffer used by fsave
  30. ; local temps for common dispatch code
  31. DispLocals struc
  32. wUser1 dw ?
  33. wUser2 dw ?
  34. savCntrl dw ?
  35. setCntrl dw ?
  36. StatusWord dw ?
  37. Fac dt ?
  38. ifdef I386
  39. Function dd ?
  40. else
  41. Function dw ?
  42. endif
  43. ErrorType db ?
  44. ifdef _MT
  45. __cpower db ?
  46. else
  47. bUser3 db ?
  48. endif
  49. typ dd ?
  50. nam dd ?
  51. arg1 dq ?
  52. arg2 dq ?
  53. retval dq ?
  54. savebuf db SBUFSIZE dup (?) ; buffer used for fsave'ing
  55. DispLocals ends
  56. DSFISize equ ((size DispLocals) + ISIZE - 1) and (not (ISIZE-1))
  57. DSF equ [rbp-DSFISize] ; Dispatch Stack Frame
  58. CondCode equ byte ptr [DSF.StatusWord+1]
  59. savCntrlbyte equ byte ptr [DSF.savCntrl+1]
  60. ifdef _MT
  61. _cpower equ <DSF.__cpower>
  62. endif
  63. ; 8087 control word structure
  64. tranCntrl= 13h ; 64 bits, round even, affine inf
  65. Affine= 10h ; affine inf
  66. default_CW= 027fh ; C default control word
  67. DEFAULT_CW_without_precision = 007fh ; C default control word, with zero precision bits
  68. ; error types for matherr
  69. CHECKRANGE= -2 ; check for possible overflow or underflow
  70. CHECKOVER= -1 ; check for possible overflow
  71. DOMAIN= 1
  72. SING= 2
  73. OVERFLOW= 3
  74. UNDERFLOW= 4
  75. TLOSS= 5
  76. PLOSS= 6
  77. DOMAIN_QNAN= 7 ; should be changed to DOMAIN
  78. ; before calling matherr
  79. INEXACT= 8
  80. ; function jump table structure
  81. funtab struc
  82. fnamlen db ?
  83. fnam db 6 dup (?)
  84. fuseval db 6 dup (?)
  85. fnumarg db ?
  86. fnumber db ?
  87. db ? ;; padding
  88. funtab ends
  89. jmptab macro nam,namlen,strnam,useval,numarg
  90. labelW _&nam&jmptab, PUBLIC
  91. db namlen ;; 1
  92. db strnam ;; 6
  93. db useval ;; 6
  94. db numarg ;; 1
  95. db nam ;; 1
  96. db ? ;; 1
  97. endm
  98. Z = 1*ISIZE ; 0.0
  99. H = 2*ISIZE ; HUGE
  100. mH = 3*ISIZE ; -HUGE
  101. Pentry macro pnam,nam,narg
  102. extrn __&nam&jmptab:word
  103. extrn __ptrandisp&narg&s:near
  104. extrn __ptrandisp&narg&d"near
  105. labelP pnam&SRQQ, PUBLIC
  106. mov rdx, dataoffset __&nam&jmptab
  107. jmp __ptrandisp&narg&s
  108. labelP pnam&DRQQ, PUBLIC
  109. mov rdx, dataoffset __&nam&jmptab
  110. jmp __ptrandisp&narg&d
  111. endm
  112. ; This macro is used to generate the necessary code and declarations
  113. ; for Fortran intrinsics with one argument
  114. F1ArgEntry macro nam
  115. extrn _&nam&jmptab:word
  116. extrn _ctrand1:near
  117. labelP _FI&nam, PUBLIC
  118. mov rdx, dataoffset _&nam&jmptab
  119. jmp _ctrand1
  120. endm
  121. ; This macro is used to generate the necessary code and declarations
  122. ; for Fortran intrinsics with two arguments
  123. F2ArgEntry macro nam
  124. extrn _&nam&jmptab:word
  125. extrn _ctrand2:near
  126. labelP _FI&nam, PUBLIC
  127. mov rdx, dataoffset _&nam&jmptab
  128. jmp _ctrand2
  129. endm
  130. ; C/FORTRAN/BASIC floatcall macro
  131. fc macro JSS,JDS,FCNAM,INS,SIZE,WAITI
  132. ;; JSS - SS:BX and ES:BX offset
  133. ;; JDS - DS:BX offset
  134. ;; FCNAM - float call name suffix
  135. ;; INS - 8087 instruction.
  136. ;; SIZE - byte,word,dword,qword,tbyte
  137. ;; WAIT - 8087 wait.
  138. ;;
  139. ;; if large model, then frame floatcalls for BASIC error recovery
  140. ifnb <JSS>
  141. labelP _s&FCNAM, PUBLIC
  142. push ss
  143. pop es
  144. _e&FCNAM proc
  145. f&ins&size& ptr es:[rbx] ;; Perform instruction.
  146. waiti
  147. ret
  148. _e&FCNAM endp
  149. endif ;;JES
  150. ifnb <JDS>
  151. _f&FCNAM proc
  152. ifnb <SIZE>
  153. f&ins&size& ptr [rbx] ;; Perform instruction.
  154. waiti
  155. else
  156. ifnb <ins>
  157. f&ins
  158. waiti
  159. endif
  160. endif ;;SIZE
  161. _f&FCNAM endp
  162. endif ;;JDS
  163. endm
  164. ; IEEE exception opcodes
  165. ; should be in sync with fpieee.h, ntxcapi.h
  166. OP_SQRT = 05h
  167. OP_ACOS = 0dh
  168. OP_ASIN = 0eh
  169. OP_ATAN = 0fh
  170. OP_ATAN2 = 10h
  171. OP_COS = 12h
  172. OP_COSH = 13h
  173. OP_EXP = 14h
  174. OP_FMOD = 16h
  175. OP_LOG = 1ah
  176. OP_LOG10 = 1bh
  177. OP_POW = 1dh
  178. OP_SIN = 1eh
  179. OP_SINH = 1fh
  180. OP_TAN = 20h
  181. OP_TANH = 21h