blob: 4e8e3fe0ba1c14f7e415f0e6ca0e0e1e1ff744ff [file] [log] [blame]
Bryan Wu1394f032007-05-06 14:50:22 -07001/*
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 Getz2ebcade2007-10-09 17:24:30 +080032/* NOTE: This code handles signal-recognition, which happens every time
Bryan Wu1394f032007-05-06 14:50:22 -070033 * after a timer-interrupt and after each system call.
34 */
35
Mike Frysinger9cb07b22007-11-21 16:45:08 +080036#include <linux/init.h>
Bryan Wu1394f032007-05-06 14:50:22 -070037#include <linux/linkage.h>
Mike Frysinger1f83b8f2007-07-12 22:58:21 +080038#include <linux/unistd.h>
Bryan Wu1394f032007-05-06 14:50:22 -070039#include <asm/blackfin.h>
Bryan Wu1394f032007-05-06 14:50:22 -070040#include <asm/errno.h>
Bernd Schmidt5d750b92008-04-25 05:02:33 +080041#include <asm/fixed_code.h>
Bryan Wu1394f032007-05-06 14:50:22 -070042#include <asm/thread_info.h> /* TIF_NEED_RESCHED */
43#include <asm/asm-offsets.h>
Robin Getz669b7922007-06-21 16:34:08 +080044#include <asm/trace.h>
Robin Getz16aadcb2009-06-09 01:18:41 +000045#include <asm/traps.h>
Bryan Wu1394f032007-05-06 14:50:22 -070046
Bryan Wu639f6572008-08-27 10:51:02 +080047#include <asm/context.S>
Bryan Wu1394f032007-05-06 14:50:22 -070048
Mike Frysingerf0b5d122007-08-05 17:03:59 +080049#if defined(CONFIG_BFIN_SCRATCH_REG_RETN)
50# define EX_SCRATCH_REG RETN
51#elif defined(CONFIG_BFIN_SCRATCH_REG_RETE)
52# define EX_SCRATCH_REG RETE
53#else
54# define EX_SCRATCH_REG CYCLES
55#endif
56
Bryan Wu1394f032007-05-06 14:50:22 -070057#ifdef CONFIG_EXCPT_IRQ_SYSC_L1
58.section .l1.text
59#else
60.text
61#endif
62
63/* Slightly simplified and streamlined entry point for CPLB misses.
64 * This one does not lower the level to IRQ5, and thus can be used to
65 * patch up CPLB misses on the kernel stack.
66 */
Mike Frysinger1aafd902007-07-25 11:19:14 +080067#if ANOMALY_05000261
Robin Getzf26fbc42007-11-12 22:21:30 +080068#define _ex_dviol _ex_workaround_261
69#define _ex_dmiss _ex_workaround_261
70#define _ex_dmult _ex_workaround_261
71
72ENTRY(_ex_workaround_261)
Bryan Wu1394f032007-05-06 14:50:22 -070073 /*
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 */
Robin Getzf26fbc42007-11-12 22:21:30 +080078 P4 = R7; /* Store EXCAUSE */
Graf Yang6b3087c2009-01-07 23:14:39 +080079
80 GET_PDA(p5, r7);
81 r7 = [p5 + PDA_LFRETX];
Bryan Wu1394f032007-05-06 14:50:22 -070082 r6 = retx;
Graf Yang6b3087c2009-01-07 23:14:39 +080083 [p5 + PDA_LFRETX] = r6;
Bryan Wu1394f032007-05-06 14:50:22 -070084 cc = r6 == r7;
Mike Frysinger8d6c2422007-11-21 15:53:49 +080085 if !cc jump _bfin_return_from_exception;
Bryan Wu1394f032007-05-06 14:50:22 -070086 /* fall through */
Robin Getzf26fbc42007-11-12 22:21:30 +080087 R7 = P4;
Robin Getz16aadcb2009-06-09 01:18:41 +000088 R6 = VEC_CPLB_M; /* Data CPLB Miss */
Robin Getzf26fbc42007-11-12 22:21:30 +080089 cc = R6 == R7;
90 if cc jump _ex_dcplb_miss (BP);
Robin Getz16aadcb2009-06-09 01:18:41 +000091#ifdef CONFIG_MPU
92 R6 = VEC_CPLB_VL; /* Data CPLB Violation */
Bernd Schmidtb97b8a92008-01-27 18:39:16 +080093 cc = R6 == R7;
94 if cc jump _ex_dcplb_viol (BP);
Robin Getz16aadcb2009-06-09 01:18:41 +000095#endif
96 /* Handle Data CPLB Protection Violation
Robin Getzf26fbc42007-11-12 22:21:30 +080097 * and Data CPLB Multiple Hits - Linux Trap Zero
98 */
99 jump _ex_trap_c;
100ENDPROC(_ex_workaround_261)
Bryan Wu1394f032007-05-06 14:50:22 -0700101
Robin Getzf26fbc42007-11-12 22:21:30 +0800102#else
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800103#ifdef CONFIG_MPU
104#define _ex_dviol _ex_dcplb_viol
105#else
Robin Getzf26fbc42007-11-12 22:21:30 +0800106#define _ex_dviol _ex_trap_c
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800107#endif
Robin Getzf26fbc42007-11-12 22:21:30 +0800108#define _ex_dmiss _ex_dcplb_miss
109#define _ex_dmult _ex_trap_c
110#endif
111
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800112
113ENTRY(_ex_dcplb_viol)
Robin Getzf26fbc42007-11-12 22:21:30 +0800114ENTRY(_ex_dcplb_miss)
115ENTRY(_ex_icplb_miss)
Bryan Wu1394f032007-05-06 14:50:22 -0700116 (R7:6,P5:4) = [sp++];
Bernd Schmidtdbdf20d2009-01-07 23:14:38 +0800117 /* We leave the previously pushed ASTAT on the stack. */
118 SAVE_CONTEXT_CPLB
119
Bernd Schmidt2a0c4fd2008-04-23 07:17:34 +0800120 /* We must load R1 here, _before_ DEBUG_HWTRACE_SAVE, since that
121 * will change the stack pointer. */
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800122 R0 = SEQSTAT;
123 R1 = SP;
Bernd Schmidtdbdf20d2009-01-07 23:14:38 +0800124
Bernd Schmidt2a0c4fd2008-04-23 07:17:34 +0800125 DEBUG_HWTRACE_SAVE(p5, r7)
Bernd Schmidtdbdf20d2009-01-07 23:14:38 +0800126
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800127 sp += -12;
128 call _cplb_hdr;
129 sp += 12;
130 CC = R0 == 0;
131 IF !CC JUMP _handle_bad_cplb;
Robin Getz0c7a6b22008-10-08 16:27:12 +0800132
133#ifdef CONFIG_DEBUG_DOUBLEFAULT
134 /* While we were processing this, did we double fault? */
135 r7 = SEQSTAT; /* reason code is in bit 5:0 */
136 r6.l = lo(SEQSTAT_EXCAUSE);
137 r6.h = hi(SEQSTAT_EXCAUSE);
138 r7 = r7 & r6;
139 r6 = 0x25;
140 CC = R7 == R6;
141 if CC JUMP _double_fault;
142#endif
143
Mike Frysinger80f31c82008-02-02 15:47:24 +0800144 DEBUG_HWTRACE_RESTORE(p5, r7)
Bernd Schmidtdbdf20d2009-01-07 23:14:38 +0800145 RESTORE_CONTEXT_CPLB
146 ASTAT = [SP++];
Mike Frysingerf0b5d122007-08-05 17:03:59 +0800147 SP = EX_SCRATCH_REG;
Bryan Wu1394f032007-05-06 14:50:22 -0700148 rtx;
Robin Getzf26fbc42007-11-12 22:21:30 +0800149ENDPROC(_ex_icplb_miss)
Bryan Wu1394f032007-05-06 14:50:22 -0700150
Bryan Wu1394f032007-05-06 14:50:22 -0700151ENTRY(_ex_syscall)
Bryan Wu1394f032007-05-06 14:50:22 -0700152 raise 15; /* invoked by TRAP #0, for sys call */
Robin Getz0c7a6b22008-10-08 16:27:12 +0800153 jump.s _bfin_return_from_exception;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800154ENDPROC(_ex_syscall)
Bryan Wu1394f032007-05-06 14:50:22 -0700155
Bryan Wu1394f032007-05-06 14:50:22 -0700156ENTRY(_ex_single_step)
Bernd Schmidt0893f122008-05-07 11:41:26 +0800157 /* If we just returned from an interrupt, the single step event is
158 for the RTI instruction. */
Bryan Wu1394f032007-05-06 14:50:22 -0700159 r7 = retx;
160 r6 = reti;
161 cc = r7 == r6;
Bernd Schmidt0893f122008-05-07 11:41:26 +0800162 if cc jump _bfin_return_from_exception;
163
Jie Zhang5400c5a2008-08-05 17:33:38 +0800164#ifdef CONFIG_KGDB
Sonic Zhang0d1cdd72008-07-26 18:54:38 +0800165 /* Don't do single step in hardware exception handler */
166 p5.l = lo(IPEND);
167 p5.h = hi(IPEND);
168 r6 = [p5];
Sonic Zhangd6a29892008-08-05 18:28:26 +0800169 cc = bittst(r6, 4);
170 if cc jump _bfin_return_from_exception;
Sonic Zhang0d1cdd72008-07-26 18:54:38 +0800171 cc = bittst(r6, 5);
172 if cc jump _bfin_return_from_exception;
173
Sonic Zhang0d1cdd72008-07-26 18:54:38 +0800174 /* skip single step if current interrupt priority is higher than
175 * that of the first instruction, from which gdb starts single step */
176 r6 >>= 6;
177 r7 = 10;
178.Lfind_priority_start:
179 cc = bittst(r6, 0);
180 if cc jump .Lfind_priority_done;
181 r6 >>= 1;
182 r7 += -1;
183 cc = r7 == 0;
184 if cc jump .Lfind_priority_done;
185 jump.s .Lfind_priority_start;
186.Lfind_priority_done:
Sonic Zhanga5ac0122008-10-13 14:07:19 +0800187 p4.l = _kgdb_single_step;
188 p4.h = _kgdb_single_step;
Sonic Zhang0d1cdd72008-07-26 18:54:38 +0800189 r6 = [p4];
190 cc = r6 == 0;
191 if cc jump .Ldo_single_step;
192 r6 += -1;
193 cc = r6 < r7;
Sonic Zhangd6a29892008-08-05 18:28:26 +0800194 if cc jump 1f;
Sonic Zhang0d1cdd72008-07-26 18:54:38 +0800195.Ldo_single_step:
Sonic Zhangd6a29892008-08-05 18:28:26 +0800196#else
Bernd Schmidt0893f122008-05-07 11:41:26 +0800197 /* If we were in user mode, do the single step normally. */
Jie Zhang5400c5a2008-08-05 17:33:38 +0800198 p5.l = lo(IPEND);
199 p5.h = hi(IPEND);
Bernd Schmidt0893f122008-05-07 11:41:26 +0800200 r6 = [p5];
201 r7 = 0xffe0 (z);
202 r7 = r7 & r6;
203 cc = r7 == 0;
Jie Zhang5400c5a2008-08-05 17:33:38 +0800204 if !cc jump 1f;
Sonic Zhangd6a29892008-08-05 18:28:26 +0800205#endif
Robin Getzb9a38992009-05-18 18:33:26 +0000206#ifdef CONFIG_EXACT_HWERR
207 /* Read the ILAT, and to check to see if the process we are
208 * single stepping caused a previous hardware error
209 * If so, do not single step, (which lowers to IRQ5, and makes
210 * us miss the error).
211 */
212 p5.l = lo(ILAT);
213 p5.h = hi(ILAT);
214 r7 = [p5];
215 cc = bittst(r7, EVT_IVHW_P);
216 if cc jump 1f;
217#endif
Jie Zhang5400c5a2008-08-05 17:33:38 +0800218 /* Single stepping only a single instruction, so clear the trace
219 * bit here. */
220 r7 = syscfg;
Robin Getz19976602009-06-17 15:18:18 +0000221 bitclr (r7, SYSCFG_SSSTEP_P);
Jie Zhang5400c5a2008-08-05 17:33:38 +0800222 syscfg = R7;
223 jump _ex_trap_c;
224
2251:
Bernd Schmidt0893f122008-05-07 11:41:26 +0800226 /*
227 * We were in an interrupt handler. By convention, all of them save
228 * SYSCFG with their first instruction, so by checking whether our
229 * RETX points at the entry point, we can determine whether to allow
230 * a single step, or whether to clear SYSCFG.
231 *
232 * First, find out the interrupt level and the event vector for it.
233 */
234 p5.l = lo(EVT0);
235 p5.h = hi(EVT0);
236 p5 += -4;
2372:
238 r7 = rot r7 by -1;
239 p5 += 4;
240 if !cc jump 2b;
241
242 /* What we actually do is test for the _second_ instruction in the
243 * IRQ handler. That way, if there are insns following the restore
244 * of SYSCFG after leaving the handler, we will not turn off SYSCFG
245 * for them. */
246
247 r7 = [p5];
248 r7 += 2;
249 r6 = RETX;
250 cc = R7 == R6;
251 if !cc jump _bfin_return_from_exception;
252
Bryan Wu1394f032007-05-06 14:50:22 -0700253 r7 = syscfg;
Robin Getz19976602009-06-17 15:18:18 +0000254 bitclr (r7, SYSCFG_SSSTEP_P); /* Turn off single step */
Bryan Wu1394f032007-05-06 14:50:22 -0700255 syscfg = R7;
256
Jie Zhang5400c5a2008-08-05 17:33:38 +0800257 /* Fall through to _bfin_return_from_exception. */
Mike Frysinger46c87c32007-11-21 16:15:48 +0800258ENDPROC(_ex_single_step)
Bryan Wu1394f032007-05-06 14:50:22 -0700259
Mike Frysinger8d6c2422007-11-21 15:53:49 +0800260ENTRY(_bfin_return_from_exception)
Mike Frysinger1aafd902007-07-25 11:19:14 +0800261#if ANOMALY_05000257
Michael Hennerich8af10b72007-05-21 18:09:09 +0800262 R7=LC0;
263 LC0=R7;
264 R7=LC1;
265 LC1=R7;
266#endif
Robin Getz0c7a6b22008-10-08 16:27:12 +0800267
268#ifdef CONFIG_DEBUG_DOUBLEFAULT
269 /* While we were processing the current exception,
270 * did we cause another, and double fault?
271 */
272 r7 = SEQSTAT; /* reason code is in bit 5:0 */
273 r6.l = lo(SEQSTAT_EXCAUSE);
274 r6.h = hi(SEQSTAT_EXCAUSE);
275 r7 = r7 & r6;
Robin Getz16aadcb2009-06-09 01:18:41 +0000276 r6 = VEC_UNCOV;
Robin Getz0c7a6b22008-10-08 16:27:12 +0800277 CC = R7 == R6;
278 if CC JUMP _double_fault;
Robin Getz0c7a6b22008-10-08 16:27:12 +0800279#endif
280
Bryan Wu1394f032007-05-06 14:50:22 -0700281 (R7:6,P5:4) = [sp++];
282 ASTAT = [sp++];
Mike Frysingerf0b5d122007-08-05 17:03:59 +0800283 sp = EX_SCRATCH_REG;
Bryan Wu1394f032007-05-06 14:50:22 -0700284 rtx;
Mike Frysinger46c87c32007-11-21 16:15:48 +0800285ENDPROC(_bfin_return_from_exception)
Bryan Wu1394f032007-05-06 14:50:22 -0700286
287ENTRY(_handle_bad_cplb)
Bernd Schmidt2a0c4fd2008-04-23 07:17:34 +0800288 DEBUG_HWTRACE_RESTORE(p5, r7)
Bryan Wu1394f032007-05-06 14:50:22 -0700289 /* To get here, we just tried and failed to change a CPLB
290 * so, handle things in trap_c (C code), by lowering to
291 * IRQ5, just like we normally do. Since this is not a
292 * "normal" return path, we have a do alot of stuff to
293 * the stack to get ready so, we can fall through - we
294 * need to make a CPLB exception look like a normal exception
295 */
Bernd Schmidtdbdf20d2009-01-07 23:14:38 +0800296 RESTORE_CONTEXT_CPLB
297 /* ASTAT is still on the stack, where it is needed. */
Mike Frysinger80f31c82008-02-02 15:47:24 +0800298 [--sp] = (R7:6,P5:4);
Bryan Wu1394f032007-05-06 14:50:22 -0700299
Mike Frysinger1ffe6642007-08-05 17:14:04 +0800300ENTRY(_ex_replaceable)
301 nop;
302
Bryan Wu1394f032007-05-06 14:50:22 -0700303ENTRY(_ex_trap_c)
Robin Getzae4f0732009-06-22 02:02:16 +0000304 /* The only thing that has been saved in this context is
305 * (R7:6,P5:4), ASTAT & SP - don't use anything else
306 */
307
308 GET_PDA(p5, r6);
309
Robin Getz2ebcade2007-10-09 17:24:30 +0800310 /* Make sure we are not in a double fault */
311 p4.l = lo(IPEND);
312 p4.h = hi(IPEND);
313 r7 = [p4];
314 CC = BITTST (r7, 5);
315 if CC jump _double_fault;
Robin Getzae4f0732009-06-22 02:02:16 +0000316 [p5 + PDA_EXIPEND] = r7;
Robin Getz2ebcade2007-10-09 17:24:30 +0800317
Bryan Wu1394f032007-05-06 14:50:22 -0700318 /* Call C code (trap_c) to handle the exception, which most
319 * likely involves sending a signal to the current process.
320 * To avoid double faults, lower our priority to IRQ5 first.
321 */
Robin Getzae4f0732009-06-22 02:02:16 +0000322 r7.h = _exception_to_level5;
323 r7.l = _exception_to_level5;
Bryan Wu1394f032007-05-06 14:50:22 -0700324 p4.l = lo(EVT5);
325 p4.h = hi(EVT5);
Robin Getzae4f0732009-06-22 02:02:16 +0000326 [p4] = r7;
Bryan Wu1394f032007-05-06 14:50:22 -0700327 csync;
328
Robin Getz0c7a6b22008-10-08 16:27:12 +0800329 /*
330 * Save these registers, as they are only valid in exception context
331 * (where we are now - as soon as we defer to IRQ5, they can change)
332 * DCPLB_STATUS and ICPLB_STATUS are also only valid in EVT3,
333 * but they are not very interesting, so don't save them
334 */
335
Bernd Schmidt5d750b92008-04-25 05:02:33 +0800336 p4.l = lo(DCPLB_FAULT_ADDR);
337 p4.h = hi(DCPLB_FAULT_ADDR);
338 r7 = [p4];
Graf Yang6b3087c2009-01-07 23:14:39 +0800339 [p5 + PDA_DCPLB] = r7;
Bernd Schmidt5d750b92008-04-25 05:02:33 +0800340
Graf Yang6b3087c2009-01-07 23:14:39 +0800341 p4.l = lo(ICPLB_FAULT_ADDR);
342 p4.h = hi(ICPLB_FAULT_ADDR);
343 r6 = [p4];
344 [p5 + PDA_ICPLB] = r6;
Bernd Schmidt5d750b92008-04-25 05:02:33 +0800345
Bernd Schmidt5d750b92008-04-25 05:02:33 +0800346 r6 = retx;
Graf Yang6b3087c2009-01-07 23:14:39 +0800347 [p5 + PDA_RETX] = r6;
Graf Yang01b9f4b2009-07-22 11:56:24 +0000348
349 r6 = SEQSTAT;
350 [p5 + PDA_SEQSTAT] = r6;
351
Robin Getz19976602009-06-17 15:18:18 +0000352 /* Save the state of single stepping */
Bernd Schmidt0893f122008-05-07 11:41:26 +0800353 r6 = SYSCFG;
Graf Yang6b3087c2009-01-07 23:14:39 +0800354 [p5 + PDA_SYSCFG] = r6;
Robin Getz19976602009-06-17 15:18:18 +0000355 /* Clear it while we handle the exception in IRQ5 mode */
356 BITCLR(r6, SYSCFG_SSSTEP_P);
Bernd Schmidt0893f122008-05-07 11:41:26 +0800357 SYSCFG = r6;
Bernd Schmidt5d750b92008-04-25 05:02:33 +0800358
Robin Getzae4f0732009-06-22 02:02:16 +0000359 /* Save the current IMASK, since we change in order to jump to level 5 */
Bryan Wu1394f032007-05-06 14:50:22 -0700360 cli r6;
Graf Yang6b3087c2009-01-07 23:14:39 +0800361 [p5 + PDA_EXIMASK] = r6;
Bernd Schmidt0893f122008-05-07 11:41:26 +0800362
363 p4.l = lo(SAFE_USER_INSTRUCTION);
364 p4.h = hi(SAFE_USER_INSTRUCTION);
365 retx = p4;
366
Robin Getzae4f0732009-06-22 02:02:16 +0000367 /* Disable all interrupts, but make sure level 5 is enabled so
368 * we can switch to that level.
369 */
Bryan Wu1394f032007-05-06 14:50:22 -0700370 r6 = 0x3f;
371 sti r6;
372
Robin Getzae4f0732009-06-22 02:02:16 +0000373 /* In case interrupts are disabled IPEND[4] (global interrupt disable bit)
374 * clear it (re-enabling interrupts again) by the special sequence of pushing
375 * RETI onto the stack. This way we can lower ourselves to IVG5 even if the
376 * exception was taken after the interrupt handler was called but before it
377 * got a chance to enable global interrupts itself.
378 */
379 [--sp] = reti;
380 sp += 4;
381
Bryan Wu1394f032007-05-06 14:50:22 -0700382 raise 5;
Robin Getz0c7a6b22008-10-08 16:27:12 +0800383 jump.s _bfin_return_from_exception;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800384ENDPROC(_ex_trap_c)
Bryan Wu1394f032007-05-06 14:50:22 -0700385
Robin Getz2ebcade2007-10-09 17:24:30 +0800386/* We just realized we got an exception, while we were processing a different
Mike Frysinger33c86912008-11-18 17:48:22 +0800387 * exception. This is a unrecoverable event, so crash.
388 * Note: this cannot be ENTRY() as we jump here with "if cc jump" ...
Robin Getz2ebcade2007-10-09 17:24:30 +0800389 */
Robin Getz19976602009-06-17 15:18:18 +0000390ENTRY(_double_fault)
Robin Getz0c7a6b22008-10-08 16:27:12 +0800391 /* Turn caches & protection off, to ensure we don't get any more
392 * double exceptions
393 */
Robin Getz2ebcade2007-10-09 17:24:30 +0800394
Robin Getz0c7a6b22008-10-08 16:27:12 +0800395 P4.L = LO(IMEM_CONTROL);
396 P4.H = HI(IMEM_CONTROL);
Robin Getz2ebcade2007-10-09 17:24:30 +0800397
Robin Getz0c7a6b22008-10-08 16:27:12 +0800398 R5 = [P4]; /* Control Register*/
399 BITCLR(R5,ENICPLB_P);
400 SSYNC; /* SSYNC required before writing to IMEM_CONTROL. */
401 .align 8;
402 [P4] = R5;
403 SSYNC;
Robin Getz2ebcade2007-10-09 17:24:30 +0800404
Robin Getz0c7a6b22008-10-08 16:27:12 +0800405 P4.L = LO(DMEM_CONTROL);
406 P4.H = HI(DMEM_CONTROL);
407 R5 = [P4];
408 BITCLR(R5,ENDCPLB_P);
409 SSYNC; /* SSYNC required before writing to DMEM_CONTROL. */
410 .align 8;
411 [P4] = R5;
412 SSYNC;
Robin Getz2ebcade2007-10-09 17:24:30 +0800413
Robin Getz0c7a6b22008-10-08 16:27:12 +0800414 /* Fix up the stack */
415 (R7:6,P5:4) = [sp++];
416 ASTAT = [sp++];
417 SP = EX_SCRATCH_REG;
Robin Getz2ebcade2007-10-09 17:24:30 +0800418
Robin Getz0c7a6b22008-10-08 16:27:12 +0800419 /* We should be out of the exception stack, and back down into
420 * kernel or user space stack
421 */
422 SAVE_ALL_SYS
Robin Getz2ebcade2007-10-09 17:24:30 +0800423
Bernd Schmidtddb3f002008-05-07 11:41:26 +0800424 /* The dumping functions expect the return address in the RETI
425 * slot. */
426 r6 = retx;
427 [sp + PT_PC] = r6;
428
Robin Getz0c7a6b22008-10-08 16:27:12 +0800429 r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */
430 SP += -12;
431 call _double_fault_c;
432 SP += 12;
Robin Getz2ebcade2007-10-09 17:24:30 +0800433.L_double_fault_panic:
434 JUMP .L_double_fault_panic
435
436ENDPROC(_double_fault)
437
Bryan Wu1394f032007-05-06 14:50:22 -0700438ENTRY(_exception_to_level5)
439 SAVE_ALL_SYS
440
Robin Getzae4f0732009-06-22 02:02:16 +0000441 GET_PDA(p5, r7); /* Fetch current PDA */
442 r6 = [p5 + PDA_RETX];
Bernd Schmidt5d750b92008-04-25 05:02:33 +0800443 [sp + PT_PC] = r6;
444
Robin Getzae4f0732009-06-22 02:02:16 +0000445 r6 = [p5 + PDA_SYSCFG];
Bernd Schmidt0893f122008-05-07 11:41:26 +0800446 [sp + PT_SYSCFG] = r6;
447
Graf Yang01b9f4b2009-07-22 11:56:24 +0000448 r6 = [p5 + PDA_SEQSTAT]; /* Read back seqstat */
449 [sp + PT_SEQSTAT] = r6;
450
Bryan Wu1394f032007-05-06 14:50:22 -0700451 /* Restore the hardware error vector. */
Robin Getzae4f0732009-06-22 02:02:16 +0000452 r7.h = _evt_ivhw;
453 r7.l = _evt_ivhw;
Bryan Wu1394f032007-05-06 14:50:22 -0700454 p4.l = lo(EVT5);
455 p4.h = hi(EVT5);
Robin Getzae4f0732009-06-22 02:02:16 +0000456 [p4] = r7;
Bryan Wu1394f032007-05-06 14:50:22 -0700457 csync;
458
Robin Getzae4f0732009-06-22 02:02:16 +0000459#ifdef CONFIG_DEBUG_DOUBLEFAULT
460 /* Now that we have the hardware error vector programmed properly
461 * we can re-enable interrupts (IPEND[4]), so if the _trap_c causes
462 * another hardware error, we can catch it (self-nesting).
463 */
464 [--sp] = reti;
465 sp += 4;
466#endif
467
468 r7 = [p5 + PDA_EXIPEND] /* Read the IPEND from the Exception state */
469 [sp + PT_IPEND] = r7; /* Store IPEND onto the stack */
Bryan Wu1394f032007-05-06 14:50:22 -0700470
Bryan Wu1394f032007-05-06 14:50:22 -0700471 r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */
472 SP += -12;
473 call _trap_c;
474 SP += 12;
475
Robin Getzae4f0732009-06-22 02:02:16 +0000476 /* If interrupts were off during the exception (IPEND[4] = 1), turn them off
477 * before we return.
478 */
479 CC = BITTST(r7, EVT_IRPTEN_P)
480 if !CC jump 1f;
481 /* this will load a random value into the reti register - but that is OK,
482 * since we do restore it to the correct value in the 'RESTORE_ALL_SYS' macro
483 */
484 sp += -4;
485 reti = [sp++];
4861:
487 /* restore the interrupt mask (IMASK) */
488 r6 = [p5 + PDA_EXIMASK];
489 sti r6;
Robin Getz0c7a6b22008-10-08 16:27:12 +0800490
Bryan Wu1394f032007-05-06 14:50:22 -0700491 call _ret_from_exception;
492 RESTORE_ALL_SYS
493 rti;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800494ENDPROC(_exception_to_level5)
Bryan Wu1394f032007-05-06 14:50:22 -0700495
496ENTRY(_trap) /* Exception: 4th entry into system event table(supervisor mode)*/
497 /* Since the kernel stack can be anywhere, it's not guaranteed to be
498 * covered by a CPLB. Switch to an exception stack; use RETN as a
499 * scratch register (for want of a better option).
500 */
Mike Frysingerf0b5d122007-08-05 17:03:59 +0800501 EX_SCRATCH_REG = sp;
Graf Yang6b3087c2009-01-07 23:14:39 +0800502 GET_PDA_SAFE(sp);
Graf Yang01b9f4b2009-07-22 11:56:24 +0000503 sp = [sp + PDA_EXSTACK];
Bryan Wu1394f032007-05-06 14:50:22 -0700504 /* Try to deal with syscalls quickly. */
505 [--sp] = ASTAT;
Mike Frysinger80f31c82008-02-02 15:47:24 +0800506 [--sp] = (R7:6,P5:4);
Robin Getz0c7a6b22008-10-08 16:27:12 +0800507
Robin Getzb9a38992009-05-18 18:33:26 +0000508#ifdef CONFIG_EXACT_HWERR
509 /* Make sure all pending read/writes complete. This will ensure any
510 * accesses which could cause hardware errors completes, and signal
511 * the the hardware before we do something silly, like crash the
512 * kernel. We don't need to work around anomaly 05000312, since
513 * we are already atomic
514 */
515 ssync;
516#endif
517
Michael Hennerich5e9e7682008-10-09 12:31:03 +0800518#if ANOMALY_05000283 || ANOMALY_05000315
519 cc = r7 == r7;
520 p5.h = HI(CHIPID);
521 p5.l = LO(CHIPID);
522 if cc jump 1f;
523 r7.l = W[p5];
5241:
525#endif
526
Robin Getz0c7a6b22008-10-08 16:27:12 +0800527#ifdef CONFIG_DEBUG_DOUBLEFAULT
528 /*
529 * Save these registers, as they are only valid in exception context
530 * (where we are now - as soon as we defer to IRQ5, they can change)
531 * DCPLB_STATUS and ICPLB_STATUS are also only valid in EVT3,
532 * but they are not very interesting, so don't save them
533 */
534
Graf Yang6b3087c2009-01-07 23:14:39 +0800535 GET_PDA(p5, r7);
Robin Getz0c7a6b22008-10-08 16:27:12 +0800536 p4.l = lo(DCPLB_FAULT_ADDR);
537 p4.h = hi(DCPLB_FAULT_ADDR);
538 r7 = [p4];
Graf Yang01b9f4b2009-07-22 11:56:24 +0000539 [p5 + PDA_DF_DCPLB] = r7;
Robin Getz0c7a6b22008-10-08 16:27:12 +0800540
Graf Yang6b3087c2009-01-07 23:14:39 +0800541 p4.l = lo(ICPLB_FAULT_ADDR);
542 p4.h = hi(ICPLB_FAULT_ADDR);
543 r7 = [p4];
Graf Yang01b9f4b2009-07-22 11:56:24 +0000544 [p5 + PDA_DF_ICPLB] = r7;
Robin Getz0c7a6b22008-10-08 16:27:12 +0800545
Graf Yang01b9f4b2009-07-22 11:56:24 +0000546 r7 = retx;
547 [p5 + PDA_DF_RETX] = r7;
Robin Getz0c7a6b22008-10-08 16:27:12 +0800548
Bryan Wu1394f032007-05-06 14:50:22 -0700549 r7 = SEQSTAT; /* reason code is in bit 5:0 */
Graf Yang01b9f4b2009-07-22 11:56:24 +0000550 [p5 + PDA_DF_SEQSTAT] = r7;
Robin Getz0c7a6b22008-10-08 16:27:12 +0800551#else
552 r7 = SEQSTAT; /* reason code is in bit 5:0 */
553#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700554 r6.l = lo(SEQSTAT_EXCAUSE);
555 r6.h = hi(SEQSTAT_EXCAUSE);
556 r7 = r7 & r6;
Mike Frysinger1ffe6642007-08-05 17:14:04 +0800557 p5.h = _ex_table;
558 p5.l = _ex_table;
Bryan Wu1394f032007-05-06 14:50:22 -0700559 p4 = r7;
560 p5 = p5 + (p4 << 2);
561 p4 = [p5];
562 jump (p4);
563
564.Lbadsys:
565 r7 = -ENOSYS; /* signextending enough */
566 [sp + PT_R0] = r7; /* return value from system call */
567 jump .Lsyscall_really_exit;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800568ENDPROC(_trap)
Bryan Wu1394f032007-05-06 14:50:22 -0700569
570ENTRY(_kernel_execve)
571 link SIZEOF_PTREGS;
572 p0 = sp;
573 r3 = SIZEOF_PTREGS / 4;
574 r4 = 0(x);
Graf Yang6b3087c2009-01-07 23:14:39 +0800575.Lclear_regs:
Bryan Wu1394f032007-05-06 14:50:22 -0700576 [p0++] = r4;
577 r3 += -1;
578 cc = r3 == 0;
Graf Yang6b3087c2009-01-07 23:14:39 +0800579 if !cc jump .Lclear_regs (bp);
Bryan Wu1394f032007-05-06 14:50:22 -0700580
581 p0 = sp;
582 sp += -16;
583 [sp + 12] = p0;
584 call _do_execve;
585 SP += 16;
586 cc = r0 == 0;
Graf Yang6b3087c2009-01-07 23:14:39 +0800587 if ! cc jump .Lexecve_failed;
Bryan Wu1394f032007-05-06 14:50:22 -0700588 /* Success. Copy our temporary pt_regs to the top of the kernel
589 * stack and do a normal exception return.
590 */
591 r1 = sp;
592 r0 = (-KERNEL_STACK_SIZE) (x);
593 r1 = r1 & r0;
594 p2 = r1;
595 p3 = [p2];
596 r0 = KERNEL_STACK_SIZE - 4 (z);
597 p1 = r0;
598 p1 = p1 + p2;
599
600 p0 = fp;
601 r4 = [p0--];
602 r3 = SIZEOF_PTREGS / 4;
Graf Yang6b3087c2009-01-07 23:14:39 +0800603.Lcopy_regs:
Bryan Wu1394f032007-05-06 14:50:22 -0700604 r4 = [p0--];
605 [p1--] = r4;
606 r3 += -1;
607 cc = r3 == 0;
Graf Yang6b3087c2009-01-07 23:14:39 +0800608 if ! cc jump .Lcopy_regs (bp);
Bryan Wu1394f032007-05-06 14:50:22 -0700609
610 r0 = (KERNEL_STACK_SIZE - SIZEOF_PTREGS) (z);
611 p1 = r0;
612 p1 = p1 + p2;
613 sp = p1;
614 r0 = syscfg;
615 [SP + PT_SYSCFG] = r0;
616 [p3 + (TASK_THREAD + THREAD_KSP)] = sp;
617
618 RESTORE_CONTEXT;
619 rti;
Graf Yang6b3087c2009-01-07 23:14:39 +0800620.Lexecve_failed:
Bryan Wu1394f032007-05-06 14:50:22 -0700621 unlink;
622 rts;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800623ENDPROC(_kernel_execve)
Bryan Wu1394f032007-05-06 14:50:22 -0700624
625ENTRY(_system_call)
626 /* Store IPEND */
627 p2.l = lo(IPEND);
628 p2.h = hi(IPEND);
629 csync;
630 r0 = [p2];
631 [sp + PT_IPEND] = r0;
632
633 /* Store RETS for now */
634 r0 = rets;
635 [sp + PT_RESERVED] = r0;
636 /* Set the stack for the current process */
637 r7 = sp;
638 r6.l = lo(ALIGN_PAGE_MASK);
639 r6.h = hi(ALIGN_PAGE_MASK);
640 r7 = r7 & r6; /* thread_info */
641 p2 = r7;
642 p2 = [p2];
643
644 [p2+(TASK_THREAD+THREAD_KSP)] = sp;
Philippe Gerum9bd50df2009-03-04 16:52:38 +0800645#ifdef CONFIG_IPIPE
646 r0 = sp;
647 SP += -12;
648 call ___ipipe_syscall_root;
649 SP += 12;
650 cc = r0 == 1;
651 if cc jump .Lsyscall_really_exit;
652 cc = r0 == -1;
653 if cc jump .Lresume_userspace;
654 r3 = [sp + PT_R3];
655 r4 = [sp + PT_R4];
656 p0 = [sp + PT_ORIG_P0];
657#endif /* CONFIG_IPIPE */
Bryan Wu1394f032007-05-06 14:50:22 -0700658
659 /* Check the System Call */
660 r7 = __NR_syscall;
661 /* System call number is passed in P0 */
662 r6 = p0;
663 cc = r6 < r7;
664 if ! cc jump .Lbadsys;
665
666 /* are we tracing syscalls?*/
667 r7 = sp;
668 r6.l = lo(ALIGN_PAGE_MASK);
669 r6.h = hi(ALIGN_PAGE_MASK);
670 r7 = r7 & r6;
671 p2 = r7;
672 r7 = [p2+TI_FLAGS];
673 CC = BITTST(r7,TIF_SYSCALL_TRACE);
674 if CC JUMP _sys_trace;
675
676 /* Execute the appropriate system call */
677
678 p4 = p0;
679 p5.l = _sys_call_table;
680 p5.h = _sys_call_table;
681 p5 = p5 + (p4 << 2);
682 r0 = [sp + PT_R0];
683 r1 = [sp + PT_R1];
684 r2 = [sp + PT_R2];
685 p5 = [p5];
686
687 [--sp] = r5;
688 [--sp] = r4;
689 [--sp] = r3;
690 SP += -12;
691 call (p5);
692 SP += 24;
693 [sp + PT_R0] = r0;
694
695.Lresume_userspace:
696 r7 = sp;
697 r4.l = lo(ALIGN_PAGE_MASK);
698 r4.h = hi(ALIGN_PAGE_MASK);
699 r7 = r7 & r4; /* thread_info->flags */
700 p5 = r7;
701.Lresume_userspace_1:
702 /* Disable interrupts. */
703 [--sp] = reti;
704 reti = [sp++];
705
706 r7 = [p5 + TI_FLAGS];
707 r4.l = lo(_TIF_WORK_MASK);
708 r4.h = hi(_TIF_WORK_MASK);
709 r7 = r7 & r4;
710
711.Lsyscall_resched:
Philippe Gerum9bd50df2009-03-04 16:52:38 +0800712#ifdef CONFIG_IPIPE
713 cc = BITTST(r7, TIF_IRQ_SYNC);
714 if !cc jump .Lsyscall_no_irqsync;
Philippe Gerum9ea77702009-06-22 18:26:07 +0200715 /*
716 * Clear IPEND[4] manually to undo what resume_userspace_1 just did;
717 * we need this so that high priority domain interrupts may still
718 * preempt the current domain while the pipeline log is being played
719 * back.
720 */
Philippe Gerum9bd50df2009-03-04 16:52:38 +0800721 [--sp] = reti;
Philippe Gerum9ea77702009-06-22 18:26:07 +0200722 SP += 4; /* don't merge with next insn to keep the pattern obvious */
Philippe Gerum9bd50df2009-03-04 16:52:38 +0800723 SP += -12;
724 call ___ipipe_sync_root;
725 SP += 12;
726 jump .Lresume_userspace_1;
727.Lsyscall_no_irqsync:
728#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700729 cc = BITTST(r7, TIF_NEED_RESCHED);
730 if !cc jump .Lsyscall_sigpending;
731
732 /* Reenable interrupts. */
733 [--sp] = reti;
Philippe Gerum9ea77702009-06-22 18:26:07 +0200734 sp += 4;
Bryan Wu1394f032007-05-06 14:50:22 -0700735
736 SP += -12;
737 call _schedule;
738 SP += 12;
739
740 jump .Lresume_userspace_1;
741
742.Lsyscall_sigpending:
743 cc = BITTST(r7, TIF_RESTORE_SIGMASK);
744 if cc jump .Lsyscall_do_signals;
745 cc = BITTST(r7, TIF_SIGPENDING);
746 if !cc jump .Lsyscall_really_exit;
747.Lsyscall_do_signals:
748 /* Reenable interrupts. */
749 [--sp] = reti;
Philippe Gerum9ea77702009-06-22 18:26:07 +0200750 sp += 4;
Bryan Wu1394f032007-05-06 14:50:22 -0700751
752 r0 = sp;
753 SP += -12;
754 call _do_signal;
755 SP += 12;
756
757.Lsyscall_really_exit:
758 r5 = [sp + PT_RESERVED];
759 rets = r5;
760 rts;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800761ENDPROC(_system_call)
Bryan Wu1394f032007-05-06 14:50:22 -0700762
Mike Frysinger47664c12008-10-09 15:32:18 +0800763/* Do not mark as ENTRY() to avoid error in assembler ...
764 * this symbol need not be global anyways, so ...
765 */
Bryan Wu1394f032007-05-06 14:50:22 -0700766_sys_trace:
767 call _syscall_trace;
768
769 /* Execute the appropriate system call */
770
771 p4 = [SP + PT_P0];
772 p5.l = _sys_call_table;
773 p5.h = _sys_call_table;
774 p5 = p5 + (p4 << 2);
775 r0 = [sp + PT_R0];
776 r1 = [sp + PT_R1];
777 r2 = [sp + PT_R2];
778 r3 = [sp + PT_R3];
779 r4 = [sp + PT_R4];
780 r5 = [sp + PT_R5];
781 p5 = [p5];
782
783 [--sp] = r5;
784 [--sp] = r4;
785 [--sp] = r3;
786 SP += -12;
787 call (p5);
788 SP += 24;
789 [sp + PT_R0] = r0;
790
791 call _syscall_trace;
792 jump .Lresume_userspace;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800793ENDPROC(_sys_trace)
Bryan Wu1394f032007-05-06 14:50:22 -0700794
795ENTRY(_resume)
796 /*
797 * Beware - when entering resume, prev (the current task) is
798 * in r0, next (the new task) is in r1.
799 */
800 p0 = r0;
801 p1 = r1;
802 [--sp] = rets;
803 [--sp] = fp;
804 [--sp] = (r7:4, p5:3);
805
806 /* save usp */
807 p2 = usp;
808 [p0+(TASK_THREAD+THREAD_USP)] = p2;
809
810 /* save current kernel stack pointer */
811 [p0+(TASK_THREAD+THREAD_KSP)] = sp;
812
813 /* save program counter */
814 r1.l = _new_old_task;
815 r1.h = _new_old_task;
816 [p0+(TASK_THREAD+THREAD_PC)] = r1;
817
818 /* restore the kernel stack pointer */
819 sp = [p1+(TASK_THREAD+THREAD_KSP)];
820
821 /* restore user stack pointer */
822 p0 = [p1+(TASK_THREAD+THREAD_USP)];
823 usp = p0;
824
825 /* restore pc */
826 p0 = [p1+(TASK_THREAD+THREAD_PC)];
827 jump (p0);
828
829 /*
830 * Following code actually lands up in a new (old) task.
831 */
832
833_new_old_task:
834 (r7:4, p5:3) = [sp++];
835 fp = [sp++];
836 rets = [sp++];
837
838 /*
839 * When we come out of resume, r0 carries "old" task, becuase we are
840 * in "new" task.
841 */
842 rts;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800843ENDPROC(_resume)
Bryan Wu1394f032007-05-06 14:50:22 -0700844
845ENTRY(_ret_from_exception)
Philippe Gerum9bd50df2009-03-04 16:52:38 +0800846#ifdef CONFIG_IPIPE
Philippe Gerumf4e12932009-06-22 18:26:22 +0200847 p2.l = _per_cpu__ipipe_percpu_domain;
848 p2.h = _per_cpu__ipipe_percpu_domain;
849 r0.l = _ipipe_root;
850 r0.h = _ipipe_root;
851 r2 = [p2];
852 cc = r0 == r2;
853 if !cc jump 4f; /* not on behalf of the root domain, get out */
Philippe Gerum9bd50df2009-03-04 16:52:38 +0800854#endif /* CONFIG_IPIPE */
Bryan Wu1394f032007-05-06 14:50:22 -0700855 p2.l = lo(IPEND);
856 p2.h = hi(IPEND);
857
858 csync;
859 r0 = [p2];
860 [sp + PT_IPEND] = r0;
861
8621:
Robin Getzd5c4b5e2007-12-21 17:49:53 +0800863 r2 = LO(~0x37) (Z);
Bryan Wu1394f032007-05-06 14:50:22 -0700864 r0 = r2 & r0;
865 cc = r0 == 0;
866 if !cc jump 4f; /* if not return to user mode, get out */
867
868 /* Make sure any pending system call or deferred exception
869 * return in ILAT for this process to get executed, otherwise
870 * in case context switch happens, system call of
871 * first process (i.e in ILAT) will be carried
872 * forward to the switched process
873 */
874
875 p2.l = lo(ILAT);
876 p2.h = hi(ILAT);
877 r0 = [p2];
878 r1 = (EVT_IVG14 | EVT_IVG15) (z);
879 r0 = r0 & r1;
880 cc = r0 == 0;
881 if !cc jump 5f;
882
883 /* Set the stack for the current process */
884 r7 = sp;
885 r4.l = lo(ALIGN_PAGE_MASK);
886 r4.h = hi(ALIGN_PAGE_MASK);
887 r7 = r7 & r4; /* thread_info->flags */
888 p5 = r7;
889 r7 = [p5 + TI_FLAGS];
890 r4.l = lo(_TIF_WORK_MASK);
891 r4.h = hi(_TIF_WORK_MASK);
892 r7 = r7 & r4;
893 cc = r7 == 0;
894 if cc jump 4f;
895
896 p0.l = lo(EVT15);
897 p0.h = hi(EVT15);
898 p1.l = _schedule_and_signal;
899 p1.h = _schedule_and_signal;
900 [p0] = p1;
901 csync;
Robin Getzb9a38992009-05-18 18:33:26 +0000902 raise 15; /* raise evt15 to do signal or reschedule */
Bryan Wu1394f032007-05-06 14:50:22 -07009034:
904 r0 = syscfg;
Robin Getz19976602009-06-17 15:18:18 +0000905 bitclr(r0, SYSCFG_SSSTEP_P); /* Turn off single step */
Bryan Wu1394f032007-05-06 14:50:22 -0700906 syscfg = r0;
9075:
908 rts;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800909ENDPROC(_ret_from_exception)
Bryan Wu1394f032007-05-06 14:50:22 -0700910
Philippe Gerum9bd50df2009-03-04 16:52:38 +0800911#ifdef CONFIG_IPIPE
912
Philippe Gerum9bd50df2009-03-04 16:52:38 +0800913_resume_kernel_from_int:
Philippe Gerum9ea77702009-06-22 18:26:07 +0200914 r0.l = ___ipipe_sync_root;
915 r0.h = ___ipipe_sync_root;
Philippe Gerum9bd50df2009-03-04 16:52:38 +0800916 [--sp] = rets;
917 [--sp] = ( r7:4, p5:3 );
918 SP += -12;
919 call ___ipipe_call_irqtail
920 SP += 12;
921 ( r7:4, p5:3 ) = [sp++];
922 rets = [sp++];
923 rts
924#else
925#define _resume_kernel_from_int 2f
926#endif
927
Bryan Wu1394f032007-05-06 14:50:22 -0700928ENTRY(_return_from_int)
929 /* If someone else already raised IRQ 15, do nothing. */
930 csync;
931 p2.l = lo(ILAT);
932 p2.h = hi(ILAT);
933 r0 = [p2];
934 cc = bittst (r0, EVT_IVG15_P);
935 if cc jump 2f;
936
937 /* if not return to user mode, get out */
938 p2.l = lo(IPEND);
939 p2.h = hi(IPEND);
940 r0 = [p2];
941 r1 = 0x17(Z);
942 r2 = ~r1;
943 r2.h = 0;
944 r0 = r2 & r0;
945 r1 = 1;
946 r1 = r0 - r1;
947 r2 = r0 & r1;
948 cc = r2 == 0;
Philippe Gerum9bd50df2009-03-04 16:52:38 +0800949 if !cc jump _resume_kernel_from_int;
Bryan Wu1394f032007-05-06 14:50:22 -0700950
951 /* Lower the interrupt level to 15. */
952 p0.l = lo(EVT15);
953 p0.h = hi(EVT15);
954 p1.l = _schedule_and_signal_from_int;
955 p1.h = _schedule_and_signal_from_int;
956 [p0] = p1;
957 csync;
Robin Getzb9a38992009-05-18 18:33:26 +0000958#if ANOMALY_05000281 || ANOMALY_05000461
Bernd Schmidt5d750b92008-04-25 05:02:33 +0800959 r0.l = lo(SAFE_USER_INSTRUCTION);
960 r0.h = hi(SAFE_USER_INSTRUCTION);
Bryan Wu1394f032007-05-06 14:50:22 -0700961 reti = r0;
962#endif
963 r0 = 0x801f (z);
964 STI r0;
965 raise 15; /* raise evt15 to do signal or reschedule */
966 rti;
9672:
968 rts;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800969ENDPROC(_return_from_int)
Bryan Wu1394f032007-05-06 14:50:22 -0700970
971ENTRY(_lower_to_irq14)
Robin Getzb9a38992009-05-18 18:33:26 +0000972#if ANOMALY_05000281 || ANOMALY_05000461
Bernd Schmidt5d750b92008-04-25 05:02:33 +0800973 r0.l = lo(SAFE_USER_INSTRUCTION);
974 r0.h = hi(SAFE_USER_INSTRUCTION);
Bryan Wu1394f032007-05-06 14:50:22 -0700975 reti = r0;
976#endif
Robin Getzb9a38992009-05-18 18:33:26 +0000977
978#ifdef CONFIG_DEBUG_HWERR
Philippe Gerum9703a732009-06-22 18:23:48 +0200979 /* enable irq14 & hwerr interrupt, until we transition to _evt_evt14 */
Robin Getzb9a38992009-05-18 18:33:26 +0000980 r0 = (EVT_IVG14 | EVT_IVHW | EVT_IRPTEN | EVT_EVX | EVT_NMI | EVT_RST | EVT_EMU);
981#else
Philippe Gerum9703a732009-06-22 18:23:48 +0200982 /* Only enable irq14 interrupt, until we transition to _evt_evt14 */
Robin Getzb9a38992009-05-18 18:33:26 +0000983 r0 = (EVT_IVG14 | EVT_IRPTEN | EVT_EVX | EVT_NMI | EVT_RST | EVT_EMU);
984#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700985 sti r0;
986 raise 14;
987 rti;
Robin Getzb9a38992009-05-18 18:33:26 +0000988ENDPROC(_lower_to_irq14)
989
Philippe Gerum9703a732009-06-22 18:23:48 +0200990ENTRY(_evt_evt14)
Bryan Wu1394f032007-05-06 14:50:22 -0700991#ifdef CONFIG_DEBUG_HWERR
Robin Getzb9a38992009-05-18 18:33:26 +0000992 r0 = (EVT_IVHW | EVT_IRPTEN | EVT_EVX | EVT_NMI | EVT_RST | EVT_EMU);
Bryan Wu1394f032007-05-06 14:50:22 -0700993 sti r0;
994#else
995 cli r0;
996#endif
997 [--sp] = RETI;
998 SP += 4;
999 rts;
Philippe Gerum9703a732009-06-22 18:23:48 +02001000ENDPROC(_evt_evt14)
Bryan Wu1394f032007-05-06 14:50:22 -07001001
Robin Getzb9a38992009-05-18 18:33:26 +00001002ENTRY(_schedule_and_signal_from_int)
Bryan Wu1394f032007-05-06 14:50:22 -07001003 /* To end up here, vector 15 was changed - so we have to change it
1004 * back.
1005 */
1006 p0.l = lo(EVT15);
1007 p0.h = hi(EVT15);
1008 p1.l = _evt_system_call;
1009 p1.h = _evt_system_call;
1010 [p0] = p1;
1011 csync;
Bernd Schmidtc8244982007-05-21 18:09:33 +08001012
1013 /* Set orig_p0 to -1 to indicate this isn't the end of a syscall. */
1014 r0 = -1 (x);
1015 [sp + PT_ORIG_P0] = r0;
1016
Bryan Wu1394f032007-05-06 14:50:22 -07001017 p1 = rets;
1018 [sp + PT_RESERVED] = p1;
1019
Graf Yang6b3087c2009-01-07 23:14:39 +08001020#ifdef CONFIG_SMP
1021 GET_PDA(p0, r0); /* Fetch current PDA (can't migrate to other CPU here) */
1022 r0 = [p0 + PDA_IRQFLAGS];
1023#else
Mike Frysinger40059782008-11-18 17:48:22 +08001024 p0.l = _bfin_irq_flags;
1025 p0.h = _bfin_irq_flags;
Bryan Wu1394f032007-05-06 14:50:22 -07001026 r0 = [p0];
Graf Yang6b3087c2009-01-07 23:14:39 +08001027#endif
Bryan Wu1394f032007-05-06 14:50:22 -07001028 sti r0;
1029
Bernd Schmidt7adfb582007-06-21 11:34:16 +08001030 r0 = sp;
1031 sp += -12;
1032 call _finish_atomic_sections;
1033 sp += 12;
Bryan Wu1394f032007-05-06 14:50:22 -07001034 jump.s .Lresume_userspace;
Robin Getzb9a38992009-05-18 18:33:26 +00001035ENDPROC(_schedule_and_signal_from_int)
Bryan Wu1394f032007-05-06 14:50:22 -07001036
Robin Getzb9a38992009-05-18 18:33:26 +00001037ENTRY(_schedule_and_signal)
Bryan Wu1394f032007-05-06 14:50:22 -07001038 SAVE_CONTEXT_SYSCALL
1039 /* To end up here, vector 15 was changed - so we have to change it
1040 * back.
1041 */
1042 p0.l = lo(EVT15);
1043 p0.h = hi(EVT15);
1044 p1.l = _evt_system_call;
1045 p1.h = _evt_system_call;
1046 [p0] = p1;
1047 csync;
1048 p0.l = 1f;
1049 p0.h = 1f;
1050 [sp + PT_RESERVED] = P0;
1051 call .Lresume_userspace;
10521:
1053 RESTORE_CONTEXT
1054 rti;
Robin Getzb9a38992009-05-18 18:33:26 +00001055ENDPROC(_schedule_and_signal)
Bryan Wu1394f032007-05-06 14:50:22 -07001056
Robin Getz518039b2007-07-25 11:03:28 +08001057/* We handle this 100% in exception space - to reduce overhead
1058 * Only potiential problem is if the software buffer gets swapped out of the
1059 * CPLB table - then double fault. - so we don't let this happen in other places
1060 */
1061#ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
1062ENTRY(_ex_trace_buff_full)
1063 [--sp] = P3;
1064 [--sp] = P2;
1065 [--sp] = LC0;
1066 [--sp] = LT0;
1067 [--sp] = LB0;
1068 P5.L = _trace_buff_offset;
1069 P5.H = _trace_buff_offset;
1070 P3 = [P5]; /* trace_buff_offset */
1071 P5.L = lo(TBUFSTAT);
1072 P5.H = hi(TBUFSTAT);
1073 R7 = [P5];
1074 R7 <<= 1; /* double, since we need to read twice */
1075 LC0 = R7;
1076 R7 <<= 2; /* need to shift over again,
1077 * to get the number of bytes */
1078 P5.L = lo(TBUF);
1079 P5.H = hi(TBUF);
1080 R6 = ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN)*1024) - 1;
1081
1082 P2 = R7;
1083 P3 = P3 + P2;
1084 R7 = P3;
1085 R7 = R7 & R6;
1086 P3 = R7;
1087 P2.L = _trace_buff_offset;
1088 P2.H = _trace_buff_offset;
1089 [P2] = P3;
1090
1091 P2.L = _software_trace_buff;
1092 P2.H = _software_trace_buff;
1093
1094 LSETUP (.Lstart, .Lend) LC0;
1095.Lstart:
1096 R7 = [P5]; /* read TBUF */
1097 P4 = P3 + P2;
1098 [P4] = R7;
1099 P3 += -4;
1100 R7 = P3;
1101 R7 = R7 & R6;
1102.Lend:
1103 P3 = R7;
1104
1105 LB0 = [sp++];
1106 LT0 = [sp++];
1107 LC0 = [sp++];
1108 P2 = [sp++];
1109 P3 = [sp++];
Mike Frysinger8d6c2422007-11-21 15:53:49 +08001110 jump _bfin_return_from_exception;
Robin Getz337d3902007-10-09 17:31:46 +08001111ENDPROC(_ex_trace_buff_full)
Robin Getz518039b2007-07-25 11:03:28 +08001112
1113#if CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN == 4
1114.data
1115#else
1116.section .l1.data.B
Robin Getz337d3902007-10-09 17:31:46 +08001117#endif /* CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN */
Robin Getz518039b2007-07-25 11:03:28 +08001118ENTRY(_trace_buff_offset)
1119 .long 0;
1120ALIGN
1121ENTRY(_software_trace_buff)
1122 .rept ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN)*256);
1123 .long 0
1124 .endr
Robin Getz337d3902007-10-09 17:31:46 +08001125#endif /* CONFIG_DEBUG_BFIN_HWTRACE_EXPAND */
1126
1127#if CONFIG_EARLY_PRINTK
Mike Frysinger9cb07b22007-11-21 16:45:08 +08001128__INIT
Robin Getz337d3902007-10-09 17:31:46 +08001129ENTRY(_early_trap)
1130 SAVE_ALL_SYS
1131 trace_buffer_stop(p0,r0);
1132
Michael Hennerich5e9e7682008-10-09 12:31:03 +08001133#if ANOMALY_05000283 || ANOMALY_05000315
1134 cc = r5 == r5;
1135 p4.h = HI(CHIPID);
1136 p4.l = LO(CHIPID);
1137 if cc jump 1f;
1138 r5.l = W[p4];
11391:
1140#endif
1141
Robin Getz337d3902007-10-09 17:31:46 +08001142 /* Turn caches off, to ensure we don't get double exceptions */
1143
1144 P4.L = LO(IMEM_CONTROL);
1145 P4.H = HI(IMEM_CONTROL);
1146
1147 R5 = [P4]; /* Control Register*/
1148 BITCLR(R5,ENICPLB_P);
1149 CLI R1;
1150 SSYNC; /* SSYNC required before writing to IMEM_CONTROL. */
1151 .align 8;
1152 [P4] = R5;
1153 SSYNC;
1154
1155 P4.L = LO(DMEM_CONTROL);
1156 P4.H = HI(DMEM_CONTROL);
1157 R5 = [P4];
1158 BITCLR(R5,ENDCPLB_P);
1159 SSYNC; /* SSYNC required before writing to DMEM_CONTROL. */
1160 .align 8;
1161 [P4] = R5;
1162 SSYNC;
1163 STI R1;
1164
1165 r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */
1166 r1 = RETX;
1167
1168 SP += -12;
1169 call _early_trap_c;
1170 SP += 12;
1171ENDPROC(_early_trap)
Mike Frysinger9cb07b22007-11-21 16:45:08 +08001172__FINIT
Robin Getz337d3902007-10-09 17:31:46 +08001173#endif /* CONFIG_EARLY_PRINTK */
Robin Getz518039b2007-07-25 11:03:28 +08001174
Bryan Wu1394f032007-05-06 14:50:22 -07001175/*
1176 * Put these in the kernel data section - that should always be covered by
1177 * a CPLB. This is needed to ensure we don't get double fault conditions
1178 */
1179
1180#ifdef CONFIG_SYSCALL_TAB_L1
1181.section .l1.data
1182#else
1183.data
1184#endif
Robin Getzf26fbc42007-11-12 22:21:30 +08001185
Mike Frysinger1ffe6642007-08-05 17:14:04 +08001186ENTRY(_ex_table)
Bryan Wu1394f032007-05-06 14:50:22 -07001187 /* entry for each EXCAUSE[5:0]
Mike Frysinger9401e612007-07-12 11:50:43 +08001188 * This table must be in sync with the table in ./kernel/traps.c
Bryan Wu1394f032007-05-06 14:50:22 -07001189 * EXCPT instruction can provide 4 bits of EXCAUSE, allowing 16 to be user defined
1190 */
Mike Frysinger1ffe6642007-08-05 17:14:04 +08001191 .long _ex_syscall /* 0x00 - User Defined - Linux Syscall */
Jie Zhang3aee91b2009-02-04 16:49:45 +08001192 .long _ex_trap_c /* 0x01 - User Defined - Software breakpoint */
Sonic Zhanga5ac0122008-10-13 14:07:19 +08001193#ifdef CONFIG_KGDB
1194 .long _ex_trap_c /* 0x02 - User Defined - KGDB initial connection
1195 and break signal trap */
1196#else
Mike Frysinger1ffe6642007-08-05 17:14:04 +08001197 .long _ex_replaceable /* 0x02 - User Defined */
Sonic Zhanga5ac0122008-10-13 14:07:19 +08001198#endif
Mike Frysinger9401e612007-07-12 11:50:43 +08001199 .long _ex_trap_c /* 0x03 - User Defined - userspace stack overflow */
Robin Getz9f336a52007-10-29 18:23:28 +08001200 .long _ex_trap_c /* 0x04 - User Defined - dump trace buffer */
Mike Frysinger1ffe6642007-08-05 17:14:04 +08001201 .long _ex_replaceable /* 0x05 - User Defined */
1202 .long _ex_replaceable /* 0x06 - User Defined */
1203 .long _ex_replaceable /* 0x07 - User Defined */
1204 .long _ex_replaceable /* 0x08 - User Defined */
1205 .long _ex_replaceable /* 0x09 - User Defined */
1206 .long _ex_replaceable /* 0x0A - User Defined */
1207 .long _ex_replaceable /* 0x0B - User Defined */
1208 .long _ex_replaceable /* 0x0C - User Defined */
1209 .long _ex_replaceable /* 0x0D - User Defined */
1210 .long _ex_replaceable /* 0x0E - User Defined */
1211 .long _ex_replaceable /* 0x0F - User Defined */
Bryan Wu1394f032007-05-06 14:50:22 -07001212 .long _ex_single_step /* 0x10 - HW Single step */
Robin Getz518039b2007-07-25 11:03:28 +08001213#ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
1214 .long _ex_trace_buff_full /* 0x11 - Trace Buffer Full */
1215#else
Bryan Wu1394f032007-05-06 14:50:22 -07001216 .long _ex_trap_c /* 0x11 - Trace Buffer Full */
Robin Getz518039b2007-07-25 11:03:28 +08001217#endif
Bryan Wu1394f032007-05-06 14:50:22 -07001218 .long _ex_trap_c /* 0x12 - Reserved */
1219 .long _ex_trap_c /* 0x13 - Reserved */
1220 .long _ex_trap_c /* 0x14 - Reserved */
1221 .long _ex_trap_c /* 0x15 - Reserved */
1222 .long _ex_trap_c /* 0x16 - Reserved */
1223 .long _ex_trap_c /* 0x17 - Reserved */
1224 .long _ex_trap_c /* 0x18 - Reserved */
1225 .long _ex_trap_c /* 0x19 - Reserved */
1226 .long _ex_trap_c /* 0x1A - Reserved */
1227 .long _ex_trap_c /* 0x1B - Reserved */
1228 .long _ex_trap_c /* 0x1C - Reserved */
1229 .long _ex_trap_c /* 0x1D - Reserved */
1230 .long _ex_trap_c /* 0x1E - Reserved */
1231 .long _ex_trap_c /* 0x1F - Reserved */
1232 .long _ex_trap_c /* 0x20 - Reserved */
1233 .long _ex_trap_c /* 0x21 - Undefined Instruction */
1234 .long _ex_trap_c /* 0x22 - Illegal Instruction Combination */
Robin Getzf26fbc42007-11-12 22:21:30 +08001235 .long _ex_dviol /* 0x23 - Data CPLB Protection Violation */
Bryan Wu1394f032007-05-06 14:50:22 -07001236 .long _ex_trap_c /* 0x24 - Data access misaligned */
1237 .long _ex_trap_c /* 0x25 - Unrecoverable Event */
Robin Getzf26fbc42007-11-12 22:21:30 +08001238 .long _ex_dmiss /* 0x26 - Data CPLB Miss */
1239 .long _ex_dmult /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero */
Bryan Wu1394f032007-05-06 14:50:22 -07001240 .long _ex_trap_c /* 0x28 - Emulation Watchpoint */
1241 .long _ex_trap_c /* 0x29 - Instruction fetch access error (535 only) */
1242 .long _ex_trap_c /* 0x2A - Instruction fetch misaligned */
Robin Getzf26fbc42007-11-12 22:21:30 +08001243 .long _ex_trap_c /* 0x2B - Instruction CPLB protection Violation */
1244 .long _ex_icplb_miss /* 0x2C - Instruction CPLB miss */
Bryan Wu1394f032007-05-06 14:50:22 -07001245 .long _ex_trap_c /* 0x2D - Instruction CPLB Multiple Hits */
1246 .long _ex_trap_c /* 0x2E - Illegal use of Supervisor Resource */
1247 .long _ex_trap_c /* 0x2E - Illegal use of Supervisor Resource */
1248 .long _ex_trap_c /* 0x2F - Reserved */
1249 .long _ex_trap_c /* 0x30 - Reserved */
1250 .long _ex_trap_c /* 0x31 - Reserved */
1251 .long _ex_trap_c /* 0x32 - Reserved */
1252 .long _ex_trap_c /* 0x33 - Reserved */
1253 .long _ex_trap_c /* 0x34 - Reserved */
1254 .long _ex_trap_c /* 0x35 - Reserved */
1255 .long _ex_trap_c /* 0x36 - Reserved */
1256 .long _ex_trap_c /* 0x37 - Reserved */
1257 .long _ex_trap_c /* 0x38 - Reserved */
1258 .long _ex_trap_c /* 0x39 - Reserved */
1259 .long _ex_trap_c /* 0x3A - Reserved */
1260 .long _ex_trap_c /* 0x3B - Reserved */
1261 .long _ex_trap_c /* 0x3C - Reserved */
1262 .long _ex_trap_c /* 0x3D - Reserved */
1263 .long _ex_trap_c /* 0x3E - Reserved */
1264 .long _ex_trap_c /* 0x3F - Reserved */
Mike Frysinger1ffe6642007-08-05 17:14:04 +08001265END(_ex_table)
Bryan Wu1394f032007-05-06 14:50:22 -07001266
Bryan Wu1394f032007-05-06 14:50:22 -07001267ENTRY(_sys_call_table)
Bryan Wu0b95f222007-09-23 00:51:32 +08001268 .long _sys_restart_syscall /* 0 */
Bryan Wu1394f032007-05-06 14:50:22 -07001269 .long _sys_exit
1270 .long _sys_fork
1271 .long _sys_read
1272 .long _sys_write
1273 .long _sys_open /* 5 */
1274 .long _sys_close
1275 .long _sys_ni_syscall /* old waitpid */
1276 .long _sys_creat
1277 .long _sys_link
1278 .long _sys_unlink /* 10 */
1279 .long _sys_execve
1280 .long _sys_chdir
1281 .long _sys_time
1282 .long _sys_mknod
1283 .long _sys_chmod /* 15 */
1284 .long _sys_chown /* chown16 */
1285 .long _sys_ni_syscall /* old break syscall holder */
1286 .long _sys_ni_syscall /* old stat */
1287 .long _sys_lseek
1288 .long _sys_getpid /* 20 */
1289 .long _sys_mount
1290 .long _sys_ni_syscall /* old umount */
1291 .long _sys_setuid
1292 .long _sys_getuid
1293 .long _sys_stime /* 25 */
1294 .long _sys_ptrace
1295 .long _sys_alarm
1296 .long _sys_ni_syscall /* old fstat */
1297 .long _sys_pause
1298 .long _sys_ni_syscall /* old utime */ /* 30 */
1299 .long _sys_ni_syscall /* old stty syscall holder */
1300 .long _sys_ni_syscall /* old gtty syscall holder */
1301 .long _sys_access
1302 .long _sys_nice
1303 .long _sys_ni_syscall /* 35 */ /* old ftime syscall holder */
1304 .long _sys_sync
1305 .long _sys_kill
1306 .long _sys_rename
1307 .long _sys_mkdir
1308 .long _sys_rmdir /* 40 */
1309 .long _sys_dup
1310 .long _sys_pipe
1311 .long _sys_times
1312 .long _sys_ni_syscall /* old prof syscall holder */
1313 .long _sys_brk /* 45 */
1314 .long _sys_setgid
1315 .long _sys_getgid
1316 .long _sys_ni_syscall /* old sys_signal */
1317 .long _sys_geteuid /* geteuid16 */
1318 .long _sys_getegid /* getegid16 */ /* 50 */
1319 .long _sys_acct
1320 .long _sys_umount /* recycled never used phys() */
1321 .long _sys_ni_syscall /* old lock syscall holder */
1322 .long _sys_ioctl
1323 .long _sys_fcntl /* 55 */
1324 .long _sys_ni_syscall /* old mpx syscall holder */
1325 .long _sys_setpgid
1326 .long _sys_ni_syscall /* old ulimit syscall holder */
1327 .long _sys_ni_syscall /* old old uname */
1328 .long _sys_umask /* 60 */
1329 .long _sys_chroot
1330 .long _sys_ustat
1331 .long _sys_dup2
1332 .long _sys_getppid
1333 .long _sys_getpgrp /* 65 */
1334 .long _sys_setsid
1335 .long _sys_ni_syscall /* old sys_sigaction */
1336 .long _sys_sgetmask
1337 .long _sys_ssetmask
1338 .long _sys_setreuid /* setreuid16 */ /* 70 */
1339 .long _sys_setregid /* setregid16 */
1340 .long _sys_ni_syscall /* old sys_sigsuspend */
1341 .long _sys_ni_syscall /* old sys_sigpending */
1342 .long _sys_sethostname
1343 .long _sys_setrlimit /* 75 */
1344 .long _sys_ni_syscall /* old getrlimit */
1345 .long _sys_getrusage
1346 .long _sys_gettimeofday
1347 .long _sys_settimeofday
1348 .long _sys_getgroups /* getgroups16 */ /* 80 */
1349 .long _sys_setgroups /* setgroups16 */
1350 .long _sys_ni_syscall /* old_select */
1351 .long _sys_symlink
1352 .long _sys_ni_syscall /* old lstat */
1353 .long _sys_readlink /* 85 */
1354 .long _sys_uselib
1355 .long _sys_ni_syscall /* sys_swapon */
1356 .long _sys_reboot
1357 .long _sys_ni_syscall /* old_readdir */
1358 .long _sys_ni_syscall /* sys_mmap */ /* 90 */
1359 .long _sys_munmap
1360 .long _sys_truncate
1361 .long _sys_ftruncate
1362 .long _sys_fchmod
1363 .long _sys_fchown /* fchown16 */ /* 95 */
1364 .long _sys_getpriority
1365 .long _sys_setpriority
1366 .long _sys_ni_syscall /* old profil syscall holder */
1367 .long _sys_statfs
1368 .long _sys_fstatfs /* 100 */
1369 .long _sys_ni_syscall
1370 .long _sys_ni_syscall /* old sys_socketcall */
1371 .long _sys_syslog
1372 .long _sys_setitimer
1373 .long _sys_getitimer /* 105 */
1374 .long _sys_newstat
1375 .long _sys_newlstat
1376 .long _sys_newfstat
1377 .long _sys_ni_syscall /* old uname */
1378 .long _sys_ni_syscall /* iopl for i386 */ /* 110 */
1379 .long _sys_vhangup
1380 .long _sys_ni_syscall /* obsolete idle() syscall */
1381 .long _sys_ni_syscall /* vm86old for i386 */
1382 .long _sys_wait4
1383 .long _sys_ni_syscall /* 115 */ /* sys_swapoff */
1384 .long _sys_sysinfo
1385 .long _sys_ni_syscall /* old sys_ipc */
1386 .long _sys_fsync
1387 .long _sys_ni_syscall /* old sys_sigreturn */
1388 .long _sys_clone /* 120 */
1389 .long _sys_setdomainname
1390 .long _sys_newuname
1391 .long _sys_ni_syscall /* old sys_modify_ldt */
1392 .long _sys_adjtimex
1393 .long _sys_ni_syscall /* 125 */ /* sys_mprotect */
1394 .long _sys_ni_syscall /* old sys_sigprocmask */
1395 .long _sys_ni_syscall /* old "creat_module" */
1396 .long _sys_init_module
1397 .long _sys_delete_module
1398 .long _sys_ni_syscall /* 130: old "get_kernel_syms" */
1399 .long _sys_quotactl
1400 .long _sys_getpgid
1401 .long _sys_fchdir
1402 .long _sys_bdflush
1403 .long _sys_ni_syscall /* 135 */ /* sys_sysfs */
1404 .long _sys_personality
1405 .long _sys_ni_syscall /* for afs_syscall */
1406 .long _sys_setfsuid /* setfsuid16 */
1407 .long _sys_setfsgid /* setfsgid16 */
1408 .long _sys_llseek /* 140 */
1409 .long _sys_getdents
1410 .long _sys_ni_syscall /* sys_select */
1411 .long _sys_flock
1412 .long _sys_ni_syscall /* sys_msync */
1413 .long _sys_readv /* 145 */
1414 .long _sys_writev
1415 .long _sys_getsid
1416 .long _sys_fdatasync
1417 .long _sys_sysctl
1418 .long _sys_ni_syscall /* 150 */ /* sys_mlock */
1419 .long _sys_ni_syscall /* sys_munlock */
1420 .long _sys_ni_syscall /* sys_mlockall */
1421 .long _sys_ni_syscall /* sys_munlockall */
1422 .long _sys_sched_setparam
1423 .long _sys_sched_getparam /* 155 */
1424 .long _sys_sched_setscheduler
1425 .long _sys_sched_getscheduler
1426 .long _sys_sched_yield
1427 .long _sys_sched_get_priority_max
1428 .long _sys_sched_get_priority_min /* 160 */
1429 .long _sys_sched_rr_get_interval
1430 .long _sys_nanosleep
Bryan Wu0b95f222007-09-23 00:51:32 +08001431 .long _sys_mremap
Bryan Wu1394f032007-05-06 14:50:22 -07001432 .long _sys_setresuid /* setresuid16 */
1433 .long _sys_getresuid /* getresuid16 */ /* 165 */
1434 .long _sys_ni_syscall /* for vm86 */
1435 .long _sys_ni_syscall /* old "query_module" */
1436 .long _sys_ni_syscall /* sys_poll */
Bryan Wu0b95f222007-09-23 00:51:32 +08001437 .long _sys_nfsservctl
Bryan Wu1394f032007-05-06 14:50:22 -07001438 .long _sys_setresgid /* setresgid16 */ /* 170 */
1439 .long _sys_getresgid /* getresgid16 */
1440 .long _sys_prctl
1441 .long _sys_rt_sigreturn
1442 .long _sys_rt_sigaction
1443 .long _sys_rt_sigprocmask /* 175 */
1444 .long _sys_rt_sigpending
1445 .long _sys_rt_sigtimedwait
1446 .long _sys_rt_sigqueueinfo
1447 .long _sys_rt_sigsuspend
1448 .long _sys_pread64 /* 180 */
1449 .long _sys_pwrite64
1450 .long _sys_lchown /* lchown16 */
1451 .long _sys_getcwd
1452 .long _sys_capget
1453 .long _sys_capset /* 185 */
1454 .long _sys_sigaltstack
1455 .long _sys_sendfile
1456 .long _sys_ni_syscall /* streams1 */
1457 .long _sys_ni_syscall /* streams2 */
1458 .long _sys_vfork /* 190 */
1459 .long _sys_getrlimit
1460 .long _sys_mmap2
1461 .long _sys_truncate64
1462 .long _sys_ftruncate64
1463 .long _sys_stat64 /* 195 */
1464 .long _sys_lstat64
1465 .long _sys_fstat64
1466 .long _sys_chown
1467 .long _sys_getuid
1468 .long _sys_getgid /* 200 */
1469 .long _sys_geteuid
1470 .long _sys_getegid
1471 .long _sys_setreuid
1472 .long _sys_setregid
1473 .long _sys_getgroups /* 205 */
1474 .long _sys_setgroups
1475 .long _sys_fchown
1476 .long _sys_setresuid
1477 .long _sys_getresuid
1478 .long _sys_setresgid /* 210 */
1479 .long _sys_getresgid
1480 .long _sys_lchown
1481 .long _sys_setuid
1482 .long _sys_setgid
1483 .long _sys_setfsuid /* 215 */
1484 .long _sys_setfsgid
1485 .long _sys_pivot_root
1486 .long _sys_ni_syscall /* sys_mincore */
1487 .long _sys_ni_syscall /* sys_madvise */
1488 .long _sys_getdents64 /* 220 */
1489 .long _sys_fcntl64
1490 .long _sys_ni_syscall /* reserved for TUX */
1491 .long _sys_ni_syscall
1492 .long _sys_gettid
Bryan Wu0b95f222007-09-23 00:51:32 +08001493 .long _sys_readahead /* 225 */
Bryan Wu1394f032007-05-06 14:50:22 -07001494 .long _sys_setxattr
1495 .long _sys_lsetxattr
1496 .long _sys_fsetxattr
1497 .long _sys_getxattr
1498 .long _sys_lgetxattr /* 230 */
1499 .long _sys_fgetxattr
1500 .long _sys_listxattr
1501 .long _sys_llistxattr
1502 .long _sys_flistxattr
1503 .long _sys_removexattr /* 235 */
1504 .long _sys_lremovexattr
1505 .long _sys_fremovexattr
1506 .long _sys_tkill
1507 .long _sys_sendfile64
1508 .long _sys_futex /* 240 */
1509 .long _sys_sched_setaffinity
1510 .long _sys_sched_getaffinity
1511 .long _sys_ni_syscall /* sys_set_thread_area */
1512 .long _sys_ni_syscall /* sys_get_thread_area */
1513 .long _sys_io_setup /* 245 */
1514 .long _sys_io_destroy
1515 .long _sys_io_getevents
1516 .long _sys_io_submit
1517 .long _sys_io_cancel
1518 .long _sys_ni_syscall /* 250 */ /* sys_alloc_hugepages */
1519 .long _sys_ni_syscall /* sys_freec_hugepages */
1520 .long _sys_exit_group
1521 .long _sys_lookup_dcookie
1522 .long _sys_bfin_spinlock
1523 .long _sys_epoll_create /* 255 */
1524 .long _sys_epoll_ctl
1525 .long _sys_epoll_wait
1526 .long _sys_ni_syscall /* remap_file_pages */
1527 .long _sys_set_tid_address
1528 .long _sys_timer_create /* 260 */
1529 .long _sys_timer_settime
1530 .long _sys_timer_gettime
1531 .long _sys_timer_getoverrun
1532 .long _sys_timer_delete
1533 .long _sys_clock_settime /* 265 */
1534 .long _sys_clock_gettime
1535 .long _sys_clock_getres
1536 .long _sys_clock_nanosleep
1537 .long _sys_statfs64
1538 .long _sys_fstatfs64 /* 270 */
1539 .long _sys_tgkill
1540 .long _sys_utimes
1541 .long _sys_fadvise64_64
1542 .long _sys_ni_syscall /* vserver */
1543 .long _sys_ni_syscall /* 275, mbind */
1544 .long _sys_ni_syscall /* get_mempolicy */
1545 .long _sys_ni_syscall /* set_mempolicy */
1546 .long _sys_mq_open
1547 .long _sys_mq_unlink
1548 .long _sys_mq_timedsend /* 280 */
1549 .long _sys_mq_timedreceive
1550 .long _sys_mq_notify
1551 .long _sys_mq_getsetattr
1552 .long _sys_ni_syscall /* kexec_load */
1553 .long _sys_waitid /* 285 */
1554 .long _sys_add_key
1555 .long _sys_request_key
1556 .long _sys_keyctl
1557 .long _sys_ioprio_set
1558 .long _sys_ioprio_get /* 290 */
1559 .long _sys_inotify_init
1560 .long _sys_inotify_add_watch
1561 .long _sys_inotify_rm_watch
1562 .long _sys_ni_syscall /* migrate_pages */
1563 .long _sys_openat /* 295 */
1564 .long _sys_mkdirat
1565 .long _sys_mknodat
1566 .long _sys_fchownat
1567 .long _sys_futimesat
1568 .long _sys_fstatat64 /* 300 */
1569 .long _sys_unlinkat
1570 .long _sys_renameat
1571 .long _sys_linkat
1572 .long _sys_symlinkat
1573 .long _sys_readlinkat /* 305 */
1574 .long _sys_fchmodat
1575 .long _sys_faccessat
1576 .long _sys_pselect6
1577 .long _sys_ppoll
1578 .long _sys_unshare /* 310 */
1579 .long _sys_sram_alloc
1580 .long _sys_sram_free
1581 .long _sys_dma_memcpy
1582 .long _sys_accept
1583 .long _sys_bind /* 315 */
1584 .long _sys_connect
1585 .long _sys_getpeername
1586 .long _sys_getsockname
1587 .long _sys_getsockopt
1588 .long _sys_listen /* 320 */
1589 .long _sys_recv
1590 .long _sys_recvfrom
1591 .long _sys_recvmsg
1592 .long _sys_send
1593 .long _sys_sendmsg /* 325 */
1594 .long _sys_sendto
1595 .long _sys_setsockopt
1596 .long _sys_shutdown
1597 .long _sys_socket
1598 .long _sys_socketpair /* 330 */
1599 .long _sys_semctl
1600 .long _sys_semget
1601 .long _sys_semop
1602 .long _sys_msgctl
1603 .long _sys_msgget /* 335 */
1604 .long _sys_msgrcv
1605 .long _sys_msgsnd
1606 .long _sys_shmat
1607 .long _sys_shmctl
1608 .long _sys_shmdt /* 340 */
1609 .long _sys_shmget
Bryan Wu0b95f222007-09-23 00:51:32 +08001610 .long _sys_splice
1611 .long _sys_sync_file_range
1612 .long _sys_tee
1613 .long _sys_vmsplice /* 345 */
1614 .long _sys_epoll_pwait
1615 .long _sys_utimensat
1616 .long _sys_signalfd
Bryan Wu2f775db2008-03-06 16:04:58 -07001617 .long _sys_timerfd_create
Bryan Wu0b95f222007-09-23 00:51:32 +08001618 .long _sys_eventfd /* 350 */
1619 .long _sys_pread64
1620 .long _sys_pwrite64
1621 .long _sys_fadvise64
1622 .long _sys_set_robust_list
1623 .long _sys_get_robust_list /* 355 */
1624 .long _sys_fallocate
Bernd Schmidtfc975512008-01-27 19:56:43 +08001625 .long _sys_semtimedop
Bryan Wu2f775db2008-03-06 16:04:58 -07001626 .long _sys_timerfd_settime
1627 .long _sys_timerfd_gettime
Bryan Wua4b7b6d2008-08-14 15:40:19 +08001628 .long _sys_signalfd4 /* 360 */
1629 .long _sys_eventfd2
1630 .long _sys_epoll_create1
1631 .long _sys_dup3
1632 .long _sys_pipe2
1633 .long _sys_inotify_init1 /* 365 */
Mike Frysinger7a1450f2009-05-26 04:55:38 -04001634 .long _sys_preadv
1635 .long _sys_pwritev
Mike Frysinger61cdd7a2009-06-12 07:30:55 -04001636 .long _sys_rt_tgsigqueueinfo
Mike Frysinger5ecf3e02009-06-19 18:56:57 -04001637 .long _sys_perf_counter_open
Bryan Wu2f775db2008-03-06 16:04:58 -07001638
Bryan Wu1394f032007-05-06 14:50:22 -07001639 .rept NR_syscalls-(.-_sys_call_table)/4
1640 .long _sys_ni_syscall
1641 .endr
Robin Getz0c7a6b22008-10-08 16:27:12 +08001642END(_sys_call_table)