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 | |
Robin Getz | 2ebcade | 2007-10-09 17:24:30 +0800 | [diff] [blame] | 32 | /* NOTE: This code handles signal-recognition, which happens every time |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 33 | * after a timer-interrupt and after each system call. |
| 34 | */ |
| 35 | |
Mike Frysinger | 9cb07b2 | 2007-11-21 16:45:08 +0800 | [diff] [blame] | 36 | #include <linux/init.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 37 | #include <linux/linkage.h> |
Mike Frysinger | 1f83b8f | 2007-07-12 22:58:21 +0800 | [diff] [blame] | 38 | #include <linux/unistd.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 39 | #include <asm/blackfin.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 40 | #include <asm/errno.h> |
Bernd Schmidt | 5d750b9 | 2008-04-25 05:02:33 +0800 | [diff] [blame] | 41 | #include <asm/fixed_code.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 42 | #include <asm/thread_info.h> /* TIF_NEED_RESCHED */ |
| 43 | #include <asm/asm-offsets.h> |
Robin Getz | 669b792 | 2007-06-21 16:34:08 +0800 | [diff] [blame] | 44 | #include <asm/trace.h> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 45 | |
Bryan Wu | 639f657 | 2008-08-27 10:51:02 +0800 | [diff] [blame] | 46 | #include <asm/context.S> |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 47 | |
Mike Frysinger | f0b5d12 | 2007-08-05 17:03:59 +0800 | [diff] [blame] | 48 | #if defined(CONFIG_BFIN_SCRATCH_REG_RETN) |
| 49 | # define EX_SCRATCH_REG RETN |
| 50 | #elif defined(CONFIG_BFIN_SCRATCH_REG_RETE) |
| 51 | # define EX_SCRATCH_REG RETE |
| 52 | #else |
| 53 | # define EX_SCRATCH_REG CYCLES |
| 54 | #endif |
| 55 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 56 | #ifdef CONFIG_EXCPT_IRQ_SYSC_L1 |
| 57 | .section .l1.text |
| 58 | #else |
| 59 | .text |
| 60 | #endif |
| 61 | |
| 62 | /* Slightly simplified and streamlined entry point for CPLB misses. |
| 63 | * This one does not lower the level to IRQ5, and thus can be used to |
| 64 | * patch up CPLB misses on the kernel stack. |
| 65 | */ |
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 66 | #if ANOMALY_05000261 |
Robin Getz | f26fbc4 | 2007-11-12 22:21:30 +0800 | [diff] [blame] | 67 | #define _ex_dviol _ex_workaround_261 |
| 68 | #define _ex_dmiss _ex_workaround_261 |
| 69 | #define _ex_dmult _ex_workaround_261 |
| 70 | |
| 71 | ENTRY(_ex_workaround_261) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 72 | /* |
| 73 | * Work around an anomaly: if we see a new DCPLB fault, return |
| 74 | * without doing anything. Then, if we get the same fault again, |
| 75 | * handle it. |
| 76 | */ |
Robin Getz | f26fbc4 | 2007-11-12 22:21:30 +0800 | [diff] [blame] | 77 | P4 = R7; /* Store EXCAUSE */ |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 78 | |
| 79 | GET_PDA(p5, r7); |
| 80 | r7 = [p5 + PDA_LFRETX]; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 81 | r6 = retx; |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 82 | [p5 + PDA_LFRETX] = r6; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 83 | cc = r6 == r7; |
Mike Frysinger | 8d6c242 | 2007-11-21 15:53:49 +0800 | [diff] [blame] | 84 | if !cc jump _bfin_return_from_exception; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 85 | /* fall through */ |
Robin Getz | f26fbc4 | 2007-11-12 22:21:30 +0800 | [diff] [blame] | 86 | R7 = P4; |
| 87 | R6 = 0x26; /* Data CPLB Miss */ |
| 88 | cc = R6 == R7; |
| 89 | if cc jump _ex_dcplb_miss (BP); |
Bernd Schmidt | b97b8a9 | 2008-01-27 18:39:16 +0800 | [diff] [blame] | 90 | R6 = 0x23; /* Data CPLB Miss */ |
| 91 | cc = R6 == R7; |
| 92 | if cc jump _ex_dcplb_viol (BP); |
Robin Getz | f26fbc4 | 2007-11-12 22:21:30 +0800 | [diff] [blame] | 93 | /* Handle 0x23 Data CPLB Protection Violation |
| 94 | * and Data CPLB Multiple Hits - Linux Trap Zero |
| 95 | */ |
| 96 | jump _ex_trap_c; |
| 97 | ENDPROC(_ex_workaround_261) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 98 | |
Robin Getz | f26fbc4 | 2007-11-12 22:21:30 +0800 | [diff] [blame] | 99 | #else |
Bernd Schmidt | b97b8a9 | 2008-01-27 18:39:16 +0800 | [diff] [blame] | 100 | #ifdef CONFIG_MPU |
| 101 | #define _ex_dviol _ex_dcplb_viol |
| 102 | #else |
Robin Getz | f26fbc4 | 2007-11-12 22:21:30 +0800 | [diff] [blame] | 103 | #define _ex_dviol _ex_trap_c |
Bernd Schmidt | b97b8a9 | 2008-01-27 18:39:16 +0800 | [diff] [blame] | 104 | #endif |
Robin Getz | f26fbc4 | 2007-11-12 22:21:30 +0800 | [diff] [blame] | 105 | #define _ex_dmiss _ex_dcplb_miss |
| 106 | #define _ex_dmult _ex_trap_c |
| 107 | #endif |
| 108 | |
Bernd Schmidt | b97b8a9 | 2008-01-27 18:39:16 +0800 | [diff] [blame] | 109 | |
| 110 | ENTRY(_ex_dcplb_viol) |
Robin Getz | f26fbc4 | 2007-11-12 22:21:30 +0800 | [diff] [blame] | 111 | ENTRY(_ex_dcplb_miss) |
| 112 | ENTRY(_ex_icplb_miss) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 113 | (R7:6,P5:4) = [sp++]; |
Bernd Schmidt | dbdf20d | 2009-01-07 23:14:38 +0800 | [diff] [blame] | 114 | /* We leave the previously pushed ASTAT on the stack. */ |
| 115 | SAVE_CONTEXT_CPLB |
| 116 | |
Bernd Schmidt | 2a0c4fd | 2008-04-23 07:17:34 +0800 | [diff] [blame] | 117 | /* We must load R1 here, _before_ DEBUG_HWTRACE_SAVE, since that |
| 118 | * will change the stack pointer. */ |
Bernd Schmidt | b97b8a9 | 2008-01-27 18:39:16 +0800 | [diff] [blame] | 119 | R0 = SEQSTAT; |
| 120 | R1 = SP; |
Bernd Schmidt | dbdf20d | 2009-01-07 23:14:38 +0800 | [diff] [blame] | 121 | |
Bernd Schmidt | 2a0c4fd | 2008-04-23 07:17:34 +0800 | [diff] [blame] | 122 | DEBUG_HWTRACE_SAVE(p5, r7) |
Bernd Schmidt | dbdf20d | 2009-01-07 23:14:38 +0800 | [diff] [blame] | 123 | |
Bernd Schmidt | b97b8a9 | 2008-01-27 18:39:16 +0800 | [diff] [blame] | 124 | sp += -12; |
| 125 | call _cplb_hdr; |
| 126 | sp += 12; |
| 127 | CC = R0 == 0; |
| 128 | IF !CC JUMP _handle_bad_cplb; |
Robin Getz | 0c7a6b2 | 2008-10-08 16:27:12 +0800 | [diff] [blame] | 129 | |
| 130 | #ifdef CONFIG_DEBUG_DOUBLEFAULT |
| 131 | /* While we were processing this, did we double fault? */ |
| 132 | r7 = SEQSTAT; /* reason code is in bit 5:0 */ |
| 133 | r6.l = lo(SEQSTAT_EXCAUSE); |
| 134 | r6.h = hi(SEQSTAT_EXCAUSE); |
| 135 | r7 = r7 & r6; |
| 136 | r6 = 0x25; |
| 137 | CC = R7 == R6; |
| 138 | if CC JUMP _double_fault; |
| 139 | #endif |
| 140 | |
Mike Frysinger | 80f31c8 | 2008-02-02 15:47:24 +0800 | [diff] [blame] | 141 | DEBUG_HWTRACE_RESTORE(p5, r7) |
Bernd Schmidt | dbdf20d | 2009-01-07 23:14:38 +0800 | [diff] [blame] | 142 | RESTORE_CONTEXT_CPLB |
| 143 | ASTAT = [SP++]; |
Mike Frysinger | f0b5d12 | 2007-08-05 17:03:59 +0800 | [diff] [blame] | 144 | SP = EX_SCRATCH_REG; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 145 | rtx; |
Robin Getz | f26fbc4 | 2007-11-12 22:21:30 +0800 | [diff] [blame] | 146 | ENDPROC(_ex_icplb_miss) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 147 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 148 | ENTRY(_ex_syscall) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 149 | raise 15; /* invoked by TRAP #0, for sys call */ |
Robin Getz | 0c7a6b2 | 2008-10-08 16:27:12 +0800 | [diff] [blame] | 150 | jump.s _bfin_return_from_exception; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 151 | ENDPROC(_ex_syscall) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 152 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 153 | ENTRY(_ex_single_step) |
Bernd Schmidt | 0893f12 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 154 | /* If we just returned from an interrupt, the single step event is |
| 155 | for the RTI instruction. */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 156 | r7 = retx; |
| 157 | r6 = reti; |
| 158 | cc = r7 == r6; |
Bernd Schmidt | 0893f12 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 159 | if cc jump _bfin_return_from_exception; |
| 160 | |
Jie Zhang | 5400c5a | 2008-08-05 17:33:38 +0800 | [diff] [blame] | 161 | #ifdef CONFIG_KGDB |
Sonic Zhang | 0d1cdd7 | 2008-07-26 18:54:38 +0800 | [diff] [blame] | 162 | /* Don't do single step in hardware exception handler */ |
| 163 | p5.l = lo(IPEND); |
| 164 | p5.h = hi(IPEND); |
| 165 | r6 = [p5]; |
Sonic Zhang | d6a2989 | 2008-08-05 18:28:26 +0800 | [diff] [blame] | 166 | cc = bittst(r6, 4); |
| 167 | if cc jump _bfin_return_from_exception; |
Sonic Zhang | 0d1cdd7 | 2008-07-26 18:54:38 +0800 | [diff] [blame] | 168 | cc = bittst(r6, 5); |
| 169 | if cc jump _bfin_return_from_exception; |
| 170 | |
Sonic Zhang | 0d1cdd7 | 2008-07-26 18:54:38 +0800 | [diff] [blame] | 171 | /* skip single step if current interrupt priority is higher than |
| 172 | * that of the first instruction, from which gdb starts single step */ |
| 173 | r6 >>= 6; |
| 174 | r7 = 10; |
| 175 | .Lfind_priority_start: |
| 176 | cc = bittst(r6, 0); |
| 177 | if cc jump .Lfind_priority_done; |
| 178 | r6 >>= 1; |
| 179 | r7 += -1; |
| 180 | cc = r7 == 0; |
| 181 | if cc jump .Lfind_priority_done; |
| 182 | jump.s .Lfind_priority_start; |
| 183 | .Lfind_priority_done: |
Sonic Zhang | a5ac012 | 2008-10-13 14:07:19 +0800 | [diff] [blame] | 184 | p4.l = _kgdb_single_step; |
| 185 | p4.h = _kgdb_single_step; |
Sonic Zhang | 0d1cdd7 | 2008-07-26 18:54:38 +0800 | [diff] [blame] | 186 | r6 = [p4]; |
| 187 | cc = r6 == 0; |
| 188 | if cc jump .Ldo_single_step; |
| 189 | r6 += -1; |
| 190 | cc = r6 < r7; |
Sonic Zhang | d6a2989 | 2008-08-05 18:28:26 +0800 | [diff] [blame] | 191 | if cc jump 1f; |
Sonic Zhang | 0d1cdd7 | 2008-07-26 18:54:38 +0800 | [diff] [blame] | 192 | .Ldo_single_step: |
Sonic Zhang | d6a2989 | 2008-08-05 18:28:26 +0800 | [diff] [blame] | 193 | #else |
Bernd Schmidt | 0893f12 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 194 | /* If we were in user mode, do the single step normally. */ |
Jie Zhang | 5400c5a | 2008-08-05 17:33:38 +0800 | [diff] [blame] | 195 | p5.l = lo(IPEND); |
| 196 | p5.h = hi(IPEND); |
Bernd Schmidt | 0893f12 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 197 | r6 = [p5]; |
| 198 | r7 = 0xffe0 (z); |
| 199 | r7 = r7 & r6; |
| 200 | cc = r7 == 0; |
Jie Zhang | 5400c5a | 2008-08-05 17:33:38 +0800 | [diff] [blame] | 201 | if !cc jump 1f; |
Sonic Zhang | d6a2989 | 2008-08-05 18:28:26 +0800 | [diff] [blame] | 202 | #endif |
Robin Getz | b9a3899 | 2009-05-18 18:33:26 +0000 | [diff] [blame^] | 203 | #ifdef CONFIG_EXACT_HWERR |
| 204 | /* Read the ILAT, and to check to see if the process we are |
| 205 | * single stepping caused a previous hardware error |
| 206 | * If so, do not single step, (which lowers to IRQ5, and makes |
| 207 | * us miss the error). |
| 208 | */ |
| 209 | p5.l = lo(ILAT); |
| 210 | p5.h = hi(ILAT); |
| 211 | r7 = [p5]; |
| 212 | cc = bittst(r7, EVT_IVHW_P); |
| 213 | if cc jump 1f; |
| 214 | #endif |
Jie Zhang | 5400c5a | 2008-08-05 17:33:38 +0800 | [diff] [blame] | 215 | /* Single stepping only a single instruction, so clear the trace |
| 216 | * bit here. */ |
| 217 | r7 = syscfg; |
| 218 | bitclr (r7, 0); |
| 219 | syscfg = R7; |
| 220 | jump _ex_trap_c; |
| 221 | |
| 222 | 1: |
Bernd Schmidt | 0893f12 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 223 | /* |
| 224 | * We were in an interrupt handler. By convention, all of them save |
| 225 | * SYSCFG with their first instruction, so by checking whether our |
| 226 | * RETX points at the entry point, we can determine whether to allow |
| 227 | * a single step, or whether to clear SYSCFG. |
| 228 | * |
| 229 | * First, find out the interrupt level and the event vector for it. |
| 230 | */ |
| 231 | p5.l = lo(EVT0); |
| 232 | p5.h = hi(EVT0); |
| 233 | p5 += -4; |
| 234 | 2: |
| 235 | r7 = rot r7 by -1; |
| 236 | p5 += 4; |
| 237 | if !cc jump 2b; |
| 238 | |
| 239 | /* What we actually do is test for the _second_ instruction in the |
| 240 | * IRQ handler. That way, if there are insns following the restore |
| 241 | * of SYSCFG after leaving the handler, we will not turn off SYSCFG |
| 242 | * for them. */ |
| 243 | |
| 244 | r7 = [p5]; |
| 245 | r7 += 2; |
| 246 | r6 = RETX; |
| 247 | cc = R7 == R6; |
| 248 | if !cc jump _bfin_return_from_exception; |
| 249 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 250 | r7 = syscfg; |
| 251 | bitclr (r7, 0); |
| 252 | syscfg = R7; |
| 253 | |
Jie Zhang | 5400c5a | 2008-08-05 17:33:38 +0800 | [diff] [blame] | 254 | /* Fall through to _bfin_return_from_exception. */ |
Mike Frysinger | 46c87c3 | 2007-11-21 16:15:48 +0800 | [diff] [blame] | 255 | ENDPROC(_ex_single_step) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 256 | |
Mike Frysinger | 8d6c242 | 2007-11-21 15:53:49 +0800 | [diff] [blame] | 257 | ENTRY(_bfin_return_from_exception) |
Mike Frysinger | 1aafd90 | 2007-07-25 11:19:14 +0800 | [diff] [blame] | 258 | #if ANOMALY_05000257 |
Michael Hennerich | 8af10b7 | 2007-05-21 18:09:09 +0800 | [diff] [blame] | 259 | R7=LC0; |
| 260 | LC0=R7; |
| 261 | R7=LC1; |
| 262 | LC1=R7; |
| 263 | #endif |
Robin Getz | 0c7a6b2 | 2008-10-08 16:27:12 +0800 | [diff] [blame] | 264 | |
| 265 | #ifdef CONFIG_DEBUG_DOUBLEFAULT |
| 266 | /* While we were processing the current exception, |
| 267 | * did we cause another, and double fault? |
| 268 | */ |
| 269 | r7 = SEQSTAT; /* reason code is in bit 5:0 */ |
| 270 | r6.l = lo(SEQSTAT_EXCAUSE); |
| 271 | r6.h = hi(SEQSTAT_EXCAUSE); |
| 272 | r7 = r7 & r6; |
| 273 | r6 = 0x25; |
| 274 | CC = R7 == R6; |
| 275 | if CC JUMP _double_fault; |
Robin Getz | 0c7a6b2 | 2008-10-08 16:27:12 +0800 | [diff] [blame] | 276 | #endif |
| 277 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 278 | (R7:6,P5:4) = [sp++]; |
| 279 | ASTAT = [sp++]; |
Mike Frysinger | f0b5d12 | 2007-08-05 17:03:59 +0800 | [diff] [blame] | 280 | sp = EX_SCRATCH_REG; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 281 | rtx; |
Mike Frysinger | 46c87c3 | 2007-11-21 16:15:48 +0800 | [diff] [blame] | 282 | ENDPROC(_bfin_return_from_exception) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 283 | |
| 284 | ENTRY(_handle_bad_cplb) |
Bernd Schmidt | 2a0c4fd | 2008-04-23 07:17:34 +0800 | [diff] [blame] | 285 | DEBUG_HWTRACE_RESTORE(p5, r7) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 286 | /* To get here, we just tried and failed to change a CPLB |
| 287 | * so, handle things in trap_c (C code), by lowering to |
| 288 | * IRQ5, just like we normally do. Since this is not a |
| 289 | * "normal" return path, we have a do alot of stuff to |
| 290 | * the stack to get ready so, we can fall through - we |
| 291 | * need to make a CPLB exception look like a normal exception |
| 292 | */ |
Bernd Schmidt | dbdf20d | 2009-01-07 23:14:38 +0800 | [diff] [blame] | 293 | RESTORE_CONTEXT_CPLB |
| 294 | /* ASTAT is still on the stack, where it is needed. */ |
Mike Frysinger | 80f31c8 | 2008-02-02 15:47:24 +0800 | [diff] [blame] | 295 | [--sp] = (R7:6,P5:4); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 296 | |
Mike Frysinger | 1ffe664 | 2007-08-05 17:14:04 +0800 | [diff] [blame] | 297 | ENTRY(_ex_replaceable) |
| 298 | nop; |
| 299 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 300 | ENTRY(_ex_trap_c) |
Robin Getz | 2ebcade | 2007-10-09 17:24:30 +0800 | [diff] [blame] | 301 | /* Make sure we are not in a double fault */ |
| 302 | p4.l = lo(IPEND); |
| 303 | p4.h = hi(IPEND); |
| 304 | r7 = [p4]; |
| 305 | CC = BITTST (r7, 5); |
| 306 | if CC jump _double_fault; |
| 307 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 308 | /* Call C code (trap_c) to handle the exception, which most |
| 309 | * likely involves sending a signal to the current process. |
| 310 | * To avoid double faults, lower our priority to IRQ5 first. |
| 311 | */ |
| 312 | P5.h = _exception_to_level5; |
| 313 | P5.l = _exception_to_level5; |
| 314 | p4.l = lo(EVT5); |
| 315 | p4.h = hi(EVT5); |
| 316 | [p4] = p5; |
| 317 | csync; |
| 318 | |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 319 | GET_PDA(p5, r6); |
Robin Getz | 0c7a6b2 | 2008-10-08 16:27:12 +0800 | [diff] [blame] | 320 | #ifndef CONFIG_DEBUG_DOUBLEFAULT |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 321 | |
Robin Getz | 0c7a6b2 | 2008-10-08 16:27:12 +0800 | [diff] [blame] | 322 | /* |
| 323 | * Save these registers, as they are only valid in exception context |
| 324 | * (where we are now - as soon as we defer to IRQ5, they can change) |
| 325 | * DCPLB_STATUS and ICPLB_STATUS are also only valid in EVT3, |
| 326 | * but they are not very interesting, so don't save them |
| 327 | */ |
| 328 | |
Bernd Schmidt | 5d750b9 | 2008-04-25 05:02:33 +0800 | [diff] [blame] | 329 | p4.l = lo(DCPLB_FAULT_ADDR); |
| 330 | p4.h = hi(DCPLB_FAULT_ADDR); |
| 331 | r7 = [p4]; |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 332 | [p5 + PDA_DCPLB] = r7; |
Bernd Schmidt | 5d750b9 | 2008-04-25 05:02:33 +0800 | [diff] [blame] | 333 | |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 334 | p4.l = lo(ICPLB_FAULT_ADDR); |
| 335 | p4.h = hi(ICPLB_FAULT_ADDR); |
| 336 | r6 = [p4]; |
| 337 | [p5 + PDA_ICPLB] = r6; |
Bernd Schmidt | 5d750b9 | 2008-04-25 05:02:33 +0800 | [diff] [blame] | 338 | |
Bernd Schmidt | 5d750b9 | 2008-04-25 05:02:33 +0800 | [diff] [blame] | 339 | r6 = retx; |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 340 | [p5 + PDA_RETX] = r6; |
Robin Getz | 0c7a6b2 | 2008-10-08 16:27:12 +0800 | [diff] [blame] | 341 | #endif |
Bernd Schmidt | 0893f12 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 342 | r6 = SYSCFG; |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 343 | [p5 + PDA_SYSCFG] = r6; |
Bernd Schmidt | 0893f12 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 344 | BITCLR(r6, 0); |
| 345 | SYSCFG = r6; |
Bernd Schmidt | 5d750b9 | 2008-04-25 05:02:33 +0800 | [diff] [blame] | 346 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 347 | /* Disable all interrupts, but make sure level 5 is enabled so |
| 348 | * we can switch to that level. Save the old mask. */ |
| 349 | cli r6; |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 350 | [p5 + PDA_EXIMASK] = r6; |
Bernd Schmidt | 0893f12 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 351 | |
| 352 | p4.l = lo(SAFE_USER_INSTRUCTION); |
| 353 | p4.h = hi(SAFE_USER_INSTRUCTION); |
| 354 | retx = p4; |
| 355 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 356 | r6 = 0x3f; |
| 357 | sti r6; |
| 358 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 359 | raise 5; |
Robin Getz | 0c7a6b2 | 2008-10-08 16:27:12 +0800 | [diff] [blame] | 360 | jump.s _bfin_return_from_exception; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 361 | ENDPROC(_ex_trap_c) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 362 | |
Robin Getz | 2ebcade | 2007-10-09 17:24:30 +0800 | [diff] [blame] | 363 | /* We just realized we got an exception, while we were processing a different |
Mike Frysinger | 33c8691 | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 364 | * exception. This is a unrecoverable event, so crash. |
| 365 | * Note: this cannot be ENTRY() as we jump here with "if cc jump" ... |
Robin Getz | 2ebcade | 2007-10-09 17:24:30 +0800 | [diff] [blame] | 366 | */ |
Mike Frysinger | 33c8691 | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 367 | _double_fault: |
Robin Getz | 0c7a6b2 | 2008-10-08 16:27:12 +0800 | [diff] [blame] | 368 | /* Turn caches & protection off, to ensure we don't get any more |
| 369 | * double exceptions |
| 370 | */ |
Robin Getz | 2ebcade | 2007-10-09 17:24:30 +0800 | [diff] [blame] | 371 | |
Robin Getz | 0c7a6b2 | 2008-10-08 16:27:12 +0800 | [diff] [blame] | 372 | P4.L = LO(IMEM_CONTROL); |
| 373 | P4.H = HI(IMEM_CONTROL); |
Robin Getz | 2ebcade | 2007-10-09 17:24:30 +0800 | [diff] [blame] | 374 | |
Robin Getz | 0c7a6b2 | 2008-10-08 16:27:12 +0800 | [diff] [blame] | 375 | R5 = [P4]; /* Control Register*/ |
| 376 | BITCLR(R5,ENICPLB_P); |
| 377 | SSYNC; /* SSYNC required before writing to IMEM_CONTROL. */ |
| 378 | .align 8; |
| 379 | [P4] = R5; |
| 380 | SSYNC; |
Robin Getz | 2ebcade | 2007-10-09 17:24:30 +0800 | [diff] [blame] | 381 | |
Robin Getz | 0c7a6b2 | 2008-10-08 16:27:12 +0800 | [diff] [blame] | 382 | P4.L = LO(DMEM_CONTROL); |
| 383 | P4.H = HI(DMEM_CONTROL); |
| 384 | R5 = [P4]; |
| 385 | BITCLR(R5,ENDCPLB_P); |
| 386 | SSYNC; /* SSYNC required before writing to DMEM_CONTROL. */ |
| 387 | .align 8; |
| 388 | [P4] = R5; |
| 389 | SSYNC; |
Robin Getz | 2ebcade | 2007-10-09 17:24:30 +0800 | [diff] [blame] | 390 | |
Robin Getz | 0c7a6b2 | 2008-10-08 16:27:12 +0800 | [diff] [blame] | 391 | /* Fix up the stack */ |
| 392 | (R7:6,P5:4) = [sp++]; |
| 393 | ASTAT = [sp++]; |
| 394 | SP = EX_SCRATCH_REG; |
Robin Getz | 2ebcade | 2007-10-09 17:24:30 +0800 | [diff] [blame] | 395 | |
Robin Getz | 0c7a6b2 | 2008-10-08 16:27:12 +0800 | [diff] [blame] | 396 | /* We should be out of the exception stack, and back down into |
| 397 | * kernel or user space stack |
| 398 | */ |
| 399 | SAVE_ALL_SYS |
Robin Getz | 2ebcade | 2007-10-09 17:24:30 +0800 | [diff] [blame] | 400 | |
Bernd Schmidt | ddb3f00 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 401 | /* The dumping functions expect the return address in the RETI |
| 402 | * slot. */ |
| 403 | r6 = retx; |
| 404 | [sp + PT_PC] = r6; |
| 405 | |
Robin Getz | 0c7a6b2 | 2008-10-08 16:27:12 +0800 | [diff] [blame] | 406 | r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */ |
| 407 | SP += -12; |
| 408 | call _double_fault_c; |
| 409 | SP += 12; |
Robin Getz | 2ebcade | 2007-10-09 17:24:30 +0800 | [diff] [blame] | 410 | .L_double_fault_panic: |
| 411 | JUMP .L_double_fault_panic |
| 412 | |
| 413 | ENDPROC(_double_fault) |
| 414 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 415 | ENTRY(_exception_to_level5) |
| 416 | SAVE_ALL_SYS |
| 417 | |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 418 | GET_PDA(p4, r7); /* Fetch current PDA */ |
| 419 | r6 = [p4 + PDA_RETX]; |
Bernd Schmidt | 5d750b9 | 2008-04-25 05:02:33 +0800 | [diff] [blame] | 420 | [sp + PT_PC] = r6; |
| 421 | |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 422 | r6 = [p4 + PDA_SYSCFG]; |
Bernd Schmidt | 0893f12 | 2008-05-07 11:41:26 +0800 | [diff] [blame] | 423 | [sp + PT_SYSCFG] = r6; |
| 424 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 425 | /* Restore interrupt mask. We haven't pushed RETI, so this |
| 426 | * doesn't enable interrupts until we return from this handler. */ |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 427 | r6 = [p4 + PDA_EXIMASK]; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 428 | sti r6; |
| 429 | |
| 430 | /* Restore the hardware error vector. */ |
| 431 | P5.h = _evt_ivhw; |
| 432 | P5.l = _evt_ivhw; |
| 433 | p4.l = lo(EVT5); |
| 434 | p4.h = hi(EVT5); |
| 435 | [p4] = p5; |
| 436 | csync; |
| 437 | |
| 438 | p2.l = lo(IPEND); |
| 439 | p2.h = hi(IPEND); |
| 440 | csync; |
| 441 | r0 = [p2]; /* Read current IPEND */ |
| 442 | [sp + PT_IPEND] = r0; /* Store IPEND */ |
| 443 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 444 | r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */ |
| 445 | SP += -12; |
| 446 | call _trap_c; |
| 447 | SP += 12; |
| 448 | |
Robin Getz | 0c7a6b2 | 2008-10-08 16:27:12 +0800 | [diff] [blame] | 449 | #ifdef CONFIG_DEBUG_DOUBLEFAULT |
| 450 | /* Grab ILAT */ |
| 451 | p2.l = lo(ILAT); |
| 452 | p2.h = hi(ILAT); |
| 453 | r0 = [p2]; |
| 454 | r1 = 0x20; /* Did I just cause anther HW error? */ |
| 455 | r0 = r0 & r1; |
| 456 | CC = R0 == R1; |
| 457 | if CC JUMP _double_fault; |
| 458 | #endif |
| 459 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 460 | call _ret_from_exception; |
| 461 | RESTORE_ALL_SYS |
| 462 | rti; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 463 | ENDPROC(_exception_to_level5) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 464 | |
| 465 | ENTRY(_trap) /* Exception: 4th entry into system event table(supervisor mode)*/ |
| 466 | /* Since the kernel stack can be anywhere, it's not guaranteed to be |
| 467 | * covered by a CPLB. Switch to an exception stack; use RETN as a |
| 468 | * scratch register (for want of a better option). |
| 469 | */ |
Mike Frysinger | f0b5d12 | 2007-08-05 17:03:59 +0800 | [diff] [blame] | 470 | EX_SCRATCH_REG = sp; |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 471 | GET_PDA_SAFE(sp); |
| 472 | sp = [sp + PDA_EXSTACK] |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 473 | /* Try to deal with syscalls quickly. */ |
| 474 | [--sp] = ASTAT; |
Mike Frysinger | 80f31c8 | 2008-02-02 15:47:24 +0800 | [diff] [blame] | 475 | [--sp] = (R7:6,P5:4); |
Robin Getz | 0c7a6b2 | 2008-10-08 16:27:12 +0800 | [diff] [blame] | 476 | |
Robin Getz | b9a3899 | 2009-05-18 18:33:26 +0000 | [diff] [blame^] | 477 | #ifdef CONFIG_EXACT_HWERR |
| 478 | /* Make sure all pending read/writes complete. This will ensure any |
| 479 | * accesses which could cause hardware errors completes, and signal |
| 480 | * the the hardware before we do something silly, like crash the |
| 481 | * kernel. We don't need to work around anomaly 05000312, since |
| 482 | * we are already atomic |
| 483 | */ |
| 484 | ssync; |
| 485 | #endif |
| 486 | |
Michael Hennerich | 5e9e768 | 2008-10-09 12:31:03 +0800 | [diff] [blame] | 487 | #if ANOMALY_05000283 || ANOMALY_05000315 |
| 488 | cc = r7 == r7; |
| 489 | p5.h = HI(CHIPID); |
| 490 | p5.l = LO(CHIPID); |
| 491 | if cc jump 1f; |
| 492 | r7.l = W[p5]; |
| 493 | 1: |
| 494 | #endif |
| 495 | |
Robin Getz | 0c7a6b2 | 2008-10-08 16:27:12 +0800 | [diff] [blame] | 496 | #ifdef CONFIG_DEBUG_DOUBLEFAULT |
| 497 | /* |
| 498 | * Save these registers, as they are only valid in exception context |
| 499 | * (where we are now - as soon as we defer to IRQ5, they can change) |
| 500 | * DCPLB_STATUS and ICPLB_STATUS are also only valid in EVT3, |
| 501 | * but they are not very interesting, so don't save them |
| 502 | */ |
| 503 | |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 504 | GET_PDA(p5, r7); |
Robin Getz | 0c7a6b2 | 2008-10-08 16:27:12 +0800 | [diff] [blame] | 505 | p4.l = lo(DCPLB_FAULT_ADDR); |
| 506 | p4.h = hi(DCPLB_FAULT_ADDR); |
| 507 | r7 = [p4]; |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 508 | [p5 + PDA_DCPLB] = r7; |
Robin Getz | 0c7a6b2 | 2008-10-08 16:27:12 +0800 | [diff] [blame] | 509 | |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 510 | p4.l = lo(ICPLB_FAULT_ADDR); |
| 511 | p4.h = hi(ICPLB_FAULT_ADDR); |
| 512 | r7 = [p4]; |
| 513 | [p5 + PDA_ICPLB] = r7; |
Robin Getz | 0c7a6b2 | 2008-10-08 16:27:12 +0800 | [diff] [blame] | 514 | |
Robin Getz | 0c7a6b2 | 2008-10-08 16:27:12 +0800 | [diff] [blame] | 515 | r6 = retx; |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 516 | [p5 + PDA_RETX] = r6; |
Robin Getz | 0c7a6b2 | 2008-10-08 16:27:12 +0800 | [diff] [blame] | 517 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 518 | r7 = SEQSTAT; /* reason code is in bit 5:0 */ |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 519 | [p5 + PDA_SEQSTAT] = r7; |
Robin Getz | 0c7a6b2 | 2008-10-08 16:27:12 +0800 | [diff] [blame] | 520 | #else |
| 521 | r7 = SEQSTAT; /* reason code is in bit 5:0 */ |
| 522 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 523 | r6.l = lo(SEQSTAT_EXCAUSE); |
| 524 | r6.h = hi(SEQSTAT_EXCAUSE); |
| 525 | r7 = r7 & r6; |
Mike Frysinger | 1ffe664 | 2007-08-05 17:14:04 +0800 | [diff] [blame] | 526 | p5.h = _ex_table; |
| 527 | p5.l = _ex_table; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 528 | p4 = r7; |
| 529 | p5 = p5 + (p4 << 2); |
| 530 | p4 = [p5]; |
| 531 | jump (p4); |
| 532 | |
| 533 | .Lbadsys: |
| 534 | r7 = -ENOSYS; /* signextending enough */ |
| 535 | [sp + PT_R0] = r7; /* return value from system call */ |
| 536 | jump .Lsyscall_really_exit; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 537 | ENDPROC(_trap) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 538 | |
| 539 | ENTRY(_kernel_execve) |
| 540 | link SIZEOF_PTREGS; |
| 541 | p0 = sp; |
| 542 | r3 = SIZEOF_PTREGS / 4; |
| 543 | r4 = 0(x); |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 544 | .Lclear_regs: |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 545 | [p0++] = r4; |
| 546 | r3 += -1; |
| 547 | cc = r3 == 0; |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 548 | if !cc jump .Lclear_regs (bp); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 549 | |
| 550 | p0 = sp; |
| 551 | sp += -16; |
| 552 | [sp + 12] = p0; |
| 553 | call _do_execve; |
| 554 | SP += 16; |
| 555 | cc = r0 == 0; |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 556 | if ! cc jump .Lexecve_failed; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 557 | /* Success. Copy our temporary pt_regs to the top of the kernel |
| 558 | * stack and do a normal exception return. |
| 559 | */ |
| 560 | r1 = sp; |
| 561 | r0 = (-KERNEL_STACK_SIZE) (x); |
| 562 | r1 = r1 & r0; |
| 563 | p2 = r1; |
| 564 | p3 = [p2]; |
| 565 | r0 = KERNEL_STACK_SIZE - 4 (z); |
| 566 | p1 = r0; |
| 567 | p1 = p1 + p2; |
| 568 | |
| 569 | p0 = fp; |
| 570 | r4 = [p0--]; |
| 571 | r3 = SIZEOF_PTREGS / 4; |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 572 | .Lcopy_regs: |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 573 | r4 = [p0--]; |
| 574 | [p1--] = r4; |
| 575 | r3 += -1; |
| 576 | cc = r3 == 0; |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 577 | if ! cc jump .Lcopy_regs (bp); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 578 | |
| 579 | r0 = (KERNEL_STACK_SIZE - SIZEOF_PTREGS) (z); |
| 580 | p1 = r0; |
| 581 | p1 = p1 + p2; |
| 582 | sp = p1; |
| 583 | r0 = syscfg; |
| 584 | [SP + PT_SYSCFG] = r0; |
| 585 | [p3 + (TASK_THREAD + THREAD_KSP)] = sp; |
| 586 | |
| 587 | RESTORE_CONTEXT; |
| 588 | rti; |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 589 | .Lexecve_failed: |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 590 | unlink; |
| 591 | rts; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 592 | ENDPROC(_kernel_execve) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 593 | |
| 594 | ENTRY(_system_call) |
| 595 | /* Store IPEND */ |
| 596 | p2.l = lo(IPEND); |
| 597 | p2.h = hi(IPEND); |
| 598 | csync; |
| 599 | r0 = [p2]; |
| 600 | [sp + PT_IPEND] = r0; |
| 601 | |
| 602 | /* Store RETS for now */ |
| 603 | r0 = rets; |
| 604 | [sp + PT_RESERVED] = r0; |
| 605 | /* Set the stack for the current process */ |
| 606 | r7 = sp; |
| 607 | r6.l = lo(ALIGN_PAGE_MASK); |
| 608 | r6.h = hi(ALIGN_PAGE_MASK); |
| 609 | r7 = r7 & r6; /* thread_info */ |
| 610 | p2 = r7; |
| 611 | p2 = [p2]; |
| 612 | |
| 613 | [p2+(TASK_THREAD+THREAD_KSP)] = sp; |
Philippe Gerum | 9bd50df | 2009-03-04 16:52:38 +0800 | [diff] [blame] | 614 | #ifdef CONFIG_IPIPE |
| 615 | r0 = sp; |
| 616 | SP += -12; |
| 617 | call ___ipipe_syscall_root; |
| 618 | SP += 12; |
| 619 | cc = r0 == 1; |
| 620 | if cc jump .Lsyscall_really_exit; |
| 621 | cc = r0 == -1; |
| 622 | if cc jump .Lresume_userspace; |
| 623 | r3 = [sp + PT_R3]; |
| 624 | r4 = [sp + PT_R4]; |
| 625 | p0 = [sp + PT_ORIG_P0]; |
| 626 | #endif /* CONFIG_IPIPE */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 627 | |
| 628 | /* Check the System Call */ |
| 629 | r7 = __NR_syscall; |
| 630 | /* System call number is passed in P0 */ |
| 631 | r6 = p0; |
| 632 | cc = r6 < r7; |
| 633 | if ! cc jump .Lbadsys; |
| 634 | |
| 635 | /* are we tracing syscalls?*/ |
| 636 | r7 = sp; |
| 637 | r6.l = lo(ALIGN_PAGE_MASK); |
| 638 | r6.h = hi(ALIGN_PAGE_MASK); |
| 639 | r7 = r7 & r6; |
| 640 | p2 = r7; |
| 641 | r7 = [p2+TI_FLAGS]; |
| 642 | CC = BITTST(r7,TIF_SYSCALL_TRACE); |
| 643 | if CC JUMP _sys_trace; |
| 644 | |
| 645 | /* Execute the appropriate system call */ |
| 646 | |
| 647 | p4 = p0; |
| 648 | p5.l = _sys_call_table; |
| 649 | p5.h = _sys_call_table; |
| 650 | p5 = p5 + (p4 << 2); |
| 651 | r0 = [sp + PT_R0]; |
| 652 | r1 = [sp + PT_R1]; |
| 653 | r2 = [sp + PT_R2]; |
| 654 | p5 = [p5]; |
| 655 | |
| 656 | [--sp] = r5; |
| 657 | [--sp] = r4; |
| 658 | [--sp] = r3; |
| 659 | SP += -12; |
| 660 | call (p5); |
| 661 | SP += 24; |
| 662 | [sp + PT_R0] = r0; |
| 663 | |
| 664 | .Lresume_userspace: |
| 665 | r7 = sp; |
| 666 | r4.l = lo(ALIGN_PAGE_MASK); |
| 667 | r4.h = hi(ALIGN_PAGE_MASK); |
| 668 | r7 = r7 & r4; /* thread_info->flags */ |
| 669 | p5 = r7; |
| 670 | .Lresume_userspace_1: |
| 671 | /* Disable interrupts. */ |
| 672 | [--sp] = reti; |
| 673 | reti = [sp++]; |
| 674 | |
| 675 | r7 = [p5 + TI_FLAGS]; |
| 676 | r4.l = lo(_TIF_WORK_MASK); |
| 677 | r4.h = hi(_TIF_WORK_MASK); |
| 678 | r7 = r7 & r4; |
| 679 | |
| 680 | .Lsyscall_resched: |
Philippe Gerum | 9bd50df | 2009-03-04 16:52:38 +0800 | [diff] [blame] | 681 | #ifdef CONFIG_IPIPE |
| 682 | cc = BITTST(r7, TIF_IRQ_SYNC); |
| 683 | if !cc jump .Lsyscall_no_irqsync; |
| 684 | [--sp] = reti; |
| 685 | r0 = [sp++]; |
| 686 | SP += -12; |
| 687 | call ___ipipe_sync_root; |
| 688 | SP += 12; |
| 689 | jump .Lresume_userspace_1; |
| 690 | .Lsyscall_no_irqsync: |
| 691 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 692 | cc = BITTST(r7, TIF_NEED_RESCHED); |
| 693 | if !cc jump .Lsyscall_sigpending; |
| 694 | |
| 695 | /* Reenable interrupts. */ |
| 696 | [--sp] = reti; |
| 697 | r0 = [sp++]; |
| 698 | |
| 699 | SP += -12; |
| 700 | call _schedule; |
| 701 | SP += 12; |
| 702 | |
| 703 | jump .Lresume_userspace_1; |
| 704 | |
| 705 | .Lsyscall_sigpending: |
| 706 | cc = BITTST(r7, TIF_RESTORE_SIGMASK); |
| 707 | if cc jump .Lsyscall_do_signals; |
| 708 | cc = BITTST(r7, TIF_SIGPENDING); |
| 709 | if !cc jump .Lsyscall_really_exit; |
| 710 | .Lsyscall_do_signals: |
| 711 | /* Reenable interrupts. */ |
| 712 | [--sp] = reti; |
| 713 | r0 = [sp++]; |
| 714 | |
| 715 | r0 = sp; |
| 716 | SP += -12; |
| 717 | call _do_signal; |
| 718 | SP += 12; |
| 719 | |
| 720 | .Lsyscall_really_exit: |
| 721 | r5 = [sp + PT_RESERVED]; |
| 722 | rets = r5; |
Philippe Gerum | 9bd50df | 2009-03-04 16:52:38 +0800 | [diff] [blame] | 723 | #ifdef CONFIG_IPIPE |
| 724 | [--sp] = reti; |
| 725 | r5 = [sp++]; |
| 726 | #endif /* CONFIG_IPIPE */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 727 | rts; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 728 | ENDPROC(_system_call) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 729 | |
Mike Frysinger | 47664c1 | 2008-10-09 15:32:18 +0800 | [diff] [blame] | 730 | /* Do not mark as ENTRY() to avoid error in assembler ... |
| 731 | * this symbol need not be global anyways, so ... |
| 732 | */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 733 | _sys_trace: |
| 734 | call _syscall_trace; |
| 735 | |
| 736 | /* Execute the appropriate system call */ |
| 737 | |
| 738 | p4 = [SP + PT_P0]; |
| 739 | p5.l = _sys_call_table; |
| 740 | p5.h = _sys_call_table; |
| 741 | p5 = p5 + (p4 << 2); |
| 742 | r0 = [sp + PT_R0]; |
| 743 | r1 = [sp + PT_R1]; |
| 744 | r2 = [sp + PT_R2]; |
| 745 | r3 = [sp + PT_R3]; |
| 746 | r4 = [sp + PT_R4]; |
| 747 | r5 = [sp + PT_R5]; |
| 748 | p5 = [p5]; |
| 749 | |
| 750 | [--sp] = r5; |
| 751 | [--sp] = r4; |
| 752 | [--sp] = r3; |
| 753 | SP += -12; |
| 754 | call (p5); |
| 755 | SP += 24; |
| 756 | [sp + PT_R0] = r0; |
| 757 | |
| 758 | call _syscall_trace; |
| 759 | jump .Lresume_userspace; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 760 | ENDPROC(_sys_trace) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 761 | |
| 762 | ENTRY(_resume) |
| 763 | /* |
| 764 | * Beware - when entering resume, prev (the current task) is |
| 765 | * in r0, next (the new task) is in r1. |
| 766 | */ |
| 767 | p0 = r0; |
| 768 | p1 = r1; |
| 769 | [--sp] = rets; |
| 770 | [--sp] = fp; |
| 771 | [--sp] = (r7:4, p5:3); |
| 772 | |
| 773 | /* save usp */ |
| 774 | p2 = usp; |
| 775 | [p0+(TASK_THREAD+THREAD_USP)] = p2; |
| 776 | |
| 777 | /* save current kernel stack pointer */ |
| 778 | [p0+(TASK_THREAD+THREAD_KSP)] = sp; |
| 779 | |
| 780 | /* save program counter */ |
| 781 | r1.l = _new_old_task; |
| 782 | r1.h = _new_old_task; |
| 783 | [p0+(TASK_THREAD+THREAD_PC)] = r1; |
| 784 | |
| 785 | /* restore the kernel stack pointer */ |
| 786 | sp = [p1+(TASK_THREAD+THREAD_KSP)]; |
| 787 | |
| 788 | /* restore user stack pointer */ |
| 789 | p0 = [p1+(TASK_THREAD+THREAD_USP)]; |
| 790 | usp = p0; |
| 791 | |
| 792 | /* restore pc */ |
| 793 | p0 = [p1+(TASK_THREAD+THREAD_PC)]; |
| 794 | jump (p0); |
| 795 | |
| 796 | /* |
| 797 | * Following code actually lands up in a new (old) task. |
| 798 | */ |
| 799 | |
| 800 | _new_old_task: |
| 801 | (r7:4, p5:3) = [sp++]; |
| 802 | fp = [sp++]; |
| 803 | rets = [sp++]; |
| 804 | |
| 805 | /* |
| 806 | * When we come out of resume, r0 carries "old" task, becuase we are |
| 807 | * in "new" task. |
| 808 | */ |
| 809 | rts; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 810 | ENDPROC(_resume) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 811 | |
| 812 | ENTRY(_ret_from_exception) |
Philippe Gerum | 9bd50df | 2009-03-04 16:52:38 +0800 | [diff] [blame] | 813 | #ifdef CONFIG_IPIPE |
| 814 | [--sp] = rets; |
| 815 | SP += -12; |
| 816 | call ___ipipe_check_root |
| 817 | SP += 12 |
| 818 | rets = [sp++]; |
| 819 | cc = r0 == 0; |
| 820 | if cc jump 4f; /* not on behalf of Linux, get out */ |
| 821 | #endif /* CONFIG_IPIPE */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 822 | p2.l = lo(IPEND); |
| 823 | p2.h = hi(IPEND); |
| 824 | |
| 825 | csync; |
| 826 | r0 = [p2]; |
| 827 | [sp + PT_IPEND] = r0; |
| 828 | |
| 829 | 1: |
Robin Getz | d5c4b5e | 2007-12-21 17:49:53 +0800 | [diff] [blame] | 830 | r2 = LO(~0x37) (Z); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 831 | r0 = r2 & r0; |
| 832 | cc = r0 == 0; |
| 833 | if !cc jump 4f; /* if not return to user mode, get out */ |
| 834 | |
| 835 | /* Make sure any pending system call or deferred exception |
| 836 | * return in ILAT for this process to get executed, otherwise |
| 837 | * in case context switch happens, system call of |
| 838 | * first process (i.e in ILAT) will be carried |
| 839 | * forward to the switched process |
| 840 | */ |
| 841 | |
| 842 | p2.l = lo(ILAT); |
| 843 | p2.h = hi(ILAT); |
| 844 | r0 = [p2]; |
| 845 | r1 = (EVT_IVG14 | EVT_IVG15) (z); |
| 846 | r0 = r0 & r1; |
| 847 | cc = r0 == 0; |
| 848 | if !cc jump 5f; |
| 849 | |
| 850 | /* Set the stack for the current process */ |
| 851 | r7 = sp; |
| 852 | r4.l = lo(ALIGN_PAGE_MASK); |
| 853 | r4.h = hi(ALIGN_PAGE_MASK); |
| 854 | r7 = r7 & r4; /* thread_info->flags */ |
| 855 | p5 = r7; |
| 856 | r7 = [p5 + TI_FLAGS]; |
| 857 | r4.l = lo(_TIF_WORK_MASK); |
| 858 | r4.h = hi(_TIF_WORK_MASK); |
| 859 | r7 = r7 & r4; |
| 860 | cc = r7 == 0; |
| 861 | if cc jump 4f; |
| 862 | |
| 863 | p0.l = lo(EVT15); |
| 864 | p0.h = hi(EVT15); |
| 865 | p1.l = _schedule_and_signal; |
| 866 | p1.h = _schedule_and_signal; |
| 867 | [p0] = p1; |
| 868 | csync; |
Robin Getz | b9a3899 | 2009-05-18 18:33:26 +0000 | [diff] [blame^] | 869 | raise 15; /* raise evt15 to do signal or reschedule */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 870 | 4: |
| 871 | r0 = syscfg; |
| 872 | bitclr(r0, 0); |
| 873 | syscfg = r0; |
| 874 | 5: |
| 875 | rts; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 876 | ENDPROC(_ret_from_exception) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 877 | |
Philippe Gerum | 9bd50df | 2009-03-04 16:52:38 +0800 | [diff] [blame] | 878 | #ifdef CONFIG_IPIPE |
| 879 | |
| 880 | _sync_root_irqs: |
| 881 | [--sp] = reti; /* Reenable interrupts */ |
| 882 | r0 = [sp++]; |
| 883 | jump.l ___ipipe_sync_root |
| 884 | |
| 885 | _resume_kernel_from_int: |
| 886 | r0.l = _sync_root_irqs |
| 887 | r0.h = _sync_root_irqs |
| 888 | [--sp] = rets; |
| 889 | [--sp] = ( r7:4, p5:3 ); |
| 890 | SP += -12; |
| 891 | call ___ipipe_call_irqtail |
| 892 | SP += 12; |
| 893 | ( r7:4, p5:3 ) = [sp++]; |
| 894 | rets = [sp++]; |
| 895 | rts |
| 896 | #else |
| 897 | #define _resume_kernel_from_int 2f |
| 898 | #endif |
| 899 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 900 | ENTRY(_return_from_int) |
| 901 | /* If someone else already raised IRQ 15, do nothing. */ |
| 902 | csync; |
| 903 | p2.l = lo(ILAT); |
| 904 | p2.h = hi(ILAT); |
| 905 | r0 = [p2]; |
| 906 | cc = bittst (r0, EVT_IVG15_P); |
| 907 | if cc jump 2f; |
| 908 | |
| 909 | /* if not return to user mode, get out */ |
| 910 | p2.l = lo(IPEND); |
| 911 | p2.h = hi(IPEND); |
| 912 | r0 = [p2]; |
| 913 | r1 = 0x17(Z); |
| 914 | r2 = ~r1; |
| 915 | r2.h = 0; |
| 916 | r0 = r2 & r0; |
| 917 | r1 = 1; |
| 918 | r1 = r0 - r1; |
| 919 | r2 = r0 & r1; |
| 920 | cc = r2 == 0; |
Philippe Gerum | 9bd50df | 2009-03-04 16:52:38 +0800 | [diff] [blame] | 921 | if !cc jump _resume_kernel_from_int; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 922 | |
| 923 | /* Lower the interrupt level to 15. */ |
| 924 | p0.l = lo(EVT15); |
| 925 | p0.h = hi(EVT15); |
| 926 | p1.l = _schedule_and_signal_from_int; |
| 927 | p1.h = _schedule_and_signal_from_int; |
| 928 | [p0] = p1; |
| 929 | csync; |
Robin Getz | b9a3899 | 2009-05-18 18:33:26 +0000 | [diff] [blame^] | 930 | #if ANOMALY_05000281 || ANOMALY_05000461 |
Bernd Schmidt | 5d750b9 | 2008-04-25 05:02:33 +0800 | [diff] [blame] | 931 | r0.l = lo(SAFE_USER_INSTRUCTION); |
| 932 | r0.h = hi(SAFE_USER_INSTRUCTION); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 933 | reti = r0; |
| 934 | #endif |
| 935 | r0 = 0x801f (z); |
| 936 | STI r0; |
| 937 | raise 15; /* raise evt15 to do signal or reschedule */ |
| 938 | rti; |
| 939 | 2: |
| 940 | rts; |
Mike Frysinger | 51be24c | 2007-06-11 15:31:30 +0800 | [diff] [blame] | 941 | ENDPROC(_return_from_int) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 942 | |
| 943 | ENTRY(_lower_to_irq14) |
Robin Getz | b9a3899 | 2009-05-18 18:33:26 +0000 | [diff] [blame^] | 944 | #if ANOMALY_05000281 || ANOMALY_05000461 |
Bernd Schmidt | 5d750b9 | 2008-04-25 05:02:33 +0800 | [diff] [blame] | 945 | r0.l = lo(SAFE_USER_INSTRUCTION); |
| 946 | r0.h = hi(SAFE_USER_INSTRUCTION); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 947 | reti = r0; |
| 948 | #endif |
Robin Getz | b9a3899 | 2009-05-18 18:33:26 +0000 | [diff] [blame^] | 949 | |
| 950 | #ifdef CONFIG_DEBUG_HWERR |
| 951 | /* enable irq14 & hwerr interrupt, until we transition to _evt14_softirq */ |
| 952 | r0 = (EVT_IVG14 | EVT_IVHW | EVT_IRPTEN | EVT_EVX | EVT_NMI | EVT_RST | EVT_EMU); |
| 953 | #else |
| 954 | /* Only enable irq14 interrupt, until we transition to _evt14_softirq */ |
| 955 | r0 = (EVT_IVG14 | EVT_IRPTEN | EVT_EVX | EVT_NMI | EVT_RST | EVT_EMU); |
| 956 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 957 | sti r0; |
| 958 | raise 14; |
| 959 | rti; |
Robin Getz | b9a3899 | 2009-05-18 18:33:26 +0000 | [diff] [blame^] | 960 | ENDPROC(_lower_to_irq14) |
| 961 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 962 | ENTRY(_evt14_softirq) |
| 963 | #ifdef CONFIG_DEBUG_HWERR |
Robin Getz | b9a3899 | 2009-05-18 18:33:26 +0000 | [diff] [blame^] | 964 | r0 = (EVT_IVHW | EVT_IRPTEN | EVT_EVX | EVT_NMI | EVT_RST | EVT_EMU); |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 965 | sti r0; |
| 966 | #else |
| 967 | cli r0; |
| 968 | #endif |
| 969 | [--sp] = RETI; |
| 970 | SP += 4; |
| 971 | rts; |
Robin Getz | b9a3899 | 2009-05-18 18:33:26 +0000 | [diff] [blame^] | 972 | ENDPROC(_evt14_softirq) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 973 | |
Robin Getz | b9a3899 | 2009-05-18 18:33:26 +0000 | [diff] [blame^] | 974 | ENTRY(_schedule_and_signal_from_int) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 975 | /* To end up here, vector 15 was changed - so we have to change it |
| 976 | * back. |
| 977 | */ |
| 978 | p0.l = lo(EVT15); |
| 979 | p0.h = hi(EVT15); |
| 980 | p1.l = _evt_system_call; |
| 981 | p1.h = _evt_system_call; |
| 982 | [p0] = p1; |
| 983 | csync; |
Bernd Schmidt | c824498 | 2007-05-21 18:09:33 +0800 | [diff] [blame] | 984 | |
| 985 | /* Set orig_p0 to -1 to indicate this isn't the end of a syscall. */ |
| 986 | r0 = -1 (x); |
| 987 | [sp + PT_ORIG_P0] = r0; |
| 988 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 989 | p1 = rets; |
| 990 | [sp + PT_RESERVED] = p1; |
| 991 | |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 992 | #ifdef CONFIG_SMP |
| 993 | GET_PDA(p0, r0); /* Fetch current PDA (can't migrate to other CPU here) */ |
| 994 | r0 = [p0 + PDA_IRQFLAGS]; |
| 995 | #else |
Mike Frysinger | 4005978 | 2008-11-18 17:48:22 +0800 | [diff] [blame] | 996 | p0.l = _bfin_irq_flags; |
| 997 | p0.h = _bfin_irq_flags; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 998 | r0 = [p0]; |
Graf Yang | 6b3087c | 2009-01-07 23:14:39 +0800 | [diff] [blame] | 999 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1000 | sti r0; |
| 1001 | |
Bernd Schmidt | 7adfb58 | 2007-06-21 11:34:16 +0800 | [diff] [blame] | 1002 | r0 = sp; |
| 1003 | sp += -12; |
| 1004 | call _finish_atomic_sections; |
| 1005 | sp += 12; |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1006 | jump.s .Lresume_userspace; |
Robin Getz | b9a3899 | 2009-05-18 18:33:26 +0000 | [diff] [blame^] | 1007 | ENDPROC(_schedule_and_signal_from_int) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1008 | |
Robin Getz | b9a3899 | 2009-05-18 18:33:26 +0000 | [diff] [blame^] | 1009 | ENTRY(_schedule_and_signal) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1010 | SAVE_CONTEXT_SYSCALL |
| 1011 | /* To end up here, vector 15 was changed - so we have to change it |
| 1012 | * back. |
| 1013 | */ |
| 1014 | p0.l = lo(EVT15); |
| 1015 | p0.h = hi(EVT15); |
| 1016 | p1.l = _evt_system_call; |
| 1017 | p1.h = _evt_system_call; |
| 1018 | [p0] = p1; |
| 1019 | csync; |
| 1020 | p0.l = 1f; |
| 1021 | p0.h = 1f; |
| 1022 | [sp + PT_RESERVED] = P0; |
| 1023 | call .Lresume_userspace; |
| 1024 | 1: |
| 1025 | RESTORE_CONTEXT |
| 1026 | rti; |
Robin Getz | b9a3899 | 2009-05-18 18:33:26 +0000 | [diff] [blame^] | 1027 | ENDPROC(_schedule_and_signal) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1028 | |
Robin Getz | 518039b | 2007-07-25 11:03:28 +0800 | [diff] [blame] | 1029 | /* We handle this 100% in exception space - to reduce overhead |
| 1030 | * Only potiential problem is if the software buffer gets swapped out of the |
| 1031 | * CPLB table - then double fault. - so we don't let this happen in other places |
| 1032 | */ |
| 1033 | #ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND |
| 1034 | ENTRY(_ex_trace_buff_full) |
| 1035 | [--sp] = P3; |
| 1036 | [--sp] = P2; |
| 1037 | [--sp] = LC0; |
| 1038 | [--sp] = LT0; |
| 1039 | [--sp] = LB0; |
| 1040 | P5.L = _trace_buff_offset; |
| 1041 | P5.H = _trace_buff_offset; |
| 1042 | P3 = [P5]; /* trace_buff_offset */ |
| 1043 | P5.L = lo(TBUFSTAT); |
| 1044 | P5.H = hi(TBUFSTAT); |
| 1045 | R7 = [P5]; |
| 1046 | R7 <<= 1; /* double, since we need to read twice */ |
| 1047 | LC0 = R7; |
| 1048 | R7 <<= 2; /* need to shift over again, |
| 1049 | * to get the number of bytes */ |
| 1050 | P5.L = lo(TBUF); |
| 1051 | P5.H = hi(TBUF); |
| 1052 | R6 = ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN)*1024) - 1; |
| 1053 | |
| 1054 | P2 = R7; |
| 1055 | P3 = P3 + P2; |
| 1056 | R7 = P3; |
| 1057 | R7 = R7 & R6; |
| 1058 | P3 = R7; |
| 1059 | P2.L = _trace_buff_offset; |
| 1060 | P2.H = _trace_buff_offset; |
| 1061 | [P2] = P3; |
| 1062 | |
| 1063 | P2.L = _software_trace_buff; |
| 1064 | P2.H = _software_trace_buff; |
| 1065 | |
| 1066 | LSETUP (.Lstart, .Lend) LC0; |
| 1067 | .Lstart: |
| 1068 | R7 = [P5]; /* read TBUF */ |
| 1069 | P4 = P3 + P2; |
| 1070 | [P4] = R7; |
| 1071 | P3 += -4; |
| 1072 | R7 = P3; |
| 1073 | R7 = R7 & R6; |
| 1074 | .Lend: |
| 1075 | P3 = R7; |
| 1076 | |
| 1077 | LB0 = [sp++]; |
| 1078 | LT0 = [sp++]; |
| 1079 | LC0 = [sp++]; |
| 1080 | P2 = [sp++]; |
| 1081 | P3 = [sp++]; |
Mike Frysinger | 8d6c242 | 2007-11-21 15:53:49 +0800 | [diff] [blame] | 1082 | jump _bfin_return_from_exception; |
Robin Getz | 337d390 | 2007-10-09 17:31:46 +0800 | [diff] [blame] | 1083 | ENDPROC(_ex_trace_buff_full) |
Robin Getz | 518039b | 2007-07-25 11:03:28 +0800 | [diff] [blame] | 1084 | |
| 1085 | #if CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN == 4 |
| 1086 | .data |
| 1087 | #else |
| 1088 | .section .l1.data.B |
Robin Getz | 337d390 | 2007-10-09 17:31:46 +0800 | [diff] [blame] | 1089 | #endif /* CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN */ |
Robin Getz | 518039b | 2007-07-25 11:03:28 +0800 | [diff] [blame] | 1090 | ENTRY(_trace_buff_offset) |
| 1091 | .long 0; |
| 1092 | ALIGN |
| 1093 | ENTRY(_software_trace_buff) |
| 1094 | .rept ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN)*256); |
| 1095 | .long 0 |
| 1096 | .endr |
Robin Getz | 337d390 | 2007-10-09 17:31:46 +0800 | [diff] [blame] | 1097 | #endif /* CONFIG_DEBUG_BFIN_HWTRACE_EXPAND */ |
| 1098 | |
| 1099 | #if CONFIG_EARLY_PRINTK |
Mike Frysinger | 9cb07b2 | 2007-11-21 16:45:08 +0800 | [diff] [blame] | 1100 | __INIT |
Robin Getz | 337d390 | 2007-10-09 17:31:46 +0800 | [diff] [blame] | 1101 | ENTRY(_early_trap) |
| 1102 | SAVE_ALL_SYS |
| 1103 | trace_buffer_stop(p0,r0); |
| 1104 | |
Michael Hennerich | 5e9e768 | 2008-10-09 12:31:03 +0800 | [diff] [blame] | 1105 | #if ANOMALY_05000283 || ANOMALY_05000315 |
| 1106 | cc = r5 == r5; |
| 1107 | p4.h = HI(CHIPID); |
| 1108 | p4.l = LO(CHIPID); |
| 1109 | if cc jump 1f; |
| 1110 | r5.l = W[p4]; |
| 1111 | 1: |
| 1112 | #endif |
| 1113 | |
Robin Getz | 337d390 | 2007-10-09 17:31:46 +0800 | [diff] [blame] | 1114 | /* Turn caches off, to ensure we don't get double exceptions */ |
| 1115 | |
| 1116 | P4.L = LO(IMEM_CONTROL); |
| 1117 | P4.H = HI(IMEM_CONTROL); |
| 1118 | |
| 1119 | R5 = [P4]; /* Control Register*/ |
| 1120 | BITCLR(R5,ENICPLB_P); |
| 1121 | CLI R1; |
| 1122 | SSYNC; /* SSYNC required before writing to IMEM_CONTROL. */ |
| 1123 | .align 8; |
| 1124 | [P4] = R5; |
| 1125 | SSYNC; |
| 1126 | |
| 1127 | P4.L = LO(DMEM_CONTROL); |
| 1128 | P4.H = HI(DMEM_CONTROL); |
| 1129 | R5 = [P4]; |
| 1130 | BITCLR(R5,ENDCPLB_P); |
| 1131 | SSYNC; /* SSYNC required before writing to DMEM_CONTROL. */ |
| 1132 | .align 8; |
| 1133 | [P4] = R5; |
| 1134 | SSYNC; |
| 1135 | STI R1; |
| 1136 | |
| 1137 | r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */ |
| 1138 | r1 = RETX; |
| 1139 | |
| 1140 | SP += -12; |
| 1141 | call _early_trap_c; |
| 1142 | SP += 12; |
| 1143 | ENDPROC(_early_trap) |
Mike Frysinger | 9cb07b2 | 2007-11-21 16:45:08 +0800 | [diff] [blame] | 1144 | __FINIT |
Robin Getz | 337d390 | 2007-10-09 17:31:46 +0800 | [diff] [blame] | 1145 | #endif /* CONFIG_EARLY_PRINTK */ |
Robin Getz | 518039b | 2007-07-25 11:03:28 +0800 | [diff] [blame] | 1146 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1147 | /* |
| 1148 | * Put these in the kernel data section - that should always be covered by |
| 1149 | * a CPLB. This is needed to ensure we don't get double fault conditions |
| 1150 | */ |
| 1151 | |
| 1152 | #ifdef CONFIG_SYSCALL_TAB_L1 |
| 1153 | .section .l1.data |
| 1154 | #else |
| 1155 | .data |
| 1156 | #endif |
Robin Getz | f26fbc4 | 2007-11-12 22:21:30 +0800 | [diff] [blame] | 1157 | |
Mike Frysinger | 1ffe664 | 2007-08-05 17:14:04 +0800 | [diff] [blame] | 1158 | ENTRY(_ex_table) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1159 | /* entry for each EXCAUSE[5:0] |
Mike Frysinger | 9401e61 | 2007-07-12 11:50:43 +0800 | [diff] [blame] | 1160 | * 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] | 1161 | * EXCPT instruction can provide 4 bits of EXCAUSE, allowing 16 to be user defined |
| 1162 | */ |
Mike Frysinger | 1ffe664 | 2007-08-05 17:14:04 +0800 | [diff] [blame] | 1163 | .long _ex_syscall /* 0x00 - User Defined - Linux Syscall */ |
Jie Zhang | 3aee91b | 2009-02-04 16:49:45 +0800 | [diff] [blame] | 1164 | .long _ex_trap_c /* 0x01 - User Defined - Software breakpoint */ |
Sonic Zhang | a5ac012 | 2008-10-13 14:07:19 +0800 | [diff] [blame] | 1165 | #ifdef CONFIG_KGDB |
| 1166 | .long _ex_trap_c /* 0x02 - User Defined - KGDB initial connection |
| 1167 | and break signal trap */ |
| 1168 | #else |
Mike Frysinger | 1ffe664 | 2007-08-05 17:14:04 +0800 | [diff] [blame] | 1169 | .long _ex_replaceable /* 0x02 - User Defined */ |
Sonic Zhang | a5ac012 | 2008-10-13 14:07:19 +0800 | [diff] [blame] | 1170 | #endif |
Mike Frysinger | 9401e61 | 2007-07-12 11:50:43 +0800 | [diff] [blame] | 1171 | .long _ex_trap_c /* 0x03 - User Defined - userspace stack overflow */ |
Robin Getz | 9f336a5 | 2007-10-29 18:23:28 +0800 | [diff] [blame] | 1172 | .long _ex_trap_c /* 0x04 - User Defined - dump trace buffer */ |
Mike Frysinger | 1ffe664 | 2007-08-05 17:14:04 +0800 | [diff] [blame] | 1173 | .long _ex_replaceable /* 0x05 - User Defined */ |
| 1174 | .long _ex_replaceable /* 0x06 - User Defined */ |
| 1175 | .long _ex_replaceable /* 0x07 - User Defined */ |
| 1176 | .long _ex_replaceable /* 0x08 - User Defined */ |
| 1177 | .long _ex_replaceable /* 0x09 - User Defined */ |
| 1178 | .long _ex_replaceable /* 0x0A - User Defined */ |
| 1179 | .long _ex_replaceable /* 0x0B - User Defined */ |
| 1180 | .long _ex_replaceable /* 0x0C - User Defined */ |
| 1181 | .long _ex_replaceable /* 0x0D - User Defined */ |
| 1182 | .long _ex_replaceable /* 0x0E - User Defined */ |
| 1183 | .long _ex_replaceable /* 0x0F - User Defined */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1184 | .long _ex_single_step /* 0x10 - HW Single step */ |
Robin Getz | 518039b | 2007-07-25 11:03:28 +0800 | [diff] [blame] | 1185 | #ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND |
| 1186 | .long _ex_trace_buff_full /* 0x11 - Trace Buffer Full */ |
| 1187 | #else |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1188 | .long _ex_trap_c /* 0x11 - Trace Buffer Full */ |
Robin Getz | 518039b | 2007-07-25 11:03:28 +0800 | [diff] [blame] | 1189 | #endif |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1190 | .long _ex_trap_c /* 0x12 - Reserved */ |
| 1191 | .long _ex_trap_c /* 0x13 - Reserved */ |
| 1192 | .long _ex_trap_c /* 0x14 - Reserved */ |
| 1193 | .long _ex_trap_c /* 0x15 - Reserved */ |
| 1194 | .long _ex_trap_c /* 0x16 - Reserved */ |
| 1195 | .long _ex_trap_c /* 0x17 - Reserved */ |
| 1196 | .long _ex_trap_c /* 0x18 - Reserved */ |
| 1197 | .long _ex_trap_c /* 0x19 - Reserved */ |
| 1198 | .long _ex_trap_c /* 0x1A - Reserved */ |
| 1199 | .long _ex_trap_c /* 0x1B - Reserved */ |
| 1200 | .long _ex_trap_c /* 0x1C - Reserved */ |
| 1201 | .long _ex_trap_c /* 0x1D - Reserved */ |
| 1202 | .long _ex_trap_c /* 0x1E - Reserved */ |
| 1203 | .long _ex_trap_c /* 0x1F - Reserved */ |
| 1204 | .long _ex_trap_c /* 0x20 - Reserved */ |
| 1205 | .long _ex_trap_c /* 0x21 - Undefined Instruction */ |
| 1206 | .long _ex_trap_c /* 0x22 - Illegal Instruction Combination */ |
Robin Getz | f26fbc4 | 2007-11-12 22:21:30 +0800 | [diff] [blame] | 1207 | .long _ex_dviol /* 0x23 - Data CPLB Protection Violation */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1208 | .long _ex_trap_c /* 0x24 - Data access misaligned */ |
| 1209 | .long _ex_trap_c /* 0x25 - Unrecoverable Event */ |
Robin Getz | f26fbc4 | 2007-11-12 22:21:30 +0800 | [diff] [blame] | 1210 | .long _ex_dmiss /* 0x26 - Data CPLB Miss */ |
| 1211 | .long _ex_dmult /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1212 | .long _ex_trap_c /* 0x28 - Emulation Watchpoint */ |
| 1213 | .long _ex_trap_c /* 0x29 - Instruction fetch access error (535 only) */ |
| 1214 | .long _ex_trap_c /* 0x2A - Instruction fetch misaligned */ |
Robin Getz | f26fbc4 | 2007-11-12 22:21:30 +0800 | [diff] [blame] | 1215 | .long _ex_trap_c /* 0x2B - Instruction CPLB protection Violation */ |
| 1216 | .long _ex_icplb_miss /* 0x2C - Instruction CPLB miss */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1217 | .long _ex_trap_c /* 0x2D - Instruction CPLB Multiple Hits */ |
| 1218 | .long _ex_trap_c /* 0x2E - Illegal use of Supervisor Resource */ |
| 1219 | .long _ex_trap_c /* 0x2E - Illegal use of Supervisor Resource */ |
| 1220 | .long _ex_trap_c /* 0x2F - Reserved */ |
| 1221 | .long _ex_trap_c /* 0x30 - Reserved */ |
| 1222 | .long _ex_trap_c /* 0x31 - Reserved */ |
| 1223 | .long _ex_trap_c /* 0x32 - Reserved */ |
| 1224 | .long _ex_trap_c /* 0x33 - Reserved */ |
| 1225 | .long _ex_trap_c /* 0x34 - Reserved */ |
| 1226 | .long _ex_trap_c /* 0x35 - Reserved */ |
| 1227 | .long _ex_trap_c /* 0x36 - Reserved */ |
| 1228 | .long _ex_trap_c /* 0x37 - Reserved */ |
| 1229 | .long _ex_trap_c /* 0x38 - Reserved */ |
| 1230 | .long _ex_trap_c /* 0x39 - Reserved */ |
| 1231 | .long _ex_trap_c /* 0x3A - Reserved */ |
| 1232 | .long _ex_trap_c /* 0x3B - Reserved */ |
| 1233 | .long _ex_trap_c /* 0x3C - Reserved */ |
| 1234 | .long _ex_trap_c /* 0x3D - Reserved */ |
| 1235 | .long _ex_trap_c /* 0x3E - Reserved */ |
| 1236 | .long _ex_trap_c /* 0x3F - Reserved */ |
Mike Frysinger | 1ffe664 | 2007-08-05 17:14:04 +0800 | [diff] [blame] | 1237 | END(_ex_table) |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1238 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1239 | ENTRY(_sys_call_table) |
Bryan Wu | 0b95f22 | 2007-09-23 00:51:32 +0800 | [diff] [blame] | 1240 | .long _sys_restart_syscall /* 0 */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1241 | .long _sys_exit |
| 1242 | .long _sys_fork |
| 1243 | .long _sys_read |
| 1244 | .long _sys_write |
| 1245 | .long _sys_open /* 5 */ |
| 1246 | .long _sys_close |
| 1247 | .long _sys_ni_syscall /* old waitpid */ |
| 1248 | .long _sys_creat |
| 1249 | .long _sys_link |
| 1250 | .long _sys_unlink /* 10 */ |
| 1251 | .long _sys_execve |
| 1252 | .long _sys_chdir |
| 1253 | .long _sys_time |
| 1254 | .long _sys_mknod |
| 1255 | .long _sys_chmod /* 15 */ |
| 1256 | .long _sys_chown /* chown16 */ |
| 1257 | .long _sys_ni_syscall /* old break syscall holder */ |
| 1258 | .long _sys_ni_syscall /* old stat */ |
| 1259 | .long _sys_lseek |
| 1260 | .long _sys_getpid /* 20 */ |
| 1261 | .long _sys_mount |
| 1262 | .long _sys_ni_syscall /* old umount */ |
| 1263 | .long _sys_setuid |
| 1264 | .long _sys_getuid |
| 1265 | .long _sys_stime /* 25 */ |
| 1266 | .long _sys_ptrace |
| 1267 | .long _sys_alarm |
| 1268 | .long _sys_ni_syscall /* old fstat */ |
| 1269 | .long _sys_pause |
| 1270 | .long _sys_ni_syscall /* old utime */ /* 30 */ |
| 1271 | .long _sys_ni_syscall /* old stty syscall holder */ |
| 1272 | .long _sys_ni_syscall /* old gtty syscall holder */ |
| 1273 | .long _sys_access |
| 1274 | .long _sys_nice |
| 1275 | .long _sys_ni_syscall /* 35 */ /* old ftime syscall holder */ |
| 1276 | .long _sys_sync |
| 1277 | .long _sys_kill |
| 1278 | .long _sys_rename |
| 1279 | .long _sys_mkdir |
| 1280 | .long _sys_rmdir /* 40 */ |
| 1281 | .long _sys_dup |
| 1282 | .long _sys_pipe |
| 1283 | .long _sys_times |
| 1284 | .long _sys_ni_syscall /* old prof syscall holder */ |
| 1285 | .long _sys_brk /* 45 */ |
| 1286 | .long _sys_setgid |
| 1287 | .long _sys_getgid |
| 1288 | .long _sys_ni_syscall /* old sys_signal */ |
| 1289 | .long _sys_geteuid /* geteuid16 */ |
| 1290 | .long _sys_getegid /* getegid16 */ /* 50 */ |
| 1291 | .long _sys_acct |
| 1292 | .long _sys_umount /* recycled never used phys() */ |
| 1293 | .long _sys_ni_syscall /* old lock syscall holder */ |
| 1294 | .long _sys_ioctl |
| 1295 | .long _sys_fcntl /* 55 */ |
| 1296 | .long _sys_ni_syscall /* old mpx syscall holder */ |
| 1297 | .long _sys_setpgid |
| 1298 | .long _sys_ni_syscall /* old ulimit syscall holder */ |
| 1299 | .long _sys_ni_syscall /* old old uname */ |
| 1300 | .long _sys_umask /* 60 */ |
| 1301 | .long _sys_chroot |
| 1302 | .long _sys_ustat |
| 1303 | .long _sys_dup2 |
| 1304 | .long _sys_getppid |
| 1305 | .long _sys_getpgrp /* 65 */ |
| 1306 | .long _sys_setsid |
| 1307 | .long _sys_ni_syscall /* old sys_sigaction */ |
| 1308 | .long _sys_sgetmask |
| 1309 | .long _sys_ssetmask |
| 1310 | .long _sys_setreuid /* setreuid16 */ /* 70 */ |
| 1311 | .long _sys_setregid /* setregid16 */ |
| 1312 | .long _sys_ni_syscall /* old sys_sigsuspend */ |
| 1313 | .long _sys_ni_syscall /* old sys_sigpending */ |
| 1314 | .long _sys_sethostname |
| 1315 | .long _sys_setrlimit /* 75 */ |
| 1316 | .long _sys_ni_syscall /* old getrlimit */ |
| 1317 | .long _sys_getrusage |
| 1318 | .long _sys_gettimeofday |
| 1319 | .long _sys_settimeofday |
| 1320 | .long _sys_getgroups /* getgroups16 */ /* 80 */ |
| 1321 | .long _sys_setgroups /* setgroups16 */ |
| 1322 | .long _sys_ni_syscall /* old_select */ |
| 1323 | .long _sys_symlink |
| 1324 | .long _sys_ni_syscall /* old lstat */ |
| 1325 | .long _sys_readlink /* 85 */ |
| 1326 | .long _sys_uselib |
| 1327 | .long _sys_ni_syscall /* sys_swapon */ |
| 1328 | .long _sys_reboot |
| 1329 | .long _sys_ni_syscall /* old_readdir */ |
| 1330 | .long _sys_ni_syscall /* sys_mmap */ /* 90 */ |
| 1331 | .long _sys_munmap |
| 1332 | .long _sys_truncate |
| 1333 | .long _sys_ftruncate |
| 1334 | .long _sys_fchmod |
| 1335 | .long _sys_fchown /* fchown16 */ /* 95 */ |
| 1336 | .long _sys_getpriority |
| 1337 | .long _sys_setpriority |
| 1338 | .long _sys_ni_syscall /* old profil syscall holder */ |
| 1339 | .long _sys_statfs |
| 1340 | .long _sys_fstatfs /* 100 */ |
| 1341 | .long _sys_ni_syscall |
| 1342 | .long _sys_ni_syscall /* old sys_socketcall */ |
| 1343 | .long _sys_syslog |
| 1344 | .long _sys_setitimer |
| 1345 | .long _sys_getitimer /* 105 */ |
| 1346 | .long _sys_newstat |
| 1347 | .long _sys_newlstat |
| 1348 | .long _sys_newfstat |
| 1349 | .long _sys_ni_syscall /* old uname */ |
| 1350 | .long _sys_ni_syscall /* iopl for i386 */ /* 110 */ |
| 1351 | .long _sys_vhangup |
| 1352 | .long _sys_ni_syscall /* obsolete idle() syscall */ |
| 1353 | .long _sys_ni_syscall /* vm86old for i386 */ |
| 1354 | .long _sys_wait4 |
| 1355 | .long _sys_ni_syscall /* 115 */ /* sys_swapoff */ |
| 1356 | .long _sys_sysinfo |
| 1357 | .long _sys_ni_syscall /* old sys_ipc */ |
| 1358 | .long _sys_fsync |
| 1359 | .long _sys_ni_syscall /* old sys_sigreturn */ |
| 1360 | .long _sys_clone /* 120 */ |
| 1361 | .long _sys_setdomainname |
| 1362 | .long _sys_newuname |
| 1363 | .long _sys_ni_syscall /* old sys_modify_ldt */ |
| 1364 | .long _sys_adjtimex |
| 1365 | .long _sys_ni_syscall /* 125 */ /* sys_mprotect */ |
| 1366 | .long _sys_ni_syscall /* old sys_sigprocmask */ |
| 1367 | .long _sys_ni_syscall /* old "creat_module" */ |
| 1368 | .long _sys_init_module |
| 1369 | .long _sys_delete_module |
| 1370 | .long _sys_ni_syscall /* 130: old "get_kernel_syms" */ |
| 1371 | .long _sys_quotactl |
| 1372 | .long _sys_getpgid |
| 1373 | .long _sys_fchdir |
| 1374 | .long _sys_bdflush |
| 1375 | .long _sys_ni_syscall /* 135 */ /* sys_sysfs */ |
| 1376 | .long _sys_personality |
| 1377 | .long _sys_ni_syscall /* for afs_syscall */ |
| 1378 | .long _sys_setfsuid /* setfsuid16 */ |
| 1379 | .long _sys_setfsgid /* setfsgid16 */ |
| 1380 | .long _sys_llseek /* 140 */ |
| 1381 | .long _sys_getdents |
| 1382 | .long _sys_ni_syscall /* sys_select */ |
| 1383 | .long _sys_flock |
| 1384 | .long _sys_ni_syscall /* sys_msync */ |
| 1385 | .long _sys_readv /* 145 */ |
| 1386 | .long _sys_writev |
| 1387 | .long _sys_getsid |
| 1388 | .long _sys_fdatasync |
| 1389 | .long _sys_sysctl |
| 1390 | .long _sys_ni_syscall /* 150 */ /* sys_mlock */ |
| 1391 | .long _sys_ni_syscall /* sys_munlock */ |
| 1392 | .long _sys_ni_syscall /* sys_mlockall */ |
| 1393 | .long _sys_ni_syscall /* sys_munlockall */ |
| 1394 | .long _sys_sched_setparam |
| 1395 | .long _sys_sched_getparam /* 155 */ |
| 1396 | .long _sys_sched_setscheduler |
| 1397 | .long _sys_sched_getscheduler |
| 1398 | .long _sys_sched_yield |
| 1399 | .long _sys_sched_get_priority_max |
| 1400 | .long _sys_sched_get_priority_min /* 160 */ |
| 1401 | .long _sys_sched_rr_get_interval |
| 1402 | .long _sys_nanosleep |
Bryan Wu | 0b95f22 | 2007-09-23 00:51:32 +0800 | [diff] [blame] | 1403 | .long _sys_mremap |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1404 | .long _sys_setresuid /* setresuid16 */ |
| 1405 | .long _sys_getresuid /* getresuid16 */ /* 165 */ |
| 1406 | .long _sys_ni_syscall /* for vm86 */ |
| 1407 | .long _sys_ni_syscall /* old "query_module" */ |
| 1408 | .long _sys_ni_syscall /* sys_poll */ |
Bryan Wu | 0b95f22 | 2007-09-23 00:51:32 +0800 | [diff] [blame] | 1409 | .long _sys_nfsservctl |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1410 | .long _sys_setresgid /* setresgid16 */ /* 170 */ |
| 1411 | .long _sys_getresgid /* getresgid16 */ |
| 1412 | .long _sys_prctl |
| 1413 | .long _sys_rt_sigreturn |
| 1414 | .long _sys_rt_sigaction |
| 1415 | .long _sys_rt_sigprocmask /* 175 */ |
| 1416 | .long _sys_rt_sigpending |
| 1417 | .long _sys_rt_sigtimedwait |
| 1418 | .long _sys_rt_sigqueueinfo |
| 1419 | .long _sys_rt_sigsuspend |
| 1420 | .long _sys_pread64 /* 180 */ |
| 1421 | .long _sys_pwrite64 |
| 1422 | .long _sys_lchown /* lchown16 */ |
| 1423 | .long _sys_getcwd |
| 1424 | .long _sys_capget |
| 1425 | .long _sys_capset /* 185 */ |
| 1426 | .long _sys_sigaltstack |
| 1427 | .long _sys_sendfile |
| 1428 | .long _sys_ni_syscall /* streams1 */ |
| 1429 | .long _sys_ni_syscall /* streams2 */ |
| 1430 | .long _sys_vfork /* 190 */ |
| 1431 | .long _sys_getrlimit |
| 1432 | .long _sys_mmap2 |
| 1433 | .long _sys_truncate64 |
| 1434 | .long _sys_ftruncate64 |
| 1435 | .long _sys_stat64 /* 195 */ |
| 1436 | .long _sys_lstat64 |
| 1437 | .long _sys_fstat64 |
| 1438 | .long _sys_chown |
| 1439 | .long _sys_getuid |
| 1440 | .long _sys_getgid /* 200 */ |
| 1441 | .long _sys_geteuid |
| 1442 | .long _sys_getegid |
| 1443 | .long _sys_setreuid |
| 1444 | .long _sys_setregid |
| 1445 | .long _sys_getgroups /* 205 */ |
| 1446 | .long _sys_setgroups |
| 1447 | .long _sys_fchown |
| 1448 | .long _sys_setresuid |
| 1449 | .long _sys_getresuid |
| 1450 | .long _sys_setresgid /* 210 */ |
| 1451 | .long _sys_getresgid |
| 1452 | .long _sys_lchown |
| 1453 | .long _sys_setuid |
| 1454 | .long _sys_setgid |
| 1455 | .long _sys_setfsuid /* 215 */ |
| 1456 | .long _sys_setfsgid |
| 1457 | .long _sys_pivot_root |
| 1458 | .long _sys_ni_syscall /* sys_mincore */ |
| 1459 | .long _sys_ni_syscall /* sys_madvise */ |
| 1460 | .long _sys_getdents64 /* 220 */ |
| 1461 | .long _sys_fcntl64 |
| 1462 | .long _sys_ni_syscall /* reserved for TUX */ |
| 1463 | .long _sys_ni_syscall |
| 1464 | .long _sys_gettid |
Bryan Wu | 0b95f22 | 2007-09-23 00:51:32 +0800 | [diff] [blame] | 1465 | .long _sys_readahead /* 225 */ |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1466 | .long _sys_setxattr |
| 1467 | .long _sys_lsetxattr |
| 1468 | .long _sys_fsetxattr |
| 1469 | .long _sys_getxattr |
| 1470 | .long _sys_lgetxattr /* 230 */ |
| 1471 | .long _sys_fgetxattr |
| 1472 | .long _sys_listxattr |
| 1473 | .long _sys_llistxattr |
| 1474 | .long _sys_flistxattr |
| 1475 | .long _sys_removexattr /* 235 */ |
| 1476 | .long _sys_lremovexattr |
| 1477 | .long _sys_fremovexattr |
| 1478 | .long _sys_tkill |
| 1479 | .long _sys_sendfile64 |
| 1480 | .long _sys_futex /* 240 */ |
| 1481 | .long _sys_sched_setaffinity |
| 1482 | .long _sys_sched_getaffinity |
| 1483 | .long _sys_ni_syscall /* sys_set_thread_area */ |
| 1484 | .long _sys_ni_syscall /* sys_get_thread_area */ |
| 1485 | .long _sys_io_setup /* 245 */ |
| 1486 | .long _sys_io_destroy |
| 1487 | .long _sys_io_getevents |
| 1488 | .long _sys_io_submit |
| 1489 | .long _sys_io_cancel |
| 1490 | .long _sys_ni_syscall /* 250 */ /* sys_alloc_hugepages */ |
| 1491 | .long _sys_ni_syscall /* sys_freec_hugepages */ |
| 1492 | .long _sys_exit_group |
| 1493 | .long _sys_lookup_dcookie |
| 1494 | .long _sys_bfin_spinlock |
| 1495 | .long _sys_epoll_create /* 255 */ |
| 1496 | .long _sys_epoll_ctl |
| 1497 | .long _sys_epoll_wait |
| 1498 | .long _sys_ni_syscall /* remap_file_pages */ |
| 1499 | .long _sys_set_tid_address |
| 1500 | .long _sys_timer_create /* 260 */ |
| 1501 | .long _sys_timer_settime |
| 1502 | .long _sys_timer_gettime |
| 1503 | .long _sys_timer_getoverrun |
| 1504 | .long _sys_timer_delete |
| 1505 | .long _sys_clock_settime /* 265 */ |
| 1506 | .long _sys_clock_gettime |
| 1507 | .long _sys_clock_getres |
| 1508 | .long _sys_clock_nanosleep |
| 1509 | .long _sys_statfs64 |
| 1510 | .long _sys_fstatfs64 /* 270 */ |
| 1511 | .long _sys_tgkill |
| 1512 | .long _sys_utimes |
| 1513 | .long _sys_fadvise64_64 |
| 1514 | .long _sys_ni_syscall /* vserver */ |
| 1515 | .long _sys_ni_syscall /* 275, mbind */ |
| 1516 | .long _sys_ni_syscall /* get_mempolicy */ |
| 1517 | .long _sys_ni_syscall /* set_mempolicy */ |
| 1518 | .long _sys_mq_open |
| 1519 | .long _sys_mq_unlink |
| 1520 | .long _sys_mq_timedsend /* 280 */ |
| 1521 | .long _sys_mq_timedreceive |
| 1522 | .long _sys_mq_notify |
| 1523 | .long _sys_mq_getsetattr |
| 1524 | .long _sys_ni_syscall /* kexec_load */ |
| 1525 | .long _sys_waitid /* 285 */ |
| 1526 | .long _sys_add_key |
| 1527 | .long _sys_request_key |
| 1528 | .long _sys_keyctl |
| 1529 | .long _sys_ioprio_set |
| 1530 | .long _sys_ioprio_get /* 290 */ |
| 1531 | .long _sys_inotify_init |
| 1532 | .long _sys_inotify_add_watch |
| 1533 | .long _sys_inotify_rm_watch |
| 1534 | .long _sys_ni_syscall /* migrate_pages */ |
| 1535 | .long _sys_openat /* 295 */ |
| 1536 | .long _sys_mkdirat |
| 1537 | .long _sys_mknodat |
| 1538 | .long _sys_fchownat |
| 1539 | .long _sys_futimesat |
| 1540 | .long _sys_fstatat64 /* 300 */ |
| 1541 | .long _sys_unlinkat |
| 1542 | .long _sys_renameat |
| 1543 | .long _sys_linkat |
| 1544 | .long _sys_symlinkat |
| 1545 | .long _sys_readlinkat /* 305 */ |
| 1546 | .long _sys_fchmodat |
| 1547 | .long _sys_faccessat |
| 1548 | .long _sys_pselect6 |
| 1549 | .long _sys_ppoll |
| 1550 | .long _sys_unshare /* 310 */ |
| 1551 | .long _sys_sram_alloc |
| 1552 | .long _sys_sram_free |
| 1553 | .long _sys_dma_memcpy |
| 1554 | .long _sys_accept |
| 1555 | .long _sys_bind /* 315 */ |
| 1556 | .long _sys_connect |
| 1557 | .long _sys_getpeername |
| 1558 | .long _sys_getsockname |
| 1559 | .long _sys_getsockopt |
| 1560 | .long _sys_listen /* 320 */ |
| 1561 | .long _sys_recv |
| 1562 | .long _sys_recvfrom |
| 1563 | .long _sys_recvmsg |
| 1564 | .long _sys_send |
| 1565 | .long _sys_sendmsg /* 325 */ |
| 1566 | .long _sys_sendto |
| 1567 | .long _sys_setsockopt |
| 1568 | .long _sys_shutdown |
| 1569 | .long _sys_socket |
| 1570 | .long _sys_socketpair /* 330 */ |
| 1571 | .long _sys_semctl |
| 1572 | .long _sys_semget |
| 1573 | .long _sys_semop |
| 1574 | .long _sys_msgctl |
| 1575 | .long _sys_msgget /* 335 */ |
| 1576 | .long _sys_msgrcv |
| 1577 | .long _sys_msgsnd |
| 1578 | .long _sys_shmat |
| 1579 | .long _sys_shmctl |
| 1580 | .long _sys_shmdt /* 340 */ |
| 1581 | .long _sys_shmget |
Bryan Wu | 0b95f22 | 2007-09-23 00:51:32 +0800 | [diff] [blame] | 1582 | .long _sys_splice |
| 1583 | .long _sys_sync_file_range |
| 1584 | .long _sys_tee |
| 1585 | .long _sys_vmsplice /* 345 */ |
| 1586 | .long _sys_epoll_pwait |
| 1587 | .long _sys_utimensat |
| 1588 | .long _sys_signalfd |
Bryan Wu | 2f775db | 2008-03-06 16:04:58 -0700 | [diff] [blame] | 1589 | .long _sys_timerfd_create |
Bryan Wu | 0b95f22 | 2007-09-23 00:51:32 +0800 | [diff] [blame] | 1590 | .long _sys_eventfd /* 350 */ |
| 1591 | .long _sys_pread64 |
| 1592 | .long _sys_pwrite64 |
| 1593 | .long _sys_fadvise64 |
| 1594 | .long _sys_set_robust_list |
| 1595 | .long _sys_get_robust_list /* 355 */ |
| 1596 | .long _sys_fallocate |
Bernd Schmidt | fc97551 | 2008-01-27 19:56:43 +0800 | [diff] [blame] | 1597 | .long _sys_semtimedop |
Bryan Wu | 2f775db | 2008-03-06 16:04:58 -0700 | [diff] [blame] | 1598 | .long _sys_timerfd_settime |
| 1599 | .long _sys_timerfd_gettime |
Bryan Wu | a4b7b6d | 2008-08-14 15:40:19 +0800 | [diff] [blame] | 1600 | .long _sys_signalfd4 /* 360 */ |
| 1601 | .long _sys_eventfd2 |
| 1602 | .long _sys_epoll_create1 |
| 1603 | .long _sys_dup3 |
| 1604 | .long _sys_pipe2 |
| 1605 | .long _sys_inotify_init1 /* 365 */ |
Mike Frysinger | 7a1450f | 2009-05-26 04:55:38 -0400 | [diff] [blame] | 1606 | .long _sys_preadv |
| 1607 | .long _sys_pwritev |
Bryan Wu | 2f775db | 2008-03-06 16:04:58 -0700 | [diff] [blame] | 1608 | |
Bryan Wu | 1394f03 | 2007-05-06 14:50:22 -0700 | [diff] [blame] | 1609 | .rept NR_syscalls-(.-_sys_call_table)/4 |
| 1610 | .long _sys_ni_syscall |
| 1611 | .endr |
Robin Getz | 0c7a6b2 | 2008-10-08 16:27:12 +0800 | [diff] [blame] | 1612 | END(_sys_call_table) |