fpunote.c 509 B

123456789101112131415161718192021222324252627282930313233343536
  1. #include <u.h>
  2. #include <libc.h>
  3. // Test that the FPU can be used in note handler
  4. void
  5. pass(void) {
  6. print("PASS\n");
  7. exits("PASS");
  8. }
  9. void
  10. fail(const char *msg) {
  11. print("FAIL - %s\n", msg);
  12. exits("FAIL");
  13. }
  14. static float correctnote = 0.0f;
  15. int
  16. handlenote(void *ureg, char *note)
  17. {
  18. if (strstr(note, "mynote")) {
  19. // suicide here if no fpu support for note handlers
  20. correctnote = 1.2f;
  21. pass();
  22. }
  23. return 1;
  24. }
  25. void
  26. main(void)
  27. {
  28. atnotify(handlenote, 1);
  29. postnote(PNPROC, getpid(), "mynote");
  30. }