diff options
Diffstat (limited to 'arch/h8300')
-rw-r--r-- | arch/h8300/kernel/sys_h8300.c | 83 | ||||
-rw-r--r-- | arch/h8300/kernel/syscalls.S | 2 |
2 files changed, 3 insertions, 82 deletions
diff --git a/arch/h8300/kernel/sys_h8300.c b/arch/h8300/kernel/sys_h8300.c index 8cb5d73a0e35..b5969db0ca10 100644 --- a/arch/h8300/kernel/sys_h8300.c +++ b/arch/h8300/kernel/sys_h8300.c | |||
@@ -26,39 +26,6 @@ | |||
26 | #include <asm/traps.h> | 26 | #include <asm/traps.h> |
27 | #include <asm/unistd.h> | 27 | #include <asm/unistd.h> |
28 | 28 | ||
29 | /* common code for old and new mmaps */ | ||
30 | static inline long do_mmap2( | ||
31 | unsigned long addr, unsigned long len, | ||
32 | unsigned long prot, unsigned long flags, | ||
33 | unsigned long fd, unsigned long pgoff) | ||
34 | { | ||
35 | int error = -EBADF; | ||
36 | struct file * file = NULL; | ||
37 | |||
38 | flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | ||
39 | if (!(flags & MAP_ANONYMOUS)) { | ||
40 | file = fget(fd); | ||
41 | if (!file) | ||
42 | goto out; | ||
43 | } | ||
44 | |||
45 | down_write(¤t->mm->mmap_sem); | ||
46 | error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff); | ||
47 | up_write(¤t->mm->mmap_sem); | ||
48 | |||
49 | if (file) | ||
50 | fput(file); | ||
51 | out: | ||
52 | return error; | ||
53 | } | ||
54 | |||
55 | asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, | ||
56 | unsigned long prot, unsigned long flags, | ||
57 | unsigned long fd, unsigned long pgoff) | ||
58 | { | ||
59 | return do_mmap2(addr, len, prot, flags, fd, pgoff); | ||
60 | } | ||
61 | |||
62 | /* | 29 | /* |
63 | * Perform the select(nd, in, out, ex, tv) and mmap() system | 30 | * Perform the select(nd, in, out, ex, tv) and mmap() system |
64 | * calls. Linux/m68k cloned Linux/i386, which didn't use to be able to | 31 | * calls. Linux/m68k cloned Linux/i386, which didn't use to be able to |
@@ -87,57 +54,11 @@ asmlinkage int old_mmap(struct mmap_arg_struct *arg) | |||
87 | if (a.offset & ~PAGE_MASK) | 54 | if (a.offset & ~PAGE_MASK) |
88 | goto out; | 55 | goto out; |
89 | 56 | ||
90 | a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | 57 | error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, |
91 | 58 | a.offset >> PAGE_SHIFT); | |
92 | error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT); | ||
93 | out: | ||
94 | return error; | ||
95 | } | ||
96 | |||
97 | #if 0 /* DAVIDM - do we want this */ | ||
98 | struct mmap_arg_struct64 { | ||
99 | __u32 addr; | ||
100 | __u32 len; | ||
101 | __u32 prot; | ||
102 | __u32 flags; | ||
103 | __u64 offset; /* 64 bits */ | ||
104 | __u32 fd; | ||
105 | }; | ||
106 | |||
107 | asmlinkage long sys_mmap64(struct mmap_arg_struct64 *arg) | ||
108 | { | ||
109 | int error = -EFAULT; | ||
110 | struct file * file = NULL; | ||
111 | struct mmap_arg_struct64 a; | ||
112 | unsigned long pgoff; | ||
113 | |||
114 | if (copy_from_user(&a, arg, sizeof(a))) | ||
115 | return -EFAULT; | ||
116 | |||
117 | if ((long)a.offset & ~PAGE_MASK) | ||
118 | return -EINVAL; | ||
119 | |||
120 | pgoff = a.offset >> PAGE_SHIFT; | ||
121 | if ((a.offset >> PAGE_SHIFT) != pgoff) | ||
122 | return -EINVAL; | ||
123 | |||
124 | if (!(a.flags & MAP_ANONYMOUS)) { | ||
125 | error = -EBADF; | ||
126 | file = fget(a.fd); | ||
127 | if (!file) | ||
128 | goto out; | ||
129 | } | ||
130 | a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE); | ||
131 | |||
132 | down_write(¤t->mm->mmap_sem); | ||
133 | error = do_mmap_pgoff(file, a.addr, a.len, a.prot, a.flags, pgoff); | ||
134 | up_write(¤t->mm->mmap_sem); | ||
135 | if (file) | ||
136 | fput(file); | ||
137 | out: | 59 | out: |
138 | return error; | 60 | return error; |
139 | } | 61 | } |
140 | #endif | ||
141 | 62 | ||
142 | struct sel_arg_struct { | 63 | struct sel_arg_struct { |
143 | unsigned long n; | 64 | unsigned long n; |
diff --git a/arch/h8300/kernel/syscalls.S b/arch/h8300/kernel/syscalls.S index 4eb67faac633..2d69881eda6a 100644 --- a/arch/h8300/kernel/syscalls.S +++ b/arch/h8300/kernel/syscalls.S | |||
@@ -206,7 +206,7 @@ SYMBOL_NAME_LABEL(sys_call_table) | |||
206 | .long SYMBOL_NAME(sys_ni_syscall) /* streams2 */ | 206 | .long SYMBOL_NAME(sys_ni_syscall) /* streams2 */ |
207 | .long SYMBOL_NAME(sys_vfork) /* 190 */ | 207 | .long SYMBOL_NAME(sys_vfork) /* 190 */ |
208 | .long SYMBOL_NAME(sys_getrlimit) | 208 | .long SYMBOL_NAME(sys_getrlimit) |
209 | .long SYMBOL_NAME(sys_mmap2) | 209 | .long SYMBOL_NAME(sys_mmap_pgoff) |
210 | .long SYMBOL_NAME(sys_truncate64) | 210 | .long SYMBOL_NAME(sys_truncate64) |
211 | .long SYMBOL_NAME(sys_ftruncate64) | 211 | .long SYMBOL_NAME(sys_ftruncate64) |
212 | .long SYMBOL_NAME(sys_stat64) /* 195 */ | 212 | .long SYMBOL_NAME(sys_stat64) /* 195 */ |