4 #include <linux/thread_info.h>
5 #include <linux/sched.h>
6 #include <asm/ptrace.h>
9 /* SP must be STACK_BIAS adjusted already. */
10 static inline bool kstack_valid(struct thread_info *tp, unsigned long sp)
12 unsigned long base = (unsigned long) tp;
14 if (sp >= (base + sizeof(struct thread_info)) &&
15 sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf)))
18 base = (unsigned long) hardirq_stack[tp->cpu];
20 sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf)))
22 base = (unsigned long) softirq_stack[tp->cpu];
24 sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf)))
30 /* Does "regs" point to a valid pt_regs trap frame? */
31 static inline bool kstack_is_trap_frame(struct thread_info *tp, struct pt_regs *regs)
33 unsigned long base = (unsigned long) tp;
34 unsigned long addr = (unsigned long) regs;
37 addr <= (base + THREAD_SIZE - sizeof(*regs)))
40 base = (unsigned long) hardirq_stack[tp->cpu];
42 addr <= (base + THREAD_SIZE - sizeof(*regs)))
44 base = (unsigned long) softirq_stack[tp->cpu];
46 addr <= (base + THREAD_SIZE - sizeof(*regs)))
52 if ((regs->magic & ~0x1ff) == PT_REGS_MAGIC)
58 #endif /* _KSTACK_H */