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.

355 lines
9.2 KiB

  1. ;
  2. ;
  3. ; Copyright (C) Microsoft Corporation, 1986
  4. ;
  5. ; This Module contains Proprietary Information of Microsoft
  6. ; Corporation and should be treated as Confidential.
  7. ;
  8. subttl emdisp.asm - Dispatch Tables
  9. page
  10. ;*********************************************************************;
  11. ; ;
  12. ; Dispatch Tables ;
  13. ; ;
  14. ;*********************************************************************;
  15. ; dispatch tables
  16. ; These tables are based upon the layout of the 8087 instructions
  17. ;
  18. ; 8087 instruction fields: |escape|MF|Arith|MOD|Op|r/m|disp1|disp2|
  19. ; field length in bits: 5 2 1 2 3 3 8 8
  20. ;
  21. ; Disp1 and Disp2 are optional address bytes present only if MOD <> 11.
  22. ; When (MOD <> 11) r/m describes which regs (SI,DI,BX,BP) are added to
  23. ; Disp1 and Disp2 to calculate the effective address. This form
  24. ; (memory format) is used for Loads, Stores, Compares, and Arithmetic
  25. ; When using memory format MF determines the Type of the Memory operand
  26. ; i.e. Single Real, Double real, Single Integer, or Double Integer
  27. ; Arith is 0 for Arithmetic opetations (and compares), set to 1 otherwise
  28. ; Op mostly determines which type of operation to do though when not in
  29. ; memory format some of that is coded into MF and r/m
  30. ; All of the tables are set up to do a jump based upon one or more of the
  31. ; above fields. The outline for decoding instructions is:
  32. ;
  33. ; IF (memory format) THEN
  34. ; Assemble Effective Address (using MOD and r/m and EffectiveAddressTab)
  35. ; IF (Arith) THEN
  36. ; Load to the stack (using MF and FLDsdriTab)
  37. ; Do the Arithmetic Operation (using Op and ArithmeticOpTab)
  38. ; ELSE (memory format non- arithmetic)
  39. ; Do the operation (using Op and NonArithOpMemTab and
  40. ; depending on the case MF and one of the FLD or FST Tabs)
  41. ; ENDIF
  42. ; ELSE (Register format)
  43. ; IF (Arith) THEN
  44. ; Test r/m for legit Stack reference
  45. ; Do the Arithmetic Operation (using Op and ArithmeticOpTab)
  46. ; ELSE (non-arithmetic register format)
  47. ; Do the operation (using Op and NonArithOpRegTab and
  48. ; depending on the case r/m and one of:
  49. ; Constants, Miscellaneous, Transcendental, or Various Tabs)
  50. EVEN
  51. glb <EA286Tab>
  52. eWORD EA286Tab ; Uses |r/m|MOD| for indexing
  53. edw BXSI0D
  54. edw BXSI1D
  55. edw BXSI2D
  56. edw NoEffectiveAddress
  57. edw BXDI0D
  58. edw BXDI1D
  59. edw BXDI2D
  60. edw NoEffectiveAddress
  61. edw BPSI0D
  62. edw BPSI1D
  63. edw BPSI2D
  64. edw NoEffectiveAddress
  65. edw BPDI0D
  66. edw BPDI1D
  67. edw BPDI2D
  68. edw NoEffectiveAddress
  69. edw DSSI0D
  70. edw DSSI1D
  71. edw DSSI2D
  72. edw NoEffectiveAddress
  73. edw DSDI0D
  74. edw DSDI1D
  75. edw DSDI2D
  76. edw NoEffectiveAddress
  77. edw DSXI2D
  78. edw BPXI1D
  79. edw BPXI2D
  80. edw NoEffectiveAddress
  81. edw BXXI0D
  82. edw BXXI1D
  83. edw BXXI2D
  84. edw NoEffectiveAddress
  85. ifdef i386
  86. glb <EA386Tab>
  87. eWORD EA386Tab ; Uses |r/m|MOD| for indexing
  88. edw Exx00 ; eax
  89. edw Exx01
  90. edw Exx10
  91. edw NoEffectiveAddress
  92. edw Exx00 ; ecx
  93. edw Exx01
  94. edw Exx10
  95. edw NoEffectiveAddress
  96. edw Exx00 ; edx
  97. edw Exx01
  98. edw Exx10
  99. edw NoEffectiveAddress
  100. edw Exx00 ; ebx
  101. edw Exx01
  102. edw Exx10
  103. edw NoEffectiveAddress
  104. edw SIB00 ; esp (S-I-B follows)
  105. edw SIB01
  106. edw SIB10
  107. edw NoEffectiveAddress
  108. edw Direct386 ; ebp (00 = direct addressing)
  109. edw Exx01
  110. edw Exx10
  111. edw NoEffectiveAddress
  112. edw Exx00 ; esi
  113. edw Exx01
  114. edw Exx10
  115. edw NoEffectiveAddress
  116. edw Exx00 ; edi
  117. edw Exx01
  118. edw Exx10
  119. edw NoEffectiveAddress
  120. endif ;i386
  121. glb <ArithmeticOpTab>
  122. eWORD ArithmeticOpTab ; Uses |Op| for indexing
  123. edw ADDRQQ ;FADD
  124. edw MUDRQQ ;FMUL
  125. edw eFCOM ;FCOM
  126. edw eFCOMP ;FCOMP
  127. edw SUDRQQ ;FSUB
  128. edw SVDRQQ ;FSUBR
  129. edw DIDRQQ ;FDIV
  130. edw DRDRQQ ;FDIVR
  131. glb <NonArithOpMemTab>
  132. eWORD NonArithOpMemTab ; Uses |Op| for indexing
  133. edw eFLDsdri ;load(single/double,real/integer)
  134. edw UNUSED ;reserved
  135. edw eFSTsdri ;Store(single/double,real/integer)
  136. edw eFSTPsdri ;Store and POP (single/double,real/integer)
  137. edw UNUSED ;reserved
  138. edw eFLDtempORcw ;Load(TempReal or LongInteger), FLDCW
  139. edw UNUSED ;reserved
  140. edw eFSTtempORcw ;Store(TempReal or LongInteger), FSTCW ,FSTSW
  141. glb <NonArithOpRegTab>
  142. eWORD NonArithOpRegTab ; Uses |Op| for indexing
  143. edw eFLDregOrFFREE ;load(register), FFREE
  144. edw eFXCHGreg ;FXCHG
  145. edw eFSTreg ;Store(register),FNOP
  146. edw eFSTPreg ;Store and POP (register)
  147. edw eMISCELANEOUS ;FCHS, FABS, FTST, FXAM, FINIT, FENI, FDISI, FCLEX
  148. edw eFLDconstants ;FLD1, FLDL2T, FLDL2E, FLDPI, FLDLG2, FLDLN2, FLDZ
  149. edw etranscendental ;F2XM1, FYL2X, FPTAN, FPATAN, FXTRACT, FDECSTP, FINCSTP
  150. edw eVARIOUS ;FPREM, FYL2XP1, FSQRT, FRNDINT, FSCALE
  151. glb <FLDsdriTab>
  152. eWORD FLDsdriTab ; Uses |MF| for indexing
  153. edw eFLDsr ;load single real
  154. edw eFLDdi ;load double integer
  155. edw eFLDdr ;load double real
  156. edw eFLDsi ;load single integer
  157. glb <FSTsdriTab>
  158. eWORD FSTsdriTab ; Uses |MF| for indexing
  159. edw eFSTsr ;store single real
  160. edw eFSTdi ;store double integer
  161. edw eFSTdr ;store double real
  162. edw eFSTsi ;store single integer
  163. glb <FLDtempORcwTab>
  164. eWORD FLDtempORcwTab ; Uses |MF| for indexing
  165. edw eFLDCW ;load control word
  166. edw eFLDtemp ;load temp real
  167. edw UNUSED ;reserved
  168. edw eFLDlongint ;load long integer
  169. glb <FSTtempORcwTab>
  170. eWORD FSTtempORcwTab ; Uses |MF| for indexing
  171. edw eFSTCW ;store control word
  172. edw eFSTtemp ;store temp real
  173. edw eFSTSW ;store status word
  174. edw eFSTlongint ;store long integer
  175. glb <FLDconstantsTab>
  176. eWORD FLDconstantsTab ; Uses |r/m| for indexing
  177. edw eFLD1
  178. edw eFLDL2T
  179. edw eFLDL2E
  180. edw eFLDPI
  181. edw eFLDLG2
  182. edw eFLDLN2
  183. edw eFLDZ
  184. edw UNUSED ;reserved
  185. glb <TranscendentalTab>
  186. eWORD TranscendentalTab ; Uses |r/m| for indexing
  187. edw eF2XM1
  188. edw eFYL2X
  189. edw eFPTAN
  190. edw eFPATAN
  191. edw eFXTRACT
  192. edw UNUSED ;reserved
  193. edw eFDECSTP
  194. edw eFINCSTP
  195. glb <VariousTab>
  196. eWORD VariousTab ; Uses |r/m| for indexing
  197. edw eFPREM
  198. edw eFYL2XP1
  199. edw eFSQRT
  200. edw UNUSED ;reserved
  201. edw eFRNDINT
  202. edw eFSCALE
  203. edw UNUSED ;reserved
  204. edw UNUSED ;reserved
  205. glb <COMtab>
  206. eWORD COMtab ; SI DI
  207. edw COMvalidvalid ; valid valid
  208. edw COMsignSI ; valid zero
  209. edw COMincomprable ; valid NAN
  210. edw COMsignDIinf ; valid INF
  211. edw COMsignDI ; zero valid
  212. edw COMequal ; zero zero
  213. edw COMincomprable ; zero NAN
  214. edw COMsignDIinf ; zero INF
  215. edw COMincomprable ; NAN valid
  216. edw COMincomprable ; NAN zero
  217. edw COMincomprable ; NAN NAN
  218. edw COMincomprable ; NAN INF
  219. edw COMsignSIinf ; INF valid
  220. edw COMsignSIinf ; INF zero
  221. edw COMincomprable ; INF NAN
  222. edw COMinfinf ; INF INF
  223. glb <TSTtab>
  224. eWORD TSTtab
  225. edw COMsignSI ; valid
  226. edw COMequal ; zero
  227. edw COMincomprable ; NAN
  228. edw COMsignSIinf ; INF
  229. glb <ADDJMPTAB>
  230. eWORD ADDJMPTAB
  231. eWORD TAJRQQ
  232. edw RADRQQ ; 0000 D Valid non-0, S Valid non-0
  233. edw DDD ; 0001 D Valid non-0, S 0
  234. edw SSINV ; 0010 D Valid non-0, S NAN
  235. edw SSS ; 0011 D Valid non-0, S Inf
  236. edw SSS ; 0100 D 0, S Valid non-0
  237. edw DDD ; 0101 D 0, S 0
  238. edw SSINV ; 0110 D 0, S NAN
  239. edw SSS ; 0111 D 0, S Inf
  240. edw DDINV ; 1000 D NAN, S Valid non-0
  241. edw DDINV ; 1001 D NAN, S 0
  242. edw BIGNAN ; 1010 D NAN, S NAN
  243. edw DDINV ; 1011 D NAN, S Inf
  244. edw DDD ; 1100 D Inf, S Valid non-0
  245. edw DDD ; 1101 D Inf, S 0
  246. edw SSINV ; 1110 D Inf, S NAN
  247. edw INFINF ; 1111 D Inf, S Inf
  248. glb <MULJMPTAB>
  249. eWORD MULJMPTAB
  250. eWORD TMJRQQ
  251. edw RMDRQQ ; 0000 D Valid non-0, S Valid non-0
  252. edw ZEROS ; 0001 D Valid non-0, S 0
  253. edw SSINV ; 0010 D Valid non-0, S NAN
  254. edw INFS ; 0011 D Valid non-0, S Inf
  255. edw ZEROS ; 0100 D 0, S Valid non-0
  256. edw ZEROS ; 0101 D 0, S 0
  257. edw SSINV ; 0110 D 0, S NAN
  258. edw INDINV ; 0111 D 0, S Inf
  259. edw DDINV ; 1000 D NAN, S Valid non-0
  260. edw DDINV ; 1001 D NAN, S 0
  261. edw BIGNAN ; 1010 D NAN, S NAN
  262. edw DDINV ; 1011 D NAN, S Inf
  263. edw INFS ; 1100 D Inf, S Valid non-0
  264. edw INDINV ; 1101 D Inf, S 0
  265. edw SSINV ; 1110 D Inf, S NAN
  266. edw INFS ; 1111 D Inf, S Inf
  267. glb <DIVJMPTAB>
  268. eWORD DIVJMPTAB
  269. eWORD TDJRQQ
  270. edw RDDRQQ ; 0000 D Valid non-0, S Valid non-0
  271. edw ZEROS ; 0001 D Valid non-0, S 0
  272. edw SSINV ; 0010 D Valid non-0, S NAN
  273. edw INFS ; 0011 D Valid non-0, S Inf
  274. edw DIV0 ; 0100 D 0, S Valid non-0
  275. edw D0INDINV ; 0101 D 0, S 0
  276. edw D0SSINV ; 0110 D 0, S NAN
  277. edw DIV0 ; 0111 D 0, S Inf
  278. edw DDINV ; 1000 D NAN, S Valid non-0
  279. edw DDINV ; 1001 D NAN, S 0
  280. edw BIGNAN ; 1010 D NAN, S NAN
  281. edw DDINV ; 1011 D NAN, S Inf
  282. edw ZEROS ; 1100 D Inf, S Valid non-0
  283. edw ZEROS ; 1101 D Inf, S 0
  284. edw SSINV ; 1110 D Inf, S NAN
  285. edw INDINV ; 1111 D Inf, S Inf
  286. glb <XAMtab>
  287. ; Tag Flag C3 C2 C1 C0 meaning
  288. XAMtab DB 04H ; 00 0 0 1 0 0 Positive Normal
  289. DB 06H ; 00 1 0 1 1 0 Negative Normal
  290. DB 40H ; 01 0 1 0 0 0 Positive Zero
  291. DB 42H ; 01 1 1 0 1 0 Negative Zero
  292. DB 01H ; 10 0 0 0 0 1 Positive NAN
  293. DB 03H ; 10 1 0 0 1 1 Negative NAN
  294. DB 05H ; 11 0 0 1 0 1 Positive Infinity
  295. DB 07H ; 11 1 0 1 1 1 Negative Infinity
  296.