x_unsupp.S 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. |
  2. | x_unsupp.sa 3.3 7/1/91
  3. |
  4. | fpsp_unsupp --- FPSP handler for unsupported data type exception
  5. |
  6. | Trap vector #55 (See table 8-1 Mc68030 User's manual).
  7. | Invoked when the user program encounters a data format (packed) that
  8. | hardware does not support or a data type (denormalized numbers or un-
  9. | normalized numbers).
  10. | Normalizes denorms and unnorms, unpacks packed numbers then stores
  11. | them back into the machine to let the 040 finish the operation.
  12. |
  13. | Unsupp calls two routines:
  14. | 1. get_op - gets the operand(s)
  15. | 2. res_func - restore the function back into the 040 or
  16. | if fmove.p fpm,<ea> then pack source (fpm)
  17. | and store in users memory <ea>.
  18. |
  19. | Input: Long fsave stack frame
  20. |
  21. |
  22. | Copyright (C) Motorola, Inc. 1990
  23. | All Rights Reserved
  24. |
  25. | For details on the license for this file, please see the
  26. | file, README, in this same directory.
  27. X_UNSUPP: |idnt 2,1 | Motorola 040 Floating Point Software Package
  28. |section 8
  29. #include "fpsp.h"
  30. |xref get_op
  31. |xref res_func
  32. |xref gen_except
  33. |xref fpsp_fmt_error
  34. .global fpsp_unsupp
  35. fpsp_unsupp:
  36. |
  37. link %a6,#-LOCAL_SIZE
  38. fsave -(%a7)
  39. moveml %d0-%d1/%a0-%a1,USER_DA(%a6)
  40. fmovemx %fp0-%fp3,USER_FP0(%a6)
  41. fmoveml %fpcr/%fpsr/%fpiar,USER_FPCR(%a6)
  42. moveb (%a7),VER_TMP(%a6) |save version number
  43. moveb (%a7),%d0 |test for valid version num
  44. andib #0xf0,%d0 |test for $4x
  45. cmpib #VER_4,%d0 |must be $4x or exit
  46. bnel fpsp_fmt_error
  47. fmovel #0,%FPSR |clear all user status bits
  48. fmovel #0,%FPCR |clear all user control bits
  49. |
  50. | The following lines are used to ensure that the FPSR
  51. | exception byte and condition codes are clear before proceeding,
  52. | except in the case of fmove, which leaves the cc's intact.
  53. |
  54. unsupp_con:
  55. movel USER_FPSR(%a6),%d1
  56. btst #5,CMDREG1B(%a6) |looking for fmove out
  57. bne fmove_con
  58. andl #0xFF00FF,%d1 |clear all but aexcs and qbyte
  59. bras end_fix
  60. fmove_con:
  61. andl #0x0FFF40FF,%d1 |clear all but cc's, snan bit, aexcs, and qbyte
  62. end_fix:
  63. movel %d1,USER_FPSR(%a6)
  64. st UFLG_TMP(%a6) |set flag for unsupp data
  65. bsrl get_op |everything okay, go get operand(s)
  66. bsrl res_func |fix up stack frame so can restore it
  67. clrl -(%a7)
  68. moveb VER_TMP(%a6),(%a7) |move idle fmt word to top of stack
  69. bral gen_except
  70. |
  71. |end