aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-02-02 19:32:53 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-02-02 19:32:53 -0500
commit69048e01881747e27457cd514a6b85d925982046 (patch)
treecb613a8f8b41232937ff8ffc049309ddceb5aedd
parent1c0b8a7a62c3d3ebf53a8e40cc6da22f5e192d63 (diff)
parent9dabf60dc4abe6e06bebcc2ee46b4d76ec8741f2 (diff)
Merge branch 'parisc-3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux
Pull parisc updates from Helge Deller: "The three major changes in this patchset is a implementation for flexible userspace memory maps, cache-flushing fixes (again), and a long-discussed ABI change to make EWOULDBLOCK the same value as EAGAIN. parisc has been the only platform where we had EWOULDBLOCK != EAGAIN to keep HP-UX compatibility. Since we will probably never implement full HP-UX support, we prefer to drop this compatibility to make it easier for us with Linux userspace programs which mostly never checked for both values. We don't expect major fall-outs because of this change, and if we face some, we will simply rebuild the necessary applications in the debian archives" * 'parisc-3.14' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux: parisc: add flexible mmap memory layout support parisc: Make EWOULDBLOCK be equal to EAGAIN on parisc parisc: convert uapi/asm/stat.h to use native types only parisc: wire up sched_setattr and sched_getattr parisc: fix cache-flushing parisc/sti_console: prefer Linux fonts over built-in ROM fonts
-rw-r--r--arch/parisc/include/asm/cacheflush.h2
-rw-r--r--arch/parisc/include/asm/elf.h4
-rw-r--r--arch/parisc/include/asm/page.h3
-rw-r--r--arch/parisc/include/asm/pgtable.h1
-rw-r--r--arch/parisc/include/asm/processor.h2
-rw-r--r--arch/parisc/include/asm/thread_info.h10
-rw-r--r--arch/parisc/include/uapi/asm/errno.h2
-rw-r--r--arch/parisc/include/uapi/asm/stat.h40
-rw-r--r--arch/parisc/include/uapi/asm/unistd.h4
-rw-r--r--arch/parisc/kernel/cache.c14
-rw-r--r--arch/parisc/kernel/process.c21
-rw-r--r--arch/parisc/kernel/sys_parisc.c238
-rw-r--r--arch/parisc/kernel/syscall_table.S2
-rw-r--r--drivers/video/console/sticore.c2
-rw-r--r--lib/fonts/Kconfig6
15 files changed, 278 insertions, 73 deletions
diff --git a/arch/parisc/include/asm/cacheflush.h b/arch/parisc/include/asm/cacheflush.h
index 2f9b751878ba..de65f66ea64e 100644
--- a/arch/parisc/include/asm/cacheflush.h
+++ b/arch/parisc/include/asm/cacheflush.h
@@ -132,7 +132,6 @@ void mark_rodata_ro(void);
132static inline void *kmap(struct page *page) 132static inline void *kmap(struct page *page)
133{ 133{
134 might_sleep(); 134 might_sleep();
135 flush_dcache_page(page);
136 return page_address(page); 135 return page_address(page);
137} 136}
138 137
@@ -144,7 +143,6 @@ static inline void kunmap(struct page *page)
144static inline void *kmap_atomic(struct page *page) 143static inline void *kmap_atomic(struct page *page)
145{ 144{
146 pagefault_disable(); 145 pagefault_disable();
147 flush_dcache_page(page);
148 return page_address(page); 146 return page_address(page);
149} 147}
150 148
diff --git a/arch/parisc/include/asm/elf.h b/arch/parisc/include/asm/elf.h
index ad2b50397894..3391d061eccc 100644
--- a/arch/parisc/include/asm/elf.h
+++ b/arch/parisc/include/asm/elf.h
@@ -348,4 +348,8 @@ struct pt_regs; /* forward declaration... */
348 348
349#define ELF_HWCAP 0 349#define ELF_HWCAP 0
350 350
351struct mm_struct;
352extern unsigned long arch_randomize_brk(struct mm_struct *);
353#define arch_randomize_brk arch_randomize_brk
354
351#endif 355#endif
diff --git a/arch/parisc/include/asm/page.h b/arch/parisc/include/asm/page.h
index c53fc63149e8..637fe031aa84 100644
--- a/arch/parisc/include/asm/page.h
+++ b/arch/parisc/include/asm/page.h
@@ -29,7 +29,8 @@ struct page;
29void clear_page_asm(void *page); 29void clear_page_asm(void *page);
30void copy_page_asm(void *to, void *from); 30void copy_page_asm(void *to, void *from);
31#define clear_user_page(vto, vaddr, page) clear_page_asm(vto) 31#define clear_user_page(vto, vaddr, page) clear_page_asm(vto)
32#define copy_user_page(vto, vfrom, vaddr, page) copy_page_asm(vto, vfrom) 32void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
33 struct page *pg);
33 34
34/* #define CONFIG_PARISC_TMPALIAS */ 35/* #define CONFIG_PARISC_TMPALIAS */
35 36
diff --git a/arch/parisc/include/asm/pgtable.h b/arch/parisc/include/asm/pgtable.h
index 34899b5d959a..22b89d1edba7 100644
--- a/arch/parisc/include/asm/pgtable.h
+++ b/arch/parisc/include/asm/pgtable.h
@@ -511,6 +511,7 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr,
511/* We provide our own get_unmapped_area to provide cache coherency */ 511/* We provide our own get_unmapped_area to provide cache coherency */
512 512
513#define HAVE_ARCH_UNMAPPED_AREA 513#define HAVE_ARCH_UNMAPPED_AREA
514#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN
514 515
515#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG 516#define __HAVE_ARCH_PTEP_TEST_AND_CLEAR_YOUNG
516#define __HAVE_ARCH_PTEP_GET_AND_CLEAR 517#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
diff --git a/arch/parisc/include/asm/processor.h b/arch/parisc/include/asm/processor.h
index cc2290a3cace..198a86feb574 100644
--- a/arch/parisc/include/asm/processor.h
+++ b/arch/parisc/include/asm/processor.h
@@ -30,6 +30,8 @@
30#endif 30#endif
31#define current_text_addr() ({ void *pc; current_ia(pc); pc; }) 31#define current_text_addr() ({ void *pc; current_ia(pc); pc; })
32 32
33#define HAVE_ARCH_PICK_MMAP_LAYOUT
34
33#define TASK_SIZE_OF(tsk) ((tsk)->thread.task_size) 35#define TASK_SIZE_OF(tsk) ((tsk)->thread.task_size)
34#define TASK_SIZE TASK_SIZE_OF(current) 36#define TASK_SIZE TASK_SIZE_OF(current)
35#define TASK_UNMAPPED_BASE (current->thread.map_base) 37#define TASK_UNMAPPED_BASE (current->thread.map_base)
diff --git a/arch/parisc/include/asm/thread_info.h b/arch/parisc/include/asm/thread_info.h
index d5f97ea3a4e1..4b9b10ce1f9d 100644
--- a/arch/parisc/include/asm/thread_info.h
+++ b/arch/parisc/include/asm/thread_info.h
@@ -76,6 +76,16 @@ struct thread_info {
76#define _TIF_SYSCALL_TRACE_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \ 76#define _TIF_SYSCALL_TRACE_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \
77 _TIF_BLOCKSTEP | _TIF_SYSCALL_AUDIT) 77 _TIF_BLOCKSTEP | _TIF_SYSCALL_AUDIT)
78 78
79#ifdef CONFIG_64BIT
80# ifdef CONFIG_COMPAT
81# define is_32bit_task() (test_thread_flag(TIF_32BIT))
82# else
83# define is_32bit_task() (0)
84# endif
85#else
86# define is_32bit_task() (1)
87#endif
88
79#endif /* __KERNEL__ */ 89#endif /* __KERNEL__ */
80 90
81#endif /* _ASM_PARISC_THREAD_INFO_H */ 91#endif /* _ASM_PARISC_THREAD_INFO_H */
diff --git a/arch/parisc/include/uapi/asm/errno.h b/arch/parisc/include/uapi/asm/errno.h
index f3a8aa554841..c0ae62520d15 100644
--- a/arch/parisc/include/uapi/asm/errno.h
+++ b/arch/parisc/include/uapi/asm/errno.h
@@ -106,7 +106,7 @@
106 106
107#define EALREADY 244 /* Operation already in progress */ 107#define EALREADY 244 /* Operation already in progress */
108#define EINPROGRESS 245 /* Operation now in progress */ 108#define EINPROGRESS 245 /* Operation now in progress */
109#define EWOULDBLOCK 246 /* Operation would block (Linux returns EAGAIN) */ 109#define EWOULDBLOCK EAGAIN /* Operation would block (Not HPUX compliant) */
110#define ENOTEMPTY 247 /* Directory not empty */ 110#define ENOTEMPTY 247 /* Directory not empty */
111#define ENAMETOOLONG 248 /* File name too long */ 111#define ENAMETOOLONG 248 /* File name too long */
112#define ELOOP 249 /* Too many symbolic links encountered */ 112#define ELOOP 249 /* Too many symbolic links encountered */
diff --git a/arch/parisc/include/uapi/asm/stat.h b/arch/parisc/include/uapi/asm/stat.h
index d76fbda5d62c..b606b366d0a7 100644
--- a/arch/parisc/include/uapi/asm/stat.h
+++ b/arch/parisc/include/uapi/asm/stat.h
@@ -5,67 +5,65 @@
5 5
6struct stat { 6struct stat {
7 unsigned int st_dev; /* dev_t is 32 bits on parisc */ 7 unsigned int st_dev; /* dev_t is 32 bits on parisc */
8 ino_t st_ino; /* 32 bits */ 8 unsigned int st_ino; /* 32 bits */
9 mode_t st_mode; /* 16 bits */ 9 unsigned short st_mode; /* 16 bits */
10 unsigned short st_nlink; /* 16 bits */ 10 unsigned short st_nlink; /* 16 bits */
11 unsigned short st_reserved1; /* old st_uid */ 11 unsigned short st_reserved1; /* old st_uid */
12 unsigned short st_reserved2; /* old st_gid */ 12 unsigned short st_reserved2; /* old st_gid */
13 unsigned int st_rdev; 13 unsigned int st_rdev;
14 off_t st_size; 14 signed int st_size;
15 time_t st_atime; 15 signed int st_atime;
16 unsigned int st_atime_nsec; 16 unsigned int st_atime_nsec;
17 time_t st_mtime; 17 signed int st_mtime;
18 unsigned int st_mtime_nsec; 18 unsigned int st_mtime_nsec;
19 time_t st_ctime; 19 signed int st_ctime;
20 unsigned int st_ctime_nsec; 20 unsigned int st_ctime_nsec;
21 int st_blksize; 21 int st_blksize;
22 int st_blocks; 22 int st_blocks;
23 unsigned int __unused1; /* ACL stuff */ 23 unsigned int __unused1; /* ACL stuff */
24 unsigned int __unused2; /* network */ 24 unsigned int __unused2; /* network */
25 ino_t __unused3; /* network */ 25 unsigned int __unused3; /* network */
26 unsigned int __unused4; /* cnodes */ 26 unsigned int __unused4; /* cnodes */
27 unsigned short __unused5; /* netsite */ 27 unsigned short __unused5; /* netsite */
28 short st_fstype; 28 short st_fstype;
29 unsigned int st_realdev; 29 unsigned int st_realdev;
30 unsigned short st_basemode; 30 unsigned short st_basemode;
31 unsigned short st_spareshort; 31 unsigned short st_spareshort;
32 uid_t st_uid; 32 unsigned int st_uid;
33 gid_t st_gid; 33 unsigned int st_gid;
34 unsigned int st_spare4[3]; 34 unsigned int st_spare4[3];
35}; 35};
36 36
37#define STAT_HAVE_NSEC 37#define STAT_HAVE_NSEC
38 38
39typedef __kernel_off64_t off64_t;
40
41struct hpux_stat64 { 39struct hpux_stat64 {
42 unsigned int st_dev; /* dev_t is 32 bits on parisc */ 40 unsigned int st_dev; /* dev_t is 32 bits on parisc */
43 ino_t st_ino; /* 32 bits */ 41 unsigned int st_ino; /* 32 bits */
44 mode_t st_mode; /* 16 bits */ 42 unsigned short st_mode; /* 16 bits */
45 unsigned short st_nlink; /* 16 bits */ 43 unsigned short st_nlink; /* 16 bits */
46 unsigned short st_reserved1; /* old st_uid */ 44 unsigned short st_reserved1; /* old st_uid */
47 unsigned short st_reserved2; /* old st_gid */ 45 unsigned short st_reserved2; /* old st_gid */
48 unsigned int st_rdev; 46 unsigned int st_rdev;
49 off64_t st_size; 47 signed long long st_size;
50 time_t st_atime; 48 signed int st_atime;
51 unsigned int st_spare1; 49 unsigned int st_spare1;
52 time_t st_mtime; 50 signed int st_mtime;
53 unsigned int st_spare2; 51 unsigned int st_spare2;
54 time_t st_ctime; 52 signed int st_ctime;
55 unsigned int st_spare3; 53 unsigned int st_spare3;
56 int st_blksize; 54 int st_blksize;
57 __u64 st_blocks; 55 unsigned long long st_blocks;
58 unsigned int __unused1; /* ACL stuff */ 56 unsigned int __unused1; /* ACL stuff */
59 unsigned int __unused2; /* network */ 57 unsigned int __unused2; /* network */
60 ino_t __unused3; /* network */ 58 unsigned int __unused3; /* network */
61 unsigned int __unused4; /* cnodes */ 59 unsigned int __unused4; /* cnodes */
62 unsigned short __unused5; /* netsite */ 60 unsigned short __unused5; /* netsite */
63 short st_fstype; 61 short st_fstype;
64 unsigned int st_realdev; 62 unsigned int st_realdev;
65 unsigned short st_basemode; 63 unsigned short st_basemode;
66 unsigned short st_spareshort; 64 unsigned short st_spareshort;
67 uid_t st_uid; 65 unsigned int st_uid;
68 gid_t st_gid; 66 unsigned int st_gid;
69 unsigned int st_spare4[3]; 67 unsigned int st_spare4[3];
70}; 68};
71 69
diff --git a/arch/parisc/include/uapi/asm/unistd.h b/arch/parisc/include/uapi/asm/unistd.h
index 2c8b9bde18eb..42706794a36f 100644
--- a/arch/parisc/include/uapi/asm/unistd.h
+++ b/arch/parisc/include/uapi/asm/unistd.h
@@ -826,8 +826,10 @@
826#define __NR_process_vm_writev (__NR_Linux + 331) 826#define __NR_process_vm_writev (__NR_Linux + 331)
827#define __NR_kcmp (__NR_Linux + 332) 827#define __NR_kcmp (__NR_Linux + 332)
828#define __NR_finit_module (__NR_Linux + 333) 828#define __NR_finit_module (__NR_Linux + 333)
829#define __NR_sched_setattr (__NR_Linux + 334)
830#define __NR_sched_getattr (__NR_Linux + 335)
829 831
830#define __NR_Linux_syscalls (__NR_finit_module + 1) 832#define __NR_Linux_syscalls (__NR_sched_getattr + 1)
831 833
832 834
833#define __IGNORE_select /* newselect */ 835#define __IGNORE_select /* newselect */
diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c
index a72545554a31..ac87a40502e6 100644
--- a/arch/parisc/kernel/cache.c
+++ b/arch/parisc/kernel/cache.c
@@ -388,6 +388,20 @@ void flush_kernel_dcache_page_addr(void *addr)
388} 388}
389EXPORT_SYMBOL(flush_kernel_dcache_page_addr); 389EXPORT_SYMBOL(flush_kernel_dcache_page_addr);
390 390
391void copy_user_page(void *vto, void *vfrom, unsigned long vaddr,
392 struct page *pg)
393{
394 /* Copy using kernel mapping. No coherency is needed (all in
395 kunmap) for the `to' page. However, the `from' page needs to
396 be flushed through a mapping equivalent to the user mapping
397 before it can be accessed through the kernel mapping. */
398 preempt_disable();
399 flush_dcache_page_asm(__pa(vfrom), vaddr);
400 preempt_enable();
401 copy_page_asm(vto, vfrom);
402}
403EXPORT_SYMBOL(copy_user_page);
404
391void purge_tlb_entries(struct mm_struct *mm, unsigned long addr) 405void purge_tlb_entries(struct mm_struct *mm, unsigned long addr)
392{ 406{
393 unsigned long flags; 407 unsigned long flags;
diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
index 55f92b614182..0bbbf0d3f608 100644
--- a/arch/parisc/kernel/process.c
+++ b/arch/parisc/kernel/process.c
@@ -13,7 +13,7 @@
13 * Copyright (C) 2000 Grant Grundler <grundler with parisc-linux.org> 13 * Copyright (C) 2000 Grant Grundler <grundler with parisc-linux.org>
14 * Copyright (C) 2001 Alan Modra <amodra at parisc-linux.org> 14 * Copyright (C) 2001 Alan Modra <amodra at parisc-linux.org>
15 * Copyright (C) 2001-2002 Ryan Bradetich <rbrad at parisc-linux.org> 15 * Copyright (C) 2001-2002 Ryan Bradetich <rbrad at parisc-linux.org>
16 * Copyright (C) 2001-2007 Helge Deller <deller at parisc-linux.org> 16 * Copyright (C) 2001-2014 Helge Deller <deller@gmx.de>
17 * Copyright (C) 2002 Randolph Chung <tausq with parisc-linux.org> 17 * Copyright (C) 2002 Randolph Chung <tausq with parisc-linux.org>
18 * 18 *
19 * 19 *
@@ -49,6 +49,7 @@
49#include <linux/kallsyms.h> 49#include <linux/kallsyms.h>
50#include <linux/uaccess.h> 50#include <linux/uaccess.h>
51#include <linux/rcupdate.h> 51#include <linux/rcupdate.h>
52#include <linux/random.h>
52 53
53#include <asm/io.h> 54#include <asm/io.h>
54#include <asm/asm-offsets.h> 55#include <asm/asm-offsets.h>
@@ -286,3 +287,21 @@ void *dereference_function_descriptor(void *ptr)
286 return ptr; 287 return ptr;
287} 288}
288#endif 289#endif
290
291static inline unsigned long brk_rnd(void)
292{
293 /* 8MB for 32bit, 1GB for 64bit */
294 if (is_32bit_task())
295 return (get_random_int() & 0x7ffUL) << PAGE_SHIFT;
296 else
297 return (get_random_int() & 0x3ffffUL) << PAGE_SHIFT;
298}
299
300unsigned long arch_randomize_brk(struct mm_struct *mm)
301{
302 unsigned long ret = PAGE_ALIGN(mm->brk + brk_rnd());
303
304 if (ret < mm->brk)
305 return mm->brk;
306 return ret;
307}
diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c
index 0d3a9d4927b5..b7cadc4a06cd 100644
--- a/arch/parisc/kernel/sys_parisc.c
+++ b/arch/parisc/kernel/sys_parisc.c
@@ -5,6 +5,7 @@
5 * Copyright (C) 1999-2003 Matthew Wilcox <willy at parisc-linux.org> 5 * Copyright (C) 1999-2003 Matthew Wilcox <willy at parisc-linux.org>
6 * Copyright (C) 2000-2003 Paul Bame <bame at parisc-linux.org> 6 * Copyright (C) 2000-2003 Paul Bame <bame at parisc-linux.org>
7 * Copyright (C) 2001 Thomas Bogendoerfer <tsbogend at parisc-linux.org> 7 * Copyright (C) 2001 Thomas Bogendoerfer <tsbogend at parisc-linux.org>
8 * Copyright (C) 1999-2014 Helge Deller <deller@gmx.de>
8 * 9 *
9 * 10 *
10 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
@@ -23,6 +24,7 @@
23 */ 24 */
24 25
25#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27#include <asm/elf.h>
26#include <linux/file.h> 28#include <linux/file.h>
27#include <linux/fs.h> 29#include <linux/fs.h>
28#include <linux/linkage.h> 30#include <linux/linkage.h>
@@ -32,78 +34,230 @@
32#include <linux/syscalls.h> 34#include <linux/syscalls.h>
33#include <linux/utsname.h> 35#include <linux/utsname.h>
34#include <linux/personality.h> 36#include <linux/personality.h>
37#include <linux/random.h>
35 38
36static unsigned long get_unshared_area(unsigned long addr, unsigned long len) 39/* we construct an artificial offset for the mapping based on the physical
40 * address of the kernel mapping variable */
41#define GET_LAST_MMAP(filp) \
42 (filp ? ((unsigned long) filp->f_mapping) >> 8 : 0UL)
43#define SET_LAST_MMAP(filp, val) \
44 { /* nothing */ }
45
46static int get_offset(unsigned int last_mmap)
37{ 47{
38 struct vm_unmapped_area_info info; 48 return (last_mmap & (SHMLBA-1)) >> PAGE_SHIFT;
49}
39 50
40 info.flags = 0; 51static unsigned long shared_align_offset(unsigned int last_mmap,
41 info.length = len; 52 unsigned long pgoff)
42 info.low_limit = PAGE_ALIGN(addr); 53{
43 info.high_limit = TASK_SIZE; 54 return (get_offset(last_mmap) + pgoff) << PAGE_SHIFT;
44 info.align_mask = 0;
45 info.align_offset = 0;
46 return vm_unmapped_area(&info);
47} 55}
48 56
49/* 57static inline unsigned long COLOR_ALIGN(unsigned long addr,
50 * We need to know the offset to use. Old scheme was to look for 58 unsigned int last_mmap, unsigned long pgoff)
51 * existing mapping and use the same offset. New scheme is to use the
52 * address of the kernel data structure as the seed for the offset.
53 * We'll see how that works...
54 *
55 * The mapping is cacheline aligned, so there's no information in the bottom
56 * few bits of the address. We're looking for 10 bits (4MB / 4k), so let's
57 * drop the bottom 8 bits and use bits 8-17.
58 */
59static int get_offset(struct address_space *mapping)
60{ 59{
61 return (unsigned long) mapping >> 8; 60 unsigned long base = (addr+SHMLBA-1) & ~(SHMLBA-1);
61 unsigned long off = (SHMLBA-1) &
62 (shared_align_offset(last_mmap, pgoff) << PAGE_SHIFT);
63
64 return base + off;
62} 65}
63 66
64static unsigned long shared_align_offset(struct file *filp, unsigned long pgoff) 67/*
68 * Top of mmap area (just below the process stack).
69 */
70
71static unsigned long mmap_upper_limit(void)
65{ 72{
66 struct address_space *mapping = filp ? filp->f_mapping : NULL; 73 unsigned long stack_base;
67 74
68 return (get_offset(mapping) + pgoff) << PAGE_SHIFT; 75 /* Limit stack size to 1GB - see setup_arg_pages() in fs/exec.c */
76 stack_base = rlimit_max(RLIMIT_STACK);
77 if (stack_base > (1 << 30))
78 stack_base = 1 << 30;
79
80 return PAGE_ALIGN(STACK_TOP - stack_base);
69} 81}
70 82
71static unsigned long get_shared_area(struct file *filp, unsigned long addr, 83
72 unsigned long len, unsigned long pgoff) 84unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
85 unsigned long len, unsigned long pgoff, unsigned long flags)
73{ 86{
87 struct mm_struct *mm = current->mm;
88 struct vm_area_struct *vma;
89 unsigned long task_size = TASK_SIZE;
90 int do_color_align, last_mmap;
74 struct vm_unmapped_area_info info; 91 struct vm_unmapped_area_info info;
75 92
93 if (len > task_size)
94 return -ENOMEM;
95
96 do_color_align = 0;
97 if (filp || (flags & MAP_SHARED))
98 do_color_align = 1;
99 last_mmap = GET_LAST_MMAP(filp);
100
101 if (flags & MAP_FIXED) {
102 if ((flags & MAP_SHARED) && last_mmap &&
103 (addr - shared_align_offset(last_mmap, pgoff))
104 & (SHMLBA - 1))
105 return -EINVAL;
106 goto found_addr;
107 }
108
109 if (addr) {
110 if (do_color_align && last_mmap)
111 addr = COLOR_ALIGN(addr, last_mmap, pgoff);
112 else
113 addr = PAGE_ALIGN(addr);
114
115 vma = find_vma(mm, addr);
116 if (task_size - len >= addr &&
117 (!vma || addr + len <= vma->vm_start))
118 goto found_addr;
119 }
120
76 info.flags = 0; 121 info.flags = 0;
77 info.length = len; 122 info.length = len;
78 info.low_limit = PAGE_ALIGN(addr); 123 info.low_limit = mm->mmap_legacy_base;
79 info.high_limit = TASK_SIZE; 124 info.high_limit = mmap_upper_limit();
80 info.align_mask = PAGE_MASK & (SHMLBA - 1); 125 info.align_mask = last_mmap ? (PAGE_MASK & (SHMLBA - 1)) : 0;
81 info.align_offset = shared_align_offset(filp, pgoff); 126 info.align_offset = shared_align_offset(last_mmap, pgoff);
82 return vm_unmapped_area(&info); 127 addr = vm_unmapped_area(&info);
128
129found_addr:
130 if (do_color_align && !last_mmap && !(addr & ~PAGE_MASK))
131 SET_LAST_MMAP(filp, addr - (pgoff << PAGE_SHIFT));
132
133 return addr;
83} 134}
84 135
85unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, 136unsigned long
86 unsigned long len, unsigned long pgoff, unsigned long flags) 137arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
138 const unsigned long len, const unsigned long pgoff,
139 const unsigned long flags)
87{ 140{
141 struct vm_area_struct *vma;
142 struct mm_struct *mm = current->mm;
143 unsigned long addr = addr0;
144 int do_color_align, last_mmap;
145 struct vm_unmapped_area_info info;
146
147#ifdef CONFIG_64BIT
148 /* This should only ever run for 32-bit processes. */
149 BUG_ON(!test_thread_flag(TIF_32BIT));
150#endif
151
152 /* requested length too big for entire address space */
88 if (len > TASK_SIZE) 153 if (len > TASK_SIZE)
89 return -ENOMEM; 154 return -ENOMEM;
155
156 do_color_align = 0;
157 if (filp || (flags & MAP_SHARED))
158 do_color_align = 1;
159 last_mmap = GET_LAST_MMAP(filp);
160
90 if (flags & MAP_FIXED) { 161 if (flags & MAP_FIXED) {
91 if ((flags & MAP_SHARED) && 162 if ((flags & MAP_SHARED) && last_mmap &&
92 (addr - shared_align_offset(filp, pgoff)) & (SHMLBA - 1)) 163 (addr - shared_align_offset(last_mmap, pgoff))
164 & (SHMLBA - 1))
93 return -EINVAL; 165 return -EINVAL;
94 return addr; 166 goto found_addr;
95 } 167 }
96 if (!addr)
97 addr = TASK_UNMAPPED_BASE;
98 168
99 if (filp || (flags & MAP_SHARED)) 169 /* requesting a specific address */
100 addr = get_shared_area(filp, addr, len, pgoff); 170 if (addr) {
101 else 171 if (do_color_align && last_mmap)
102 addr = get_unshared_area(addr, len); 172 addr = COLOR_ALIGN(addr, last_mmap, pgoff);
173 else
174 addr = PAGE_ALIGN(addr);
175 vma = find_vma(mm, addr);
176 if (TASK_SIZE - len >= addr &&
177 (!vma || addr + len <= vma->vm_start))
178 goto found_addr;
179 }
180
181 info.flags = VM_UNMAPPED_AREA_TOPDOWN;
182 info.length = len;
183 info.low_limit = PAGE_SIZE;
184 info.high_limit = mm->mmap_base;
185 info.align_mask = last_mmap ? (PAGE_MASK & (SHMLBA - 1)) : 0;
186 info.align_offset = shared_align_offset(last_mmap, pgoff);
187 addr = vm_unmapped_area(&info);
188 if (!(addr & ~PAGE_MASK))
189 goto found_addr;
190 VM_BUG_ON(addr != -ENOMEM);
191
192 /*
193 * A failed mmap() very likely causes application failure,
194 * so fall back to the bottom-up function here. This scenario
195 * can happen with large stack limits and large mmap()
196 * allocations.
197 */
198 return arch_get_unmapped_area(filp, addr0, len, pgoff, flags);
199
200found_addr:
201 if (do_color_align && !last_mmap && !(addr & ~PAGE_MASK))
202 SET_LAST_MMAP(filp, addr - (pgoff << PAGE_SHIFT));
103 203
104 return addr; 204 return addr;
105} 205}
106 206
207static int mmap_is_legacy(void)
208{
209 if (current->personality & ADDR_COMPAT_LAYOUT)
210 return 1;
211
212 /* parisc stack always grows up - so a unlimited stack should
213 * not be an indicator to use the legacy memory layout.
214 * if (rlimit(RLIMIT_STACK) == RLIM_INFINITY)
215 * return 1;
216 */
217
218 return sysctl_legacy_va_layout;
219}
220
221static unsigned long mmap_rnd(void)
222{
223 unsigned long rnd = 0;
224
225 /*
226 * 8 bits of randomness in 32bit mmaps, 20 address space bits
227 * 28 bits of randomness in 64bit mmaps, 40 address space bits
228 */
229 if (current->flags & PF_RANDOMIZE) {
230 if (is_32bit_task())
231 rnd = get_random_int() % (1<<8);
232 else
233 rnd = get_random_int() % (1<<28);
234 }
235 return rnd << PAGE_SHIFT;
236}
237
238static unsigned long mmap_legacy_base(void)
239{
240 return TASK_UNMAPPED_BASE + mmap_rnd();
241}
242
243/*
244 * This function, called very early during the creation of a new
245 * process VM image, sets up which VM layout function to use:
246 */
247void arch_pick_mmap_layout(struct mm_struct *mm)
248{
249 mm->mmap_legacy_base = mmap_legacy_base();
250 mm->mmap_base = mmap_upper_limit();
251
252 if (mmap_is_legacy()) {
253 mm->mmap_base = mm->mmap_legacy_base;
254 mm->get_unmapped_area = arch_get_unmapped_area;
255 } else {
256 mm->get_unmapped_area = arch_get_unmapped_area_topdown;
257 }
258}
259
260
107asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len, 261asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len,
108 unsigned long prot, unsigned long flags, unsigned long fd, 262 unsigned long prot, unsigned long flags, unsigned long fd,
109 unsigned long pgoff) 263 unsigned long pgoff)
diff --git a/arch/parisc/kernel/syscall_table.S b/arch/parisc/kernel/syscall_table.S
index 0c9107285e66..8fa3fbb3e4d3 100644
--- a/arch/parisc/kernel/syscall_table.S
+++ b/arch/parisc/kernel/syscall_table.S
@@ -429,6 +429,8 @@
429 ENTRY_COMP(process_vm_writev) 429 ENTRY_COMP(process_vm_writev)
430 ENTRY_SAME(kcmp) 430 ENTRY_SAME(kcmp)
431 ENTRY_SAME(finit_module) 431 ENTRY_SAME(finit_module)
432 ENTRY_SAME(sched_setattr)
433 ENTRY_SAME(sched_getattr) /* 335 */
432 434
433 /* Nothing yet */ 435 /* Nothing yet */
434 436
diff --git a/drivers/video/console/sticore.c b/drivers/video/console/sticore.c
index 4ad24f2c6472..cecd3de01c24 100644
--- a/drivers/video/console/sticore.c
+++ b/drivers/video/console/sticore.c
@@ -488,7 +488,7 @@ static int sti_init_glob_cfg(struct sti_struct *sti, unsigned long rom_address,
488 return 0; 488 return 0;
489} 489}
490 490
491#ifdef CONFIG_FONTS 491#ifdef CONFIG_FONT_SUPPORT
492static struct sti_cooked_font * 492static struct sti_cooked_font *
493sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name) 493sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
494{ 494{
diff --git a/lib/fonts/Kconfig b/lib/fonts/Kconfig
index 34fd931b54b5..4dc1b990aa23 100644
--- a/lib/fonts/Kconfig
+++ b/lib/fonts/Kconfig
@@ -9,7 +9,7 @@ if FONT_SUPPORT
9 9
10config FONTS 10config FONTS
11 bool "Select compiled-in fonts" 11 bool "Select compiled-in fonts"
12 depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE 12 depends on FRAMEBUFFER_CONSOLE
13 help 13 help
14 Say Y here if you would like to use fonts other than the default 14 Say Y here if you would like to use fonts other than the default
15 your frame buffer console usually use. 15 your frame buffer console usually use.
@@ -22,7 +22,7 @@ config FONTS
22 22
23config FONT_8x8 23config FONT_8x8
24 bool "VGA 8x8 font" if FONTS 24 bool "VGA 8x8 font" if FONTS
25 depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE 25 depends on FRAMEBUFFER_CONSOLE
26 default y if !SPARC && !FONTS 26 default y if !SPARC && !FONTS
27 help 27 help
28 This is the "high resolution" font for the VGA frame buffer (the one 28 This is the "high resolution" font for the VGA frame buffer (the one
@@ -45,7 +45,7 @@ config FONT_8x16
45 45
46config FONT_6x11 46config FONT_6x11
47 bool "Mac console 6x11 font (not supported by all drivers)" if FONTS 47 bool "Mac console 6x11 font (not supported by all drivers)" if FONTS
48 depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE 48 depends on FRAMEBUFFER_CONSOLE
49 default y if !SPARC && !FONTS && MAC 49 default y if !SPARC && !FONTS && MAC
50 help 50 help
51 Small console font with Macintosh-style high-half glyphs. Some Mac 51 Small console font with Macintosh-style high-half glyphs. Some Mac