Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1 | /* |
| 2 | * File: arch/blackfin/mach-common/entry.S |
| 3 | * Based on: |
| 4 | * Author: Linus Torvalds |
| 5 | * |
| 6 | * Created: ? |
| 7 | * Description: contains the system-call and fault low-level handling routines. |
| 8 | * This also contains the timer-interrupt handler, as well as all |
| 9 | * interrupts and faults that can result in a task-switch. |
| 10 | * |
| 11 | * Modified: |
| 12 | * Copyright 2004-2006 Analog Devices Inc. |
| 13 | * |
| 14 | * Bugs: Enter bugs at http://blackfin.uclinux.org/ |
| 15 | * |
| 16 | * This program is free software; you can redistribute it and/or modify |
| 17 | * it under the terms of the GNU General Public License as published by |
| 18 | * the Free Software Foundation; either version 2 of the License, or |
| 19 | * (at your option) any later version. |
| 20 | * |
| 21 | * This program is distributed in the hope that it will be useful, |
| 22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 24 | * GNU General Public License for more details. |
| 25 | * |
| 26 | * You should have received a copy of the GNU General Public License |
| 27 | * along with this program; if not, see the file COPYING, or write |
| 28 | * to the Free Software Foundation, Inc., |
| 29 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 30 | */ |
| 31 | |
| 32 | /* |
| 33 | * 25-Dec-2004 - LG Soft India |
| 34 | * 1. Fix in return_from_int, to make sure any pending |
| 35 | * system call in ILAT for this process to get |
| 36 | * executed, otherwise in case context switch happens, |
| 37 | * system call of first process (i.e in ILAT) will be |
| 38 | * carried forward to the switched process. |
| 39 | * 2. Removed Constant references for the following |
| 40 | * a. IPEND |
| 41 | * b. EXCAUSE mask |
| 42 | * c. PAGE Mask |
| 43 | */ |
| 44 | |
| 45 | /* |
| 46 | * NOTE: This code handles signal-recognition, which happens every time |
| 47 | * after a timer-interrupt and after each system call. |
| 48 | */ |
| 49 | |
| 50 | |
| 51 | #include <linux/linkage.h> |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 52 | #include <linux/unistd.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 53 | #include <asm/blackfin.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 54 | #include <asm/errno.h> |
| 55 | #include <asm/thread_info.h> /* TIF_NEED_RESCHED */ |
| 56 | #include <asm/asm-offsets.h> |
Robin Getz | 669b792 | 2007-06-21 16:34:08 +0800 | [diff] [blame] | 57 | #include <asm/trace.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 58 | |
| 59 | #include <asm/mach-common/context.S> |
| 60 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 61 | #ifdef CONFIG_EXCPT_IRQ_SYSC_L1 |
| 62 | .section .l1.text |
| 63 | #else |
| 64 | .text |
| 65 | #endif |
| 66 | |
| 67 | /* Slightly simplified and streamlined entry point for CPLB misses. |
| 68 | * This one does not lower the level to IRQ5, and thus can be used to |
| 69 | * patch up CPLB misses on the kernel stack. |
| 70 | */ |
| 71 | ENTRY(_ex_dcplb) |
| 72 | #if defined(ANOMALY_05000261) |
| 73 | /* |
| 74 | * Work around an anomaly: if we see a new DCPLB fault, return |
| 75 | * without doing anything. Then, if we get the same fault again, |
| 76 | * handle it. |
| 77 | */ |
| 78 | p5.l = _last_cplb_fault_retx; |
| 79 | p5.h = _last_cplb_fault_retx; |
| 80 | r7 = [p5]; |
| 81 | r6 = retx; |
| 82 | [p5] = r6; |
| 83 | cc = r6 == r7; |
| 84 | if !cc jump _return_from_exception; |
| 85 | /* fall through */ |
| 86 | #endif |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 87 | ENDPROC(_ex_dcplb) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 88 | |
| 89 | ENTRY(_ex_icplb) |
| 90 | (R7:6,P5:4) = [sp++]; |
| 91 | ASTAT = [sp++]; |
| 92 | SAVE_ALL_SYS |
| 93 | call __cplb_hdr; |
Robin Getz | 669b792 | 2007-06-21 16:34:08 +0800 | [diff] [blame] | 94 | DEBUG_START_HWTRACE(p5, r7) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 95 | RESTORE_ALL_SYS |
| 96 | SP = RETN; |
| 97 | rtx; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 98 | ENDPROC(_ex_icplb) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 99 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 100 | ENTRY(_ex_syscall) |
Robin Getz | 669b792 | 2007-06-21 16:34:08 +0800 | [diff] [blame] | 101 | DEBUG_START_HWTRACE(p5, r7) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 102 | (R7:6,P5:4) = [sp++]; |
| 103 | ASTAT = [sp++]; |
| 104 | raise 15; /* invoked by TRAP #0, for sys call */ |
| 105 | sp = retn; |
| 106 | rtx |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 107 | ENDPROC(_ex_syscall) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 108 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 109 | ENTRY(_ex_soft_bp) |
| 110 | r7 = retx; |
| 111 | r7 += -2; |
| 112 | retx = r7; |
| 113 | jump.s _ex_trap_c; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 114 | ENDPROC(_ex_soft_bp) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 115 | |
| 116 | ENTRY(_ex_single_step) |
| 117 | r7 = retx; |
| 118 | r6 = reti; |
| 119 | cc = r7 == r6; |
| 120 | if cc jump _return_from_exception |
| 121 | r7 = syscfg; |
| 122 | bitclr (r7, 0); |
| 123 | syscfg = R7; |
| 124 | |
| 125 | p5.l = lo(IPEND); |
| 126 | p5.h = hi(IPEND); |
| 127 | r6 = [p5]; |
| 128 | cc = bittst(r6, 5); |
| 129 | if !cc jump _ex_trap_c; |
| 130 | p4.l = lo(EVT5); |
| 131 | p4.h = hi(EVT5); |
| 132 | r6.h = _exception_to_level5; |
| 133 | r6.l = _exception_to_level5; |
| 134 | r7 = [p4]; |
| 135 | cc = r6 == r7; |
| 136 | if !cc jump _ex_trap_c; |
| 137 | |
| 138 | _return_from_exception: |
Robin Getz | 669b792 | 2007-06-21 16:34:08 +0800 | [diff] [blame] | 139 | DEBUG_START_HWTRACE(p5, r7) |
Michael Hennerich | 8af10b7 | 2007-05-21 18:09:09 +0800 | [diff] [blame] | 140 | #ifdef ANOMALY_05000257 |
| 141 | R7=LC0; |
| 142 | LC0=R7; |
| 143 | R7=LC1; |
| 144 | LC1=R7; |
| 145 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 146 | (R7:6,P5:4) = [sp++]; |
| 147 | ASTAT = [sp++]; |
| 148 | sp = retn; |
| 149 | rtx; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 150 | ENDPROC(_ex_soft_bp) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 151 | |
| 152 | ENTRY(_handle_bad_cplb) |
| 153 | /* To get here, we just tried and failed to change a CPLB |
| 154 | * so, handle things in trap_c (C code), by lowering to |
| 155 | * IRQ5, just like we normally do. Since this is not a |
| 156 | * "normal" return path, we have a do alot of stuff to |
| 157 | * the stack to get ready so, we can fall through - we |
| 158 | * need to make a CPLB exception look like a normal exception |
| 159 | */ |
| 160 | |
Robin Getz | 669b792 | 2007-06-21 16:34:08 +0800 | [diff] [blame] | 161 | DEBUG_START_HWTRACE(p5, r7) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 162 | RESTORE_ALL_SYS |
| 163 | [--sp] = ASTAT; |
| 164 | [--sp] = (R7:6, P5:4); |
| 165 | |
| 166 | ENTRY(_ex_trap_c) |
| 167 | /* Call C code (trap_c) to handle the exception, which most |
| 168 | * likely involves sending a signal to the current process. |
| 169 | * To avoid double faults, lower our priority to IRQ5 first. |
| 170 | */ |
| 171 | P5.h = _exception_to_level5; |
| 172 | P5.l = _exception_to_level5; |
| 173 | p4.l = lo(EVT5); |
| 174 | p4.h = hi(EVT5); |
| 175 | [p4] = p5; |
| 176 | csync; |
| 177 | |
| 178 | /* Disable all interrupts, but make sure level 5 is enabled so |
| 179 | * we can switch to that level. Save the old mask. */ |
| 180 | cli r6; |
| 181 | p4.l = _excpt_saved_imask; |
| 182 | p4.h = _excpt_saved_imask; |
| 183 | [p4] = r6; |
| 184 | r6 = 0x3f; |
| 185 | sti r6; |
| 186 | |
| 187 | /* Save the excause into a circular buffer, in case the instruction |
| 188 | * which caused this excecptions causes others. |
| 189 | */ |
| 190 | P5.l = _in_ptr_excause; |
| 191 | P5.h = _in_ptr_excause; |
| 192 | R7 = [P5]; |
| 193 | R7 += 4; |
| 194 | R6 = 0xF; |
| 195 | R7 = R7 & R6; |
| 196 | [P5] = R7; |
| 197 | R6.l = _excause_circ_buf; |
| 198 | R6.h = _excause_circ_buf; |
| 199 | R7 = R7 + R6; |
| 200 | p5 = R7; |
| 201 | R6 = SEQSTAT; |
| 202 | [P5] = R6; |
| 203 | |
Robin Getz | 669b792 | 2007-06-21 16:34:08 +0800 | [diff] [blame] | 204 | DEBUG_START_HWTRACE(p5, r7) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 205 | (R7:6,P5:4) = [sp++]; |
| 206 | ASTAT = [sp++]; |
| 207 | SP = RETN; |
| 208 | raise 5; |
| 209 | rtx; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 210 | ENDPROC(_ex_trap_c) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 211 | |
| 212 | ENTRY(_exception_to_level5) |
| 213 | SAVE_ALL_SYS |
| 214 | |
| 215 | /* Restore interrupt mask. We haven't pushed RETI, so this |
| 216 | * doesn't enable interrupts until we return from this handler. */ |
| 217 | p4.l = _excpt_saved_imask; |
| 218 | p4.h = _excpt_saved_imask; |
| 219 | r6 = [p4]; |
| 220 | sti r6; |
| 221 | |
| 222 | /* Restore the hardware error vector. */ |
| 223 | P5.h = _evt_ivhw; |
| 224 | P5.l = _evt_ivhw; |
| 225 | p4.l = lo(EVT5); |
| 226 | p4.h = hi(EVT5); |
| 227 | [p4] = p5; |
| 228 | csync; |
| 229 | |
| 230 | p2.l = lo(IPEND); |
| 231 | p2.h = hi(IPEND); |
| 232 | csync; |
| 233 | r0 = [p2]; /* Read current IPEND */ |
| 234 | [sp + PT_IPEND] = r0; /* Store IPEND */ |
| 235 | |
| 236 | /* Pop the excause from the circular buffer and push it on the stack |
| 237 | * (in the right place - if you change the location of SEQSTAT, you |
| 238 | * must change this offset. |
| 239 | */ |
| 240 | .L_excep_to_5_again: |
| 241 | P5.l = _out_ptr_excause; |
| 242 | P5.h = _out_ptr_excause; |
| 243 | R7 = [P5]; |
| 244 | R7 += 4; |
| 245 | R6 = 0xF; |
| 246 | R7 = R7 & R6; |
| 247 | [P5] = R7; |
| 248 | R6.l = _excause_circ_buf; |
| 249 | R6.h = _excause_circ_buf; |
| 250 | R7 = R7 + R6; |
| 251 | P5 = R7; |
| 252 | R1 = [P5]; |
| 253 | [SP + 8] = r1; |
| 254 | |
| 255 | r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */ |
| 256 | SP += -12; |
| 257 | call _trap_c; |
| 258 | SP += 12; |
| 259 | |
| 260 | /* See if anything else is in the exception buffer |
| 261 | * if there is, process it |
| 262 | */ |
| 263 | P5.l = _out_ptr_excause; |
| 264 | P5.h = _out_ptr_excause; |
| 265 | P4.l = _in_ptr_excause; |
| 266 | P4.h = _in_ptr_excause; |
| 267 | R6 = [P5]; |
| 268 | R7 = [P4]; |
| 269 | CC = R6 == R7; |
| 270 | if ! CC JUMP .L_excep_to_5_again |
| 271 | |
| 272 | call _ret_from_exception; |
| 273 | RESTORE_ALL_SYS |
| 274 | rti; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 275 | ENDPROC(_exception_to_level5) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 276 | |
| 277 | ENTRY(_trap) /* Exception: 4th entry into system event table(supervisor mode)*/ |
| 278 | /* Since the kernel stack can be anywhere, it's not guaranteed to be |
| 279 | * covered by a CPLB. Switch to an exception stack; use RETN as a |
| 280 | * scratch register (for want of a better option). |
| 281 | */ |
| 282 | retn = sp; |
| 283 | sp.l = _exception_stack_top; |
| 284 | sp.h = _exception_stack_top; |
| 285 | /* Try to deal with syscalls quickly. */ |
| 286 | [--sp] = ASTAT; |
| 287 | [--sp] = (R7:6, P5:4); |
Robin Getz | 669b792 | 2007-06-21 16:34:08 +0800 | [diff] [blame] | 288 | DEBUG_STOP_HWTRACE(p5, r7) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 289 | r7 = SEQSTAT; /* reason code is in bit 5:0 */ |
| 290 | r6.l = lo(SEQSTAT_EXCAUSE); |
| 291 | r6.h = hi(SEQSTAT_EXCAUSE); |
| 292 | r7 = r7 & r6; |
| 293 | p5.h = _extable; |
| 294 | p5.l = _extable; |
| 295 | p4 = r7; |
| 296 | p5 = p5 + (p4 << 2); |
| 297 | p4 = [p5]; |
| 298 | jump (p4); |
| 299 | |
| 300 | .Lbadsys: |
| 301 | r7 = -ENOSYS; /* signextending enough */ |
| 302 | [sp + PT_R0] = r7; /* return value from system call */ |
| 303 | jump .Lsyscall_really_exit; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 304 | ENDPROC(_trap) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 305 | |
| 306 | ENTRY(_kernel_execve) |
| 307 | link SIZEOF_PTREGS; |
| 308 | p0 = sp; |
| 309 | r3 = SIZEOF_PTREGS / 4; |
| 310 | r4 = 0(x); |
| 311 | 0: |
| 312 | [p0++] = r4; |
| 313 | r3 += -1; |
| 314 | cc = r3 == 0; |
| 315 | if !cc jump 0b (bp); |
| 316 | |
| 317 | p0 = sp; |
| 318 | sp += -16; |
| 319 | [sp + 12] = p0; |
| 320 | call _do_execve; |
| 321 | SP += 16; |
| 322 | cc = r0 == 0; |
| 323 | if ! cc jump 1f; |
| 324 | /* Success. Copy our temporary pt_regs to the top of the kernel |
| 325 | * stack and do a normal exception return. |
| 326 | */ |
| 327 | r1 = sp; |
| 328 | r0 = (-KERNEL_STACK_SIZE) (x); |
| 329 | r1 = r1 & r0; |
| 330 | p2 = r1; |
| 331 | p3 = [p2]; |
| 332 | r0 = KERNEL_STACK_SIZE - 4 (z); |
| 333 | p1 = r0; |
| 334 | p1 = p1 + p2; |
| 335 | |
| 336 | p0 = fp; |
| 337 | r4 = [p0--]; |
| 338 | r3 = SIZEOF_PTREGS / 4; |
| 339 | 0: |
| 340 | r4 = [p0--]; |
| 341 | [p1--] = r4; |
| 342 | r3 += -1; |
| 343 | cc = r3 == 0; |
| 344 | if ! cc jump 0b (bp); |
| 345 | |
| 346 | r0 = (KERNEL_STACK_SIZE - SIZEOF_PTREGS) (z); |
| 347 | p1 = r0; |
| 348 | p1 = p1 + p2; |
| 349 | sp = p1; |
| 350 | r0 = syscfg; |
| 351 | [SP + PT_SYSCFG] = r0; |
| 352 | [p3 + (TASK_THREAD + THREAD_KSP)] = sp; |
| 353 | |
| 354 | RESTORE_CONTEXT; |
| 355 | rti; |
| 356 | 1: |
| 357 | unlink; |
| 358 | rts; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 359 | ENDPROC(_kernel_execve) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 360 | |
| 361 | ENTRY(_system_call) |
| 362 | /* Store IPEND */ |
| 363 | p2.l = lo(IPEND); |
| 364 | p2.h = hi(IPEND); |
| 365 | csync; |
| 366 | r0 = [p2]; |
| 367 | [sp + PT_IPEND] = r0; |
| 368 | |
| 369 | /* Store RETS for now */ |
| 370 | r0 = rets; |
| 371 | [sp + PT_RESERVED] = r0; |
| 372 | /* Set the stack for the current process */ |
| 373 | r7 = sp; |
| 374 | r6.l = lo(ALIGN_PAGE_MASK); |
| 375 | r6.h = hi(ALIGN_PAGE_MASK); |
| 376 | r7 = r7 & r6; /* thread_info */ |
| 377 | p2 = r7; |
| 378 | p2 = [p2]; |
| 379 | |
| 380 | [p2+(TASK_THREAD+THREAD_KSP)] = sp; |
| 381 | |
| 382 | /* Check the System Call */ |
| 383 | r7 = __NR_syscall; |
| 384 | /* System call number is passed in P0 */ |
| 385 | r6 = p0; |
| 386 | cc = r6 < r7; |
| 387 | if ! cc jump .Lbadsys; |
| 388 | |
| 389 | /* are we tracing syscalls?*/ |
| 390 | r7 = sp; |
| 391 | r6.l = lo(ALIGN_PAGE_MASK); |
| 392 | r6.h = hi(ALIGN_PAGE_MASK); |
| 393 | r7 = r7 & r6; |
| 394 | p2 = r7; |
| 395 | r7 = [p2+TI_FLAGS]; |
| 396 | CC = BITTST(r7,TIF_SYSCALL_TRACE); |
| 397 | if CC JUMP _sys_trace; |
| 398 | |
| 399 | /* Execute the appropriate system call */ |
| 400 | |
| 401 | p4 = p0; |
| 402 | p5.l = _sys_call_table; |
| 403 | p5.h = _sys_call_table; |
| 404 | p5 = p5 + (p4 << 2); |
| 405 | r0 = [sp + PT_R0]; |
| 406 | r1 = [sp + PT_R1]; |
| 407 | r2 = [sp + PT_R2]; |
| 408 | p5 = [p5]; |
| 409 | |
| 410 | [--sp] = r5; |
| 411 | [--sp] = r4; |
| 412 | [--sp] = r3; |
| 413 | SP += -12; |
| 414 | call (p5); |
| 415 | SP += 24; |
| 416 | [sp + PT_R0] = r0; |
| 417 | |
| 418 | .Lresume_userspace: |
| 419 | r7 = sp; |
| 420 | r4.l = lo(ALIGN_PAGE_MASK); |
| 421 | r4.h = hi(ALIGN_PAGE_MASK); |
| 422 | r7 = r7 & r4; /* thread_info->flags */ |
| 423 | p5 = r7; |
| 424 | .Lresume_userspace_1: |
| 425 | /* Disable interrupts. */ |
| 426 | [--sp] = reti; |
| 427 | reti = [sp++]; |
| 428 | |
| 429 | r7 = [p5 + TI_FLAGS]; |
| 430 | r4.l = lo(_TIF_WORK_MASK); |
| 431 | r4.h = hi(_TIF_WORK_MASK); |
| 432 | r7 = r7 & r4; |
| 433 | |
| 434 | .Lsyscall_resched: |
| 435 | cc = BITTST(r7, TIF_NEED_RESCHED); |
| 436 | if !cc jump .Lsyscall_sigpending; |
| 437 | |
| 438 | /* Reenable interrupts. */ |
| 439 | [--sp] = reti; |
| 440 | r0 = [sp++]; |
| 441 | |
| 442 | SP += -12; |
| 443 | call _schedule; |
| 444 | SP += 12; |
| 445 | |
| 446 | jump .Lresume_userspace_1; |
| 447 | |
| 448 | .Lsyscall_sigpending: |
| 449 | cc = BITTST(r7, TIF_RESTORE_SIGMASK); |
| 450 | if cc jump .Lsyscall_do_signals; |
| 451 | cc = BITTST(r7, TIF_SIGPENDING); |
| 452 | if !cc jump .Lsyscall_really_exit; |
| 453 | .Lsyscall_do_signals: |
| 454 | /* Reenable interrupts. */ |
| 455 | [--sp] = reti; |
| 456 | r0 = [sp++]; |
| 457 | |
| 458 | r0 = sp; |
| 459 | SP += -12; |
| 460 | call _do_signal; |
| 461 | SP += 12; |
| 462 | |
| 463 | .Lsyscall_really_exit: |
| 464 | r5 = [sp + PT_RESERVED]; |
| 465 | rets = r5; |
| 466 | rts; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 467 | ENDPROC(_system_call) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 468 | |
| 469 | _sys_trace: |
| 470 | call _syscall_trace; |
| 471 | |
| 472 | /* Execute the appropriate system call */ |
| 473 | |
| 474 | p4 = [SP + PT_P0]; |
| 475 | p5.l = _sys_call_table; |
| 476 | p5.h = _sys_call_table; |
| 477 | p5 = p5 + (p4 << 2); |
| 478 | r0 = [sp + PT_R0]; |
| 479 | r1 = [sp + PT_R1]; |
| 480 | r2 = [sp + PT_R2]; |
| 481 | r3 = [sp + PT_R3]; |
| 482 | r4 = [sp + PT_R4]; |
| 483 | r5 = [sp + PT_R5]; |
| 484 | p5 = [p5]; |
| 485 | |
| 486 | [--sp] = r5; |
| 487 | [--sp] = r4; |
| 488 | [--sp] = r3; |
| 489 | SP += -12; |
| 490 | call (p5); |
| 491 | SP += 24; |
| 492 | [sp + PT_R0] = r0; |
| 493 | |
| 494 | call _syscall_trace; |
| 495 | jump .Lresume_userspace; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 496 | ENDPROC(_sys_trace) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 497 | |
| 498 | ENTRY(_resume) |
| 499 | /* |
| 500 | * Beware - when entering resume, prev (the current task) is |
| 501 | * in r0, next (the new task) is in r1. |
| 502 | */ |
| 503 | p0 = r0; |
| 504 | p1 = r1; |
| 505 | [--sp] = rets; |
| 506 | [--sp] = fp; |
| 507 | [--sp] = (r7:4, p5:3); |
| 508 | |
| 509 | /* save usp */ |
| 510 | p2 = usp; |
| 511 | [p0+(TASK_THREAD+THREAD_USP)] = p2; |
| 512 | |
| 513 | /* save current kernel stack pointer */ |
| 514 | [p0+(TASK_THREAD+THREAD_KSP)] = sp; |
| 515 | |
| 516 | /* save program counter */ |
| 517 | r1.l = _new_old_task; |
| 518 | r1.h = _new_old_task; |
| 519 | [p0+(TASK_THREAD+THREAD_PC)] = r1; |
| 520 | |
| 521 | /* restore the kernel stack pointer */ |
| 522 | sp = [p1+(TASK_THREAD+THREAD_KSP)]; |
| 523 | |
| 524 | /* restore user stack pointer */ |
| 525 | p0 = [p1+(TASK_THREAD+THREAD_USP)]; |
| 526 | usp = p0; |
| 527 | |
| 528 | /* restore pc */ |
| 529 | p0 = [p1+(TASK_THREAD+THREAD_PC)]; |
| 530 | jump (p0); |
| 531 | |
| 532 | /* |
| 533 | * Following code actually lands up in a new (old) task. |
| 534 | */ |
| 535 | |
| 536 | _new_old_task: |
| 537 | (r7:4, p5:3) = [sp++]; |
| 538 | fp = [sp++]; |
| 539 | rets = [sp++]; |
| 540 | |
| 541 | /* |
| 542 | * When we come out of resume, r0 carries "old" task, becuase we are |
| 543 | * in "new" task. |
| 544 | */ |
| 545 | rts; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 546 | ENDPROC(_resume) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 547 | |
| 548 | ENTRY(_ret_from_exception) |
| 549 | p2.l = lo(IPEND); |
| 550 | p2.h = hi(IPEND); |
| 551 | |
| 552 | csync; |
| 553 | r0 = [p2]; |
| 554 | [sp + PT_IPEND] = r0; |
| 555 | |
| 556 | 1: |
| 557 | r1 = 0x37(Z); |
| 558 | r2 = ~r1; |
| 559 | r2.h = 0; |
| 560 | r0 = r2 & r0; |
| 561 | cc = r0 == 0; |
| 562 | if !cc jump 4f; /* if not return to user mode, get out */ |
| 563 | |
| 564 | /* Make sure any pending system call or deferred exception |
| 565 | * return in ILAT for this process to get executed, otherwise |
| 566 | * in case context switch happens, system call of |
| 567 | * first process (i.e in ILAT) will be carried |
| 568 | * forward to the switched process |
| 569 | */ |
| 570 | |
| 571 | p2.l = lo(ILAT); |
| 572 | p2.h = hi(ILAT); |
| 573 | r0 = [p2]; |
| 574 | r1 = (EVT_IVG14 | EVT_IVG15) (z); |
| 575 | r0 = r0 & r1; |
| 576 | cc = r0 == 0; |
| 577 | if !cc jump 5f; |
| 578 | |
| 579 | /* Set the stack for the current process */ |
| 580 | r7 = sp; |
| 581 | r4.l = lo(ALIGN_PAGE_MASK); |
| 582 | r4.h = hi(ALIGN_PAGE_MASK); |
| 583 | r7 = r7 & r4; /* thread_info->flags */ |
| 584 | p5 = r7; |
| 585 | r7 = [p5 + TI_FLAGS]; |
| 586 | r4.l = lo(_TIF_WORK_MASK); |
| 587 | r4.h = hi(_TIF_WORK_MASK); |
| 588 | r7 = r7 & r4; |
| 589 | cc = r7 == 0; |
| 590 | if cc jump 4f; |
| 591 | |
| 592 | p0.l = lo(EVT15); |
| 593 | p0.h = hi(EVT15); |
| 594 | p1.l = _schedule_and_signal; |
| 595 | p1.h = _schedule_and_signal; |
| 596 | [p0] = p1; |
| 597 | csync; |
| 598 | raise 15; /* raise evt14 to do signal or reschedule */ |
| 599 | 4: |
| 600 | r0 = syscfg; |
| 601 | bitclr(r0, 0); |
| 602 | syscfg = r0; |
| 603 | 5: |
| 604 | rts; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 605 | ENDPROC(_ret_from_exception) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 606 | |
| 607 | ENTRY(_return_from_int) |
| 608 | /* If someone else already raised IRQ 15, do nothing. */ |
| 609 | csync; |
| 610 | p2.l = lo(ILAT); |
| 611 | p2.h = hi(ILAT); |
| 612 | r0 = [p2]; |
| 613 | cc = bittst (r0, EVT_IVG15_P); |
| 614 | if cc jump 2f; |
| 615 | |
| 616 | /* if not return to user mode, get out */ |
| 617 | p2.l = lo(IPEND); |
| 618 | p2.h = hi(IPEND); |
| 619 | r0 = [p2]; |
| 620 | r1 = 0x17(Z); |
| 621 | r2 = ~r1; |
| 622 | r2.h = 0; |
| 623 | r0 = r2 & r0; |
| 624 | r1 = 1; |
| 625 | r1 = r0 - r1; |
| 626 | r2 = r0 & r1; |
| 627 | cc = r2 == 0; |
| 628 | if !cc jump 2f; |
| 629 | |
| 630 | /* Lower the interrupt level to 15. */ |
| 631 | p0.l = lo(EVT15); |
| 632 | p0.h = hi(EVT15); |
| 633 | p1.l = _schedule_and_signal_from_int; |
| 634 | p1.h = _schedule_and_signal_from_int; |
| 635 | [p0] = p1; |
| 636 | csync; |
| 637 | #if defined(ANOMALY_05000281) |
| 638 | r0.l = lo(CONFIG_BOOT_LOAD); |
| 639 | r0.h = hi(CONFIG_BOOT_LOAD); |
| 640 | reti = r0; |
| 641 | #endif |
| 642 | r0 = 0x801f (z); |
| 643 | STI r0; |
| 644 | raise 15; /* raise evt15 to do signal or reschedule */ |
| 645 | rti; |
| 646 | 2: |
| 647 | rts; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 648 | ENDPROC(_return_from_int) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 649 | |
| 650 | ENTRY(_lower_to_irq14) |
| 651 | #if defined(ANOMALY_05000281) |
| 652 | r0.l = lo(CONFIG_BOOT_LOAD); |
| 653 | r0.h = hi(CONFIG_BOOT_LOAD); |
| 654 | reti = r0; |
| 655 | #endif |
| 656 | r0 = 0x401f; |
| 657 | sti r0; |
| 658 | raise 14; |
| 659 | rti; |
| 660 | ENTRY(_evt14_softirq) |
| 661 | #ifdef CONFIG_DEBUG_HWERR |
| 662 | r0 = 0x3f; |
| 663 | sti r0; |
| 664 | #else |
| 665 | cli r0; |
| 666 | #endif |
| 667 | [--sp] = RETI; |
| 668 | SP += 4; |
| 669 | rts; |
| 670 | |
| 671 | _schedule_and_signal_from_int: |
| 672 | /* To end up here, vector 15 was changed - so we have to change it |
| 673 | * back. |
| 674 | */ |
| 675 | p0.l = lo(EVT15); |
| 676 | p0.h = hi(EVT15); |
| 677 | p1.l = _evt_system_call; |
| 678 | p1.h = _evt_system_call; |
| 679 | [p0] = p1; |
| 680 | csync; |
Bernd Schmidt | c824498 | 2007-05-21 18:09:33 +0800 | [diff] [blame] | 681 | |
| 682 | /* Set orig_p0 to -1 to indicate this isn't the end of a syscall. */ |
| 683 | r0 = -1 (x); |
| 684 | [sp + PT_ORIG_P0] = r0; |
| 685 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 686 | p1 = rets; |
| 687 | [sp + PT_RESERVED] = p1; |
| 688 | |
| 689 | p0.l = _irq_flags; |
| 690 | p0.h = _irq_flags; |
| 691 | r0 = [p0]; |
| 692 | sti r0; |
| 693 | |
Bernd Schmidt | 7adfb58 | 2007-06-21 11:34:16 +0800 | [diff] [blame] | 694 | r0 = sp; |
| 695 | sp += -12; |
| 696 | call _finish_atomic_sections; |
| 697 | sp += 12; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 698 | jump.s .Lresume_userspace; |
| 699 | |
| 700 | _schedule_and_signal: |
| 701 | SAVE_CONTEXT_SYSCALL |
| 702 | /* To end up here, vector 15 was changed - so we have to change it |
| 703 | * back. |
| 704 | */ |
| 705 | p0.l = lo(EVT15); |
| 706 | p0.h = hi(EVT15); |
| 707 | p1.l = _evt_system_call; |
| 708 | p1.h = _evt_system_call; |
| 709 | [p0] = p1; |
| 710 | csync; |
| 711 | p0.l = 1f; |
| 712 | p0.h = 1f; |
| 713 | [sp + PT_RESERVED] = P0; |
| 714 | call .Lresume_userspace; |
| 715 | 1: |
| 716 | RESTORE_CONTEXT |
| 717 | rti; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 718 | ENDPROC(_lower_to_irq14) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 719 | |
| 720 | /* Make sure when we start, that the circular buffer is initialized properly |
| 721 | * R0 and P0 are call clobbered, so we can use them here. |
| 722 | */ |
| 723 | ENTRY(_init_exception_buff) |
| 724 | r0 = 0; |
| 725 | p0.h = _in_ptr_excause; |
| 726 | p0.l = _in_ptr_excause; |
| 727 | [p0] = r0; |
| 728 | p0.h = _out_ptr_excause; |
| 729 | p0.l = _out_ptr_excause; |
| 730 | [p0] = r0; |
| 731 | rts; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 732 | ENDPROC(_init_exception_buff) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 733 | |
| 734 | /* |
| 735 | * Put these in the kernel data section - that should always be covered by |
| 736 | * a CPLB. This is needed to ensure we don't get double fault conditions |
| 737 | */ |
| 738 | |
| 739 | #ifdef CONFIG_SYSCALL_TAB_L1 |
| 740 | .section .l1.data |
| 741 | #else |
| 742 | .data |
| 743 | #endif |
| 744 | ALIGN |
| 745 | _extable: |
| 746 | /* entry for each EXCAUSE[5:0] |
Mike Frysinger | 9401e61 | 2007-07-12 11:50:43 +0800 | [diff] [blame] | 747 | * This table must be in sync with the table in ./kernel/traps.c |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 748 | * EXCPT instruction can provide 4 bits of EXCAUSE, allowing 16 to be user defined |
| 749 | */ |
| 750 | .long _ex_syscall; /* 0x00 - User Defined - Linux Syscall */ |
| 751 | .long _ex_soft_bp /* 0x01 - User Defined - Software breakpoint */ |
| 752 | .long _ex_trap_c /* 0x02 - User Defined */ |
Mike Frysinger | 9401e61 | 2007-07-12 11:50:43 +0800 | [diff] [blame] | 753 | .long _ex_trap_c /* 0x03 - User Defined - userspace stack overflow */ |
| 754 | .long _ex_trap_c /* 0x04 - User Defined */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 755 | .long _ex_trap_c /* 0x05 - User Defined */ |
| 756 | .long _ex_trap_c /* 0x06 - User Defined */ |
| 757 | .long _ex_trap_c /* 0x07 - User Defined */ |
| 758 | .long _ex_trap_c /* 0x08 - User Defined */ |
| 759 | .long _ex_trap_c /* 0x09 - User Defined */ |
| 760 | .long _ex_trap_c /* 0x0A - User Defined */ |
| 761 | .long _ex_trap_c /* 0x0B - User Defined */ |
| 762 | .long _ex_trap_c /* 0x0C - User Defined */ |
| 763 | .long _ex_trap_c /* 0x0D - User Defined */ |
| 764 | .long _ex_trap_c /* 0x0E - User Defined */ |
| 765 | .long _ex_trap_c /* 0x0F - User Defined */ |
| 766 | .long _ex_single_step /* 0x10 - HW Single step */ |
| 767 | .long _ex_trap_c /* 0x11 - Trace Buffer Full */ |
| 768 | .long _ex_trap_c /* 0x12 - Reserved */ |
| 769 | .long _ex_trap_c /* 0x13 - Reserved */ |
| 770 | .long _ex_trap_c /* 0x14 - Reserved */ |
| 771 | .long _ex_trap_c /* 0x15 - Reserved */ |
| 772 | .long _ex_trap_c /* 0x16 - Reserved */ |
| 773 | .long _ex_trap_c /* 0x17 - Reserved */ |
| 774 | .long _ex_trap_c /* 0x18 - Reserved */ |
| 775 | .long _ex_trap_c /* 0x19 - Reserved */ |
| 776 | .long _ex_trap_c /* 0x1A - Reserved */ |
| 777 | .long _ex_trap_c /* 0x1B - Reserved */ |
| 778 | .long _ex_trap_c /* 0x1C - Reserved */ |
| 779 | .long _ex_trap_c /* 0x1D - Reserved */ |
| 780 | .long _ex_trap_c /* 0x1E - Reserved */ |
| 781 | .long _ex_trap_c /* 0x1F - Reserved */ |
| 782 | .long _ex_trap_c /* 0x20 - Reserved */ |
| 783 | .long _ex_trap_c /* 0x21 - Undefined Instruction */ |
| 784 | .long _ex_trap_c /* 0x22 - Illegal Instruction Combination */ |
| 785 | .long _ex_dcplb /* 0x23 - Data CPLB Protection Violation */ |
| 786 | .long _ex_trap_c /* 0x24 - Data access misaligned */ |
| 787 | .long _ex_trap_c /* 0x25 - Unrecoverable Event */ |
| 788 | .long _ex_dcplb /* 0x26 - Data CPLB Miss */ |
| 789 | .long _ex_trap_c /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero */ |
| 790 | .long _ex_trap_c /* 0x28 - Emulation Watchpoint */ |
| 791 | .long _ex_trap_c /* 0x29 - Instruction fetch access error (535 only) */ |
| 792 | .long _ex_trap_c /* 0x2A - Instruction fetch misaligned */ |
| 793 | .long _ex_icplb /* 0x2B - Instruction CPLB protection Violation */ |
| 794 | .long _ex_icplb /* 0x2C - Instruction CPLB miss */ |
| 795 | .long _ex_trap_c /* 0x2D - Instruction CPLB Multiple Hits */ |
| 796 | .long _ex_trap_c /* 0x2E - Illegal use of Supervisor Resource */ |
| 797 | .long _ex_trap_c /* 0x2E - Illegal use of Supervisor Resource */ |
| 798 | .long _ex_trap_c /* 0x2F - Reserved */ |
| 799 | .long _ex_trap_c /* 0x30 - Reserved */ |
| 800 | .long _ex_trap_c /* 0x31 - Reserved */ |
| 801 | .long _ex_trap_c /* 0x32 - Reserved */ |
| 802 | .long _ex_trap_c /* 0x33 - Reserved */ |
| 803 | .long _ex_trap_c /* 0x34 - Reserved */ |
| 804 | .long _ex_trap_c /* 0x35 - Reserved */ |
| 805 | .long _ex_trap_c /* 0x36 - Reserved */ |
| 806 | .long _ex_trap_c /* 0x37 - Reserved */ |
| 807 | .long _ex_trap_c /* 0x38 - Reserved */ |
| 808 | .long _ex_trap_c /* 0x39 - Reserved */ |
| 809 | .long _ex_trap_c /* 0x3A - Reserved */ |
| 810 | .long _ex_trap_c /* 0x3B - Reserved */ |
| 811 | .long _ex_trap_c /* 0x3C - Reserved */ |
| 812 | .long _ex_trap_c /* 0x3D - Reserved */ |
| 813 | .long _ex_trap_c /* 0x3E - Reserved */ |
| 814 | .long _ex_trap_c /* 0x3F - Reserved */ |
| 815 | |
| 816 | ALIGN |
| 817 | ENTRY(_sys_call_table) |
Bryan Wu | 0b95f22 | 2007-09-23 00:51:32 +0800 | [diff] [blame^] | 818 | .long _sys_restart_syscall /* 0 */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 819 | .long _sys_exit |
| 820 | .long _sys_fork |
| 821 | .long _sys_read |
| 822 | .long _sys_write |
| 823 | .long _sys_open /* 5 */ |
| 824 | .long _sys_close |
| 825 | .long _sys_ni_syscall /* old waitpid */ |
| 826 | .long _sys_creat |
| 827 | .long _sys_link |
| 828 | .long _sys_unlink /* 10 */ |
| 829 | .long _sys_execve |
| 830 | .long _sys_chdir |
| 831 | .long _sys_time |
| 832 | .long _sys_mknod |
| 833 | .long _sys_chmod /* 15 */ |
| 834 | .long _sys_chown /* chown16 */ |
| 835 | .long _sys_ni_syscall /* old break syscall holder */ |
| 836 | .long _sys_ni_syscall /* old stat */ |
| 837 | .long _sys_lseek |
| 838 | .long _sys_getpid /* 20 */ |
| 839 | .long _sys_mount |
| 840 | .long _sys_ni_syscall /* old umount */ |
| 841 | .long _sys_setuid |
| 842 | .long _sys_getuid |
| 843 | .long _sys_stime /* 25 */ |
| 844 | .long _sys_ptrace |
| 845 | .long _sys_alarm |
| 846 | .long _sys_ni_syscall /* old fstat */ |
| 847 | .long _sys_pause |
| 848 | .long _sys_ni_syscall /* old utime */ /* 30 */ |
| 849 | .long _sys_ni_syscall /* old stty syscall holder */ |
| 850 | .long _sys_ni_syscall /* old gtty syscall holder */ |
| 851 | .long _sys_access |
| 852 | .long _sys_nice |
| 853 | .long _sys_ni_syscall /* 35 */ /* old ftime syscall holder */ |
| 854 | .long _sys_sync |
| 855 | .long _sys_kill |
| 856 | .long _sys_rename |
| 857 | .long _sys_mkdir |
| 858 | .long _sys_rmdir /* 40 */ |
| 859 | .long _sys_dup |
| 860 | .long _sys_pipe |
| 861 | .long _sys_times |
| 862 | .long _sys_ni_syscall /* old prof syscall holder */ |
| 863 | .long _sys_brk /* 45 */ |
| 864 | .long _sys_setgid |
| 865 | .long _sys_getgid |
| 866 | .long _sys_ni_syscall /* old sys_signal */ |
| 867 | .long _sys_geteuid /* geteuid16 */ |
| 868 | .long _sys_getegid /* getegid16 */ /* 50 */ |
| 869 | .long _sys_acct |
| 870 | .long _sys_umount /* recycled never used phys() */ |
| 871 | .long _sys_ni_syscall /* old lock syscall holder */ |
| 872 | .long _sys_ioctl |
| 873 | .long _sys_fcntl /* 55 */ |
| 874 | .long _sys_ni_syscall /* old mpx syscall holder */ |
| 875 | .long _sys_setpgid |
| 876 | .long _sys_ni_syscall /* old ulimit syscall holder */ |
| 877 | .long _sys_ni_syscall /* old old uname */ |
| 878 | .long _sys_umask /* 60 */ |
| 879 | .long _sys_chroot |
| 880 | .long _sys_ustat |
| 881 | .long _sys_dup2 |
| 882 | .long _sys_getppid |
| 883 | .long _sys_getpgrp /* 65 */ |
| 884 | .long _sys_setsid |
| 885 | .long _sys_ni_syscall /* old sys_sigaction */ |
| 886 | .long _sys_sgetmask |
| 887 | .long _sys_ssetmask |
| 888 | .long _sys_setreuid /* setreuid16 */ /* 70 */ |
| 889 | .long _sys_setregid /* setregid16 */ |
| 890 | .long _sys_ni_syscall /* old sys_sigsuspend */ |
| 891 | .long _sys_ni_syscall /* old sys_sigpending */ |
| 892 | .long _sys_sethostname |
| 893 | .long _sys_setrlimit /* 75 */ |
| 894 | .long _sys_ni_syscall /* old getrlimit */ |
| 895 | .long _sys_getrusage |
| 896 | .long _sys_gettimeofday |
| 897 | .long _sys_settimeofday |
| 898 | .long _sys_getgroups /* getgroups16 */ /* 80 */ |
| 899 | .long _sys_setgroups /* setgroups16 */ |
| 900 | .long _sys_ni_syscall /* old_select */ |
| 901 | .long _sys_symlink |
| 902 | .long _sys_ni_syscall /* old lstat */ |
| 903 | .long _sys_readlink /* 85 */ |
| 904 | .long _sys_uselib |
| 905 | .long _sys_ni_syscall /* sys_swapon */ |
| 906 | .long _sys_reboot |
| 907 | .long _sys_ni_syscall /* old_readdir */ |
| 908 | .long _sys_ni_syscall /* sys_mmap */ /* 90 */ |
| 909 | .long _sys_munmap |
| 910 | .long _sys_truncate |
| 911 | .long _sys_ftruncate |
| 912 | .long _sys_fchmod |
| 913 | .long _sys_fchown /* fchown16 */ /* 95 */ |
| 914 | .long _sys_getpriority |
| 915 | .long _sys_setpriority |
| 916 | .long _sys_ni_syscall /* old profil syscall holder */ |
| 917 | .long _sys_statfs |
| 918 | .long _sys_fstatfs /* 100 */ |
| 919 | .long _sys_ni_syscall |
| 920 | .long _sys_ni_syscall /* old sys_socketcall */ |
| 921 | .long _sys_syslog |
| 922 | .long _sys_setitimer |
| 923 | .long _sys_getitimer /* 105 */ |
| 924 | .long _sys_newstat |
| 925 | .long _sys_newlstat |
| 926 | .long _sys_newfstat |
| 927 | .long _sys_ni_syscall /* old uname */ |
| 928 | .long _sys_ni_syscall /* iopl for i386 */ /* 110 */ |
| 929 | .long _sys_vhangup |
| 930 | .long _sys_ni_syscall /* obsolete idle() syscall */ |
| 931 | .long _sys_ni_syscall /* vm86old for i386 */ |
| 932 | .long _sys_wait4 |
| 933 | .long _sys_ni_syscall /* 115 */ /* sys_swapoff */ |
| 934 | .long _sys_sysinfo |
| 935 | .long _sys_ni_syscall /* old sys_ipc */ |
| 936 | .long _sys_fsync |
| 937 | .long _sys_ni_syscall /* old sys_sigreturn */ |
| 938 | .long _sys_clone /* 120 */ |
| 939 | .long _sys_setdomainname |
| 940 | .long _sys_newuname |
| 941 | .long _sys_ni_syscall /* old sys_modify_ldt */ |
| 942 | .long _sys_adjtimex |
| 943 | .long _sys_ni_syscall /* 125 */ /* sys_mprotect */ |
| 944 | .long _sys_ni_syscall /* old sys_sigprocmask */ |
| 945 | .long _sys_ni_syscall /* old "creat_module" */ |
| 946 | .long _sys_init_module |
| 947 | .long _sys_delete_module |
| 948 | .long _sys_ni_syscall /* 130: old "get_kernel_syms" */ |
| 949 | .long _sys_quotactl |
| 950 | .long _sys_getpgid |
| 951 | .long _sys_fchdir |
| 952 | .long _sys_bdflush |
| 953 | .long _sys_ni_syscall /* 135 */ /* sys_sysfs */ |
| 954 | .long _sys_personality |
| 955 | .long _sys_ni_syscall /* for afs_syscall */ |
| 956 | .long _sys_setfsuid /* setfsuid16 */ |
| 957 | .long _sys_setfsgid /* setfsgid16 */ |
| 958 | .long _sys_llseek /* 140 */ |
| 959 | .long _sys_getdents |
| 960 | .long _sys_ni_syscall /* sys_select */ |
| 961 | .long _sys_flock |
| 962 | .long _sys_ni_syscall /* sys_msync */ |
| 963 | .long _sys_readv /* 145 */ |
| 964 | .long _sys_writev |
| 965 | .long _sys_getsid |
| 966 | .long _sys_fdatasync |
| 967 | .long _sys_sysctl |
| 968 | .long _sys_ni_syscall /* 150 */ /* sys_mlock */ |
| 969 | .long _sys_ni_syscall /* sys_munlock */ |
| 970 | .long _sys_ni_syscall /* sys_mlockall */ |
| 971 | .long _sys_ni_syscall /* sys_munlockall */ |
| 972 | .long _sys_sched_setparam |
| 973 | .long _sys_sched_getparam /* 155 */ |
| 974 | .long _sys_sched_setscheduler |
| 975 | .long _sys_sched_getscheduler |
| 976 | .long _sys_sched_yield |
| 977 | .long _sys_sched_get_priority_max |
| 978 | .long _sys_sched_get_priority_min /* 160 */ |
| 979 | .long _sys_sched_rr_get_interval |
| 980 | .long _sys_nanosleep |
Bryan Wu | 0b95f22 | 2007-09-23 00:51:32 +0800 | [diff] [blame^] | 981 | .long _sys_mremap |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 982 | .long _sys_setresuid /* setresuid16 */ |
| 983 | .long _sys_getresuid /* getresuid16 */ /* 165 */ |
| 984 | .long _sys_ni_syscall /* for vm86 */ |
| 985 | .long _sys_ni_syscall /* old "query_module" */ |
| 986 | .long _sys_ni_syscall /* sys_poll */ |
Bryan Wu | 0b95f22 | 2007-09-23 00:51:32 +0800 | [diff] [blame^] | 987 | .long _sys_nfsservctl |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 988 | .long _sys_setresgid /* setresgid16 */ /* 170 */ |
| 989 | .long _sys_getresgid /* getresgid16 */ |
| 990 | .long _sys_prctl |
| 991 | .long _sys_rt_sigreturn |
| 992 | .long _sys_rt_sigaction |
| 993 | .long _sys_rt_sigprocmask /* 175 */ |
| 994 | .long _sys_rt_sigpending |
| 995 | .long _sys_rt_sigtimedwait |
| 996 | .long _sys_rt_sigqueueinfo |
| 997 | .long _sys_rt_sigsuspend |
| 998 | .long _sys_pread64 /* 180 */ |
| 999 | .long _sys_pwrite64 |
| 1000 | .long _sys_lchown /* lchown16 */ |
| 1001 | .long _sys_getcwd |
| 1002 | .long _sys_capget |
| 1003 | .long _sys_capset /* 185 */ |
| 1004 | .long _sys_sigaltstack |
| 1005 | .long _sys_sendfile |
| 1006 | .long _sys_ni_syscall /* streams1 */ |
| 1007 | .long _sys_ni_syscall /* streams2 */ |
| 1008 | .long _sys_vfork /* 190 */ |
| 1009 | .long _sys_getrlimit |
| 1010 | .long _sys_mmap2 |
| 1011 | .long _sys_truncate64 |
| 1012 | .long _sys_ftruncate64 |
| 1013 | .long _sys_stat64 /* 195 */ |
| 1014 | .long _sys_lstat64 |
| 1015 | .long _sys_fstat64 |
| 1016 | .long _sys_chown |
| 1017 | .long _sys_getuid |
| 1018 | .long _sys_getgid /* 200 */ |
| 1019 | .long _sys_geteuid |
| 1020 | .long _sys_getegid |
| 1021 | .long _sys_setreuid |
| 1022 | .long _sys_setregid |
| 1023 | .long _sys_getgroups /* 205 */ |
| 1024 | .long _sys_setgroups |
| 1025 | .long _sys_fchown |
| 1026 | .long _sys_setresuid |
| 1027 | .long _sys_getresuid |
| 1028 | .long _sys_setresgid /* 210 */ |
| 1029 | .long _sys_getresgid |
| 1030 | .long _sys_lchown |
| 1031 | .long _sys_setuid |
| 1032 | .long _sys_setgid |
| 1033 | .long _sys_setfsuid /* 215 */ |
| 1034 | .long _sys_setfsgid |
| 1035 | .long _sys_pivot_root |
| 1036 | .long _sys_ni_syscall /* sys_mincore */ |
| 1037 | .long _sys_ni_syscall /* sys_madvise */ |
| 1038 | .long _sys_getdents64 /* 220 */ |
| 1039 | .long _sys_fcntl64 |
| 1040 | .long _sys_ni_syscall /* reserved for TUX */ |
| 1041 | .long _sys_ni_syscall |
| 1042 | .long _sys_gettid |
Bryan Wu | 0b95f22 | 2007-09-23 00:51:32 +0800 | [diff] [blame^] | 1043 | .long _sys_readahead /* 225 */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1044 | .long _sys_setxattr |
| 1045 | .long _sys_lsetxattr |
| 1046 | .long _sys_fsetxattr |
| 1047 | .long _sys_getxattr |
| 1048 | .long _sys_lgetxattr /* 230 */ |
| 1049 | .long _sys_fgetxattr |
| 1050 | .long _sys_listxattr |
| 1051 | .long _sys_llistxattr |
| 1052 | .long _sys_flistxattr |
| 1053 | .long _sys_removexattr /* 235 */ |
| 1054 | .long _sys_lremovexattr |
| 1055 | .long _sys_fremovexattr |
| 1056 | .long _sys_tkill |
| 1057 | .long _sys_sendfile64 |
| 1058 | .long _sys_futex /* 240 */ |
| 1059 | .long _sys_sched_setaffinity |
| 1060 | .long _sys_sched_getaffinity |
| 1061 | .long _sys_ni_syscall /* sys_set_thread_area */ |
| 1062 | .long _sys_ni_syscall /* sys_get_thread_area */ |
| 1063 | .long _sys_io_setup /* 245 */ |
| 1064 | .long _sys_io_destroy |
| 1065 | .long _sys_io_getevents |
| 1066 | .long _sys_io_submit |
| 1067 | .long _sys_io_cancel |
| 1068 | .long _sys_ni_syscall /* 250 */ /* sys_alloc_hugepages */ |
| 1069 | .long _sys_ni_syscall /* sys_freec_hugepages */ |
| 1070 | .long _sys_exit_group |
| 1071 | .long _sys_lookup_dcookie |
| 1072 | .long _sys_bfin_spinlock |
| 1073 | .long _sys_epoll_create /* 255 */ |
| 1074 | .long _sys_epoll_ctl |
| 1075 | .long _sys_epoll_wait |
| 1076 | .long _sys_ni_syscall /* remap_file_pages */ |
| 1077 | .long _sys_set_tid_address |
| 1078 | .long _sys_timer_create /* 260 */ |
| 1079 | .long _sys_timer_settime |
| 1080 | .long _sys_timer_gettime |
| 1081 | .long _sys_timer_getoverrun |
| 1082 | .long _sys_timer_delete |
| 1083 | .long _sys_clock_settime /* 265 */ |
| 1084 | .long _sys_clock_gettime |
| 1085 | .long _sys_clock_getres |
| 1086 | .long _sys_clock_nanosleep |
| 1087 | .long _sys_statfs64 |
| 1088 | .long _sys_fstatfs64 /* 270 */ |
| 1089 | .long _sys_tgkill |
| 1090 | .long _sys_utimes |
| 1091 | .long _sys_fadvise64_64 |
| 1092 | .long _sys_ni_syscall /* vserver */ |
| 1093 | .long _sys_ni_syscall /* 275, mbind */ |
| 1094 | .long _sys_ni_syscall /* get_mempolicy */ |
| 1095 | .long _sys_ni_syscall /* set_mempolicy */ |
| 1096 | .long _sys_mq_open |
| 1097 | .long _sys_mq_unlink |
| 1098 | .long _sys_mq_timedsend /* 280 */ |
| 1099 | .long _sys_mq_timedreceive |
| 1100 | .long _sys_mq_notify |
| 1101 | .long _sys_mq_getsetattr |
| 1102 | .long _sys_ni_syscall /* kexec_load */ |
| 1103 | .long _sys_waitid /* 285 */ |
| 1104 | .long _sys_add_key |
| 1105 | .long _sys_request_key |
| 1106 | .long _sys_keyctl |
| 1107 | .long _sys_ioprio_set |
| 1108 | .long _sys_ioprio_get /* 290 */ |
| 1109 | .long _sys_inotify_init |
| 1110 | .long _sys_inotify_add_watch |
| 1111 | .long _sys_inotify_rm_watch |
| 1112 | .long _sys_ni_syscall /* migrate_pages */ |
| 1113 | .long _sys_openat /* 295 */ |
| 1114 | .long _sys_mkdirat |
| 1115 | .long _sys_mknodat |
| 1116 | .long _sys_fchownat |
| 1117 | .long _sys_futimesat |
| 1118 | .long _sys_fstatat64 /* 300 */ |
| 1119 | .long _sys_unlinkat |
| 1120 | .long _sys_renameat |
| 1121 | .long _sys_linkat |
| 1122 | .long _sys_symlinkat |
| 1123 | .long _sys_readlinkat /* 305 */ |
| 1124 | .long _sys_fchmodat |
| 1125 | .long _sys_faccessat |
| 1126 | .long _sys_pselect6 |
| 1127 | .long _sys_ppoll |
| 1128 | .long _sys_unshare /* 310 */ |
| 1129 | .long _sys_sram_alloc |
| 1130 | .long _sys_sram_free |
| 1131 | .long _sys_dma_memcpy |
| 1132 | .long _sys_accept |
| 1133 | .long _sys_bind /* 315 */ |
| 1134 | .long _sys_connect |
| 1135 | .long _sys_getpeername |
| 1136 | .long _sys_getsockname |
| 1137 | .long _sys_getsockopt |
| 1138 | .long _sys_listen /* 320 */ |
| 1139 | .long _sys_recv |
| 1140 | .long _sys_recvfrom |
| 1141 | .long _sys_recvmsg |
| 1142 | .long _sys_send |
| 1143 | .long _sys_sendmsg /* 325 */ |
| 1144 | .long _sys_sendto |
| 1145 | .long _sys_setsockopt |
| 1146 | .long _sys_shutdown |
| 1147 | .long _sys_socket |
| 1148 | .long _sys_socketpair /* 330 */ |
| 1149 | .long _sys_semctl |
| 1150 | .long _sys_semget |
| 1151 | .long _sys_semop |
| 1152 | .long _sys_msgctl |
| 1153 | .long _sys_msgget /* 335 */ |
| 1154 | .long _sys_msgrcv |
| 1155 | .long _sys_msgsnd |
| 1156 | .long _sys_shmat |
| 1157 | .long _sys_shmctl |
| 1158 | .long _sys_shmdt /* 340 */ |
| 1159 | .long _sys_shmget |
Bryan Wu | 0b95f22 | 2007-09-23 00:51:32 +0800 | [diff] [blame^] | 1160 | .long _sys_splice |
| 1161 | .long _sys_sync_file_range |
| 1162 | .long _sys_tee |
| 1163 | .long _sys_vmsplice /* 345 */ |
| 1164 | .long _sys_epoll_pwait |
| 1165 | .long _sys_utimensat |
| 1166 | .long _sys_signalfd |
| 1167 | .long _sys_timerfd |
| 1168 | .long _sys_eventfd /* 350 */ |
| 1169 | .long _sys_pread64 |
| 1170 | .long _sys_pwrite64 |
| 1171 | .long _sys_fadvise64 |
| 1172 | .long _sys_set_robust_list |
| 1173 | .long _sys_get_robust_list /* 355 */ |
| 1174 | .long _sys_fallocate |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1175 | .rept NR_syscalls-(.-_sys_call_table)/4 |
| 1176 | .long _sys_ni_syscall |
| 1177 | .endr |
| 1178 | _excpt_saved_imask: |
| 1179 | .long 0; |
| 1180 | |
| 1181 | _exception_stack: |
| 1182 | .rept 1024 |
| 1183 | .long 0; |
| 1184 | .endr |
| 1185 | _exception_stack_top: |
| 1186 | |
| 1187 | #if defined(ANOMALY_05000261) |
| 1188 | /* Used by the assembly entry point to work around an anomaly. */ |
| 1189 | _last_cplb_fault_retx: |
| 1190 | .long 0; |
| 1191 | #endif |
| 1192 | /* |
| 1193 | * Single instructions can have multiple faults, which need to be |
| 1194 | * handled by traps.c, in irq5. We store the exception cause to ensure |
| 1195 | * we don't miss a double fault condition |
| 1196 | */ |
| 1197 | ENTRY(_in_ptr_excause) |
| 1198 | .long 0; |
| 1199 | ENTRY(_out_ptr_excause) |
| 1200 | .long 0; |
| 1201 | ALIGN |
| 1202 | ENTRY(_excause_circ_buf) |
| 1203 | .rept 4 |
| 1204 | .long 0 |
| 1205 | .endr |