Commit a4679373cf4ee0e7792dc56205365732b725c2c1
Committed by
Linus Torvalds
1 parent
5d0e52830e
Add generic sys_old_mmap()
Add a generic implementation of the old mmap() syscall, which expects its argument in a memory block and switch all architectures over to use it. Signed-off-by: Christoph Hellwig <hch@lst.de> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mundt <lethal@linux-sh.org> Cc: Jeff Dike <jdike@addtoit.com> Cc: Hirokazu Takata <takata@linux-m32r.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@elte.hu> Reviewed-by: H. Peter Anvin <hpa@zytor.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: "Luck, Tony" <tony.luck@intel.com> Cc: James Morris <jmorris@namei.org> Cc: Andreas Schwab <schwab@linux-m68k.org> Acked-by: Jesper Nilsson <jesper.nilsson@axis.com> Acked-by: Russell King <rmk+kernel@arm.linux.org.uk> Acked-by: Greg Ungerer <gerg@uclinux.org> Acked-by: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 31 changed files with 79 additions and 258 deletions Side-by-side Diff
- arch/arm/include/asm/unistd.h
- arch/arm/kernel/calls.S
- arch/arm/kernel/sys_arm.c
- arch/cris/arch-v10/kernel/entry.S
- arch/cris/arch-v32/kernel/entry.S
- arch/cris/include/asm/unistd.h
- arch/cris/kernel/sys_cris.c
- arch/h8300/include/asm/unistd.h
- arch/h8300/kernel/sys_h8300.c
- arch/h8300/kernel/syscalls.S
- arch/m68k/include/asm/unistd.h
- arch/m68k/kernel/entry.S
- arch/m68k/kernel/sys_m68k.c
- arch/m68knommu/kernel/sys_m68k.c
- arch/m68knommu/kernel/syscalltable.S
- arch/s390/include/asm/unistd.h
- arch/s390/kernel/entry.h
- arch/s390/kernel/sys_s390.c
- arch/s390/kernel/syscalls.S
- arch/um/sys-i386/shared/sysdep/syscalls.h
- arch/um/sys-i386/sys_call_table.S
- arch/um/sys-i386/syscalls.c
- arch/x86/ia32/sys_ia32.c
- arch/x86/include/asm/sys_ia32.h
- arch/x86/include/asm/syscalls.h
- arch/x86/include/asm/unistd_32.h
- arch/x86/kernel/sys_i386_32.c
- arch/x86/kernel/syscall_table_32.S
- include/linux/syscalls.h
- mm/mmap.c
- mm/nommu.c
arch/arm/include/asm/unistd.h
... | ... | @@ -443,6 +443,7 @@ |
443 | 443 | #define __ARCH_WANT_SYS_SIGPROCMASK |
444 | 444 | #define __ARCH_WANT_SYS_RT_SIGACTION |
445 | 445 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND |
446 | +#define __ARCH_WANT_SYS_OLD_MMAP | |
446 | 447 | #define __ARCH_WANT_SYS_OLD_SELECT |
447 | 448 | |
448 | 449 | #if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT) |
arch/arm/kernel/calls.S
... | ... | @@ -99,7 +99,7 @@ |
99 | 99 | CALL(sys_swapon) |
100 | 100 | CALL(sys_reboot) |
101 | 101 | CALL(OBSOLETE(sys_old_readdir)) /* used by libc4 */ |
102 | -/* 90 */ CALL(OBSOLETE(old_mmap)) /* used by libc4 */ | |
102 | +/* 90 */ CALL(OBSOLETE(sys_old_mmap)) /* used by libc4 */ | |
103 | 103 | CALL(sys_munmap) |
104 | 104 | CALL(sys_truncate) |
105 | 105 | CALL(sys_ftruncate) |
arch/arm/kernel/sys_arm.c
... | ... | @@ -28,32 +28,6 @@ |
28 | 28 | #include <linux/ipc.h> |
29 | 29 | #include <linux/uaccess.h> |
30 | 30 | |
31 | -struct mmap_arg_struct { | |
32 | - unsigned long addr; | |
33 | - unsigned long len; | |
34 | - unsigned long prot; | |
35 | - unsigned long flags; | |
36 | - unsigned long fd; | |
37 | - unsigned long offset; | |
38 | -}; | |
39 | - | |
40 | -asmlinkage int old_mmap(struct mmap_arg_struct __user *arg) | |
41 | -{ | |
42 | - int error = -EFAULT; | |
43 | - struct mmap_arg_struct a; | |
44 | - | |
45 | - if (copy_from_user(&a, arg, sizeof(a))) | |
46 | - goto out; | |
47 | - | |
48 | - error = -EINVAL; | |
49 | - if (a.offset & ~PAGE_MASK) | |
50 | - goto out; | |
51 | - | |
52 | - error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT); | |
53 | -out: | |
54 | - return error; | |
55 | -} | |
56 | - | |
57 | 31 | #if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT) |
58 | 32 | /* |
59 | 33 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. |
arch/cris/arch-v10/kernel/entry.S
arch/cris/arch-v32/kernel/entry.S
arch/cris/include/asm/unistd.h
... | ... | @@ -364,6 +364,7 @@ |
364 | 364 | #define __ARCH_WANT_SYS_LLSEEK |
365 | 365 | #define __ARCH_WANT_SYS_NICE |
366 | 366 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT |
367 | +#define __ARCH_WANT_SYS_OLD_MMAP | |
367 | 368 | #define __ARCH_WANT_SYS_OLDUMOUNT |
368 | 369 | #define __ARCH_WANT_SYS_SIGPENDING |
369 | 370 | #define __ARCH_WANT_SYS_SIGPROCMASK |
arch/cris/kernel/sys_cris.c
... | ... | @@ -26,24 +26,6 @@ |
26 | 26 | #include <asm/uaccess.h> |
27 | 27 | #include <asm/segment.h> |
28 | 28 | |
29 | -asmlinkage unsigned long old_mmap(unsigned long __user *args) | |
30 | -{ | |
31 | - unsigned long buffer[6]; | |
32 | - int err = -EFAULT; | |
33 | - | |
34 | - if (copy_from_user(&buffer, args, sizeof(buffer))) | |
35 | - goto out; | |
36 | - | |
37 | - err = -EINVAL; | |
38 | - if (buffer[5] & ~PAGE_MASK) /* verify that offset is on page boundary */ | |
39 | - goto out; | |
40 | - | |
41 | - err = sys_mmap_pgoff(buffer[0], buffer[1], buffer[2], buffer[3], | |
42 | - buffer[4], buffer[5] >> PAGE_SHIFT); | |
43 | -out: | |
44 | - return err; | |
45 | -} | |
46 | - | |
47 | 29 | asmlinkage long |
48 | 30 | sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot, |
49 | 31 | unsigned long flags, unsigned long fd, unsigned long pgoff) |
arch/h8300/include/asm/unistd.h
... | ... | @@ -348,6 +348,7 @@ |
348 | 348 | #define __ARCH_WANT_SYS_LLSEEK |
349 | 349 | #define __ARCH_WANT_SYS_NICE |
350 | 350 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT |
351 | +#define __ARCH_WANT_SYS_OLD_MMAP | |
351 | 352 | #define __ARCH_WANT_SYS_OLD_SELECT |
352 | 353 | #define __ARCH_WANT_SYS_OLDUMOUNT |
353 | 354 | #define __ARCH_WANT_SYS_SIGPENDING |
arch/h8300/kernel/sys_h8300.c
... | ... | @@ -27,40 +27,6 @@ |
27 | 27 | #include <asm/unistd.h> |
28 | 28 | |
29 | 29 | /* |
30 | - * Perform the select(nd, in, out, ex, tv) and mmap() system | |
31 | - * calls. Linux/m68k cloned Linux/i386, which didn't use to be able to | |
32 | - * handle more than 4 system call parameters, so these system calls | |
33 | - * used a memory block for parameter passing.. | |
34 | - */ | |
35 | - | |
36 | -struct mmap_arg_struct { | |
37 | - unsigned long addr; | |
38 | - unsigned long len; | |
39 | - unsigned long prot; | |
40 | - unsigned long flags; | |
41 | - unsigned long fd; | |
42 | - unsigned long offset; | |
43 | -}; | |
44 | - | |
45 | -asmlinkage int old_mmap(struct mmap_arg_struct *arg) | |
46 | -{ | |
47 | - struct mmap_arg_struct a; | |
48 | - int error = -EFAULT; | |
49 | - | |
50 | - if (copy_from_user(&a, arg, sizeof(a))) | |
51 | - goto out; | |
52 | - | |
53 | - error = -EINVAL; | |
54 | - if (a.offset & ~PAGE_MASK) | |
55 | - goto out; | |
56 | - | |
57 | - error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, | |
58 | - a.offset >> PAGE_SHIFT); | |
59 | -out: | |
60 | - return error; | |
61 | -} | |
62 | - | |
63 | -/* | |
64 | 30 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. |
65 | 31 | * |
66 | 32 | * This is really horribly ugly. |
arch/h8300/kernel/syscalls.S
... | ... | @@ -104,7 +104,7 @@ |
104 | 104 | .long SYMBOL_NAME(sys_swapon) |
105 | 105 | .long SYMBOL_NAME(sys_reboot) |
106 | 106 | .long SYMBOL_NAME(sys_old_readdir) |
107 | - .long SYMBOL_NAME(old_mmap) /* 90 */ | |
107 | + .long SYMBOL_NAME(sys_old_mmap) /* 90 */ | |
108 | 108 | .long SYMBOL_NAME(sys_munmap) |
109 | 109 | .long SYMBOL_NAME(sys_truncate) |
110 | 110 | .long SYMBOL_NAME(sys_ftruncate) |
arch/m68k/include/asm/unistd.h
... | ... | @@ -363,6 +363,7 @@ |
363 | 363 | #define __ARCH_WANT_SYS_LLSEEK |
364 | 364 | #define __ARCH_WANT_SYS_NICE |
365 | 365 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT |
366 | +#define __ARCH_WANT_SYS_OLD_MMAP | |
366 | 367 | #define __ARCH_WANT_SYS_OLD_SELECT |
367 | 368 | #define __ARCH_WANT_SYS_OLDUMOUNT |
368 | 369 | #define __ARCH_WANT_SYS_SIGPENDING |
arch/m68k/kernel/entry.S
arch/m68k/kernel/sys_m68k.c
... | ... | @@ -47,40 +47,6 @@ |
47 | 47 | } |
48 | 48 | |
49 | 49 | /* |
50 | - * Perform the select(nd, in, out, ex, tv) and mmap() system | |
51 | - * calls. Linux/m68k cloned Linux/i386, which didn't use to be able to | |
52 | - * handle more than 4 system call parameters, so these system calls | |
53 | - * used a memory block for parameter passing.. | |
54 | - */ | |
55 | - | |
56 | -struct mmap_arg_struct { | |
57 | - unsigned long addr; | |
58 | - unsigned long len; | |
59 | - unsigned long prot; | |
60 | - unsigned long flags; | |
61 | - unsigned long fd; | |
62 | - unsigned long offset; | |
63 | -}; | |
64 | - | |
65 | -asmlinkage int old_mmap(struct mmap_arg_struct __user *arg) | |
66 | -{ | |
67 | - struct mmap_arg_struct a; | |
68 | - int error = -EFAULT; | |
69 | - | |
70 | - if (copy_from_user(&a, arg, sizeof(a))) | |
71 | - goto out; | |
72 | - | |
73 | - error = -EINVAL; | |
74 | - if (a.offset & ~PAGE_MASK) | |
75 | - goto out; | |
76 | - | |
77 | - error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, | |
78 | - a.offset >> PAGE_SHIFT); | |
79 | -out: | |
80 | - return error; | |
81 | -} | |
82 | - | |
83 | -/* | |
84 | 50 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. |
85 | 51 | * |
86 | 52 | * This is really horribly ugly. |
arch/m68knommu/kernel/sys_m68k.c
... | ... | @@ -28,40 +28,6 @@ |
28 | 28 | #include <asm/unistd.h> |
29 | 29 | |
30 | 30 | /* |
31 | - * Perform the select(nd, in, out, ex, tv) and mmap() system | |
32 | - * calls. Linux/m68k cloned Linux/i386, which didn't use to be able to | |
33 | - * handle more than 4 system call parameters, so these system calls | |
34 | - * used a memory block for parameter passing.. | |
35 | - */ | |
36 | - | |
37 | -struct mmap_arg_struct { | |
38 | - unsigned long addr; | |
39 | - unsigned long len; | |
40 | - unsigned long prot; | |
41 | - unsigned long flags; | |
42 | - unsigned long fd; | |
43 | - unsigned long offset; | |
44 | -}; | |
45 | - | |
46 | -asmlinkage int old_mmap(struct mmap_arg_struct *arg) | |
47 | -{ | |
48 | - struct mmap_arg_struct a; | |
49 | - int error = -EFAULT; | |
50 | - | |
51 | - if (copy_from_user(&a, arg, sizeof(a))) | |
52 | - goto out; | |
53 | - | |
54 | - error = -EINVAL; | |
55 | - if (a.offset & ~PAGE_MASK) | |
56 | - goto out; | |
57 | - | |
58 | - error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, | |
59 | - a.offset >> PAGE_SHIFT); | |
60 | -out: | |
61 | - return error; | |
62 | -} | |
63 | - | |
64 | -/* | |
65 | 31 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. |
66 | 32 | * |
67 | 33 | * This is really horribly ugly. |
arch/m68knommu/kernel/syscalltable.S
arch/s390/include/asm/unistd.h
... | ... | @@ -392,6 +392,7 @@ |
392 | 392 | #define __ARCH_WANT_SYS_LLSEEK |
393 | 393 | #define __ARCH_WANT_SYS_NICE |
394 | 394 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT |
395 | +#define __ARCH_WANT_SYS_OLD_MMAP | |
395 | 396 | #define __ARCH_WANT_SYS_OLDUMOUNT |
396 | 397 | #define __ARCH_WANT_SYS_SIGPENDING |
397 | 398 | #define __ARCH_WANT_SYS_SIGPROCMASK |
arch/s390/kernel/entry.h
... | ... | @@ -25,12 +25,11 @@ |
25 | 25 | void die(const char * str, struct pt_regs * regs, long err); |
26 | 26 | |
27 | 27 | struct new_utsname; |
28 | -struct mmap_arg_struct; | |
28 | +struct s390_mmap_arg_struct; | |
29 | 29 | struct fadvise64_64_args; |
30 | 30 | struct old_sigaction; |
31 | 31 | |
32 | -long sys_mmap2(struct mmap_arg_struct __user *arg); | |
33 | -long sys_s390_old_mmap(struct mmap_arg_struct __user *arg); | |
32 | +long sys_mmap2(struct s390_mmap_arg_struct __user *arg); | |
34 | 33 | long sys_ipc(uint call, int first, unsigned long second, |
35 | 34 | unsigned long third, void __user *ptr); |
36 | 35 | long sys_s390_newuname(struct new_utsname __user *name); |
arch/s390/kernel/sys_s390.c
... | ... | @@ -33,13 +33,12 @@ |
33 | 33 | #include "entry.h" |
34 | 34 | |
35 | 35 | /* |
36 | - * Perform the select(nd, in, out, ex, tv) and mmap() system | |
37 | - * calls. Linux for S/390 isn't able to handle more than 5 | |
38 | - * system call parameters, so these system calls used a memory | |
39 | - * block for parameter passing.. | |
36 | + * Perform the mmap() system call. Linux for S/390 isn't able to handle more | |
37 | + * than 5 system call parameters, so this system call uses a memory block | |
38 | + * for parameter passing. | |
40 | 39 | */ |
41 | 40 | |
42 | -struct mmap_arg_struct { | |
41 | +struct s390_mmap_arg_struct { | |
43 | 42 | unsigned long addr; |
44 | 43 | unsigned long len; |
45 | 44 | unsigned long prot; |
46 | 45 | |
47 | 46 | |
... | ... | @@ -48,31 +47,14 @@ |
48 | 47 | unsigned long offset; |
49 | 48 | }; |
50 | 49 | |
51 | -SYSCALL_DEFINE1(mmap2, struct mmap_arg_struct __user *, arg) | |
50 | +SYSCALL_DEFINE1(mmap2, struct s390_mmap_arg_struct __user *, arg) | |
52 | 51 | { |
53 | - struct mmap_arg_struct a; | |
52 | + struct s390_mmap_arg_struct a; | |
54 | 53 | int error = -EFAULT; |
55 | 54 | |
56 | 55 | if (copy_from_user(&a, arg, sizeof(a))) |
57 | 56 | goto out; |
58 | 57 | error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); |
59 | -out: | |
60 | - return error; | |
61 | -} | |
62 | - | |
63 | -SYSCALL_DEFINE1(s390_old_mmap, struct mmap_arg_struct __user *, arg) | |
64 | -{ | |
65 | - struct mmap_arg_struct a; | |
66 | - long error = -EFAULT; | |
67 | - | |
68 | - if (copy_from_user(&a, arg, sizeof(a))) | |
69 | - goto out; | |
70 | - | |
71 | - error = -EINVAL; | |
72 | - if (a.offset & ~PAGE_MASK) | |
73 | - goto out; | |
74 | - | |
75 | - error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT); | |
76 | 58 | out: |
77 | 59 | return error; |
78 | 60 | } |
arch/s390/kernel/syscalls.S
... | ... | @@ -98,7 +98,7 @@ |
98 | 98 | SYSCALL(sys_swapon,sys_swapon,sys32_swapon_wrapper) |
99 | 99 | SYSCALL(sys_reboot,sys_reboot,sys32_reboot_wrapper) |
100 | 100 | SYSCALL(sys_ni_syscall,sys_ni_syscall,old32_readdir_wrapper) /* old readdir syscall */ |
101 | -SYSCALL(sys_s390_old_mmap,sys_s390_old_mmap,old32_mmap_wrapper) /* 90 */ | |
101 | +SYSCALL(sys_old_mmap,sys_old_mmap,old32_mmap_wrapper) /* 90 */ | |
102 | 102 | SYSCALL(sys_munmap,sys_munmap,sys32_munmap_wrapper) |
103 | 103 | SYSCALL(sys_truncate,sys_truncate,sys32_truncate_wrapper) |
104 | 104 | SYSCALL(sys_ftruncate,sys_ftruncate,sys32_ftruncate_wrapper) |
arch/um/sys-i386/shared/sysdep/syscalls.h
arch/um/sys-i386/sys_call_table.S
arch/um/sys-i386/syscalls.c
... | ... | @@ -12,39 +12,6 @@ |
12 | 12 | #include "asm/unistd.h" |
13 | 13 | |
14 | 14 | /* |
15 | - * Perform the select(nd, in, out, ex, tv) and mmap() system | |
16 | - * calls. Linux/i386 didn't use to be able to handle more than | |
17 | - * 4 system call parameters, so these system calls used a memory | |
18 | - * block for parameter passing.. | |
19 | - */ | |
20 | - | |
21 | -struct mmap_arg_struct { | |
22 | - unsigned long addr; | |
23 | - unsigned long len; | |
24 | - unsigned long prot; | |
25 | - unsigned long flags; | |
26 | - unsigned long fd; | |
27 | - unsigned long offset; | |
28 | -}; | |
29 | - | |
30 | -extern int old_mmap(unsigned long addr, unsigned long len, | |
31 | - unsigned long prot, unsigned long flags, | |
32 | - unsigned long fd, unsigned long offset); | |
33 | - | |
34 | -long old_mmap_i386(struct mmap_arg_struct __user *arg) | |
35 | -{ | |
36 | - struct mmap_arg_struct a; | |
37 | - int err = -EFAULT; | |
38 | - | |
39 | - if (copy_from_user(&a, arg, sizeof(a))) | |
40 | - goto out; | |
41 | - | |
42 | - err = old_mmap(a.addr, a.len, a.prot, a.flags, a.fd, a.offset); | |
43 | - out: | |
44 | - return err; | |
45 | -} | |
46 | - | |
47 | -/* | |
48 | 15 | * The prototype on i386 is: |
49 | 16 | * |
50 | 17 | * int clone(int flags, void * child_stack, int * parent_tidptr, struct user_desc * newtls, int * child_tidptr) |
arch/x86/ia32/sys_ia32.c
... | ... | @@ -143,7 +143,7 @@ |
143 | 143 | * block for parameter passing.. |
144 | 144 | */ |
145 | 145 | |
146 | -struct mmap_arg_struct { | |
146 | +struct mmap_arg_struct32 { | |
147 | 147 | unsigned int addr; |
148 | 148 | unsigned int len; |
149 | 149 | unsigned int prot; |
150 | 150 | |
... | ... | @@ -152,9 +152,9 @@ |
152 | 152 | unsigned int offset; |
153 | 153 | }; |
154 | 154 | |
155 | -asmlinkage long sys32_mmap(struct mmap_arg_struct __user *arg) | |
155 | +asmlinkage long sys32_mmap(struct mmap_arg_struct32 __user *arg) | |
156 | 156 | { |
157 | - struct mmap_arg_struct a; | |
157 | + struct mmap_arg_struct32 a; | |
158 | 158 | |
159 | 159 | if (copy_from_user(&a, arg, sizeof(a))) |
160 | 160 | return -EFAULT; |
arch/x86/include/asm/sys_ia32.h
... | ... | @@ -26,8 +26,8 @@ |
26 | 26 | asmlinkage long sys32_fstat64(unsigned int, struct stat64 __user *); |
27 | 27 | asmlinkage long sys32_fstatat(unsigned int, char __user *, |
28 | 28 | struct stat64 __user *, int); |
29 | -struct mmap_arg_struct; | |
30 | -asmlinkage long sys32_mmap(struct mmap_arg_struct __user *); | |
29 | +struct mmap_arg_struct32; | |
30 | +asmlinkage long sys32_mmap(struct mmap_arg_struct32 __user *); | |
31 | 31 | asmlinkage long sys32_mprotect(unsigned long, size_t, unsigned long); |
32 | 32 | |
33 | 33 | struct sigaction32; |
arch/x86/include/asm/syscalls.h
... | ... | @@ -51,11 +51,9 @@ |
51 | 51 | unsigned long sys_sigreturn(struct pt_regs *); |
52 | 52 | |
53 | 53 | /* kernel/sys_i386_32.c */ |
54 | -struct mmap_arg_struct; | |
55 | 54 | struct oldold_utsname; |
56 | 55 | struct old_utsname; |
57 | 56 | |
58 | -asmlinkage int old_mmap(struct mmap_arg_struct __user *); | |
59 | 57 | asmlinkage int sys_ipc(uint, int, int, int, void __user *, long); |
60 | 58 | asmlinkage int sys_uname(struct old_utsname __user *); |
61 | 59 | asmlinkage int sys_olduname(struct oldold_utsname __user *); |
arch/x86/include/asm/unistd_32.h
... | ... | @@ -366,6 +366,7 @@ |
366 | 366 | #define __ARCH_WANT_SYS_LLSEEK |
367 | 367 | #define __ARCH_WANT_SYS_NICE |
368 | 368 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT |
369 | +#define __ARCH_WANT_SYS_OLD_MMAP | |
369 | 370 | #define __ARCH_WANT_SYS_OLD_SELECT |
370 | 371 | #define __ARCH_WANT_SYS_OLDUMOUNT |
371 | 372 | #define __ARCH_WANT_SYS_SIGPENDING |
arch/x86/kernel/sys_i386_32.c
... | ... | @@ -25,40 +25,6 @@ |
25 | 25 | #include <asm/syscalls.h> |
26 | 26 | |
27 | 27 | /* |
28 | - * Perform the select(nd, in, out, ex, tv) and mmap() system | |
29 | - * calls. Linux/i386 didn't use to be able to handle more than | |
30 | - * 4 system call parameters, so these system calls used a memory | |
31 | - * block for parameter passing.. | |
32 | - */ | |
33 | - | |
34 | -struct mmap_arg_struct { | |
35 | - unsigned long addr; | |
36 | - unsigned long len; | |
37 | - unsigned long prot; | |
38 | - unsigned long flags; | |
39 | - unsigned long fd; | |
40 | - unsigned long offset; | |
41 | -}; | |
42 | - | |
43 | -asmlinkage int old_mmap(struct mmap_arg_struct __user *arg) | |
44 | -{ | |
45 | - struct mmap_arg_struct a; | |
46 | - int err = -EFAULT; | |
47 | - | |
48 | - if (copy_from_user(&a, arg, sizeof(a))) | |
49 | - goto out; | |
50 | - | |
51 | - err = -EINVAL; | |
52 | - if (a.offset & ~PAGE_MASK) | |
53 | - goto out; | |
54 | - | |
55 | - err = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, | |
56 | - a.fd, a.offset >> PAGE_SHIFT); | |
57 | -out: | |
58 | - return err; | |
59 | -} | |
60 | - | |
61 | -/* | |
62 | 28 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. |
63 | 29 | * |
64 | 30 | * This is really horribly ugly. |
arch/x86/kernel/syscall_table_32.S
include/linux/syscalls.h
... | ... | @@ -23,6 +23,7 @@ |
23 | 23 | struct linux_dirent; |
24 | 24 | struct linux_dirent64; |
25 | 25 | struct list_head; |
26 | +struct mmap_arg_struct; | |
26 | 27 | struct msgbuf; |
27 | 28 | struct msghdr; |
28 | 29 | struct mmsghdr; |
... | ... | @@ -838,5 +839,7 @@ |
838 | 839 | asmlinkage long sys_mmap_pgoff(unsigned long addr, unsigned long len, |
839 | 840 | unsigned long prot, unsigned long flags, |
840 | 841 | unsigned long fd, unsigned long pgoff); |
842 | +asmlinkage long sys_old_mmap(struct mmap_arg_struct __user *arg); | |
843 | + | |
841 | 844 | #endif |
mm/mmap.c
... | ... | @@ -1088,6 +1088,30 @@ |
1088 | 1088 | return retval; |
1089 | 1089 | } |
1090 | 1090 | |
1091 | +#ifdef __ARCH_WANT_SYS_OLD_MMAP | |
1092 | +struct mmap_arg_struct { | |
1093 | + unsigned long addr; | |
1094 | + unsigned long len; | |
1095 | + unsigned long prot; | |
1096 | + unsigned long flags; | |
1097 | + unsigned long fd; | |
1098 | + unsigned long offset; | |
1099 | +}; | |
1100 | + | |
1101 | +SYSCALL_DEFINE1(old_mmap, struct mmap_arg_struct __user *, arg) | |
1102 | +{ | |
1103 | + struct mmap_arg_struct a; | |
1104 | + | |
1105 | + if (copy_from_user(&a, arg, sizeof(a))) | |
1106 | + return -EFAULT; | |
1107 | + if (a.offset & ~PAGE_MASK) | |
1108 | + return -EINVAL; | |
1109 | + | |
1110 | + return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, | |
1111 | + a.offset >> PAGE_SHIFT); | |
1112 | +} | |
1113 | +#endif /* __ARCH_WANT_SYS_OLD_MMAP */ | |
1114 | + | |
1091 | 1115 | /* |
1092 | 1116 | * Some shared mappigns will want the pages marked read-only |
1093 | 1117 | * to track write events. If so, we'll downgrade vm_page_prot |
mm/nommu.c
... | ... | @@ -1428,6 +1428,30 @@ |
1428 | 1428 | return retval; |
1429 | 1429 | } |
1430 | 1430 | |
1431 | +#ifdef __ARCH_WANT_SYS_OLD_MMAP | |
1432 | +struct mmap_arg_struct { | |
1433 | + unsigned long addr; | |
1434 | + unsigned long len; | |
1435 | + unsigned long prot; | |
1436 | + unsigned long flags; | |
1437 | + unsigned long fd; | |
1438 | + unsigned long offset; | |
1439 | +}; | |
1440 | + | |
1441 | +SYSCALL_DEFINE1(old_mmap, struct mmap_arg_struct __user *, arg) | |
1442 | +{ | |
1443 | + struct mmap_arg_struct a; | |
1444 | + | |
1445 | + if (copy_from_user(&a, arg, sizeof(a))) | |
1446 | + return -EFAULT; | |
1447 | + if (a.offset & ~PAGE_MASK) | |
1448 | + return -EINVAL; | |
1449 | + | |
1450 | + return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, | |
1451 | + a.offset >> PAGE_SHIFT); | |
1452 | +} | |
1453 | +#endif /* __ARCH_WANT_SYS_OLD_MMAP */ | |
1454 | + | |
1431 | 1455 | /* |
1432 | 1456 | * split a vma into two pieces at address 'addr', a new vma is allocated either |
1433 | 1457 | * for the first part or the tail. |