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.

81 lines
1.7 KiB

  1. subttl emfmisc.asm - FABS, FCHS, FFREE, FXCH
  2. page
  3. ;*******************************************************************************
  4. ;emfmisc.asm - FABS, FCHS, FFREE, FXCH
  5. ;
  6. ; Microsoft Confidential
  7. ;
  8. ; Copyright (c) Microsoft Corporation 1991
  9. ; All Rights Reserved
  10. ;
  11. ;Purpose:
  12. ; FABS, FCHS, FFREE, FXCH instructions
  13. ;Inputs:
  14. ; edi = [CURstk]
  15. ; esi = pointer to st(i) from instruction field
  16. ;
  17. ;Revision History:
  18. ;
  19. ; [] 09/05/91 TP Initial 32-bit version.
  20. ;
  21. ;*******************************************************************************
  22. ;******
  23. EM_ENTRY eFABS
  24. eFABS:
  25. ;******
  26. cmp EMSEG:[edi].bTag,bTAG_EMPTY
  27. jz StackError ;in emarith.asm
  28. mov EMSEG:[edi].bSgn,0 ;Turn sign bit off
  29. ret
  30. ;******
  31. EM_ENTRY eFCHS
  32. eFCHS:
  33. ;******
  34. cmp EMSEG:[edi].bTag,bTAG_EMPTY
  35. jz StackError ;in emarith.asm
  36. not EMSEG:[edi].bSgn ;Flip the sign
  37. ret
  38. ;******
  39. EM_ENTRY eFFREE
  40. eFFREE:
  41. ;******
  42. mov EMSEG:[esi].bTag,bTAG_EMPTY
  43. ret
  44. ;******
  45. EM_ENTRY eFXCH
  46. eFXCH:
  47. ;******
  48. cmp EMSEG:[esi].bTag,bTAG_EMPTY
  49. jz XchDestEmpty
  50. XchgChkSrc:
  51. cmp EMSEG:[edi].bTag,bTAG_EMPTY
  52. jz XchSrcEmpty
  53. DoSwap:
  54. ;Swap [esi] with [edi]
  55. mov eax,EMSEG:[edi]
  56. xchg eax,EMSEG:[esi]
  57. mov EMSEG:[edi],eax
  58. mov eax,EMSEG:[edi+4]
  59. xchg eax,EMSEG:[esi+4]
  60. mov EMSEG:[edi+4],eax
  61. mov eax,EMSEG:[edi+8]
  62. xchg eax,EMSEG:[esi+8]
  63. mov EMSEG:[edi+8],eax
  64. ret
  65. XchDestEmpty:
  66. call ReturnIndefinite ;in emarith.asm - ZF set if unmasked
  67. jnz XchgChkSrc ;Continue if masked
  68. ret
  69. XchSrcEmpty:
  70. xchg edi,esi ;pass pointer in esi
  71. call ReturnIndefinite ;in emarith.asm - ZF set if unmasked
  72. xchg edi,esi
  73. jnz DoSwap ;Continue if masked
  74. ret