Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* -*- mode: asm -*- |
| 2 | * |
| 3 | * linux/arch/m68k/kernel/entry.S |
| 4 | * |
| 5 | * Copyright (C) 1991, 1992 Linus Torvalds |
| 6 | * |
| 7 | * This file is subject to the terms and conditions of the GNU General Public |
| 8 | * License. See the file README.legal in the main directory of this archive |
| 9 | * for more details. |
| 10 | * |
| 11 | * Linux/m68k support by Hamish Macdonald |
| 12 | * |
| 13 | * 68060 fixes by Jesper Skov |
| 14 | * |
| 15 | */ |
| 16 | |
| 17 | /* |
| 18 | * entry.S contains the system-call and fault low-level handling routines. |
| 19 | * This also contains the timer-interrupt handler, as well as all interrupts |
| 20 | * and faults that can result in a task-switch. |
| 21 | * |
| 22 | * NOTE: This code handles signal-recognition, which happens every time |
| 23 | * after a timer-interrupt and after each system call. |
| 24 | * |
| 25 | */ |
| 26 | |
| 27 | /* |
| 28 | * 12/03/96 Jes: Currently we only support m68k single-cpu systems, so |
| 29 | * all pointers that used to be 'current' are now entry |
| 30 | * number 0 in the 'current_set' list. |
| 31 | * |
| 32 | * 6/05/00 RZ: addedd writeback completion after return from sighandler |
| 33 | * for 68040 |
| 34 | */ |
| 35 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | #include <linux/linkage.h> |
| 37 | #include <asm/entry.h> |
| 38 | #include <asm/errno.h> |
| 39 | #include <asm/setup.h> |
| 40 | #include <asm/segment.h> |
| 41 | #include <asm/traps.h> |
| 42 | #include <asm/unistd.h> |
| 43 | |
Sam Ravnborg | 0013a85 | 2005-09-09 20:57:26 +0200 | [diff] [blame] | 44 | #include <asm/asm-offsets.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | |
Roman Zippel | 3b66a1e | 2005-11-13 16:06:59 -0800 | [diff] [blame] | 46 | .globl system_call, buserr, trap, resume |
Roman Zippel | 92445eaa | 2006-06-25 05:46:58 -0700 | [diff] [blame] | 47 | .globl sys_call_table |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 48 | .globl sys_fork, sys_clone, sys_vfork |
| 49 | .globl ret_from_interrupt, bad_interrupt |
Roman Zippel | 68387c4 | 2006-06-25 05:47:01 -0700 | [diff] [blame] | 50 | .globl auto_irqhandler_fixup |
| 51 | .globl user_irqvec_fixup, user_irqhandler_fixup |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 52 | |
| 53 | .text |
| 54 | ENTRY(buserr) |
| 55 | SAVE_ALL_INT |
| 56 | GET_CURRENT(%d0) |
| 57 | movel %sp,%sp@- | stack frame pointer argument |
| 58 | bsrl buserr_c |
| 59 | addql #4,%sp |
Roman Zippel | 3b66a1e | 2005-11-13 16:06:59 -0800 | [diff] [blame] | 60 | jra .Lret_from_exception |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | |
| 62 | ENTRY(trap) |
| 63 | SAVE_ALL_INT |
| 64 | GET_CURRENT(%d0) |
| 65 | movel %sp,%sp@- | stack frame pointer argument |
| 66 | bsrl trap_c |
| 67 | addql #4,%sp |
Roman Zippel | 3b66a1e | 2005-11-13 16:06:59 -0800 | [diff] [blame] | 68 | jra .Lret_from_exception |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | |
| 70 | | After a fork we jump here directly from resume, |
| 71 | | so that %d1 contains the previous task |
| 72 | | schedule_tail now used regardless of CONFIG_SMP |
| 73 | ENTRY(ret_from_fork) |
| 74 | movel %d1,%sp@- |
| 75 | jsr schedule_tail |
| 76 | addql #4,%sp |
Roman Zippel | 3b66a1e | 2005-11-13 16:06:59 -0800 | [diff] [blame] | 77 | jra .Lret_from_exception |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 78 | |
Roman Zippel | 3b66a1e | 2005-11-13 16:06:59 -0800 | [diff] [blame] | 79 | do_trace_entry: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | movel #-ENOSYS,%sp@(PT_D0) | needed for strace |
| 81 | subql #4,%sp |
| 82 | SAVE_SWITCH_STACK |
| 83 | jbsr syscall_trace |
| 84 | RESTORE_SWITCH_STACK |
| 85 | addql #4,%sp |
Roman Zippel | 3b66a1e | 2005-11-13 16:06:59 -0800 | [diff] [blame] | 86 | movel %sp@(PT_ORIG_D0),%d0 |
| 87 | cmpl #NR_syscalls,%d0 |
| 88 | jcs syscall |
| 89 | badsys: |
| 90 | movel #-ENOSYS,%sp@(PT_D0) |
| 91 | jra ret_from_syscall |
| 92 | |
| 93 | do_trace_exit: |
| 94 | subql #4,%sp |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 95 | SAVE_SWITCH_STACK |
| 96 | jbsr syscall_trace |
Roman Zippel | 3b66a1e | 2005-11-13 16:06:59 -0800 | [diff] [blame] | 97 | RESTORE_SWITCH_STACK |
| 98 | addql #4,%sp |
| 99 | jra .Lret_from_exception |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | |
Roman Zippel | 3b66a1e | 2005-11-13 16:06:59 -0800 | [diff] [blame] | 101 | ENTRY(ret_from_signal) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | RESTORE_SWITCH_STACK |
| 103 | addql #4,%sp |
| 104 | /* on 68040 complete pending writebacks if any */ |
| 105 | #ifdef CONFIG_M68040 |
| 106 | bfextu %sp@(PT_VECTOR){#0,#4},%d0 |
| 107 | subql #7,%d0 | bus error frame ? |
| 108 | jbne 1f |
| 109 | movel %sp,%sp@- |
| 110 | jbsr berr_040cleanup |
| 111 | addql #4,%sp |
| 112 | 1: |
| 113 | #endif |
Roman Zippel | 3b66a1e | 2005-11-13 16:06:59 -0800 | [diff] [blame] | 114 | jra .Lret_from_exception |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 115 | |
| 116 | ENTRY(system_call) |
| 117 | SAVE_ALL_SYS |
| 118 | |
| 119 | GET_CURRENT(%d1) |
| 120 | | save top of frame |
| 121 | movel %sp,%curptr@(TASK_THREAD+THREAD_ESP0) |
| 122 | |
Roman Zippel | 3b66a1e | 2005-11-13 16:06:59 -0800 | [diff] [blame] | 123 | | syscall trace? |
| 124 | tstb %curptr@(TASK_INFO+TINFO_FLAGS+2) |
| 125 | jmi do_trace_entry |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 126 | cmpl #NR_syscalls,%d0 |
| 127 | jcc badsys |
Roman Zippel | 3b66a1e | 2005-11-13 16:06:59 -0800 | [diff] [blame] | 128 | syscall: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 129 | jbsr @(sys_call_table,%d0:l:4)@(0) |
| 130 | movel %d0,%sp@(PT_D0) | save the return value |
Roman Zippel | 3b66a1e | 2005-11-13 16:06:59 -0800 | [diff] [blame] | 131 | ret_from_syscall: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | |oriw #0x0700,%sr |
Roman Zippel | 3b66a1e | 2005-11-13 16:06:59 -0800 | [diff] [blame] | 133 | movew %curptr@(TASK_INFO+TINFO_FLAGS+2),%d0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 | jne syscall_exit_work |
| 135 | 1: RESTORE_ALL |
| 136 | |
| 137 | syscall_exit_work: |
| 138 | btst #5,%sp@(PT_SR) | check if returning to kernel |
| 139 | bnes 1b | if so, skip resched, signals |
Roman Zippel | 3b66a1e | 2005-11-13 16:06:59 -0800 | [diff] [blame] | 140 | lslw #1,%d0 |
| 141 | jcs do_trace_exit |
| 142 | jmi do_delayed_trace |
| 143 | lslw #8,%d0 |
| 144 | jmi do_signal_return |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 | pea resume_userspace |
Roman Zippel | 3b66a1e | 2005-11-13 16:06:59 -0800 | [diff] [blame] | 146 | jra schedule |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | |
Roman Zippel | 3b66a1e | 2005-11-13 16:06:59 -0800 | [diff] [blame] | 148 | |
| 149 | ENTRY(ret_from_exception) |
| 150 | .Lret_from_exception: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 | btst #5,%sp@(PT_SR) | check if returning to kernel |
| 152 | bnes 1f | if so, skip resched, signals |
| 153 | | only allow interrupts when we are really the last one on the |
| 154 | | kernel stack, otherwise stack overflow can occur during |
| 155 | | heavy interrupt load |
| 156 | andw #ALLOWINT,%sr |
| 157 | |
| 158 | resume_userspace: |
Roman Zippel | 3b66a1e | 2005-11-13 16:06:59 -0800 | [diff] [blame] | 159 | moveb %curptr@(TASK_INFO+TINFO_FLAGS+3),%d0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 160 | jne exit_work |
| 161 | 1: RESTORE_ALL |
| 162 | |
| 163 | exit_work: |
| 164 | | save top of frame |
| 165 | movel %sp,%curptr@(TASK_THREAD+THREAD_ESP0) |
Roman Zippel | 3b66a1e | 2005-11-13 16:06:59 -0800 | [diff] [blame] | 166 | lslb #1,%d0 |
| 167 | jmi do_signal_return |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 168 | pea resume_userspace |
Roman Zippel | 3b66a1e | 2005-11-13 16:06:59 -0800 | [diff] [blame] | 169 | jra schedule |
| 170 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 171 | |
| 172 | do_signal_return: |
| 173 | |andw #ALLOWINT,%sr |
| 174 | subql #4,%sp | dummy return address |
| 175 | SAVE_SWITCH_STACK |
| 176 | pea %sp@(SWITCH_STACK_SIZE) |
| 177 | clrl %sp@- |
| 178 | bsrl do_signal |
| 179 | addql #8,%sp |
| 180 | RESTORE_SWITCH_STACK |
| 181 | addql #4,%sp |
| 182 | jbra resume_userspace |
| 183 | |
| 184 | do_delayed_trace: |
| 185 | bclr #7,%sp@(PT_SR) | clear trace bit in SR |
| 186 | pea 1 | send SIGTRAP |
| 187 | movel %curptr,%sp@- |
| 188 | pea LSIGTRAP |
| 189 | jbsr send_sig |
| 190 | addql #8,%sp |
| 191 | addql #4,%sp |
| 192 | jbra resume_userspace |
| 193 | |
| 194 | |
Roman Zippel | 92445eaa | 2006-06-25 05:46:58 -0700 | [diff] [blame] | 195 | /* This is the main interrupt handler for autovector interrupts */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 196 | |
Roman Zippel | 92445eaa | 2006-06-25 05:46:58 -0700 | [diff] [blame] | 197 | ENTRY(auto_inthandler) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 198 | SAVE_ALL_INT |
| 199 | GET_CURRENT(%d0) |
Roman Zippel | 6d2f16a | 2006-06-23 02:04:59 -0700 | [diff] [blame] | 200 | addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 201 | | put exception # in d0 |
Roman Zippel | 92445eaa | 2006-06-25 05:46:58 -0700 | [diff] [blame] | 202 | bfextu %sp@(PT_VECTOR){#4,#10},%d0 |
| 203 | subw #VEC_SPUR,%d0 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 204 | |
| 205 | movel %sp,%sp@- |
| 206 | movel %d0,%sp@- | put vector # on stack |
Roman Zippel | 68387c4 | 2006-06-25 05:47:01 -0700 | [diff] [blame] | 207 | auto_irqhandler_fixup = . + 2 |
Al Viro | 2850bc2 | 2006-10-07 14:16:45 +0100 | [diff] [blame] | 208 | jsr __m68k_handle_int | process the IRQ |
Roman Zippel | 77dda33 | 2006-06-25 05:47:05 -0700 | [diff] [blame] | 209 | addql #8,%sp | pop parameters off stack |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 210 | |
| 211 | ret_from_interrupt: |
Roman Zippel | 6d2f16a | 2006-06-23 02:04:59 -0700 | [diff] [blame] | 212 | subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) |
Roman Zippel | 92445eaa | 2006-06-25 05:46:58 -0700 | [diff] [blame] | 213 | jeq ret_from_last_interrupt |
| 214 | 2: RESTORE_ALL |
| 215 | |
| 216 | ALIGN |
| 217 | ret_from_last_interrupt: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 218 | moveq #(~ALLOWINT>>8)&0xff,%d0 |
| 219 | andb %sp@(PT_SR),%d0 |
| 220 | jne 2b |
| 221 | |
| 222 | /* check if we need to do software interrupts */ |
| 223 | tstl irq_stat+CPUSTAT_SOFTIRQ_PENDING |
Roman Zippel | 3b66a1e | 2005-11-13 16:06:59 -0800 | [diff] [blame] | 224 | jeq .Lret_from_exception |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 225 | pea ret_from_exception |
| 226 | jra do_softirq |
| 227 | |
Roman Zippel | 92445eaa | 2006-06-25 05:46:58 -0700 | [diff] [blame] | 228 | /* Handler for user defined interrupt vectors */ |
| 229 | |
Roman Zippel | 68387c4 | 2006-06-25 05:47:01 -0700 | [diff] [blame] | 230 | ENTRY(user_inthandler) |
Roman Zippel | 92445eaa | 2006-06-25 05:46:58 -0700 | [diff] [blame] | 231 | SAVE_ALL_INT |
| 232 | GET_CURRENT(%d0) |
| 233 | addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) |
| 234 | | put exception # in d0 |
| 235 | bfextu %sp@(PT_VECTOR){#4,#10},%d0 |
Roman Zippel | 68387c4 | 2006-06-25 05:47:01 -0700 | [diff] [blame] | 236 | user_irqvec_fixup = . + 2 |
| 237 | subw #VEC_USER,%d0 |
Roman Zippel | 92445eaa | 2006-06-25 05:46:58 -0700 | [diff] [blame] | 238 | |
| 239 | movel %sp,%sp@- |
| 240 | movel %d0,%sp@- | put vector # on stack |
Roman Zippel | 68387c4 | 2006-06-25 05:47:01 -0700 | [diff] [blame] | 241 | user_irqhandler_fixup = . + 2 |
Al Viro | 2850bc2 | 2006-10-07 14:16:45 +0100 | [diff] [blame] | 242 | jsr __m68k_handle_int | process the IRQ |
Roman Zippel | 92445eaa | 2006-06-25 05:46:58 -0700 | [diff] [blame] | 243 | addql #8,%sp | pop parameters off stack |
| 244 | |
| 245 | subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) |
| 246 | jeq ret_from_last_interrupt |
| 247 | RESTORE_ALL |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 248 | |
| 249 | /* Handler for uninitialized and spurious interrupts */ |
| 250 | |
Roman Zippel | 92445eaa | 2006-06-25 05:46:58 -0700 | [diff] [blame] | 251 | ENTRY(bad_inthandler) |
| 252 | SAVE_ALL_INT |
| 253 | GET_CURRENT(%d0) |
| 254 | addqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) |
| 255 | |
| 256 | movel %sp,%sp@- |
| 257 | jsr handle_badint |
| 258 | addql #4,%sp |
| 259 | |
| 260 | subqb #1,%curptr@(TASK_INFO+TINFO_PREEMPT+1) |
| 261 | jeq ret_from_last_interrupt |
| 262 | RESTORE_ALL |
| 263 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | |
| 265 | ENTRY(sys_fork) |
| 266 | SAVE_SWITCH_STACK |
| 267 | pea %sp@(SWITCH_STACK_SIZE) |
| 268 | jbsr m68k_fork |
| 269 | addql #4,%sp |
| 270 | RESTORE_SWITCH_STACK |
| 271 | rts |
| 272 | |
| 273 | ENTRY(sys_clone) |
| 274 | SAVE_SWITCH_STACK |
| 275 | pea %sp@(SWITCH_STACK_SIZE) |
| 276 | jbsr m68k_clone |
| 277 | addql #4,%sp |
| 278 | RESTORE_SWITCH_STACK |
| 279 | rts |
| 280 | |
| 281 | ENTRY(sys_vfork) |
| 282 | SAVE_SWITCH_STACK |
| 283 | pea %sp@(SWITCH_STACK_SIZE) |
| 284 | jbsr m68k_vfork |
| 285 | addql #4,%sp |
| 286 | RESTORE_SWITCH_STACK |
| 287 | rts |
| 288 | |
| 289 | ENTRY(sys_sigsuspend) |
| 290 | SAVE_SWITCH_STACK |
| 291 | pea %sp@(SWITCH_STACK_SIZE) |
| 292 | jbsr do_sigsuspend |
| 293 | addql #4,%sp |
| 294 | RESTORE_SWITCH_STACK |
| 295 | rts |
| 296 | |
| 297 | ENTRY(sys_rt_sigsuspend) |
| 298 | SAVE_SWITCH_STACK |
| 299 | pea %sp@(SWITCH_STACK_SIZE) |
| 300 | jbsr do_rt_sigsuspend |
| 301 | addql #4,%sp |
| 302 | RESTORE_SWITCH_STACK |
| 303 | rts |
| 304 | |
| 305 | ENTRY(sys_sigreturn) |
| 306 | SAVE_SWITCH_STACK |
| 307 | jbsr do_sigreturn |
| 308 | RESTORE_SWITCH_STACK |
| 309 | rts |
| 310 | |
| 311 | ENTRY(sys_rt_sigreturn) |
| 312 | SAVE_SWITCH_STACK |
| 313 | jbsr do_rt_sigreturn |
| 314 | RESTORE_SWITCH_STACK |
| 315 | rts |
| 316 | |
| 317 | resume: |
| 318 | /* |
| 319 | * Beware - when entering resume, prev (the current task) is |
| 320 | * in a0, next (the new task) is in a1,so don't change these |
| 321 | * registers until their contents are no longer needed. |
| 322 | */ |
| 323 | |
| 324 | /* save sr */ |
| 325 | movew %sr,%a0@(TASK_THREAD+THREAD_SR) |
| 326 | |
| 327 | /* save fs (sfc,%dfc) (may be pointing to kernel memory) */ |
| 328 | movec %sfc,%d0 |
| 329 | movew %d0,%a0@(TASK_THREAD+THREAD_FS) |
| 330 | |
| 331 | /* save usp */ |
| 332 | /* it is better to use a movel here instead of a movew 8*) */ |
| 333 | movec %usp,%d0 |
| 334 | movel %d0,%a0@(TASK_THREAD+THREAD_USP) |
| 335 | |
| 336 | /* save non-scratch registers on stack */ |
| 337 | SAVE_SWITCH_STACK |
| 338 | |
| 339 | /* save current kernel stack pointer */ |
| 340 | movel %sp,%a0@(TASK_THREAD+THREAD_KSP) |
| 341 | |
| 342 | /* save floating point context */ |
| 343 | #ifndef CONFIG_M68KFPU_EMU_ONLY |
| 344 | #ifdef CONFIG_M68KFPU_EMU |
| 345 | tstl m68k_fputype |
| 346 | jeq 3f |
| 347 | #endif |
| 348 | fsave %a0@(TASK_THREAD+THREAD_FPSTATE) |
| 349 | |
| 350 | #if defined(CONFIG_M68060) |
| 351 | #if !defined(CPU_M68060_ONLY) |
| 352 | btst #3,m68k_cputype+3 |
| 353 | beqs 1f |
| 354 | #endif |
| 355 | /* The 060 FPU keeps status in bits 15-8 of the first longword */ |
| 356 | tstb %a0@(TASK_THREAD+THREAD_FPSTATE+2) |
| 357 | jeq 3f |
| 358 | #if !defined(CPU_M68060_ONLY) |
| 359 | jra 2f |
| 360 | #endif |
| 361 | #endif /* CONFIG_M68060 */ |
| 362 | #if !defined(CPU_M68060_ONLY) |
| 363 | 1: tstb %a0@(TASK_THREAD+THREAD_FPSTATE) |
| 364 | jeq 3f |
| 365 | #endif |
| 366 | 2: fmovemx %fp0-%fp7,%a0@(TASK_THREAD+THREAD_FPREG) |
| 367 | fmoveml %fpcr/%fpsr/%fpiar,%a0@(TASK_THREAD+THREAD_FPCNTL) |
| 368 | 3: |
| 369 | #endif /* CONFIG_M68KFPU_EMU_ONLY */ |
| 370 | /* Return previous task in %d1 */ |
| 371 | movel %curptr,%d1 |
| 372 | |
| 373 | /* switch to new task (a1 contains new task) */ |
| 374 | movel %a1,%curptr |
| 375 | |
| 376 | /* restore floating point context */ |
| 377 | #ifndef CONFIG_M68KFPU_EMU_ONLY |
| 378 | #ifdef CONFIG_M68KFPU_EMU |
| 379 | tstl m68k_fputype |
| 380 | jeq 4f |
| 381 | #endif |
| 382 | #if defined(CONFIG_M68060) |
| 383 | #if !defined(CPU_M68060_ONLY) |
| 384 | btst #3,m68k_cputype+3 |
| 385 | beqs 1f |
| 386 | #endif |
| 387 | /* The 060 FPU keeps status in bits 15-8 of the first longword */ |
| 388 | tstb %a1@(TASK_THREAD+THREAD_FPSTATE+2) |
| 389 | jeq 3f |
| 390 | #if !defined(CPU_M68060_ONLY) |
| 391 | jra 2f |
| 392 | #endif |
| 393 | #endif /* CONFIG_M68060 */ |
| 394 | #if !defined(CPU_M68060_ONLY) |
| 395 | 1: tstb %a1@(TASK_THREAD+THREAD_FPSTATE) |
| 396 | jeq 3f |
| 397 | #endif |
| 398 | 2: fmovemx %a1@(TASK_THREAD+THREAD_FPREG),%fp0-%fp7 |
| 399 | fmoveml %a1@(TASK_THREAD+THREAD_FPCNTL),%fpcr/%fpsr/%fpiar |
| 400 | 3: frestore %a1@(TASK_THREAD+THREAD_FPSTATE) |
| 401 | 4: |
| 402 | #endif /* CONFIG_M68KFPU_EMU_ONLY */ |
| 403 | |
| 404 | /* restore the kernel stack pointer */ |
| 405 | movel %a1@(TASK_THREAD+THREAD_KSP),%sp |
| 406 | |
| 407 | /* restore non-scratch registers */ |
| 408 | RESTORE_SWITCH_STACK |
| 409 | |
| 410 | /* restore user stack pointer */ |
| 411 | movel %a1@(TASK_THREAD+THREAD_USP),%a0 |
| 412 | movel %a0,%usp |
| 413 | |
| 414 | /* restore fs (sfc,%dfc) */ |
| 415 | movew %a1@(TASK_THREAD+THREAD_FS),%a0 |
| 416 | movec %a0,%sfc |
| 417 | movec %a0,%dfc |
| 418 | |
| 419 | /* restore status register */ |
| 420 | movew %a1@(TASK_THREAD+THREAD_SR),%sr |
| 421 | |
| 422 | rts |
| 423 | |
| 424 | .data |
| 425 | ALIGN |
| 426 | sys_call_table: |
| 427 | .long sys_ni_syscall /* 0 - old "setup()" system call*/ |
| 428 | .long sys_exit |
| 429 | .long sys_fork |
| 430 | .long sys_read |
| 431 | .long sys_write |
| 432 | .long sys_open /* 5 */ |
| 433 | .long sys_close |
| 434 | .long sys_waitpid |
| 435 | .long sys_creat |
| 436 | .long sys_link |
| 437 | .long sys_unlink /* 10 */ |
| 438 | .long sys_execve |
| 439 | .long sys_chdir |
| 440 | .long sys_time |
| 441 | .long sys_mknod |
| 442 | .long sys_chmod /* 15 */ |
| 443 | .long sys_chown16 |
| 444 | .long sys_ni_syscall /* old break syscall holder */ |
| 445 | .long sys_stat |
| 446 | .long sys_lseek |
| 447 | .long sys_getpid /* 20 */ |
| 448 | .long sys_mount |
| 449 | .long sys_oldumount |
| 450 | .long sys_setuid16 |
| 451 | .long sys_getuid16 |
| 452 | .long sys_stime /* 25 */ |
| 453 | .long sys_ptrace |
| 454 | .long sys_alarm |
| 455 | .long sys_fstat |
| 456 | .long sys_pause |
| 457 | .long sys_utime /* 30 */ |
| 458 | .long sys_ni_syscall /* old stty syscall holder */ |
| 459 | .long sys_ni_syscall /* old gtty syscall holder */ |
| 460 | .long sys_access |
| 461 | .long sys_nice |
| 462 | .long sys_ni_syscall /* 35 */ /* old ftime syscall holder */ |
| 463 | .long sys_sync |
| 464 | .long sys_kill |
| 465 | .long sys_rename |
| 466 | .long sys_mkdir |
| 467 | .long sys_rmdir /* 40 */ |
| 468 | .long sys_dup |
| 469 | .long sys_pipe |
| 470 | .long sys_times |
| 471 | .long sys_ni_syscall /* old prof syscall holder */ |
| 472 | .long sys_brk /* 45 */ |
| 473 | .long sys_setgid16 |
| 474 | .long sys_getgid16 |
| 475 | .long sys_signal |
| 476 | .long sys_geteuid16 |
| 477 | .long sys_getegid16 /* 50 */ |
| 478 | .long sys_acct |
| 479 | .long sys_umount /* recycled never used phys() */ |
| 480 | .long sys_ni_syscall /* old lock syscall holder */ |
| 481 | .long sys_ioctl |
| 482 | .long sys_fcntl /* 55 */ |
| 483 | .long sys_ni_syscall /* old mpx syscall holder */ |
| 484 | .long sys_setpgid |
| 485 | .long sys_ni_syscall /* old ulimit syscall holder */ |
| 486 | .long sys_ni_syscall |
| 487 | .long sys_umask /* 60 */ |
| 488 | .long sys_chroot |
| 489 | .long sys_ustat |
| 490 | .long sys_dup2 |
| 491 | .long sys_getppid |
| 492 | .long sys_getpgrp /* 65 */ |
| 493 | .long sys_setsid |
| 494 | .long sys_sigaction |
| 495 | .long sys_sgetmask |
| 496 | .long sys_ssetmask |
| 497 | .long sys_setreuid16 /* 70 */ |
| 498 | .long sys_setregid16 |
| 499 | .long sys_sigsuspend |
| 500 | .long sys_sigpending |
| 501 | .long sys_sethostname |
| 502 | .long sys_setrlimit /* 75 */ |
| 503 | .long sys_old_getrlimit |
| 504 | .long sys_getrusage |
| 505 | .long sys_gettimeofday |
| 506 | .long sys_settimeofday |
| 507 | .long sys_getgroups16 /* 80 */ |
| 508 | .long sys_setgroups16 |
| 509 | .long old_select |
| 510 | .long sys_symlink |
| 511 | .long sys_lstat |
| 512 | .long sys_readlink /* 85 */ |
| 513 | .long sys_uselib |
| 514 | .long sys_swapon |
| 515 | .long sys_reboot |
| 516 | .long old_readdir |
| 517 | .long old_mmap /* 90 */ |
| 518 | .long sys_munmap |
| 519 | .long sys_truncate |
| 520 | .long sys_ftruncate |
| 521 | .long sys_fchmod |
| 522 | .long sys_fchown16 /* 95 */ |
| 523 | .long sys_getpriority |
| 524 | .long sys_setpriority |
| 525 | .long sys_ni_syscall /* old profil syscall holder */ |
| 526 | .long sys_statfs |
| 527 | .long sys_fstatfs /* 100 */ |
| 528 | .long sys_ni_syscall /* ioperm for i386 */ |
| 529 | .long sys_socketcall |
| 530 | .long sys_syslog |
| 531 | .long sys_setitimer |
| 532 | .long sys_getitimer /* 105 */ |
| 533 | .long sys_newstat |
| 534 | .long sys_newlstat |
| 535 | .long sys_newfstat |
| 536 | .long sys_ni_syscall |
| 537 | .long sys_ni_syscall /* 110 */ /* iopl for i386 */ |
| 538 | .long sys_vhangup |
| 539 | .long sys_ni_syscall /* obsolete idle() syscall */ |
| 540 | .long sys_ni_syscall /* vm86old for i386 */ |
| 541 | .long sys_wait4 |
| 542 | .long sys_swapoff /* 115 */ |
| 543 | .long sys_sysinfo |
| 544 | .long sys_ipc |
| 545 | .long sys_fsync |
| 546 | .long sys_sigreturn |
| 547 | .long sys_clone /* 120 */ |
| 548 | .long sys_setdomainname |
| 549 | .long sys_newuname |
| 550 | .long sys_cacheflush /* modify_ldt for i386 */ |
| 551 | .long sys_adjtimex |
| 552 | .long sys_mprotect /* 125 */ |
| 553 | .long sys_sigprocmask |
| 554 | .long sys_ni_syscall /* old "create_module" */ |
| 555 | .long sys_init_module |
| 556 | .long sys_delete_module |
| 557 | .long sys_ni_syscall /* 130 - old "get_kernel_syms" */ |
| 558 | .long sys_quotactl |
| 559 | .long sys_getpgid |
| 560 | .long sys_fchdir |
| 561 | .long sys_bdflush |
| 562 | .long sys_sysfs /* 135 */ |
| 563 | .long sys_personality |
| 564 | .long sys_ni_syscall /* for afs_syscall */ |
| 565 | .long sys_setfsuid16 |
| 566 | .long sys_setfsgid16 |
| 567 | .long sys_llseek /* 140 */ |
| 568 | .long sys_getdents |
| 569 | .long sys_select |
| 570 | .long sys_flock |
| 571 | .long sys_msync |
| 572 | .long sys_readv /* 145 */ |
| 573 | .long sys_writev |
| 574 | .long sys_getsid |
| 575 | .long sys_fdatasync |
| 576 | .long sys_sysctl |
| 577 | .long sys_mlock /* 150 */ |
| 578 | .long sys_munlock |
| 579 | .long sys_mlockall |
| 580 | .long sys_munlockall |
| 581 | .long sys_sched_setparam |
| 582 | .long sys_sched_getparam /* 155 */ |
| 583 | .long sys_sched_setscheduler |
| 584 | .long sys_sched_getscheduler |
| 585 | .long sys_sched_yield |
| 586 | .long sys_sched_get_priority_max |
| 587 | .long sys_sched_get_priority_min /* 160 */ |
| 588 | .long sys_sched_rr_get_interval |
| 589 | .long sys_nanosleep |
| 590 | .long sys_mremap |
| 591 | .long sys_setresuid16 |
| 592 | .long sys_getresuid16 /* 165 */ |
| 593 | .long sys_getpagesize |
| 594 | .long sys_ni_syscall /* old sys_query_module */ |
| 595 | .long sys_poll |
| 596 | .long sys_nfsservctl |
| 597 | .long sys_setresgid16 /* 170 */ |
| 598 | .long sys_getresgid16 |
| 599 | .long sys_prctl |
| 600 | .long sys_rt_sigreturn |
| 601 | .long sys_rt_sigaction |
| 602 | .long sys_rt_sigprocmask /* 175 */ |
| 603 | .long sys_rt_sigpending |
| 604 | .long sys_rt_sigtimedwait |
| 605 | .long sys_rt_sigqueueinfo |
| 606 | .long sys_rt_sigsuspend |
| 607 | .long sys_pread64 /* 180 */ |
| 608 | .long sys_pwrite64 |
| 609 | .long sys_lchown16; |
| 610 | .long sys_getcwd |
| 611 | .long sys_capget |
| 612 | .long sys_capset /* 185 */ |
| 613 | .long sys_sigaltstack |
| 614 | .long sys_sendfile |
| 615 | .long sys_ni_syscall /* streams1 */ |
| 616 | .long sys_ni_syscall /* streams2 */ |
| 617 | .long sys_vfork /* 190 */ |
| 618 | .long sys_getrlimit |
| 619 | .long sys_mmap2 |
| 620 | .long sys_truncate64 |
| 621 | .long sys_ftruncate64 |
| 622 | .long sys_stat64 /* 195 */ |
| 623 | .long sys_lstat64 |
| 624 | .long sys_fstat64 |
| 625 | .long sys_chown |
| 626 | .long sys_getuid |
| 627 | .long sys_getgid /* 200 */ |
| 628 | .long sys_geteuid |
| 629 | .long sys_getegid |
| 630 | .long sys_setreuid |
| 631 | .long sys_setregid |
| 632 | .long sys_getgroups /* 205 */ |
| 633 | .long sys_setgroups |
| 634 | .long sys_fchown |
| 635 | .long sys_setresuid |
| 636 | .long sys_getresuid |
| 637 | .long sys_setresgid /* 210 */ |
| 638 | .long sys_getresgid |
| 639 | .long sys_lchown |
| 640 | .long sys_setuid |
| 641 | .long sys_setgid |
| 642 | .long sys_setfsuid /* 215 */ |
| 643 | .long sys_setfsgid |
| 644 | .long sys_pivot_root |
| 645 | .long sys_ni_syscall |
| 646 | .long sys_ni_syscall |
| 647 | .long sys_getdents64 /* 220 */ |
| 648 | .long sys_gettid |
| 649 | .long sys_tkill |
| 650 | .long sys_setxattr |
| 651 | .long sys_lsetxattr |
| 652 | .long sys_fsetxattr /* 225 */ |
| 653 | .long sys_getxattr |
| 654 | .long sys_lgetxattr |
| 655 | .long sys_fgetxattr |
| 656 | .long sys_listxattr |
| 657 | .long sys_llistxattr /* 230 */ |
| 658 | .long sys_flistxattr |
| 659 | .long sys_removexattr |
| 660 | .long sys_lremovexattr |
| 661 | .long sys_fremovexattr |
| 662 | .long sys_futex /* 235 */ |
| 663 | .long sys_sendfile64 |
| 664 | .long sys_mincore |
| 665 | .long sys_madvise |
| 666 | .long sys_fcntl64 |
| 667 | .long sys_readahead /* 240 */ |
| 668 | .long sys_io_setup |
| 669 | .long sys_io_destroy |
| 670 | .long sys_io_getevents |
| 671 | .long sys_io_submit |
| 672 | .long sys_io_cancel /* 245 */ |
| 673 | .long sys_fadvise64 |
| 674 | .long sys_exit_group |
| 675 | .long sys_lookup_dcookie |
| 676 | .long sys_epoll_create |
| 677 | .long sys_epoll_ctl /* 250 */ |
| 678 | .long sys_epoll_wait |
| 679 | .long sys_remap_file_pages |
| 680 | .long sys_set_tid_address |
| 681 | .long sys_timer_create |
| 682 | .long sys_timer_settime /* 255 */ |
| 683 | .long sys_timer_gettime |
| 684 | .long sys_timer_getoverrun |
| 685 | .long sys_timer_delete |
| 686 | .long sys_clock_settime |
| 687 | .long sys_clock_gettime /* 260 */ |
| 688 | .long sys_clock_getres |
| 689 | .long sys_clock_nanosleep |
| 690 | .long sys_statfs64 |
| 691 | .long sys_fstatfs64 |
| 692 | .long sys_tgkill /* 265 */ |
| 693 | .long sys_utimes |
| 694 | .long sys_fadvise64_64 |
Roman Zippel | 6ff5801 | 2007-05-01 22:32:43 +0200 | [diff] [blame] | 695 | .long sys_mbind |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 696 | .long sys_get_mempolicy |
| 697 | .long sys_set_mempolicy /* 270 */ |
| 698 | .long sys_mq_open |
| 699 | .long sys_mq_unlink |
| 700 | .long sys_mq_timedsend |
| 701 | .long sys_mq_timedreceive |
| 702 | .long sys_mq_notify /* 275 */ |
| 703 | .long sys_mq_getsetattr |
| 704 | .long sys_waitid |
| 705 | .long sys_ni_syscall /* for sys_vserver */ |
| 706 | .long sys_add_key |
| 707 | .long sys_request_key /* 280 */ |
| 708 | .long sys_keyctl |
Geert Uytterhoeven | 6aabd6a | 2006-10-09 22:02:25 +0200 | [diff] [blame] | 709 | .long sys_ioprio_set |
| 710 | .long sys_ioprio_get |
| 711 | .long sys_inotify_init |
| 712 | .long sys_inotify_add_watch /* 285 */ |
| 713 | .long sys_inotify_rm_watch |
Geert Uytterhoeven | 6fb8296 | 2006-10-09 22:02:31 +0200 | [diff] [blame] | 714 | .long sys_migrate_pages |
| 715 | .long sys_openat |
| 716 | .long sys_mkdirat |
| 717 | .long sys_mknodat /* 290 */ |
| 718 | .long sys_fchownat |
| 719 | .long sys_futimesat |
| 720 | .long sys_fstatat64 |
| 721 | .long sys_unlinkat |
| 722 | .long sys_renameat /* 295 */ |
| 723 | .long sys_linkat |
| 724 | .long sys_symlinkat |
| 725 | .long sys_readlinkat |
| 726 | .long sys_fchmodat |
| 727 | .long sys_faccessat /* 300 */ |
| 728 | .long sys_ni_syscall /* Reserved for pselect6 */ |
| 729 | .long sys_ni_syscall /* Reserved for ppoll */ |
| 730 | .long sys_unshare |
| 731 | .long sys_set_robust_list |
| 732 | .long sys_get_robust_list /* 305 */ |
| 733 | .long sys_splice |
| 734 | .long sys_sync_file_range |
| 735 | .long sys_tee |
| 736 | .long sys_vmsplice |
| 737 | .long sys_move_pages /* 310 */ |
Geert Uytterhoeven | e845498 | 2007-09-11 15:23:56 -0700 | [diff] [blame] | 738 | .long sys_sched_setaffinity |
| 739 | .long sys_sched_getaffinity |
| 740 | .long sys_kexec_load |
| 741 | .long sys_getcpu |
| 742 | .long sys_epoll_pwait /* 315 */ |
| 743 | .long sys_utimensat |
| 744 | .long sys_signalfd |
| 745 | .long sys_timerfd |
| 746 | .long sys_eventfd |
| 747 | .long sys_fallocate /* 320 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 748 | |