diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-14 22:43:21 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-14 22:43:21 -0500 |
commit | 8d5c315059460e665c804d5a9b641f7f0a1e9dd7 (patch) | |
tree | b9c598b2ac7a4fd7cf121ce733b98b0f18b8a1df /arch/arm/kernel | |
parent | a9df3d0f312f4b1aefec76ae5ee86cccbf7cd4e0 (diff) | |
parent | 3f471126ee53feb5e9b210ea2f525ed3bb9b7a7f (diff) |
Merge master.kernel.org:/home/rmk/linux-2.6-arm
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r-- | arch/arm/kernel/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/kernel/armksyms.c | 22 | ||||
-rw-r--r-- | arch/arm/kernel/calls.S | 59 | ||||
-rw-r--r-- | arch/arm/kernel/entry-armv.S | 24 | ||||
-rw-r--r-- | arch/arm/kernel/entry-common.S | 146 | ||||
-rw-r--r-- | arch/arm/kernel/entry-header.S | 1 | ||||
-rw-r--r-- | arch/arm/kernel/head.S | 7 | ||||
-rw-r--r-- | arch/arm/kernel/ptrace.c | 15 | ||||
-rw-r--r-- | arch/arm/kernel/semaphore.c | 17 | ||||
-rw-r--r-- | arch/arm/kernel/sys_arm.c | 2 | ||||
-rw-r--r-- | arch/arm/kernel/sys_oabi-compat.c | 339 | ||||
-rw-r--r-- | arch/arm/kernel/traps.c | 2 |
12 files changed, 574 insertions, 61 deletions
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile index de94b0f3ee2a..2ce0e3a27a45 100644 --- a/arch/arm/kernel/Makefile +++ b/arch/arm/kernel/Makefile | |||
@@ -20,6 +20,7 @@ obj-$(CONFIG_ARTHUR) += arthur.o | |||
20 | obj-$(CONFIG_ISA_DMA) += dma-isa.o | 20 | obj-$(CONFIG_ISA_DMA) += dma-isa.o |
21 | obj-$(CONFIG_PCI) += bios32.o | 21 | obj-$(CONFIG_PCI) += bios32.o |
22 | obj-$(CONFIG_SMP) += smp.o | 22 | obj-$(CONFIG_SMP) += smp.o |
23 | obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o | ||
23 | 24 | ||
24 | obj-$(CONFIG_IWMMXT) += iwmmxt.o | 25 | obj-$(CONFIG_IWMMXT) += iwmmxt.o |
25 | AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt | 26 | AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt |
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c index 9997098009a9..1574941ebfe1 100644 --- a/arch/arm/kernel/armksyms.c +++ b/arch/arm/kernel/armksyms.c | |||
@@ -35,6 +35,16 @@ extern void __udivsi3(void); | |||
35 | extern void __umodsi3(void); | 35 | extern void __umodsi3(void); |
36 | extern void __do_div64(void); | 36 | extern void __do_div64(void); |
37 | 37 | ||
38 | extern void __aeabi_idiv(void); | ||
39 | extern void __aeabi_idivmod(void); | ||
40 | extern void __aeabi_lasr(void); | ||
41 | extern void __aeabi_llsl(void); | ||
42 | extern void __aeabi_llsr(void); | ||
43 | extern void __aeabi_lmul(void); | ||
44 | extern void __aeabi_uidiv(void); | ||
45 | extern void __aeabi_uidivmod(void); | ||
46 | extern void __aeabi_ulcmp(void); | ||
47 | |||
38 | extern void fpundefinstr(void); | 48 | extern void fpundefinstr(void); |
39 | extern void fp_enter(void); | 49 | extern void fp_enter(void); |
40 | 50 | ||
@@ -141,6 +151,18 @@ EXPORT_SYMBOL(__udivsi3); | |||
141 | EXPORT_SYMBOL(__umodsi3); | 151 | EXPORT_SYMBOL(__umodsi3); |
142 | EXPORT_SYMBOL(__do_div64); | 152 | EXPORT_SYMBOL(__do_div64); |
143 | 153 | ||
154 | #ifdef CONFIG_AEABI | ||
155 | EXPORT_SYMBOL(__aeabi_idiv); | ||
156 | EXPORT_SYMBOL(__aeabi_idivmod); | ||
157 | EXPORT_SYMBOL(__aeabi_lasr); | ||
158 | EXPORT_SYMBOL(__aeabi_llsl); | ||
159 | EXPORT_SYMBOL(__aeabi_llsr); | ||
160 | EXPORT_SYMBOL(__aeabi_lmul); | ||
161 | EXPORT_SYMBOL(__aeabi_uidiv); | ||
162 | EXPORT_SYMBOL(__aeabi_uidivmod); | ||
163 | EXPORT_SYMBOL(__aeabi_ulcmp); | ||
164 | #endif | ||
165 | |||
144 | /* bitops */ | 166 | /* bitops */ |
145 | EXPORT_SYMBOL(_set_bit_le); | 167 | EXPORT_SYMBOL(_set_bit_le); |
146 | EXPORT_SYMBOL(_test_and_set_bit_le); | 168 | EXPORT_SYMBOL(_test_and_set_bit_le); |
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S index 55076a75e5bf..75e6f9a94713 100644 --- a/arch/arm/kernel/calls.S +++ b/arch/arm/kernel/calls.S | |||
@@ -13,7 +13,7 @@ | |||
13 | #define NR_syscalls 328 | 13 | #define NR_syscalls 328 |
14 | #else | 14 | #else |
15 | 15 | ||
16 | __syscall_start: | 16 | 100: |
17 | /* 0 */ .long sys_restart_syscall | 17 | /* 0 */ .long sys_restart_syscall |
18 | .long sys_exit | 18 | .long sys_exit |
19 | .long sys_fork_wrapper | 19 | .long sys_fork_wrapper |
@@ -27,7 +27,7 @@ __syscall_start: | |||
27 | /* 10 */ .long sys_unlink | 27 | /* 10 */ .long sys_unlink |
28 | .long sys_execve_wrapper | 28 | .long sys_execve_wrapper |
29 | .long sys_chdir | 29 | .long sys_chdir |
30 | .long sys_time /* used by libc4 */ | 30 | .long OBSOLETE(sys_time) /* used by libc4 */ |
31 | .long sys_mknod | 31 | .long sys_mknod |
32 | /* 15 */ .long sys_chmod | 32 | /* 15 */ .long sys_chmod |
33 | .long sys_lchown16 | 33 | .long sys_lchown16 |
@@ -36,15 +36,15 @@ __syscall_start: | |||
36 | .long sys_lseek | 36 | .long sys_lseek |
37 | /* 20 */ .long sys_getpid | 37 | /* 20 */ .long sys_getpid |
38 | .long sys_mount | 38 | .long sys_mount |
39 | .long sys_oldumount /* used by libc4 */ | 39 | .long OBSOLETE(sys_oldumount) /* used by libc4 */ |
40 | .long sys_setuid16 | 40 | .long sys_setuid16 |
41 | .long sys_getuid16 | 41 | .long sys_getuid16 |
42 | /* 25 */ .long sys_stime | 42 | /* 25 */ .long OBSOLETE(sys_stime) |
43 | .long sys_ptrace | 43 | .long sys_ptrace |
44 | .long sys_alarm /* used by libc4 */ | 44 | .long OBSOLETE(sys_alarm) /* used by libc4 */ |
45 | .long sys_ni_syscall /* was sys_fstat */ | 45 | .long sys_ni_syscall /* was sys_fstat */ |
46 | .long sys_pause | 46 | .long sys_pause |
47 | /* 30 */ .long sys_utime /* used by libc4 */ | 47 | /* 30 */ .long OBSOLETE(sys_utime) /* used by libc4 */ |
48 | .long sys_ni_syscall /* was sys_stty */ | 48 | .long sys_ni_syscall /* was sys_stty */ |
49 | .long sys_ni_syscall /* was sys_getty */ | 49 | .long sys_ni_syscall /* was sys_getty */ |
50 | .long sys_access | 50 | .long sys_access |
@@ -90,21 +90,21 @@ __syscall_start: | |||
90 | .long sys_sigpending | 90 | .long sys_sigpending |
91 | .long sys_sethostname | 91 | .long sys_sethostname |
92 | /* 75 */ .long sys_setrlimit | 92 | /* 75 */ .long sys_setrlimit |
93 | .long sys_old_getrlimit /* used by libc4 */ | 93 | .long OBSOLETE(sys_old_getrlimit) /* used by libc4 */ |
94 | .long sys_getrusage | 94 | .long sys_getrusage |
95 | .long sys_gettimeofday | 95 | .long sys_gettimeofday |
96 | .long sys_settimeofday | 96 | .long sys_settimeofday |
97 | /* 80 */ .long sys_getgroups16 | 97 | /* 80 */ .long sys_getgroups16 |
98 | .long sys_setgroups16 | 98 | .long sys_setgroups16 |
99 | .long old_select /* used by libc4 */ | 99 | .long OBSOLETE(old_select) /* used by libc4 */ |
100 | .long sys_symlink | 100 | .long sys_symlink |
101 | .long sys_ni_syscall /* was sys_lstat */ | 101 | .long sys_ni_syscall /* was sys_lstat */ |
102 | /* 85 */ .long sys_readlink | 102 | /* 85 */ .long sys_readlink |
103 | .long sys_uselib | 103 | .long sys_uselib |
104 | .long sys_swapon | 104 | .long sys_swapon |
105 | .long sys_reboot | 105 | .long sys_reboot |
106 | .long old_readdir /* used by libc4 */ | 106 | .long OBSOLETE(old_readdir) /* used by libc4 */ |
107 | /* 90 */ .long old_mmap /* used by libc4 */ | 107 | /* 90 */ .long OBSOLETE(old_mmap) /* used by libc4 */ |
108 | .long sys_munmap | 108 | .long sys_munmap |
109 | .long sys_truncate | 109 | .long sys_truncate |
110 | .long sys_ftruncate | 110 | .long sys_ftruncate |
@@ -116,7 +116,7 @@ __syscall_start: | |||
116 | .long sys_statfs | 116 | .long sys_statfs |
117 | /* 100 */ .long sys_fstatfs | 117 | /* 100 */ .long sys_fstatfs |
118 | .long sys_ni_syscall | 118 | .long sys_ni_syscall |
119 | .long sys_socketcall | 119 | .long OBSOLETE(sys_socketcall) |
120 | .long sys_syslog | 120 | .long sys_syslog |
121 | .long sys_setitimer | 121 | .long sys_setitimer |
122 | /* 105 */ .long sys_getitimer | 122 | /* 105 */ .long sys_getitimer |
@@ -127,11 +127,11 @@ __syscall_start: | |||
127 | /* 110 */ .long sys_ni_syscall /* was sys_iopl */ | 127 | /* 110 */ .long sys_ni_syscall /* was sys_iopl */ |
128 | .long sys_vhangup | 128 | .long sys_vhangup |
129 | .long sys_ni_syscall | 129 | .long sys_ni_syscall |
130 | .long sys_syscall /* call a syscall */ | 130 | .long OBSOLETE(sys_syscall) /* call a syscall */ |
131 | .long sys_wait4 | 131 | .long sys_wait4 |
132 | /* 115 */ .long sys_swapoff | 132 | /* 115 */ .long sys_swapoff |
133 | .long sys_sysinfo | 133 | .long sys_sysinfo |
134 | .long sys_ipc | 134 | .long OBSOLETE(ABI(sys_ipc, sys_oabi_ipc)) |
135 | .long sys_fsync | 135 | .long sys_fsync |
136 | .long sys_sigreturn_wrapper | 136 | .long sys_sigreturn_wrapper |
137 | /* 120 */ .long sys_clone_wrapper | 137 | /* 120 */ .long sys_clone_wrapper |
@@ -194,8 +194,8 @@ __syscall_start: | |||
194 | .long sys_rt_sigtimedwait | 194 | .long sys_rt_sigtimedwait |
195 | .long sys_rt_sigqueueinfo | 195 | .long sys_rt_sigqueueinfo |
196 | .long sys_rt_sigsuspend_wrapper | 196 | .long sys_rt_sigsuspend_wrapper |
197 | /* 180 */ .long sys_pread64 | 197 | /* 180 */ .long ABI(sys_pread64, sys_oabi_pread64) |
198 | .long sys_pwrite64 | 198 | .long ABI(sys_pwrite64, sys_oabi_pwrite64) |
199 | .long sys_chown16 | 199 | .long sys_chown16 |
200 | .long sys_getcwd | 200 | .long sys_getcwd |
201 | .long sys_capget | 201 | .long sys_capget |
@@ -207,11 +207,11 @@ __syscall_start: | |||
207 | /* 190 */ .long sys_vfork_wrapper | 207 | /* 190 */ .long sys_vfork_wrapper |
208 | .long sys_getrlimit | 208 | .long sys_getrlimit |
209 | .long sys_mmap2 | 209 | .long sys_mmap2 |
210 | .long sys_truncate64 | 210 | .long ABI(sys_truncate64, sys_oabi_truncate64) |
211 | .long sys_ftruncate64 | 211 | .long ABI(sys_ftruncate64, sys_oabi_ftruncate64) |
212 | /* 195 */ .long sys_stat64 | 212 | /* 195 */ .long ABI(sys_stat64, sys_oabi_stat64) |
213 | .long sys_lstat64 | 213 | .long ABI(sys_lstat64, sys_oabi_lstat64) |
214 | .long sys_fstat64 | 214 | .long ABI(sys_fstat64, sys_oabi_fstat64) |
215 | .long sys_lchown | 215 | .long sys_lchown |
216 | .long sys_getuid | 216 | .long sys_getuid |
217 | /* 200 */ .long sys_getgid | 217 | /* 200 */ .long sys_getgid |
@@ -235,11 +235,11 @@ __syscall_start: | |||
235 | .long sys_pivot_root | 235 | .long sys_pivot_root |
236 | .long sys_mincore | 236 | .long sys_mincore |
237 | /* 220 */ .long sys_madvise | 237 | /* 220 */ .long sys_madvise |
238 | .long sys_fcntl64 | 238 | .long ABI(sys_fcntl64, sys_oabi_fcntl64) |
239 | .long sys_ni_syscall /* TUX */ | 239 | .long sys_ni_syscall /* TUX */ |
240 | .long sys_ni_syscall | 240 | .long sys_ni_syscall |
241 | .long sys_gettid | 241 | .long sys_gettid |
242 | /* 225 */ .long sys_readahead | 242 | /* 225 */ .long ABI(sys_readahead, sys_oabi_readahead) |
243 | .long sys_setxattr | 243 | .long sys_setxattr |
244 | .long sys_lsetxattr | 244 | .long sys_lsetxattr |
245 | .long sys_fsetxattr | 245 | .long sys_fsetxattr |
@@ -265,8 +265,8 @@ __syscall_start: | |||
265 | .long sys_exit_group | 265 | .long sys_exit_group |
266 | .long sys_lookup_dcookie | 266 | .long sys_lookup_dcookie |
267 | /* 250 */ .long sys_epoll_create | 267 | /* 250 */ .long sys_epoll_create |
268 | .long sys_epoll_ctl | 268 | .long ABI(sys_epoll_ctl, sys_oabi_epoll_ctl) |
269 | .long sys_epoll_wait | 269 | .long ABI(sys_epoll_wait, sys_oabi_epoll_wait) |
270 | .long sys_remap_file_pages | 270 | .long sys_remap_file_pages |
271 | .long sys_ni_syscall /* sys_set_thread_area */ | 271 | .long sys_ni_syscall /* sys_set_thread_area */ |
272 | /* 255 */ .long sys_ni_syscall /* sys_get_thread_area */ | 272 | /* 255 */ .long sys_ni_syscall /* sys_get_thread_area */ |
@@ -280,8 +280,8 @@ __syscall_start: | |||
280 | .long sys_clock_gettime | 280 | .long sys_clock_gettime |
281 | .long sys_clock_getres | 281 | .long sys_clock_getres |
282 | /* 265 */ .long sys_clock_nanosleep | 282 | /* 265 */ .long sys_clock_nanosleep |
283 | .long sys_statfs64 | 283 | .long sys_statfs64_wrapper |
284 | .long sys_fstatfs64 | 284 | .long sys_fstatfs64_wrapper |
285 | .long sys_tgkill | 285 | .long sys_tgkill |
286 | .long sys_utimes | 286 | .long sys_utimes |
287 | /* 270 */ .long sys_arm_fadvise64_64 | 287 | /* 270 */ .long sys_arm_fadvise64_64 |
@@ -312,7 +312,7 @@ __syscall_start: | |||
312 | /* 295 */ .long sys_getsockopt | 312 | /* 295 */ .long sys_getsockopt |
313 | .long sys_sendmsg | 313 | .long sys_sendmsg |
314 | .long sys_recvmsg | 314 | .long sys_recvmsg |
315 | .long sys_semop | 315 | .long ABI(sys_semop, sys_oabi_semop) |
316 | .long sys_semget | 316 | .long sys_semget |
317 | /* 300 */ .long sys_semctl | 317 | /* 300 */ .long sys_semctl |
318 | .long sys_msgsnd | 318 | .long sys_msgsnd |
@@ -326,7 +326,7 @@ __syscall_start: | |||
326 | .long sys_add_key | 326 | .long sys_add_key |
327 | /* 310 */ .long sys_request_key | 327 | /* 310 */ .long sys_request_key |
328 | .long sys_keyctl | 328 | .long sys_keyctl |
329 | .long sys_semtimedop | 329 | .long ABI(sys_semtimedop, sys_oabi_semtimedop) |
330 | /* vserver */ .long sys_ni_syscall | 330 | /* vserver */ .long sys_ni_syscall |
331 | .long sys_ioprio_set | 331 | .long sys_ioprio_set |
332 | /* 315 */ .long sys_ioprio_get | 332 | /* 315 */ .long sys_ioprio_get |
@@ -336,9 +336,8 @@ __syscall_start: | |||
336 | .long sys_mbind | 336 | .long sys_mbind |
337 | /* 320 */ .long sys_get_mempolicy | 337 | /* 320 */ .long sys_get_mempolicy |
338 | .long sys_set_mempolicy | 338 | .long sys_set_mempolicy |
339 | __syscall_end: | ||
340 | 339 | ||
341 | .rept NR_syscalls - (__syscall_end - __syscall_start) / 4 | 340 | .rept NR_syscalls - (. - 100b) / 4 |
342 | .long sys_ni_syscall | 341 | .long sys_ni_syscall |
343 | .endr | 342 | .endr |
344 | #endif | 343 | #endif |
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S index a52baedf6262..874e6bb79405 100644 --- a/arch/arm/kernel/entry-armv.S +++ b/arch/arm/kernel/entry-armv.S | |||
@@ -3,6 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Copyright (C) 1996,1997,1998 Russell King. | 4 | * Copyright (C) 1996,1997,1998 Russell King. |
5 | * ARM700 fix by Matthew Godbolt (linux-user@willothewisp.demon.co.uk) | 5 | * ARM700 fix by Matthew Godbolt (linux-user@willothewisp.demon.co.uk) |
6 | * nommu support by Hyok S. Choi (hyok.choi@samsung.com) | ||
6 | * | 7 | * |
7 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
@@ -104,14 +105,24 @@ common_invalid: | |||
104 | /* | 105 | /* |
105 | * SVC mode handlers | 106 | * SVC mode handlers |
106 | */ | 107 | */ |
108 | |||
109 | #if defined(CONFIG_AEABI) && (__LINUX_ARM_ARCH__ >= 5) | ||
110 | #define SPFIX(code...) code | ||
111 | #else | ||
112 | #define SPFIX(code...) | ||
113 | #endif | ||
114 | |||
107 | .macro svc_entry | 115 | .macro svc_entry |
108 | sub sp, sp, #S_FRAME_SIZE | 116 | sub sp, sp, #S_FRAME_SIZE |
117 | SPFIX( tst sp, #4 ) | ||
118 | SPFIX( bicne sp, sp, #4 ) | ||
109 | stmib sp, {r1 - r12} | 119 | stmib sp, {r1 - r12} |
110 | 120 | ||
111 | ldmia r0, {r1 - r3} | 121 | ldmia r0, {r1 - r3} |
112 | add r5, sp, #S_SP @ here for interlock avoidance | 122 | add r5, sp, #S_SP @ here for interlock avoidance |
113 | mov r4, #-1 @ "" "" "" "" | 123 | mov r4, #-1 @ "" "" "" "" |
114 | add r0, sp, #S_FRAME_SIZE @ "" "" "" "" | 124 | add r0, sp, #S_FRAME_SIZE @ "" "" "" "" |
125 | SPFIX( addne r0, r0, #4 ) | ||
115 | str r1, [sp] @ save the "real" r0 copied | 126 | str r1, [sp] @ save the "real" r0 copied |
116 | @ from the exception stack | 127 | @ from the exception stack |
117 | 128 | ||
@@ -302,7 +313,14 @@ __pabt_svc: | |||
302 | 313 | ||
303 | /* | 314 | /* |
304 | * User mode handlers | 315 | * User mode handlers |
316 | * | ||
317 | * EABI note: sp_svc is always 64-bit aligned here, so should S_FRAME_SIZE | ||
305 | */ | 318 | */ |
319 | |||
320 | #if defined(CONFIG_AEABI) && (__LINUX_ARM_ARCH__ >= 5) && (S_FRAME_SIZE & 7) | ||
321 | #error "sizeof(struct pt_regs) must be a multiple of 8" | ||
322 | #endif | ||
323 | |||
306 | .macro usr_entry | 324 | .macro usr_entry |
307 | sub sp, sp, #S_FRAME_SIZE | 325 | sub sp, sp, #S_FRAME_SIZE |
308 | stmib sp, {r1 - r12} | 326 | stmib sp, {r1 - r12} |
@@ -538,7 +556,11 @@ ENTRY(__switch_to) | |||
538 | add ip, r1, #TI_CPU_SAVE | 556 | add ip, r1, #TI_CPU_SAVE |
539 | ldr r3, [r2, #TI_TP_VALUE] | 557 | ldr r3, [r2, #TI_TP_VALUE] |
540 | stmia ip!, {r4 - sl, fp, sp, lr} @ Store most regs on stack | 558 | stmia ip!, {r4 - sl, fp, sp, lr} @ Store most regs on stack |
559 | #ifndef CONFIG_MMU | ||
560 | add r2, r2, #TI_CPU_DOMAIN | ||
561 | #else | ||
541 | ldr r6, [r2, #TI_CPU_DOMAIN]! | 562 | ldr r6, [r2, #TI_CPU_DOMAIN]! |
563 | #endif | ||
542 | #if __LINUX_ARM_ARCH__ >= 6 | 564 | #if __LINUX_ARM_ARCH__ >= 6 |
543 | #ifdef CONFIG_CPU_MPCORE | 565 | #ifdef CONFIG_CPU_MPCORE |
544 | clrex | 566 | clrex |
@@ -556,7 +578,9 @@ ENTRY(__switch_to) | |||
556 | mov r4, #0xffff0fff | 578 | mov r4, #0xffff0fff |
557 | str r3, [r4, #-15] @ TLS val at 0xffff0ff0 | 579 | str r3, [r4, #-15] @ TLS val at 0xffff0ff0 |
558 | #endif | 580 | #endif |
581 | #ifdef CONFIG_MMU | ||
559 | mcr p15, 0, r6, c3, c0, 0 @ Set domain register | 582 | mcr p15, 0, r6, c3, c0, 0 @ Set domain register |
583 | #endif | ||
560 | #ifdef CONFIG_VFP | 584 | #ifdef CONFIG_VFP |
561 | @ Always disable VFP so we can lazily save/restore the old | 585 | @ Always disable VFP so we can lazily save/restore the old |
562 | @ state. This occurs in the context of the previous thread. | 586 | @ state. This occurs in the context of the previous thread. |
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index e2b42997ad33..2b92ce85f97f 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S | |||
@@ -98,20 +98,14 @@ ENTRY(ret_from_fork) | |||
98 | run on an ARM7 and we can save a couple of instructions. | 98 | run on an ARM7 and we can save a couple of instructions. |
99 | --pb */ | 99 | --pb */ |
100 | #ifdef CONFIG_CPU_ARM710 | 100 | #ifdef CONFIG_CPU_ARM710 |
101 | .macro arm710_bug_check, instr, temp | 101 | #define A710(code...) code |
102 | and \temp, \instr, #0x0f000000 @ check for SWI | 102 | .Larm710bug: |
103 | teq \temp, #0x0f000000 | ||
104 | bne .Larm700bug | ||
105 | .endm | ||
106 | |||
107 | .Larm700bug: | ||
108 | ldmia sp, {r0 - lr}^ @ Get calling r0 - lr | 103 | ldmia sp, {r0 - lr}^ @ Get calling r0 - lr |
109 | mov r0, r0 | 104 | mov r0, r0 |
110 | add sp, sp, #S_FRAME_SIZE | 105 | add sp, sp, #S_FRAME_SIZE |
111 | subs pc, lr, #4 | 106 | subs pc, lr, #4 |
112 | #else | 107 | #else |
113 | .macro arm710_bug_check, instr, temp | 108 | #define A710(code...) |
114 | .endm | ||
115 | #endif | 109 | #endif |
116 | 110 | ||
117 | .align 5 | 111 | .align 5 |
@@ -129,14 +123,50 @@ ENTRY(vector_swi) | |||
129 | /* | 123 | /* |
130 | * Get the system call number. | 124 | * Get the system call number. |
131 | */ | 125 | */ |
126 | |||
127 | #if defined(CONFIG_OABI_COMPAT) | ||
128 | |||
129 | /* | ||
130 | * If we have CONFIG_OABI_COMPAT then we need to look at the swi | ||
131 | * value to determine if it is an EABI or an old ABI call. | ||
132 | */ | ||
132 | #ifdef CONFIG_ARM_THUMB | 133 | #ifdef CONFIG_ARM_THUMB |
134 | tst r8, #PSR_T_BIT | ||
135 | movne r10, #0 @ no thumb OABI emulation | ||
136 | ldreq r10, [lr, #-4] @ get SWI instruction | ||
137 | #else | ||
138 | ldr r10, [lr, #-4] @ get SWI instruction | ||
139 | A710( and ip, r10, #0x0f000000 @ check for SWI ) | ||
140 | A710( teq ip, #0x0f000000 ) | ||
141 | A710( bne .Larm710bug ) | ||
142 | #endif | ||
143 | |||
144 | #elif defined(CONFIG_AEABI) | ||
145 | |||
146 | /* | ||
147 | * Pure EABI user space always put syscall number into scno (r7). | ||
148 | */ | ||
149 | A710( ldr ip, [lr, #-4] @ get SWI instruction ) | ||
150 | A710( and ip, ip, #0x0f000000 @ check for SWI ) | ||
151 | A710( teq ip, #0x0f000000 ) | ||
152 | A710( bne .Larm710bug ) | ||
153 | |||
154 | #elif defined(CONFIG_ARM_THUMB) | ||
155 | |||
156 | /* Legacy ABI only, possibly thumb mode. */ | ||
133 | tst r8, #PSR_T_BIT @ this is SPSR from save_user_regs | 157 | tst r8, #PSR_T_BIT @ this is SPSR from save_user_regs |
134 | addne scno, r7, #__NR_SYSCALL_BASE @ put OS number in | 158 | addne scno, r7, #__NR_SYSCALL_BASE @ put OS number in |
135 | ldreq scno, [lr, #-4] | 159 | ldreq scno, [lr, #-4] |
160 | |||
136 | #else | 161 | #else |
162 | |||
163 | /* Legacy ABI only. */ | ||
137 | ldr scno, [lr, #-4] @ get SWI instruction | 164 | ldr scno, [lr, #-4] @ get SWI instruction |
165 | A710( and ip, scno, #0x0f000000 @ check for SWI ) | ||
166 | A710( teq ip, #0x0f000000 ) | ||
167 | A710( bne .Larm710bug ) | ||
168 | |||
138 | #endif | 169 | #endif |
139 | arm710_bug_check scno, ip | ||
140 | 170 | ||
141 | #ifdef CONFIG_ALIGNMENT_TRAP | 171 | #ifdef CONFIG_ALIGNMENT_TRAP |
142 | ldr ip, __cr_alignment | 172 | ldr ip, __cr_alignment |
@@ -145,18 +175,31 @@ ENTRY(vector_swi) | |||
145 | #endif | 175 | #endif |
146 | enable_irq | 176 | enable_irq |
147 | 177 | ||
148 | stmdb sp!, {r4, r5} @ push fifth and sixth args | ||
149 | |||
150 | get_thread_info tsk | 178 | get_thread_info tsk |
179 | adr tbl, sys_call_table @ load syscall table pointer | ||
151 | ldr ip, [tsk, #TI_FLAGS] @ check for syscall tracing | 180 | ldr ip, [tsk, #TI_FLAGS] @ check for syscall tracing |
181 | |||
182 | #if defined(CONFIG_OABI_COMPAT) | ||
183 | /* | ||
184 | * If the swi argument is zero, this is an EABI call and we do nothing. | ||
185 | * | ||
186 | * If this is an old ABI call, get the syscall number into scno and | ||
187 | * get the old ABI syscall table address. | ||
188 | */ | ||
189 | bics r10, r10, #0xff000000 | ||
190 | eorne scno, r10, #__NR_OABI_SYSCALL_BASE | ||
191 | ldrne tbl, =sys_oabi_call_table | ||
192 | #elif !defined(CONFIG_AEABI) | ||
152 | bic scno, scno, #0xff000000 @ mask off SWI op-code | 193 | bic scno, scno, #0xff000000 @ mask off SWI op-code |
153 | eor scno, scno, #__NR_SYSCALL_BASE @ check OS number | 194 | eor scno, scno, #__NR_SYSCALL_BASE @ check OS number |
154 | adr tbl, sys_call_table @ load syscall table pointer | 195 | #endif |
196 | |||
197 | stmdb sp!, {r4, r5} @ push fifth and sixth args | ||
155 | tst ip, #_TIF_SYSCALL_TRACE @ are we tracing syscalls? | 198 | tst ip, #_TIF_SYSCALL_TRACE @ are we tracing syscalls? |
156 | bne __sys_trace | 199 | bne __sys_trace |
157 | 200 | ||
158 | adr lr, ret_fast_syscall @ return address | ||
159 | cmp scno, #NR_syscalls @ check upper syscall limit | 201 | cmp scno, #NR_syscalls @ check upper syscall limit |
202 | adr lr, ret_fast_syscall @ return address | ||
160 | ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine | 203 | ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine |
161 | 204 | ||
162 | add r1, sp, #S_OFF | 205 | add r1, sp, #S_OFF |
@@ -171,11 +214,13 @@ ENTRY(vector_swi) | |||
171 | * context switches, and waiting for our parent to respond. | 214 | * context switches, and waiting for our parent to respond. |
172 | */ | 215 | */ |
173 | __sys_trace: | 216 | __sys_trace: |
217 | mov r2, scno | ||
174 | add r1, sp, #S_OFF | 218 | add r1, sp, #S_OFF |
175 | mov r0, #0 @ trace entry [IP = 0] | 219 | mov r0, #0 @ trace entry [IP = 0] |
176 | bl syscall_trace | 220 | bl syscall_trace |
177 | 221 | ||
178 | adr lr, __sys_trace_return @ return address | 222 | adr lr, __sys_trace_return @ return address |
223 | mov scno, r0 @ syscall number (possibly new) | ||
179 | add r1, sp, #S_R0 + S_OFF @ pointer to regs | 224 | add r1, sp, #S_R0 + S_OFF @ pointer to regs |
180 | cmp scno, #NR_syscalls @ check upper syscall limit | 225 | cmp scno, #NR_syscalls @ check upper syscall limit |
181 | ldmccia r1, {r0 - r3} @ have to reload r0 - r3 | 226 | ldmccia r1, {r0 - r3} @ have to reload r0 - r3 |
@@ -184,6 +229,7 @@ __sys_trace: | |||
184 | 229 | ||
185 | __sys_trace_return: | 230 | __sys_trace_return: |
186 | str r0, [sp, #S_R0 + S_OFF]! @ save returned r0 | 231 | str r0, [sp, #S_R0 + S_OFF]! @ save returned r0 |
232 | mov r2, scno | ||
187 | mov r1, sp | 233 | mov r1, sp |
188 | mov r0, #1 @ trace exit [IP = 1] | 234 | mov r0, #1 @ trace exit [IP = 1] |
189 | bl syscall_trace | 235 | bl syscall_trace |
@@ -195,10 +241,24 @@ __sys_trace_return: | |||
195 | __cr_alignment: | 241 | __cr_alignment: |
196 | .word cr_alignment | 242 | .word cr_alignment |
197 | #endif | 243 | #endif |
244 | .ltorg | ||
245 | |||
246 | /* | ||
247 | * This is the syscall table declaration for native ABI syscalls. | ||
248 | * With EABI a couple syscalls are obsolete and defined as sys_ni_syscall. | ||
249 | */ | ||
250 | #define ABI(native, compat) native | ||
251 | #ifdef CONFIG_AEABI | ||
252 | #define OBSOLETE(syscall) sys_ni_syscall | ||
253 | #else | ||
254 | #define OBSOLETE(syscall) syscall | ||
255 | #endif | ||
198 | 256 | ||
199 | .type sys_call_table, #object | 257 | .type sys_call_table, #object |
200 | ENTRY(sys_call_table) | 258 | ENTRY(sys_call_table) |
201 | #include "calls.S" | 259 | #include "calls.S" |
260 | #undef ABI | ||
261 | #undef OBSOLETE | ||
202 | 262 | ||
203 | /*============================================================================ | 263 | /*============================================================================ |
204 | * Special system call wrappers | 264 | * Special system call wrappers |
@@ -207,7 +267,7 @@ ENTRY(sys_call_table) | |||
207 | @ r8 = syscall table | 267 | @ r8 = syscall table |
208 | .type sys_syscall, #function | 268 | .type sys_syscall, #function |
209 | sys_syscall: | 269 | sys_syscall: |
210 | eor scno, r0, #__NR_SYSCALL_BASE | 270 | eor scno, r0, #__NR_OABI_SYSCALL_BASE |
211 | cmp scno, #__NR_syscall - __NR_SYSCALL_BASE | 271 | cmp scno, #__NR_syscall - __NR_SYSCALL_BASE |
212 | cmpne scno, #NR_syscalls @ check range | 272 | cmpne scno, #NR_syscalls @ check range |
213 | stmloia sp, {r5, r6} @ shuffle args | 273 | stmloia sp, {r5, r6} @ shuffle args |
@@ -255,6 +315,16 @@ sys_sigaltstack_wrapper: | |||
255 | ldr r2, [sp, #S_OFF + S_SP] | 315 | ldr r2, [sp, #S_OFF + S_SP] |
256 | b do_sigaltstack | 316 | b do_sigaltstack |
257 | 317 | ||
318 | sys_statfs64_wrapper: | ||
319 | teq r1, #88 | ||
320 | moveq r1, #84 | ||
321 | b sys_statfs64 | ||
322 | |||
323 | sys_fstatfs64_wrapper: | ||
324 | teq r1, #88 | ||
325 | moveq r1, #84 | ||
326 | b sys_fstatfs64 | ||
327 | |||
258 | /* | 328 | /* |
259 | * Note: off_4k (r5) is always units of 4K. If we can't do the requested | 329 | * Note: off_4k (r5) is always units of 4K. If we can't do the requested |
260 | * offset, we return EINVAL. | 330 | * offset, we return EINVAL. |
@@ -271,3 +341,49 @@ sys_mmap2: | |||
271 | str r5, [sp, #4] | 341 | str r5, [sp, #4] |
272 | b do_mmap2 | 342 | b do_mmap2 |
273 | #endif | 343 | #endif |
344 | |||
345 | #ifdef CONFIG_OABI_COMPAT | ||
346 | |||
347 | /* | ||
348 | * These are syscalls with argument register differences | ||
349 | */ | ||
350 | |||
351 | sys_oabi_pread64: | ||
352 | stmia sp, {r3, r4} | ||
353 | b sys_pread64 | ||
354 | |||
355 | sys_oabi_pwrite64: | ||
356 | stmia sp, {r3, r4} | ||
357 | b sys_pwrite64 | ||
358 | |||
359 | sys_oabi_truncate64: | ||
360 | mov r3, r2 | ||
361 | mov r2, r1 | ||
362 | b sys_truncate64 | ||
363 | |||
364 | sys_oabi_ftruncate64: | ||
365 | mov r3, r2 | ||
366 | mov r2, r1 | ||
367 | b sys_ftruncate64 | ||
368 | |||
369 | sys_oabi_readahead: | ||
370 | str r3, [sp] | ||
371 | mov r3, r2 | ||
372 | mov r2, r1 | ||
373 | b sys_readahead | ||
374 | |||
375 | /* | ||
376 | * Let's declare a second syscall table for old ABI binaries | ||
377 | * using the compatibility syscall entries. | ||
378 | */ | ||
379 | #define ABI(native, compat) compat | ||
380 | #define OBSOLETE(syscall) syscall | ||
381 | |||
382 | .type sys_oabi_call_table, #object | ||
383 | ENTRY(sys_oabi_call_table) | ||
384 | #include "calls.S" | ||
385 | #undef ABI | ||
386 | #undef OBSOLETE | ||
387 | |||
388 | #endif | ||
389 | |||
diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S index 648cfff93138..55c99cdab7d6 100644 --- a/arch/arm/kernel/entry-header.S +++ b/arch/arm/kernel/entry-header.S | |||
@@ -19,6 +19,7 @@ | |||
19 | @ | 19 | @ |
20 | @ Most of the stack format comes from struct pt_regs, but with | 20 | @ Most of the stack format comes from struct pt_regs, but with |
21 | @ the addition of 8 bytes for storing syscall args 5 and 6. | 21 | @ the addition of 8 bytes for storing syscall args 5 and 6. |
22 | @ This _must_ remain a multiple of 8 for EABI. | ||
22 | @ | 23 | @ |
23 | #define S_OFF 8 | 24 | #define S_OFF 8 |
24 | 25 | ||
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index 1e985f2cd70f..1aca1775b28f 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S | |||
@@ -251,12 +251,11 @@ __turn_mmu_on: | |||
251 | * r10 = procinfo | 251 | * r10 = procinfo |
252 | * | 252 | * |
253 | * Returns: | 253 | * Returns: |
254 | * r0, r3, r5, r6, r7 corrupted | 254 | * r0, r3, r6, r7 corrupted |
255 | * r4 = physical page table address | 255 | * r4 = physical page table address |
256 | */ | 256 | */ |
257 | .type __create_page_tables, %function | 257 | .type __create_page_tables, %function |
258 | __create_page_tables: | 258 | __create_page_tables: |
259 | ldr r5, [r8, #MACHINFO_PHYSRAM] @ physram | ||
260 | pgtbl r4 @ page table address | 259 | pgtbl r4 @ page table address |
261 | 260 | ||
262 | /* | 261 | /* |
@@ -303,7 +302,7 @@ __create_page_tables: | |||
303 | * Then map first 1MB of ram in case it contains our boot params. | 302 | * Then map first 1MB of ram in case it contains our boot params. |
304 | */ | 303 | */ |
305 | add r0, r4, #PAGE_OFFSET >> 18 | 304 | add r0, r4, #PAGE_OFFSET >> 18 |
306 | orr r6, r5, r7 | 305 | orr r6, r7, #PHYS_OFFSET |
307 | str r6, [r0] | 306 | str r6, [r0] |
308 | 307 | ||
309 | #ifdef CONFIG_XIP_KERNEL | 308 | #ifdef CONFIG_XIP_KERNEL |
@@ -311,7 +310,7 @@ __create_page_tables: | |||
311 | * Map some ram to cover our .data and .bss areas. | 310 | * Map some ram to cover our .data and .bss areas. |
312 | * Mapping 3MB should be plenty. | 311 | * Mapping 3MB should be plenty. |
313 | */ | 312 | */ |
314 | sub r3, r4, r5 | 313 | sub r3, r4, #PHYS_OFFSET |
315 | mov r3, r3, lsr #20 | 314 | mov r3, r3, lsr #20 |
316 | add r0, r0, r3, lsl #2 | 315 | add r0, r0, r3, lsl #2 |
317 | add r6, r6, r3, lsl #20 | 316 | add r6, r6, r3, lsl #20 |
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c index e591f72bcdeb..7b6256bb590e 100644 --- a/arch/arm/kernel/ptrace.c +++ b/arch/arm/kernel/ptrace.c | |||
@@ -766,6 +766,11 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
766 | (unsigned long __user *) data); | 766 | (unsigned long __user *) data); |
767 | break; | 767 | break; |
768 | 768 | ||
769 | case PTRACE_SET_SYSCALL: | ||
770 | ret = 0; | ||
771 | child->ptrace_message = data; | ||
772 | break; | ||
773 | |||
769 | default: | 774 | default: |
770 | ret = ptrace_request(child, request, addr, data); | 775 | ret = ptrace_request(child, request, addr, data); |
771 | break; | 776 | break; |
@@ -774,14 +779,14 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) | |||
774 | return ret; | 779 | return ret; |
775 | } | 780 | } |
776 | 781 | ||
777 | asmlinkage void syscall_trace(int why, struct pt_regs *regs) | 782 | asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno) |
778 | { | 783 | { |
779 | unsigned long ip; | 784 | unsigned long ip; |
780 | 785 | ||
781 | if (!test_thread_flag(TIF_SYSCALL_TRACE)) | 786 | if (!test_thread_flag(TIF_SYSCALL_TRACE)) |
782 | return; | 787 | return scno; |
783 | if (!(current->ptrace & PT_PTRACED)) | 788 | if (!(current->ptrace & PT_PTRACED)) |
784 | return; | 789 | return scno; |
785 | 790 | ||
786 | /* | 791 | /* |
787 | * Save IP. IP is used to denote syscall entry/exit: | 792 | * Save IP. IP is used to denote syscall entry/exit: |
@@ -790,6 +795,8 @@ asmlinkage void syscall_trace(int why, struct pt_regs *regs) | |||
790 | ip = regs->ARM_ip; | 795 | ip = regs->ARM_ip; |
791 | regs->ARM_ip = why; | 796 | regs->ARM_ip = why; |
792 | 797 | ||
798 | current->ptrace_message = scno; | ||
799 | |||
793 | /* the 0x80 provides a way for the tracing parent to distinguish | 800 | /* the 0x80 provides a way for the tracing parent to distinguish |
794 | between a syscall stop and SIGTRAP delivery */ | 801 | between a syscall stop and SIGTRAP delivery */ |
795 | ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) | 802 | ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) |
@@ -804,4 +811,6 @@ asmlinkage void syscall_trace(int why, struct pt_regs *regs) | |||
804 | current->exit_code = 0; | 811 | current->exit_code = 0; |
805 | } | 812 | } |
806 | regs->ARM_ip = ip; | 813 | regs->ARM_ip = ip; |
814 | |||
815 | return current->ptrace_message; | ||
807 | } | 816 | } |
diff --git a/arch/arm/kernel/semaphore.c b/arch/arm/kernel/semaphore.c index 4c31f2923055..981fe5c6ccbe 100644 --- a/arch/arm/kernel/semaphore.c +++ b/arch/arm/kernel/semaphore.c | |||
@@ -177,41 +177,42 @@ int __down_trylock(struct semaphore * sem) | |||
177 | * ip contains the semaphore pointer on entry. Save the C-clobbered | 177 | * ip contains the semaphore pointer on entry. Save the C-clobbered |
178 | * registers (r0 to r3 and lr), but not ip, as we use it as a return | 178 | * registers (r0 to r3 and lr), but not ip, as we use it as a return |
179 | * value in some cases.. | 179 | * value in some cases.. |
180 | * To remain AAPCS compliant (64-bit stack align) we save r4 as well. | ||
180 | */ | 181 | */ |
181 | asm(" .section .sched.text,\"ax\",%progbits \n\ | 182 | asm(" .section .sched.text,\"ax\",%progbits \n\ |
182 | .align 5 \n\ | 183 | .align 5 \n\ |
183 | .globl __down_failed \n\ | 184 | .globl __down_failed \n\ |
184 | __down_failed: \n\ | 185 | __down_failed: \n\ |
185 | stmfd sp!, {r0 - r3, lr} \n\ | 186 | stmfd sp!, {r0 - r4, lr} \n\ |
186 | mov r0, ip \n\ | 187 | mov r0, ip \n\ |
187 | bl __down \n\ | 188 | bl __down \n\ |
188 | ldmfd sp!, {r0 - r3, pc} \n\ | 189 | ldmfd sp!, {r0 - r4, pc} \n\ |
189 | \n\ | 190 | \n\ |
190 | .align 5 \n\ | 191 | .align 5 \n\ |
191 | .globl __down_interruptible_failed \n\ | 192 | .globl __down_interruptible_failed \n\ |
192 | __down_interruptible_failed: \n\ | 193 | __down_interruptible_failed: \n\ |
193 | stmfd sp!, {r0 - r3, lr} \n\ | 194 | stmfd sp!, {r0 - r4, lr} \n\ |
194 | mov r0, ip \n\ | 195 | mov r0, ip \n\ |
195 | bl __down_interruptible \n\ | 196 | bl __down_interruptible \n\ |
196 | mov ip, r0 \n\ | 197 | mov ip, r0 \n\ |
197 | ldmfd sp!, {r0 - r3, pc} \n\ | 198 | ldmfd sp!, {r0 - r4, pc} \n\ |
198 | \n\ | 199 | \n\ |
199 | .align 5 \n\ | 200 | .align 5 \n\ |
200 | .globl __down_trylock_failed \n\ | 201 | .globl __down_trylock_failed \n\ |
201 | __down_trylock_failed: \n\ | 202 | __down_trylock_failed: \n\ |
202 | stmfd sp!, {r0 - r3, lr} \n\ | 203 | stmfd sp!, {r0 - r4, lr} \n\ |
203 | mov r0, ip \n\ | 204 | mov r0, ip \n\ |
204 | bl __down_trylock \n\ | 205 | bl __down_trylock \n\ |
205 | mov ip, r0 \n\ | 206 | mov ip, r0 \n\ |
206 | ldmfd sp!, {r0 - r3, pc} \n\ | 207 | ldmfd sp!, {r0 - r4, pc} \n\ |
207 | \n\ | 208 | \n\ |
208 | .align 5 \n\ | 209 | .align 5 \n\ |
209 | .globl __up_wakeup \n\ | 210 | .globl __up_wakeup \n\ |
210 | __up_wakeup: \n\ | 211 | __up_wakeup: \n\ |
211 | stmfd sp!, {r0 - r3, lr} \n\ | 212 | stmfd sp!, {r0 - r4, lr} \n\ |
212 | mov r0, ip \n\ | 213 | mov r0, ip \n\ |
213 | bl __up \n\ | 214 | bl __up \n\ |
214 | ldmfd sp!, {r0 - r3, pc} \n\ | 215 | ldmfd sp!, {r0 - r4, pc} \n\ |
215 | "); | 216 | "); |
216 | 217 | ||
217 | EXPORT_SYMBOL(__down_failed); | 218 | EXPORT_SYMBOL(__down_failed); |
diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c index ea569ba482b1..a491de2d9024 100644 --- a/arch/arm/kernel/sys_arm.c +++ b/arch/arm/kernel/sys_arm.c | |||
@@ -147,6 +147,7 @@ asmlinkage int old_select(struct sel_arg_struct __user *arg) | |||
147 | return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp); | 147 | return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp); |
148 | } | 148 | } |
149 | 149 | ||
150 | #if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT) | ||
150 | /* | 151 | /* |
151 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. | 152 | * sys_ipc() is the de-multiplexer for the SysV IPC calls.. |
152 | * | 153 | * |
@@ -226,6 +227,7 @@ asmlinkage int sys_ipc(uint call, int first, int second, int third, | |||
226 | return -ENOSYS; | 227 | return -ENOSYS; |
227 | } | 228 | } |
228 | } | 229 | } |
230 | #endif | ||
229 | 231 | ||
230 | /* Fork a new task - this creates a new program thread. | 232 | /* Fork a new task - this creates a new program thread. |
231 | * This is called indirectly via a small wrapper | 233 | * This is called indirectly via a small wrapper |
diff --git a/arch/arm/kernel/sys_oabi-compat.c b/arch/arm/kernel/sys_oabi-compat.c new file mode 100644 index 000000000000..eafa8e5284af --- /dev/null +++ b/arch/arm/kernel/sys_oabi-compat.c | |||
@@ -0,0 +1,339 @@ | |||
1 | /* | ||
2 | * arch/arm/kernel/sys_oabi-compat.c | ||
3 | * | ||
4 | * Compatibility wrappers for syscalls that are used from | ||
5 | * old ABI user space binaries with an EABI kernel. | ||
6 | * | ||
7 | * Author: Nicolas Pitre | ||
8 | * Created: Oct 7, 2005 | ||
9 | * Copyright: MontaVista Software, Inc. | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License version 2 as | ||
13 | * published by the Free Software Foundation. | ||
14 | */ | ||
15 | |||
16 | /* | ||
17 | * The legacy ABI and the new ARM EABI have different rules making some | ||
18 | * syscalls incompatible especially with structure arguments. | ||
19 | * Most notably, Eabi says 64-bit members should be 64-bit aligned instead of | ||
20 | * simply word aligned. EABI also pads structures to the size of the largest | ||
21 | * member it contains instead of the invariant 32-bit. | ||
22 | * | ||
23 | * The following syscalls are affected: | ||
24 | * | ||
25 | * sys_stat64: | ||
26 | * sys_lstat64: | ||
27 | * sys_fstat64: | ||
28 | * | ||
29 | * struct stat64 has different sizes and some members are shifted | ||
30 | * Compatibility wrappers are needed for them and provided below. | ||
31 | * | ||
32 | * sys_fcntl64: | ||
33 | * | ||
34 | * struct flock64 has different sizes and some members are shifted | ||
35 | * A compatibility wrapper is needed and provided below. | ||
36 | * | ||
37 | * sys_statfs64: | ||
38 | * sys_fstatfs64: | ||
39 | * | ||
40 | * struct statfs64 has extra padding with EABI growing its size from | ||
41 | * 84 to 88. This struct is now __attribute__((packed,aligned(4))) | ||
42 | * with a small assembly wrapper to force the sz argument to 84 if it is 88 | ||
43 | * to avoid copying the extra padding over user space unexpecting it. | ||
44 | * | ||
45 | * sys_newuname: | ||
46 | * | ||
47 | * struct new_utsname has no padding with EABI. No problem there. | ||
48 | * | ||
49 | * sys_epoll_ctl: | ||
50 | * sys_epoll_wait: | ||
51 | * | ||
52 | * struct epoll_event has its second member shifted also affecting the | ||
53 | * structure size. Compatibility wrappers are needed and provided below. | ||
54 | * | ||
55 | * sys_ipc: | ||
56 | * sys_semop: | ||
57 | * sys_semtimedop: | ||
58 | * | ||
59 | * struct sembuf loses its padding with EABI. Since arrays of them are | ||
60 | * used they have to be copyed to remove the padding. Compatibility wrappers | ||
61 | * provided below. | ||
62 | */ | ||
63 | |||
64 | #include <linux/syscalls.h> | ||
65 | #include <linux/errno.h> | ||
66 | #include <linux/fs.h> | ||
67 | #include <linux/fcntl.h> | ||
68 | #include <linux/eventpoll.h> | ||
69 | #include <linux/sem.h> | ||
70 | #include <asm/ipc.h> | ||
71 | #include <asm/uaccess.h> | ||
72 | |||
73 | struct oldabi_stat64 { | ||
74 | unsigned long long st_dev; | ||
75 | unsigned int __pad1; | ||
76 | unsigned long __st_ino; | ||
77 | unsigned int st_mode; | ||
78 | unsigned int st_nlink; | ||
79 | |||
80 | unsigned long st_uid; | ||
81 | unsigned long st_gid; | ||
82 | |||
83 | unsigned long long st_rdev; | ||
84 | unsigned int __pad2; | ||
85 | |||
86 | long long st_size; | ||
87 | unsigned long st_blksize; | ||
88 | unsigned long long st_blocks; | ||
89 | |||
90 | unsigned long st_atime; | ||
91 | unsigned long st_atime_nsec; | ||
92 | |||
93 | unsigned long st_mtime; | ||
94 | unsigned long st_mtime_nsec; | ||
95 | |||
96 | unsigned long st_ctime; | ||
97 | unsigned long st_ctime_nsec; | ||
98 | |||
99 | unsigned long long st_ino; | ||
100 | } __attribute__ ((packed,aligned(4))); | ||
101 | |||
102 | static long cp_oldabi_stat64(struct kstat *stat, | ||
103 | struct oldabi_stat64 __user *statbuf) | ||
104 | { | ||
105 | struct oldabi_stat64 tmp; | ||
106 | |||
107 | tmp.st_dev = huge_encode_dev(stat->dev); | ||
108 | tmp.__pad1 = 0; | ||
109 | tmp.__st_ino = stat->ino; | ||
110 | tmp.st_mode = stat->mode; | ||
111 | tmp.st_nlink = stat->nlink; | ||
112 | tmp.st_uid = stat->uid; | ||
113 | tmp.st_gid = stat->gid; | ||
114 | tmp.st_rdev = huge_encode_dev(stat->rdev); | ||
115 | tmp.st_size = stat->size; | ||
116 | tmp.st_blocks = stat->blocks; | ||
117 | tmp.__pad2 = 0; | ||
118 | tmp.st_blksize = stat->blksize; | ||
119 | tmp.st_atime = stat->atime.tv_sec; | ||
120 | tmp.st_atime_nsec = stat->atime.tv_nsec; | ||
121 | tmp.st_mtime = stat->mtime.tv_sec; | ||
122 | tmp.st_mtime_nsec = stat->mtime.tv_nsec; | ||
123 | tmp.st_ctime = stat->ctime.tv_sec; | ||
124 | tmp.st_ctime_nsec = stat->ctime.tv_nsec; | ||
125 | tmp.st_ino = stat->ino; | ||
126 | return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; | ||
127 | } | ||
128 | |||
129 | asmlinkage long sys_oabi_stat64(char __user * filename, | ||
130 | struct oldabi_stat64 __user * statbuf) | ||
131 | { | ||
132 | struct kstat stat; | ||
133 | int error = vfs_stat(filename, &stat); | ||
134 | if (!error) | ||
135 | error = cp_oldabi_stat64(&stat, statbuf); | ||
136 | return error; | ||
137 | } | ||
138 | |||
139 | asmlinkage long sys_oabi_lstat64(char __user * filename, | ||
140 | struct oldabi_stat64 __user * statbuf) | ||
141 | { | ||
142 | struct kstat stat; | ||
143 | int error = vfs_lstat(filename, &stat); | ||
144 | if (!error) | ||
145 | error = cp_oldabi_stat64(&stat, statbuf); | ||
146 | return error; | ||
147 | } | ||
148 | |||
149 | asmlinkage long sys_oabi_fstat64(unsigned long fd, | ||
150 | struct oldabi_stat64 __user * statbuf) | ||
151 | { | ||
152 | struct kstat stat; | ||
153 | int error = vfs_fstat(fd, &stat); | ||
154 | if (!error) | ||
155 | error = cp_oldabi_stat64(&stat, statbuf); | ||
156 | return error; | ||
157 | } | ||
158 | |||
159 | struct oabi_flock64 { | ||
160 | short l_type; | ||
161 | short l_whence; | ||
162 | loff_t l_start; | ||
163 | loff_t l_len; | ||
164 | pid_t l_pid; | ||
165 | } __attribute__ ((packed,aligned(4))); | ||
166 | |||
167 | asmlinkage long sys_oabi_fcntl64(unsigned int fd, unsigned int cmd, | ||
168 | unsigned long arg) | ||
169 | { | ||
170 | struct oabi_flock64 user; | ||
171 | struct flock64 kernel; | ||
172 | mm_segment_t fs = USER_DS; /* initialized to kill a warning */ | ||
173 | unsigned long local_arg = arg; | ||
174 | int ret; | ||
175 | |||
176 | switch (cmd) { | ||
177 | case F_GETLK64: | ||
178 | case F_SETLK64: | ||
179 | case F_SETLKW64: | ||
180 | if (copy_from_user(&user, (struct oabi_flock64 __user *)arg, | ||
181 | sizeof(user))) | ||
182 | return -EFAULT; | ||
183 | kernel.l_type = user.l_type; | ||
184 | kernel.l_whence = user.l_whence; | ||
185 | kernel.l_start = user.l_start; | ||
186 | kernel.l_len = user.l_len; | ||
187 | kernel.l_pid = user.l_pid; | ||
188 | local_arg = (unsigned long)&kernel; | ||
189 | fs = get_fs(); | ||
190 | set_fs(KERNEL_DS); | ||
191 | } | ||
192 | |||
193 | ret = sys_fcntl64(fd, cmd, local_arg); | ||
194 | |||
195 | switch (cmd) { | ||
196 | case F_GETLK64: | ||
197 | if (!ret) { | ||
198 | user.l_type = kernel.l_type; | ||
199 | user.l_whence = kernel.l_whence; | ||
200 | user.l_start = kernel.l_start; | ||
201 | user.l_len = kernel.l_len; | ||
202 | user.l_pid = kernel.l_pid; | ||
203 | if (copy_to_user((struct oabi_flock64 __user *)arg, | ||
204 | &user, sizeof(user))) | ||
205 | ret = -EFAULT; | ||
206 | } | ||
207 | case F_SETLK64: | ||
208 | case F_SETLKW64: | ||
209 | set_fs(fs); | ||
210 | } | ||
211 | |||
212 | return ret; | ||
213 | } | ||
214 | |||
215 | struct oabi_epoll_event { | ||
216 | __u32 events; | ||
217 | __u64 data; | ||
218 | } __attribute__ ((packed,aligned(4))); | ||
219 | |||
220 | asmlinkage long sys_oabi_epoll_ctl(int epfd, int op, int fd, | ||
221 | struct oabi_epoll_event __user *event) | ||
222 | { | ||
223 | struct oabi_epoll_event user; | ||
224 | struct epoll_event kernel; | ||
225 | mm_segment_t fs; | ||
226 | long ret; | ||
227 | |||
228 | if (op == EPOLL_CTL_DEL) | ||
229 | return sys_epoll_ctl(epfd, op, fd, NULL); | ||
230 | if (copy_from_user(&user, event, sizeof(user))) | ||
231 | return -EFAULT; | ||
232 | kernel.events = user.events; | ||
233 | kernel.data = user.data; | ||
234 | fs = get_fs(); | ||
235 | set_fs(KERNEL_DS); | ||
236 | ret = sys_epoll_ctl(epfd, op, fd, &kernel); | ||
237 | set_fs(fs); | ||
238 | return ret; | ||
239 | } | ||
240 | |||
241 | asmlinkage long sys_oabi_epoll_wait(int epfd, | ||
242 | struct oabi_epoll_event __user *events, | ||
243 | int maxevents, int timeout) | ||
244 | { | ||
245 | struct epoll_event *kbuf; | ||
246 | mm_segment_t fs; | ||
247 | long ret, err, i; | ||
248 | |||
249 | if (maxevents <= 0 || maxevents > (INT_MAX/sizeof(struct epoll_event))) | ||
250 | return -EINVAL; | ||
251 | kbuf = kmalloc(sizeof(*kbuf) * maxevents, GFP_KERNEL); | ||
252 | if (!kbuf) | ||
253 | return -ENOMEM; | ||
254 | fs = get_fs(); | ||
255 | set_fs(KERNEL_DS); | ||
256 | ret = sys_epoll_wait(epfd, kbuf, maxevents, timeout); | ||
257 | set_fs(fs); | ||
258 | err = 0; | ||
259 | for (i = 0; i < ret; i++) { | ||
260 | __put_user_error(kbuf[i].events, &events->events, err); | ||
261 | __put_user_error(kbuf[i].data, &events->data, err); | ||
262 | events++; | ||
263 | } | ||
264 | kfree(kbuf); | ||
265 | return err ? -EFAULT : ret; | ||
266 | } | ||
267 | |||
268 | struct oabi_sembuf { | ||
269 | unsigned short sem_num; | ||
270 | short sem_op; | ||
271 | short sem_flg; | ||
272 | unsigned short __pad; | ||
273 | }; | ||
274 | |||
275 | asmlinkage long sys_oabi_semtimedop(int semid, | ||
276 | struct oabi_sembuf __user *tsops, | ||
277 | unsigned nsops, | ||
278 | const struct timespec __user *timeout) | ||
279 | { | ||
280 | struct sembuf *sops; | ||
281 | struct timespec local_timeout; | ||
282 | long err; | ||
283 | int i; | ||
284 | |||
285 | if (nsops < 1) | ||
286 | return -EINVAL; | ||
287 | sops = kmalloc(sizeof(*sops) * nsops, GFP_KERNEL); | ||
288 | if (!sops) | ||
289 | return -ENOMEM; | ||
290 | err = 0; | ||
291 | for (i = 0; i < nsops; i++) { | ||
292 | __get_user_error(sops[i].sem_num, &tsops->sem_num, err); | ||
293 | __get_user_error(sops[i].sem_op, &tsops->sem_op, err); | ||
294 | __get_user_error(sops[i].sem_flg, &tsops->sem_flg, err); | ||
295 | tsops++; | ||
296 | } | ||
297 | if (timeout) { | ||
298 | /* copy this as well before changing domain protection */ | ||
299 | err |= copy_from_user(&local_timeout, timeout, sizeof(*timeout)); | ||
300 | timeout = &local_timeout; | ||
301 | } | ||
302 | if (err) { | ||
303 | err = -EFAULT; | ||
304 | } else { | ||
305 | mm_segment_t fs = get_fs(); | ||
306 | set_fs(KERNEL_DS); | ||
307 | err = sys_semtimedop(semid, sops, nsops, timeout); | ||
308 | set_fs(fs); | ||
309 | } | ||
310 | kfree(sops); | ||
311 | return err; | ||
312 | } | ||
313 | |||
314 | asmlinkage long sys_oabi_semop(int semid, struct oabi_sembuf __user *tsops, | ||
315 | unsigned nsops) | ||
316 | { | ||
317 | return sys_oabi_semtimedop(semid, tsops, nsops, NULL); | ||
318 | } | ||
319 | |||
320 | extern asmlinkage int sys_ipc(uint call, int first, int second, int third, | ||
321 | void __user *ptr, long fifth); | ||
322 | |||
323 | asmlinkage int sys_oabi_ipc(uint call, int first, int second, int third, | ||
324 | void __user *ptr, long fifth) | ||
325 | { | ||
326 | switch (call & 0xffff) { | ||
327 | case SEMOP: | ||
328 | return sys_oabi_semtimedop(first, | ||
329 | (struct oabi_sembuf __user *)ptr, | ||
330 | second, NULL); | ||
331 | case SEMTIMEDOP: | ||
332 | return sys_oabi_semtimedop(first, | ||
333 | (struct oabi_sembuf __user *)ptr, | ||
334 | second, | ||
335 | (const struct timespec __user *)fifth); | ||
336 | default: | ||
337 | return sys_ipc(call, first, second, third, ptr, fifth); | ||
338 | } | ||
339 | } | ||
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 93cfd3ffcc72..10235b01582e 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c | |||
@@ -404,7 +404,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs) | |||
404 | struct thread_info *thread = current_thread_info(); | 404 | struct thread_info *thread = current_thread_info(); |
405 | siginfo_t info; | 405 | siginfo_t info; |
406 | 406 | ||
407 | if ((no >> 16) != 0x9f) | 407 | if ((no >> 16) != (__ARM_NR_BASE>> 16)) |
408 | return bad_syscall(no, regs); | 408 | return bad_syscall(no, regs); |
409 | 409 | ||
410 | switch (no & 0xffff) { | 410 | switch (no & 0xffff) { |