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 if (hardirq_stack
[tp
->cpu
]) {
19 base
= (unsigned long) hardirq_stack
[tp
->cpu
];
21 sp
<= (base
+ THREAD_SIZE
- sizeof(struct sparc_stackf
)))
23 base
= (unsigned long) softirq_stack
[tp
->cpu
];
25 sp
<= (base
+ THREAD_SIZE
- sizeof(struct sparc_stackf
)))
31 /* Does "regs" point to a valid pt_regs trap frame? */
32 static inline bool kstack_is_trap_frame(struct thread_info
*tp
, struct pt_regs
*regs
)
34 unsigned long base
= (unsigned long) tp
;
35 unsigned long addr
= (unsigned long) regs
;
38 addr
<= (base
+ THREAD_SIZE
- sizeof(*regs
)))
41 if (hardirq_stack
[tp
->cpu
]) {
42 base
= (unsigned long) hardirq_stack
[tp
->cpu
];
44 addr
<= (base
+ THREAD_SIZE
- sizeof(*regs
)))
46 base
= (unsigned long) softirq_stack
[tp
->cpu
];
48 addr
<= (base
+ THREAD_SIZE
- sizeof(*regs
)))
54 if ((regs
->magic
& ~0x1ff) == PT_REGS_MAGIC
)
60 #endif /* _KSTACK_H */