softfpu.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #include "u.h"
  2. #include "../port/lib.h"
  3. #include "mem.h"
  4. #include "dat.h"
  5. #include "fns.h"
  6. int
  7. fpudevprocio(Proc* proc, void* a, long n, uintptr offset, int write)
  8. {
  9. /*
  10. * Called from procdevtab.read and procdevtab.write
  11. * allow user process access to the FPU registers.
  12. * This is the only FPU routine which is called directly
  13. * from the port code; it would be nice to have dynamic
  14. * creation of entries in the device file trees...
  15. */
  16. USED(proc, a, n, offset, write);
  17. return 0;
  18. }
  19. void
  20. fpunotify(Ureg*)
  21. {
  22. /*
  23. * Called when a note is about to be delivered to a
  24. * user process, usually at the end of a system call.
  25. * Note handlers are not allowed to use the FPU so
  26. * the state is marked (after saving if necessary) and
  27. * checked in the Device Not Available handler.
  28. */
  29. }
  30. void
  31. fpunoted(void)
  32. {
  33. /*
  34. * Called from sysnoted() via the machine-dependent
  35. * noted() routine.
  36. * Clear the flag set above in fpunotify().
  37. */
  38. }
  39. void
  40. fpusysrfork(Ureg*)
  41. {
  42. /*
  43. * Called early in the non-interruptible path of
  44. * sysrfork() via the machine-dependent syscall() routine.
  45. * Save the state so that it can be easily copied
  46. * to the child process later.
  47. */
  48. }
  49. void
  50. fpusysrforkchild(Proc*, Ureg *, Proc*)
  51. {
  52. /*
  53. * Called later in sysrfork() via the machine-dependent
  54. * sysrforkchild() routine.
  55. * Copy the parent FPU state to the child.
  56. */
  57. }
  58. void
  59. fpuprocsave(Proc*)
  60. {
  61. /*
  62. * Called from sched() and sleep() via the machine-dependent
  63. * procsave() routine.
  64. * About to go in to the scheduler.
  65. * If the process wasn't using the FPU
  66. * there's nothing to do.
  67. */
  68. }
  69. void
  70. fpuprocrestore(Proc*)
  71. {
  72. /*
  73. * The process has been rescheduled and is about to run.
  74. * Nothing to do here right now. If the process tries to use
  75. * the FPU again it will cause a Device Not Available
  76. * exception and the state will then be restored.
  77. */
  78. }
  79. void
  80. fpusysprocsetup(Proc*)
  81. {
  82. /*
  83. * Disable the FPU.
  84. * Called from sysexec() via sysprocsetup() to
  85. * set the FPU for the new process.
  86. */
  87. }
  88. void
  89. fpuinit(void)
  90. {
  91. }
  92. int
  93. fpuemu(Ureg* ureg)
  94. {
  95. int nfp;
  96. if(waserror()){
  97. splhi();
  98. postnote(up, 1, up->errstr, NDebug);
  99. return 1;
  100. }
  101. spllo();
  102. nfp = fpiarm(ureg);
  103. splhi();
  104. poperror();
  105. return nfp;
  106. }