From c0c3835db0af8da107b458542d5139c93e69568e Mon Sep 17 00:00:00 2001 From: Franck Bui-Huu Date: Thu, 19 Jul 2007 14:04:21 +0200 Subject: [PATCH] --- yaml --- r: 62202 b: refs/heads/master c: 941091024ef0f2f7e09eb81201d293ac18833cc8 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/mips/kernel/process.c | 14 ++++++++++++++ trunk/include/asm-mips/system.h | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 85ea0301b7c5..a7f4e8c678c8 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c55757b261038d17c729068fcdaef646a665385f +refs/heads/master: 941091024ef0f2f7e09eb81201d293ac18833cc8 diff --git a/trunk/arch/mips/kernel/process.c b/trunk/arch/mips/kernel/process.c index 8f4cf27c7157..bd05f5a927ea 100644 --- a/trunk/arch/mips/kernel/process.c +++ b/trunk/arch/mips/kernel/process.c @@ -25,7 +25,9 @@ #include #include #include +#include +#include #include #include #include @@ -460,3 +462,15 @@ unsigned long get_wchan(struct task_struct *task) out: return pc; } + +/* + * Don't forget that the stack pointer must be aligned on a 8 bytes + * boundary for 32-bits ABI and 16 bytes for 64-bits ABI. + */ +unsigned long arch_align_stack(unsigned long sp) +{ + if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space) + sp -= get_random_int() & ~PAGE_MASK; + + return sp & ALMASK; +} diff --git a/trunk/include/asm-mips/system.h b/trunk/include/asm-mips/system.h index eba2e3da9abe..8d0b1cd4a45e 100644 --- a/trunk/include/asm-mips/system.h +++ b/trunk/include/asm-mips/system.h @@ -470,6 +470,6 @@ extern int stop_a_enabled; */ #define __ARCH_WANT_UNLOCKED_CTXSW -#define arch_align_stack(x) (x) +extern unsigned long arch_align_stack(unsigned long sp); #endif /* _ASM_SYSTEM_H */