aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/mips/kernel/process.c14
-rw-r--r--include/asm-mips/system.h2
2 files changed, 15 insertions, 1 deletions
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 8f4cf27c7157..bd05f5a927ea 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -25,7 +25,9 @@
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/completion.h> 26#include <linux/completion.h>
27#include <linux/kallsyms.h> 27#include <linux/kallsyms.h>
28#include <linux/random.h>
28 29
30#include <asm/asm.h>
29#include <asm/bootinfo.h> 31#include <asm/bootinfo.h>
30#include <asm/cpu.h> 32#include <asm/cpu.h>
31#include <asm/dsp.h> 33#include <asm/dsp.h>
@@ -460,3 +462,15 @@ unsigned long get_wchan(struct task_struct *task)
460out: 462out:
461 return pc; 463 return pc;
462} 464}
465
466/*
467 * Don't forget that the stack pointer must be aligned on a 8 bytes
468 * boundary for 32-bits ABI and 16 bytes for 64-bits ABI.
469 */
470unsigned long arch_align_stack(unsigned long sp)
471{
472 if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)
473 sp -= get_random_int() & ~PAGE_MASK;
474
475 return sp & ALMASK;
476}
diff --git a/include/asm-mips/system.h b/include/asm-mips/system.h
index eba2e3da9abe..8d0b1cd4a45e 100644
--- a/include/asm-mips/system.h
+++ b/include/asm-mips/system.h
@@ -470,6 +470,6 @@ extern int stop_a_enabled;
470 */ 470 */
471#define __ARCH_WANT_UNLOCKED_CTXSW 471#define __ARCH_WANT_UNLOCKED_CTXSW
472 472
473#define arch_align_stack(x) (x) 473extern unsigned long arch_align_stack(unsigned long sp);
474 474
475#endif /* _ASM_SYSTEM_H */ 475#endif /* _ASM_SYSTEM_H */