iwmmxt-notifier.c 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * linux/arch/arm/kernel/iwmmxt-notifier.c
  3. *
  4. * XScale iWMMXt (Concan) context switching and handling
  5. *
  6. * Initial code:
  7. * Copyright (c) 2003, Intel Corporation
  8. *
  9. * Full lazy switching support, optimizations and more, by Nicolas Pitre
  10. * Copyright (c) 2003-2004, MontaVista Software, Inc.
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License version 2 as
  14. * published by the Free Software Foundation.
  15. */
  16. #include <linux/module.h>
  17. #include <linux/config.h>
  18. #include <linux/types.h>
  19. #include <linux/kernel.h>
  20. #include <linux/signal.h>
  21. #include <linux/sched.h>
  22. #include <linux/init.h>
  23. #include <asm/thread_notify.h>
  24. #include <asm/io.h>
  25. static int iwmmxt_do(struct notifier_block *self, unsigned long cmd, void *t)
  26. {
  27. struct thread_info *thread = t;
  28. switch (cmd) {
  29. case THREAD_NOTIFY_FLUSH:
  30. /*
  31. * flush_thread() zeroes thread->fpstate, so no need
  32. * to do anything here.
  33. *
  34. * FALLTHROUGH: Ensure we don't try to overwrite our newly
  35. * initialised state information on the first fault.
  36. */
  37. case THREAD_NOTIFY_RELEASE:
  38. iwmmxt_task_release(thread);
  39. break;
  40. case THREAD_NOTIFY_SWITCH:
  41. iwmmxt_task_switch(thread);
  42. break;
  43. }
  44. return NOTIFY_DONE;
  45. }
  46. static struct notifier_block iwmmxt_notifier_block = {
  47. .notifier_call = iwmmxt_do,
  48. };
  49. static int __init iwmmxt_init(void)
  50. {
  51. thread_register_notifier(&iwmmxt_notifier_block);
  52. return 0;
  53. }
  54. late_initcall(iwmmxt_init);