diff options
author | David S. Miller <davem@davemloft.net> | 2008-08-12 21:33:56 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-08-12 21:33:56 -0400 |
commit | 4f70f7a91bffdcc39f088748dc678953eb9a3fbd (patch) | |
tree | 934591a9518fbed87c14b758a1744cc30c9dfbb8 /arch/sparc64/kernel/kstack.h | |
parent | e34456825de0d3ac4c4e8fe0bdc6b599404ea06f (diff) |
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 000000000000..43909d5680ea --- /dev/null +++ b/arch/sparc64/kernel/kstack.h | |||
@@ -0,0 +1,58 @@ | |||
1 | #ifndef _KSTACK_H | ||
2 | #define _KSTACK_H | ||
3 | |||
4 | #include <linux/thread_info.h> | ||
5 | #include <linux/sched.h> | ||
6 | #include <asm/ptrace.h> | ||
7 | #include <asm/irq.h> | ||
8 | |||
9 | /* SP must be STACK_BIAS adjusted already. */ | ||
10 | static inline bool kstack_valid(struct thread_info *tp, unsigned long sp) | ||
11 | { | ||
12 | unsigned long base = (unsigned long) tp; | ||
13 | |||
14 | if (sp >= (base + sizeof(struct thread_info)) && | ||
15 | sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf))) | ||
16 | return true; | ||
17 | |||
18 | base = (unsigned long) hardirq_stack[tp->cpu]; | ||
19 | if (sp >= base && | ||
20 | sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf))) | ||
21 | return true; | ||
22 | base = (unsigned long) softirq_stack[tp->cpu]; | ||
23 | if (sp >= base && | ||
24 | sp <= (base + THREAD_SIZE - sizeof(struct sparc_stackf))) | ||
25 | return true; | ||
26 | |||
27 | return false; | ||
28 | } | ||
29 | |||
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) | ||
32 | { | ||
33 | unsigned long base = (unsigned long) tp; | ||
34 | unsigned long addr = (unsigned long) regs; | ||
35 | |||
36 | if (addr >= base && | ||
37 | addr <= (base + THREAD_SIZE - sizeof(*regs))) | ||
38 | goto check_magic; | ||
39 | |||
40 | base = (unsigned long) hardirq_stack[tp->cpu]; | ||
41 | if (addr >= base && | ||
42 | addr <= (base + THREAD_SIZE - sizeof(*regs))) | ||
43 | goto check_magic; | ||
44 | base = (unsigned long) softirq_stack[tp->cpu]; | ||
45 | if (addr >= base && | ||
46 | addr <= (base + THREAD_SIZE - sizeof(*regs))) | ||
47 | goto check_magic; | ||
48 | |||
49 | return false; | ||
50 | |||
51 | check_magic: | ||
52 | if ((regs->magic & ~0x1ff) == PT_REGS_MAGIC) | ||
53 | return true; | ||
54 | return false; | ||
55 | |||
56 | } | ||
57 | |||
58 | #endif /* _KSTACK_H */ | ||