xtensa: move spill_registers to traps.h
authorMax Filippov <jcmvbkbc@gmail.com>
Sun, 3 Feb 2013 01:39:22 +0000 (05:39 +0400)
committerChris Zankel <chris@zankel.net>
Sun, 24 Feb 2013 03:22:48 +0000 (19:22 -0800)
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Chris Zankel <chris@zankel.net>
arch/xtensa/include/asm/traps.h
arch/xtensa/kernel/traps.c

index 54f70440185e359c34daf6e4012104a93d4ca408..b5464ef3cf66b4184714a178b193a0c3e3c07c70 100644 (file)
 extern void * __init trap_set_handler(int cause, void *handler);
 extern void do_unhandled(struct pt_regs *regs, unsigned long exccause);
 
+static inline void spill_registers(void)
+{
+       unsigned int a0, ps;
+
+       __asm__ __volatile__ (
+               "movi   a14, " __stringify(PS_EXCM_BIT | LOCKLEVEL) "\n\t"
+               "mov    a12, a0\n\t"
+               "rsr    a13, sar\n\t"
+               "xsr    a14, ps\n\t"
+               "movi   a0, _spill_registers\n\t"
+               "rsync\n\t"
+               "callx0 a0\n\t"
+               "mov    a0, a12\n\t"
+               "wsr    a13, sar\n\t"
+               "wsr    a14, ps\n\t"
+               : : "a" (&a0), "a" (&ps)
+#if defined(CONFIG_FRAME_POINTER)
+               : "a2", "a3", "a4",       "a11", "a12", "a13", "a14", "a15",
+#else
+               : "a2", "a3", "a4", "a7", "a11", "a12", "a13", "a14", "a15",
+#endif
+                 "memory");
+}
+
 #endif /* _XTENSA_TRAPS_H */
index 9b5c345d2b4f306a4a1e03da98a1901e45c5af18..5e0f81a651863dc2069ee508032c9417e84e18f3 100644 (file)
@@ -37,6 +37,7 @@
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
 #include <asm/processor.h>
+#include <asm/traps.h>
 
 #ifdef CONFIG_KGDB
 extern int gdb_enter;
@@ -413,26 +414,6 @@ static __always_inline unsigned long *stack_pointer(struct task_struct *task)
        return sp;
 }
 
-static inline void spill_registers(void)
-{
-       unsigned int a0, ps;
-
-       __asm__ __volatile__ (
-               "movi   a14, " __stringify(PS_EXCM_BIT | LOCKLEVEL) "\n\t"
-               "mov    a12, a0\n\t"
-               "rsr    a13, sar\n\t"
-               "xsr    a14, ps\n\t"
-               "movi   a0, _spill_registers\n\t"
-               "rsync\n\t"
-               "callx0 a0\n\t"
-               "mov    a0, a12\n\t"
-               "wsr    a13, sar\n\t"
-               "wsr    a14, ps\n\t"
-               :: "a" (&a0), "a" (&ps)
-               : "a2", "a3", "a4", "a7", "a11", "a12", "a13", "a14", "a15",
-                 "memory");
-}
-
 void show_trace(struct task_struct *task, unsigned long *sp)
 {
        unsigned long a0, a1, pc;