Commit 0973c687 authored by Greg Ungerer's avatar Greg Ungerer Committed by Al Viro

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: default avatarGreg Ungerer <gerg@uclinux.org>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent be6abfa7
...@@ -100,6 +100,16 @@ struct thread_struct { ...@@ -100,6 +100,16 @@ struct thread_struct {
.fs = __KERNEL_DS, \ .fs = __KERNEL_DS, \
} }
/*
* ColdFire stack format sbould be 0x4 for an aligned usp (will always be
* true on thread creation). We need to set this explicitly.
*/
#ifdef CONFIG_COLDFIRE
#define setframeformat(_regs) do { (_regs)->format = 0x4; } while(0)
#else
#define setframeformat(_regs) do { } while (0)
#endif
#ifdef CONFIG_MMU #ifdef CONFIG_MMU
/* /*
* Do necessary setup to start up a newly executed thread. * 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,6 +119,7 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc,
{ {
regs->pc = pc; regs->pc = pc;
regs->sr &= ~0x2000; regs->sr &= ~0x2000;
setframeformat(regs);
wrusp(usp); wrusp(usp);
} }
...@@ -116,21 +127,11 @@ extern int handle_kernel_fault(struct pt_regs *regs); ...@@ -116,21 +127,11 @@ extern int handle_kernel_fault(struct pt_regs *regs);
#else #else
/*
* Coldfire stacks need to be re-aligned on trap exit, conventional
* 68k can handle this case cleanly.
*/
#ifdef CONFIG_COLDFIRE
#define reformat(_regs) do { (_regs)->format = 0x4; } while(0)
#else
#define reformat(_regs) do { } while (0)
#endif
#define start_thread(_regs, _pc, _usp) \ #define start_thread(_regs, _pc, _usp) \
do { \ do { \
(_regs)->pc = (_pc); \ (_regs)->pc = (_pc); \
((struct switch_stack *)(_regs))[-1].a6 = 0; \ ((struct switch_stack *)(_regs))[-1].a6 = 0; \
reformat(_regs); \ setframeformat(_regs); \
if (current->mm) \ if (current->mm) \
(_regs)->d5 = current->mm->start_data; \ (_regs)->d5 = current->mm->start_data; \
(_regs)->sr &= ~0x2000; \ (_regs)->sr &= ~0x2000; \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment