aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/kernel/process.c')
-rw-r--r--arch/mips/kernel/process.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index 8fc69891e117..d4f7fd4550e1 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -32,6 +32,7 @@
32#include <linux/nmi.h> 32#include <linux/nmi.h>
33#include <linux/cpu.h> 33#include <linux/cpu.h>
34 34
35#include <asm/abi.h>
35#include <asm/asm.h> 36#include <asm/asm.h>
36#include <asm/bootinfo.h> 37#include <asm/bootinfo.h>
37#include <asm/cpu.h> 38#include <asm/cpu.h>
@@ -39,6 +40,7 @@
39#include <asm/dsp.h> 40#include <asm/dsp.h>
40#include <asm/fpu.h> 41#include <asm/fpu.h>
41#include <asm/irq.h> 42#include <asm/irq.h>
43#include <asm/mips-cps.h>
42#include <asm/msa.h> 44#include <asm/msa.h>
43#include <asm/pgtable.h> 45#include <asm/pgtable.h>
44#include <asm/mipsregs.h> 46#include <asm/mipsregs.h>
@@ -645,6 +647,29 @@ out:
645 return pc; 647 return pc;
646} 648}
647 649
650unsigned long mips_stack_top(void)
651{
652 unsigned long top = TASK_SIZE & PAGE_MASK;
653
654 /* One page for branch delay slot "emulation" */
655 top -= PAGE_SIZE;
656
657 /* Space for the VDSO, data page & GIC user page */
658 top -= PAGE_ALIGN(current->thread.abi->vdso->size);
659 top -= PAGE_SIZE;
660 top -= mips_gic_present() ? PAGE_SIZE : 0;
661
662 /* Space for cache colour alignment */
663 if (cpu_has_dc_aliases)
664 top -= shm_align_mask + 1;
665
666 /* Space to randomize the VDSO base */
667 if (current->flags & PF_RANDOMIZE)
668 top -= VDSO_RANDOMIZE_SIZE;
669
670 return top;
671}
672
648/* 673/*
649 * Don't forget that the stack pointer must be aligned on a 8 bytes 674 * Don't forget that the stack pointer must be aligned on a 8 bytes
650 * boundary for 32-bits ABI and 16 bytes for 64-bits ABI. 675 * boundary for 32-bits ABI and 16 bytes for 64-bits ABI.