irq.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef __ASM_IRQ_H
  2. #define __ASM_IRQ_H
  3. #define IRQ_STACK_SIZE THREAD_SIZE
  4. #define IRQ_STACK_START_SP THREAD_START_SP
  5. #ifndef __ASSEMBLER__
  6. #include <linux/percpu.h>
  7. #include <asm-generic/irq.h>
  8. #include <asm/thread_info.h>
  9. struct pt_regs;
  10. DECLARE_PER_CPU(unsigned long [IRQ_STACK_SIZE/sizeof(long)], irq_stack);
  11. /*
  12. * The highest address on the stack, and the first to be used. Used to
  13. * find the dummy-stack frame put down by el?_irq() in entry.S, which
  14. * is structured as follows:
  15. *
  16. * ------------
  17. * | | <- irq_stack_ptr
  18. * top ------------
  19. * | x19 | <- irq_stack_ptr - 0x08
  20. * ------------
  21. * | x29 | <- irq_stack_ptr - 0x10
  22. * ------------
  23. *
  24. * where x19 holds a copy of the task stack pointer where the struct pt_regs
  25. * from kernel_entry can be found.
  26. *
  27. */
  28. #define IRQ_STACK_PTR(cpu) ((unsigned long)per_cpu(irq_stack, cpu) + IRQ_STACK_START_SP)
  29. /*
  30. * The offset from irq_stack_ptr where entry.S will store the original
  31. * stack pointer. Used by unwind_frame() and dump_backtrace().
  32. */
  33. #define IRQ_STACK_TO_TASK_STACK(ptr) (*((unsigned long *)((ptr) - 0x08)))
  34. extern void set_handle_irq(void (*handle_irq)(struct pt_regs *));
  35. static inline int nr_legacy_irqs(void)
  36. {
  37. return 0;
  38. }
  39. static inline bool on_irq_stack(unsigned long sp, int cpu)
  40. {
  41. /* variable names the same as kernel/stacktrace.c */
  42. unsigned long low = (unsigned long)per_cpu(irq_stack, cpu);
  43. unsigned long high = low + IRQ_STACK_START_SP;
  44. return (low <= sp && sp <= high);
  45. }
  46. #endif /* !__ASSEMBLER__ */
  47. #endif