aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2006-03-17 20:33:56 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-03-20 04:16:36 -0500
commitd61e16df940e02e25679bdc1aee8c25786f6de90 (patch)
treede76f4007d526835b8564203341ebf66ca29b12d
parenta91690ddd05ab0b7fbdd37733875525ac75c20f2 (diff)
[SPARC64]: Increase top of 32-bit process stack.
Put it one page below the top of the 32-bit address space. This gives us ~16MB more address space to work with. Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--arch/sparc64/kernel/binfmt_elf32.c4
-rw-r--r--arch/sparc64/kernel/sys_sparc.c13
-rw-r--r--arch/sparc64/kernel/sys_sparc32.c9
-rw-r--r--arch/sparc64/solaris/misc.c4
-rw-r--r--include/asm-sparc64/a.out.h6
5 files changed, 21 insertions, 15 deletions
diff --git a/arch/sparc64/kernel/binfmt_elf32.c b/arch/sparc64/kernel/binfmt_elf32.c
index a1a12d2aa353..8a2abcce2737 100644
--- a/arch/sparc64/kernel/binfmt_elf32.c
+++ b/arch/sparc64/kernel/binfmt_elf32.c
@@ -153,7 +153,9 @@ MODULE_AUTHOR("Eric Youngdale, David S. Miller, Jakub Jelinek");
153#undef MODULE_DESCRIPTION 153#undef MODULE_DESCRIPTION
154#undef MODULE_AUTHOR 154#undef MODULE_AUTHOR
155 155
156#include <asm/a.out.h>
157
156#undef TASK_SIZE 158#undef TASK_SIZE
157#define TASK_SIZE 0xf0000000 159#define TASK_SIZE STACK_TOP32
158 160
159#include "../../../fs/binfmt_elf.c" 161#include "../../../fs/binfmt_elf.c"
diff --git a/arch/sparc64/kernel/sys_sparc.c b/arch/sparc64/kernel/sys_sparc.c
index 61dffb9349bd..9019b41fc02a 100644
--- a/arch/sparc64/kernel/sys_sparc.c
+++ b/arch/sparc64/kernel/sys_sparc.c
@@ -30,6 +30,7 @@
30#include <asm/ipc.h> 30#include <asm/ipc.h>
31#include <asm/utrap.h> 31#include <asm/utrap.h>
32#include <asm/perfctr.h> 32#include <asm/perfctr.h>
33#include <asm/a.out.h>
33 34
34/* #define DEBUG_UNIMP_SYSCALL */ 35/* #define DEBUG_UNIMP_SYSCALL */
35 36
@@ -130,7 +131,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
130 } 131 }
131 132
132 if (test_thread_flag(TIF_32BIT)) 133 if (test_thread_flag(TIF_32BIT))
133 task_size = 0xf0000000UL; 134 task_size = STACK_TOP32;
134 if (unlikely(len > task_size || len >= VA_EXCLUDE_START)) 135 if (unlikely(len > task_size || len >= VA_EXCLUDE_START))
135 return -ENOMEM; 136 return -ENOMEM;
136 137
@@ -203,7 +204,7 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
203{ 204{
204 struct vm_area_struct *vma; 205 struct vm_area_struct *vma;
205 struct mm_struct *mm = current->mm; 206 struct mm_struct *mm = current->mm;
206 unsigned long task_size = 0xf0000000UL; 207 unsigned long task_size = STACK_TOP32;
207 unsigned long addr = addr0; 208 unsigned long addr = addr0;
208 int do_color_align; 209 int do_color_align;
209 210
@@ -370,7 +371,7 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
370 mm->unmap_area = arch_unmap_area; 371 mm->unmap_area = arch_unmap_area;
371 } else { 372 } else {
372 /* We know it's 32-bit */ 373 /* We know it's 32-bit */
373 unsigned long task_size = 0xf0000000UL; 374 unsigned long task_size = STACK_TOP32;
374 unsigned long gap; 375 unsigned long gap;
375 376
376 gap = current->signal->rlim[RLIMIT_STACK].rlim_cur; 377 gap = current->signal->rlim[RLIMIT_STACK].rlim_cur;
@@ -388,7 +389,7 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
388asmlinkage unsigned long sparc_brk(unsigned long brk) 389asmlinkage unsigned long sparc_brk(unsigned long brk)
389{ 390{
390 /* People could try to be nasty and use ta 0x6d in 32bit programs */ 391 /* People could try to be nasty and use ta 0x6d in 32bit programs */
391 if (test_thread_flag(TIF_32BIT) && brk >= 0xf0000000UL) 392 if (test_thread_flag(TIF_32BIT) && brk >= STACK_TOP32)
392 return current->mm->brk; 393 return current->mm->brk;
393 394
394 if (unlikely(straddles_64bit_va_hole(current->mm->brk, brk))) 395 if (unlikely(straddles_64bit_va_hole(current->mm->brk, brk)))
@@ -554,10 +555,10 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
554 retval = -EINVAL; 555 retval = -EINVAL;
555 556
556 if (test_thread_flag(TIF_32BIT)) { 557 if (test_thread_flag(TIF_32BIT)) {
557 if (len >= 0xf0000000UL) 558 if (len >= STACK_TOP32)
558 goto out_putf; 559 goto out_putf;
559 560
560 if ((flags & MAP_FIXED) && addr > 0xf0000000UL - len) 561 if ((flags & MAP_FIXED) && addr > STACK_TOP32 - len)
561 goto out_putf; 562 goto out_putf;
562 } else { 563 } else {
563 if (len >= VA_EXCLUDE_START) 564 if (len >= VA_EXCLUDE_START)
diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c
index 417727bd87ba..0e41df024489 100644
--- a/arch/sparc64/kernel/sys_sparc32.c
+++ b/arch/sparc64/kernel/sys_sparc32.c
@@ -62,6 +62,7 @@
62#include <asm/fpumacro.h> 62#include <asm/fpumacro.h>
63#include <asm/semaphore.h> 63#include <asm/semaphore.h>
64#include <asm/mmu_context.h> 64#include <asm/mmu_context.h>
65#include <asm/a.out.h>
65 66
66asmlinkage long sys32_chown16(const char __user * filename, u16 user, u16 group) 67asmlinkage long sys32_chown16(const char __user * filename, u16 user, u16 group)
67{ 68{
@@ -1039,15 +1040,15 @@ asmlinkage unsigned long sys32_mremap(unsigned long addr,
1039 unsigned long ret = -EINVAL; 1040 unsigned long ret = -EINVAL;
1040 unsigned long new_addr = __new_addr; 1041 unsigned long new_addr = __new_addr;
1041 1042
1042 if (old_len > 0xf0000000UL || new_len > 0xf0000000UL) 1043 if (old_len > STACK_TOP32 || new_len > STACK_TOP32)
1043 goto out; 1044 goto out;
1044 if (addr > 0xf0000000UL - old_len) 1045 if (addr > STACK_TOP32 - old_len)
1045 goto out; 1046 goto out;
1046 down_write(&current->mm->mmap_sem); 1047 down_write(&current->mm->mmap_sem);
1047 if (flags & MREMAP_FIXED) { 1048 if (flags & MREMAP_FIXED) {
1048 if (new_addr > 0xf0000000UL - new_len) 1049 if (new_addr > STACK_TOP32 - new_len)
1049 goto out_sem; 1050 goto out_sem;
1050 } else if (addr > 0xf0000000UL - new_len) { 1051 } else if (addr > STACK_TOP32 - new_len) {
1051 unsigned long map_flags = 0; 1052 unsigned long map_flags = 0;
1052 struct file *file = NULL; 1053 struct file *file = NULL;
1053 1054
diff --git a/arch/sparc64/solaris/misc.c b/arch/sparc64/solaris/misc.c
index 3ab4677395f2..5284996780a7 100644
--- a/arch/sparc64/solaris/misc.c
+++ b/arch/sparc64/solaris/misc.c
@@ -90,7 +90,7 @@ static u32 do_solaris_mmap(u32 addr, u32 len, u32 prot, u32 flags, u32 fd, u64 o
90 len = PAGE_ALIGN(len); 90 len = PAGE_ALIGN(len);
91 if(!(flags & MAP_FIXED)) 91 if(!(flags & MAP_FIXED))
92 addr = 0; 92 addr = 0;
93 else if (len > 0xf0000000UL || addr > 0xf0000000UL - len) 93 else if (len > STACK_TOP32 || addr > STACK_TOP32 - len)
94 goto out_putf; 94 goto out_putf;
95 ret_type = flags & _MAP_NEW; 95 ret_type = flags & _MAP_NEW;
96 flags &= ~_MAP_NEW; 96 flags &= ~_MAP_NEW;
@@ -102,7 +102,7 @@ static u32 do_solaris_mmap(u32 addr, u32 len, u32 prot, u32 flags, u32 fd, u64 o
102 (unsigned long) prot, (unsigned long) flags, off); 102 (unsigned long) prot, (unsigned long) flags, off);
103 up_write(&current->mm->mmap_sem); 103 up_write(&current->mm->mmap_sem);
104 if(!ret_type) 104 if(!ret_type)
105 retval = ((retval < 0xf0000000) ? 0 : retval); 105 retval = ((retval < STACK_TOP32) ? 0 : retval);
106 106
107out_putf: 107out_putf:
108 if (file) 108 if (file)
diff --git a/include/asm-sparc64/a.out.h b/include/asm-sparc64/a.out.h
index faac321d5594..35cb5c9e0c92 100644
--- a/include/asm-sparc64/a.out.h
+++ b/include/asm-sparc64/a.out.h
@@ -95,9 +95,11 @@ struct relocation_info /* used when header.a_machtype == M_SPARC */
95 95
96#ifdef __KERNEL__ 96#ifdef __KERNEL__
97 97
98#define STACK_TOP32 ((1UL << 32UL) - PAGE_SIZE)
99#define STACK_TOP64 (0x0000080000000000UL - (1UL << 32UL))
100
98#define STACK_TOP (test_thread_flag(TIF_32BIT) ? \ 101#define STACK_TOP (test_thread_flag(TIF_32BIT) ? \
99 0xf0000000 : \ 102 STACK_TOP32 : STACK_TOP64)
100 (0x0000080000000000UL - (1UL << 32UL)))
101 103
102#endif 104#endif
103 105