irq.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. *
  3. * linux/arch/cris/kernel/irq.c
  4. *
  5. * Copyright (c) 2000,2007 Axis Communications AB
  6. *
  7. * Authors: Bjorn Wesen (bjornw@axis.com)
  8. *
  9. * This file contains the code used by various IRQ handling routines:
  10. * asking for different IRQs should be done through these routines
  11. * instead of just grabbing them. Thus setups with different IRQ numbers
  12. * shouldn't result in any weird surprises, and installing new handlers
  13. * should be easier.
  14. *
  15. */
  16. /*
  17. * IRQs are in fact implemented a bit like signal handlers for the kernel.
  18. * Naturally it's not a 1:1 relation, but there are similarities.
  19. */
  20. #include <linux/module.h>
  21. #include <linux/ptrace.h>
  22. #include <linux/irq.h>
  23. #include <linux/kernel_stat.h>
  24. #include <linux/signal.h>
  25. #include <linux/sched.h>
  26. #include <linux/ioport.h>
  27. #include <linux/interrupt.h>
  28. #include <linux/timex.h>
  29. #include <linux/random.h>
  30. #include <linux/init.h>
  31. #include <linux/seq_file.h>
  32. #include <linux/errno.h>
  33. #include <linux/spinlock.h>
  34. #include <asm/io.h>
  35. #include <arch/system.h>
  36. /* called by the assembler IRQ entry functions defined in irq.h
  37. * to dispatch the interrupts to registered handlers
  38. */
  39. asmlinkage void do_IRQ(int irq, struct pt_regs * regs)
  40. {
  41. unsigned long sp;
  42. struct pt_regs *old_regs;
  43. trace_hardirqs_off();
  44. old_regs = set_irq_regs(regs);
  45. irq_enter();
  46. sp = rdsp();
  47. if (unlikely((sp & (PAGE_SIZE - 1)) < (PAGE_SIZE/8))) {
  48. printk("do_IRQ: stack overflow: %lX\n", sp);
  49. show_stack(NULL, (unsigned long *)sp);
  50. }
  51. generic_handle_irq(irq);
  52. irq_exit();
  53. set_irq_regs(old_regs);
  54. }
  55. void weird_irq(void)
  56. {
  57. local_irq_disable();
  58. printk("weird irq\n");
  59. while(1);
  60. }