iwmmxt-notifier.c 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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/types.h>
  18. #include <linux/kernel.h>
  19. #include <linux/signal.h>
  20. #include <linux/sched.h>
  21. #include <linux/init.h>
  22. #include <asm/thread_notify.h>
  23. #include <asm/io.h>
  24. static int iwmmxt_do(struct notifier_block *self, unsigned long cmd, void *t)
  25. {
  26. struct thread_info *thread = t;
  27. switch (cmd) {
  28. case THREAD_NOTIFY_FLUSH:
  29. /*
  30. * flush_thread() zeroes thread->fpstate, so no need
  31. * to do anything here.
  32. *
  33. * FALLTHROUGH: Ensure we don't try to overwrite our newly
  34. * initialised state information on the first fault.
  35. */
  36. case THREAD_NOTIFY_RELEASE:
  37. iwmmxt_task_release(thread);
  38. break;
  39. case THREAD_NOTIFY_SWITCH:
  40. iwmmxt_task_switch(thread);
  41. break;
  42. }
  43. return NOTIFY_DONE;
  44. }
  45. static struct notifier_block iwmmxt_notifier_block = {
  46. .notifier_call = iwmmxt_do,
  47. };
  48. static int __init iwmmxt_init(void)
  49. {
  50. thread_register_notifier(&iwmmxt_notifier_block);
  51. return 0;
  52. }
  53. late_initcall(iwmmxt_init);