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 /* Stack pointer must be 16-byte aligned. */
18 if (sp >= (base + sizeof(struct thread_info)) &&
19 sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf)))
22 if (hardirq_stack[tp->cpu]) {
23 base = (unsigned long) hardirq_stack[tp->cpu];
25 sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf)))
27 base = (unsigned long) softirq_stack[tp->cpu];
29 sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf)))
35 /* Does "regs" point to a valid pt_regs trap frame? */
36 static inline bool kstack_is_trap_frame(struct thread_info *tp, struct pt_regs *regs)
38 unsigned long base = (unsigned long) tp;
39 unsigned long addr = (unsigned long) regs;
42 addr <= (base + THREAD_SIZE - sizeof(*regs)))
45 if (hardirq_stack[tp->cpu]) {
46 base = (unsigned long) hardirq_stack[tp->cpu];
48 addr <= (base + THREAD_SIZE - sizeof(*regs)))
50 base = (unsigned long) softirq_stack[tp->cpu];
52 addr <= (base + THREAD_SIZE - sizeof(*regs)))
58 if ((regs->magic & ~0x1ff) == PT_REGS_MAGIC)
64 #endif /* _KSTACK_H */