diff options
author | David S. Miller <davem@davemloft.net> | 2008-08-12 18:33:56 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-12 18:33:56 -0700 |
commit | 4f70f7a91bffdcc39f088748dc678953eb9a3fbd (patch) | |
tree | 934591a9518fbed87c14b758a1744cc30c9dfbb8 /arch/sparc64/kernel/kstack.h | |
parent | e34456825de0d3ac4c4e8fe0bdc6b599404ea06f (diff) | |
download | op-kernel-dev-4f70f7a91bffdcc39f088748dc678953eb9a3fbd.zip op-kernel-dev-4f70f7a91bffdcc39f088748dc678953eb9a3fbd.tar.gz |
sparc64: Implement IRQ stacks.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc64/kernel/kstack.h')
-rw-r--r-- | arch/sparc64/kernel/kstack.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/arch/sparc64/kernel/kstack.h b/arch/sparc64/kernel/kstack.h new file mode 100644 index 0000000..43909d5 --- /dev/null +++ b/arch/sparc64/kernel/kstack.h @@ -0,0 +1,58 @@ +#ifndef _KSTACK_H +#define _KSTACK_H + +#include <linux/thread_info.h> +#include <linux/sched.h> +#include <asm/ptrace.h> +#include <asm/irq.h> + +/* SP must be STACK_BIAS adjusted already. */ +static inline bool kstack_valid(struct thread_info *tp, unsigned long sp) +{ + unsigned long base = (unsigned long) tp; + + if (sp >= (base + sizeof(struct thread_info)) && + sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf))) + return true; + + base = (unsigned long) hardirq_stack[tp->cpu]; + if (sp >= base && + sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf))) + return true; + base = (unsigned long) softirq_stack[tp->cpu]; + if (sp >= base && + sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf))) + return true; + + return false; +} + +/* Does "regs" point to a valid pt_regs trap frame? */ +static inline bool kstack_is_trap_frame(struct thread_info *tp, struct pt_regs *regs) +{ + unsigned long base = (unsigned long) tp; + unsigned long addr = (unsigned long) regs; + + if (addr >= base && + addr <= (base + THREAD_SIZE - sizeof(*regs))) + goto check_magic; + + base = (unsigned long) hardirq_stack[tp->cpu]; + if (addr >= base && + addr <= (base + THREAD_SIZE - sizeof(*regs))) + goto check_magic; + base = (unsigned long) softirq_stack[tp->cpu]; + if (addr >= base && + addr <= (base + THREAD_SIZE - sizeof(*regs))) + goto check_magic; + + return false; + +check_magic: + if ((regs->magic & ~0x1ff) == PT_REGS_MAGIC) + return true; + return false; + +} + +#endif /* _KSTACK_H */ |