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