diff options
author | Greg Ungerer <gerg@snapgear.com> | 2006-06-25 21:01:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-26 00:04:24 -0400 |
commit | 7bf9a37d8df1e7db82784117d28bb98da5f53f2f (patch) | |
tree | 605552c82a6e6f50459af7c487cdddc984001693 /include/asm-m68knommu/processor.h | |
parent | 31f4fde38c5027ca05941db4a05c163d6314278e (diff) |
[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: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-m68knommu/processor.h')
-rw-r--r-- | include/asm-m68knommu/processor.h | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/include/asm-m68knommu/processor.h b/include/asm-m68knommu/processor.h index 278b00bc60c5..0ee158e09abb 100644 --- a/include/asm-m68knommu/processor.h +++ b/include/asm-m68knommu/processor.h | |||
@@ -78,19 +78,31 @@ struct thread_struct { | |||
78 | } | 78 | } |
79 | 79 | ||
80 | /* | 80 | /* |
81 | * Coldfire stacks need to be re-aligned on trap exit, conventional | ||
82 | * 68k can handle this case cleanly. | ||
83 | */ | ||
84 | #if defined(CONFIG_COLDFIRE) | ||
85 | #define reformat(_regs) do { (_regs)->format = 0x4; } while(0) | ||
86 | #else | ||
87 | #define reformat(_regs) do { } while (0) | ||
88 | #endif | ||
89 | |||
90 | /* | ||
81 | * Do necessary setup to start up a newly executed thread. | 91 | * Do necessary setup to start up a newly executed thread. |
82 | * | 92 | * |
83 | * pass the data segment into user programs if it exists, | 93 | * pass the data segment into user programs if it exists, |
84 | * it can't hurt anything as far as I can tell | 94 | * it can't hurt anything as far as I can tell |
85 | */ | 95 | */ |
86 | #define start_thread(_regs, _pc, _usp) \ | 96 | #define start_thread(_regs, _pc, _usp) \ |
87 | do { \ | 97 | do { \ |
88 | set_fs(USER_DS); /* reads from user space */ \ | 98 | set_fs(USER_DS); /* reads from user space */ \ |
89 | (_regs)->pc = (_pc); \ | 99 | (_regs)->pc = (_pc); \ |
90 | if (current->mm) \ | 100 | ((struct switch_stack *)(_regs))[-1].a6 = 0; \ |
91 | (_regs)->d5 = current->mm->start_data; \ | 101 | reformat(_regs); \ |
92 | (_regs)->sr &= ~0x2000; \ | 102 | if (current->mm) \ |
93 | wrusp(_usp); \ | 103 | (_regs)->d5 = current->mm->start_data; \ |
104 | (_regs)->sr &= ~0x2000; \ | ||
105 | wrusp(_usp); \ | ||
94 | } while(0) | 106 | } while(0) |
95 | 107 | ||
96 | /* Forward declaration, a strange C thing */ | 108 | /* Forward declaration, a strange C thing */ |