x_unimp.S 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. |
  2. | x_unimp.sa 3.3 7/1/91
  3. |
  4. | fpsp_unimp --- FPSP handler for unimplemented instruction
  5. | exception.
  6. |
  7. | Invoked when the user program encounters a floating-point
  8. | op-code that hardware does not support. Trap vector# 11
  9. | (See table 8-1 MC68030 User's Manual).
  10. |
  11. |
  12. | Note: An fsave for an unimplemented inst. will create a short
  13. | fsave stack.
  14. |
  15. | Input: 1. Six word stack frame for unimplemented inst, four word
  16. | for illegal
  17. | (See table 8-7 MC68030 User's Manual).
  18. | 2. Unimp (short) fsave state frame created here by fsave
  19. | instruction.
  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_UNIMP: |idnt 2,1 | Motorola 040 Floating Point Software Package
  28. |section 8
  29. #include "fpsp.h"
  30. |xref get_op
  31. |xref do_func
  32. |xref sto_res
  33. |xref gen_except
  34. |xref fpsp_fmt_error
  35. .global fpsp_unimp
  36. .global uni_2
  37. fpsp_unimp:
  38. link %a6,#-LOCAL_SIZE
  39. fsave -(%a7)
  40. uni_2:
  41. moveml %d0-%d1/%a0-%a1,USER_DA(%a6)
  42. fmovemx %fp0-%fp3,USER_FP0(%a6)
  43. fmoveml %fpcr/%fpsr/%fpiar,USER_FPCR(%a6)
  44. moveb (%a7),%d0 |test for valid version num
  45. andib #0xf0,%d0 |test for $4x
  46. cmpib #VER_4,%d0 |must be $4x or exit
  47. bnel fpsp_fmt_error
  48. |
  49. | Temporary D25B Fix
  50. | The following lines are used to ensure that the FPSR
  51. | exception byte and condition codes are clear before proceeding
  52. |
  53. movel USER_FPSR(%a6),%d0
  54. andl #0xFF00FF,%d0 |clear all but accrued exceptions
  55. movel %d0,USER_FPSR(%a6)
  56. fmovel #0,%FPSR |clear all user bits
  57. fmovel #0,%FPCR |clear all user exceptions for FPSP
  58. clrb UFLG_TMP(%a6) |clr flag for unsupp data
  59. bsrl get_op |go get operand(s)
  60. clrb STORE_FLG(%a6)
  61. bsrl do_func |do the function
  62. fsave -(%a7) |capture possible exc state
  63. tstb STORE_FLG(%a6)
  64. bnes no_store |if STORE_FLG is set, no store
  65. bsrl sto_res |store the result in user space
  66. no_store:
  67. bral gen_except |post any exceptions and return
  68. |end