aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Ungerer <gerg@uclinux.org>2012-09-12 05:13:19 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-10-01 00:44:43 -0400
commit0973c687e05a802a757664722678d2b5016f1c1c (patch)
tree9c83e715a057d418e77cd95377a780ec21d30bff
parentbe6abfa769fa07ce89ac73273360b335ae978805 (diff)
m68k: always set stack frame format for ColdFire on thread start
The stack frame "format" field needs to be explicitly set on thread creation on ColdFire. For a normal long word aligned user stack pointer the frame format is 0x4. We were doing this for non-MMU ColdFire, but not for the case with MMU enabled. So fix it so we always do it if targeting ColdFire. The old code happend to rely on the stack frame format being inhereted from the process calling exec. Furture changes means that may not always work, so we really do want to set it explicitly. Signed-off-by: Greg Ungerer <gerg@uclinux.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--arch/m68k/include/asm/processor.h23
1 files changed, 12 insertions, 11 deletions
diff --git a/arch/m68k/include/asm/processor.h b/arch/m68k/include/asm/processor.h
index f17c42aff7ff..9b4c82c1ef47 100644
--- a/arch/m68k/include/asm/processor.h
+++ b/arch/m68k/include/asm/processor.h
@@ -100,6 +100,16 @@ struct thread_struct {
100 .fs = __KERNEL_DS, \ 100 .fs = __KERNEL_DS, \
101} 101}
102 102
103/*
104 * ColdFire stack format sbould be 0x4 for an aligned usp (will always be
105 * true on thread creation). We need to set this explicitly.
106 */
107#ifdef CONFIG_COLDFIRE
108#define setframeformat(_regs) do { (_regs)->format = 0x4; } while(0)
109#else
110#define setframeformat(_regs) do { } while (0)
111#endif
112
103#ifdef CONFIG_MMU 113#ifdef CONFIG_MMU
104/* 114/*
105 * Do necessary setup to start up a newly executed thread. 115 * Do necessary setup to start up a newly executed thread.
@@ -109,6 +119,7 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc,
109{ 119{
110 regs->pc = pc; 120 regs->pc = pc;
111 regs->sr &= ~0x2000; 121 regs->sr &= ~0x2000;
122 setframeformat(regs);
112 wrusp(usp); 123 wrusp(usp);
113} 124}
114 125
@@ -116,21 +127,11 @@ extern int handle_kernel_fault(struct pt_regs *regs);
116 127
117#else 128#else
118 129
119/*
120 * Coldfire stacks need to be re-aligned on trap exit, conventional
121 * 68k can handle this case cleanly.
122 */
123#ifdef CONFIG_COLDFIRE
124#define reformat(_regs) do { (_regs)->format = 0x4; } while(0)
125#else
126#define reformat(_regs) do { } while (0)
127#endif
128
129#define start_thread(_regs, _pc, _usp) \ 130#define start_thread(_regs, _pc, _usp) \
130do { \ 131do { \
131 (_regs)->pc = (_pc); \ 132 (_regs)->pc = (_pc); \
132 ((struct switch_stack *)(_regs))[-1].a6 = 0; \ 133 ((struct switch_stack *)(_regs))[-1].a6 = 0; \
133 reformat(_regs); \ 134 setframeformat(_regs); \
134 if (current->mm) \ 135 if (current->mm) \
135 (_regs)->d5 = current->mm->start_data; \ 136 (_regs)->d5 = current->mm->start_data; \
136 (_regs)->sr &= ~0x2000; \ 137 (_regs)->sr &= ~0x2000; \