2012-03-05 11:49:29 +00:00
|
|
|
#ifndef __ASM_IRQ_H
|
|
|
|
#define __ASM_IRQ_H
|
|
|
|
|
2015-12-04 11:02:26 +00:00
|
|
|
#define IRQ_STACK_SIZE THREAD_SIZE
|
|
|
|
#define IRQ_STACK_START_SP THREAD_START_SP
|
|
|
|
|
|
|
|
#ifndef __ASSEMBLER__
|
|
|
|
|
|
|
|
#include <linux/percpu.h>
|
|
|
|
|
2012-03-05 11:49:29 +00:00
|
|
|
#include <asm-generic/irq.h>
|
2015-12-04 11:02:26 +00:00
|
|
|
#include <asm/thread_info.h>
|
2012-03-05 11:49:29 +00:00
|
|
|
|
2014-12-04 06:29:35 +00:00
|
|
|
struct pt_regs;
|
|
|
|
|
2015-12-04 11:02:26 +00:00
|
|
|
DECLARE_PER_CPU(unsigned long [IRQ_STACK_SIZE/sizeof(long)], irq_stack);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The highest address on the stack, and the first to be used. Used to
|
2015-12-09 13:58:42 +00:00
|
|
|
* find the dummy-stack frame put down by el?_irq() in entry.S, which
|
|
|
|
* is structured as follows:
|
|
|
|
*
|
|
|
|
* ------------
|
|
|
|
* | | <- irq_stack_ptr
|
|
|
|
* top ------------
|
2015-12-15 11:21:25 +00:00
|
|
|
* | x19 | <- irq_stack_ptr - 0x08
|
2015-12-09 13:58:42 +00:00
|
|
|
* ------------
|
|
|
|
* | x29 | <- irq_stack_ptr - 0x10
|
|
|
|
* ------------
|
|
|
|
*
|
2015-12-15 11:21:25 +00:00
|
|
|
* where x19 holds a copy of the task stack pointer where the struct pt_regs
|
|
|
|
* from kernel_entry can be found.
|
2015-12-09 13:58:42 +00:00
|
|
|
*
|
2015-12-04 11:02:26 +00:00
|
|
|
*/
|
|
|
|
#define IRQ_STACK_PTR(cpu) ((unsigned long)per_cpu(irq_stack, cpu) + IRQ_STACK_START_SP)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The offset from irq_stack_ptr where entry.S will store the original
|
|
|
|
* stack pointer. Used by unwind_frame() and dump_backtrace().
|
|
|
|
*/
|
2015-12-15 11:21:25 +00:00
|
|
|
#define IRQ_STACK_TO_TASK_STACK(ptr) (*((unsigned long *)((ptr) - 0x08)))
|
2015-12-04 11:02:26 +00:00
|
|
|
|
2013-01-14 12:39:31 +00:00
|
|
|
extern void set_handle_irq(void (*handle_irq)(struct pt_regs *));
|
2012-03-05 11:49:29 +00:00
|
|
|
|
2015-11-20 16:25:04 +00:00
|
|
|
static inline int nr_legacy_irqs(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-12-04 11:02:26 +00:00
|
|
|
static inline bool on_irq_stack(unsigned long sp, int cpu)
|
|
|
|
{
|
|
|
|
/* variable names the same as kernel/stacktrace.c */
|
|
|
|
unsigned long low = (unsigned long)per_cpu(irq_stack, cpu);
|
|
|
|
unsigned long high = low + IRQ_STACK_START_SP;
|
|
|
|
|
|
|
|
return (low <= sp && sp <= high);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* !__ASSEMBLER__ */
|
2012-03-05 11:49:29 +00:00
|
|
|
#endif
|