setprec.387 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /* Set 80387 floating point hardware rounding precision */
  2. .file "setprec.387"
  3. .text
  4. .align 2
  5. .globl _sprec
  6. _sprec:
  7. pushl %ebp
  8. movl %esp,%ebp
  9. pushl %eax
  10. subl $4,%esp
  11. fstcw (%esp)
  12. fwait
  13. movl (%esp),%eax
  14. andl $0xfcff,%eax
  15. movl %eax,(%esp)
  16. fldcw (%esp)
  17. popl %eax
  18. popl %eax
  19. leave
  20. ret
  21. .align 2
  22. .globl _dprec
  23. _dprec:
  24. pushl %ebp
  25. movl %esp,%ebp
  26. pushl %eax
  27. subl $4,%esp
  28. fstcw (%esp)
  29. fwait
  30. movl (%esp),%eax
  31. /* andl $0xfcff,%eax */
  32. /* exception on overflow */
  33. andl $0xfcf7,%eax
  34. orl $0x200,%eax
  35. movl %eax,(%esp)
  36. fldcw (%esp)
  37. popl %eax
  38. popl %eax
  39. leave
  40. ret
  41. .align 2
  42. .globl _ldprec
  43. _ldprec:
  44. pushl %ebp
  45. movl %esp,%ebp
  46. pushl %eax
  47. subl $4,%esp
  48. fstcw (%esp)
  49. fwait
  50. movl (%esp),%eax
  51. orl $0x300,%eax
  52. movl %eax,(%esp)
  53. fldcw (%esp)
  54. popl %eax
  55. popl %eax
  56. leave
  57. ret
  58. .globl _getprec
  59. _getprec:
  60. pushl %ebp
  61. movl %esp,%ebp
  62. subl $4,%esp
  63. fstcw (%esp)
  64. fwait
  65. movl (%esp),%eax
  66. leave
  67. ret
  68. .globl _setfpu
  69. _setfpu:
  70. pushl %ebp
  71. movl %esp,%ebp
  72. movl 8(%ebp),%eax
  73. pushl %eax
  74. fldcw (%esp)
  75. fwait
  76. movl %ebp,%esp
  77. popl %ebp
  78. ret