summaryrefslogtreecommitdiff
path: root/arch/sparc/kernel/kstack.h
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2010-04-14 02:04:29 -0700
committerDavid S. Miller <davem@davemloft.net>2010-04-14 02:04:29 -0700
commitec687886de00e1e63f3d821ccade9a61590408ed (patch)
tree093e303475754d30b679bd35ae9cc5522832057e /arch/sparc/kernel/kstack.h
parent035df35d968323f6f463c8789553e8589efcbcd4 (diff)
sparc64: Run NMIs on the hardirq stack.
Otherwise we can overflow the main stack with the function tracer enabled. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/kernel/kstack.h')
-rw-r--r--arch/sparc/kernel/kstack.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/arch/sparc/kernel/kstack.h b/arch/sparc/kernel/kstack.h
index 5247283d1c03..53dfb92e09fb 100644
--- a/arch/sparc/kernel/kstack.h
+++ b/arch/sparc/kernel/kstack.h
@@ -61,4 +61,23 @@ check_magic:
}
+static inline __attribute__((always_inline)) void *set_hardirq_stack(void)
+{
+ void *orig_sp, *sp = hardirq_stack[smp_processor_id()];
+
+ __asm__ __volatile__("mov %%sp, %0" : "=r" (orig_sp));
+ if (orig_sp < sp ||
+ orig_sp > (sp + THREAD_SIZE)) {
+ sp += THREAD_SIZE - 192 - STACK_BIAS;
+ __asm__ __volatile__("mov %0, %%sp" : : "r" (sp));
+ }
+
+ return orig_sp;
+}
+
+static inline __attribute__((always_inline)) void restore_hardirq_stack(void *orig_sp)
+{
+ __asm__ __volatile__("mov %0, %%sp" : : "r" (orig_sp));
+}
+
#endif /* _KSTACK_H */