Skip to content
Snippets Groups Projects
Commit 7bf9a37d authored by Greg Ungerer's avatar Greg Ungerer Committed by Linus Torvalds
Browse files

[PATCH] m68knommu: force stack alignment on ColdFire


This patch solve a bug triggered by execvp (this function use calloc to
store the argument list and gcc 3.4.x align the stack to word, not to dword).
This situation aren't related to signal handling and all 2.6.x have the bug.
On ColdFire targets we must force the stack to be aligned.

Original patch from Andrea Tarani <andrea.tarani@gilbarco.com>,

Signed-off-by: default avatarGreg Ungerer <gerg@uclinux.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 31f4fde3
No related branches found
No related tags found
No related merge requests found
...@@ -77,20 +77,32 @@ struct thread_struct { ...@@ -77,20 +77,32 @@ struct thread_struct {
{0, 0}, 0, {0,}, {0, 0, 0}, {0,}, \ {0, 0}, 0, {0,}, {0, 0, 0}, {0,}, \
} }
/*
* Coldfire stacks need to be re-aligned on trap exit, conventional
* 68k can handle this case cleanly.
*/
#if defined(CONFIG_COLDFIRE)
#define reformat(_regs) do { (_regs)->format = 0x4; } while(0)
#else
#define reformat(_regs) do { } while (0)
#endif
/* /*
* Do necessary setup to start up a newly executed thread. * Do necessary setup to start up a newly executed thread.
* *
* pass the data segment into user programs if it exists, * pass the data segment into user programs if it exists,
* it can't hurt anything as far as I can tell * it can't hurt anything as far as I can tell
*/ */
#define start_thread(_regs, _pc, _usp) \ #define start_thread(_regs, _pc, _usp) \
do { \ do { \
set_fs(USER_DS); /* reads from user space */ \ set_fs(USER_DS); /* reads from user space */ \
(_regs)->pc = (_pc); \ (_regs)->pc = (_pc); \
if (current->mm) \ ((struct switch_stack *)(_regs))[-1].a6 = 0; \
(_regs)->d5 = current->mm->start_data; \ reformat(_regs); \
(_regs)->sr &= ~0x2000; \ if (current->mm) \
wrusp(_usp); \ (_regs)->d5 = current->mm->start_data; \
(_regs)->sr &= ~0x2000; \
wrusp(_usp); \
} while(0) } while(0)
/* Forward declaration, a strange C thing */ /* Forward declaration, a strange C thing */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment