diff options
Diffstat (limited to 'arch/arm/kernel/entry-common.S')
-rw-r--r-- | arch/arm/kernel/entry-common.S | 146 |
1 files changed, 131 insertions, 15 deletions
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 | |||