blob: fae77465137457f40e120b2b090e0ffbf5853124 [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>
Graf Yang6b3087c2009-01-07 23:14:39 +080039#include <linux/threads.h>
Bryan Wu1394f032007-05-06 14:50:22 -070040#include <asm/blackfin.h>
Bryan Wu1394f032007-05-06 14:50:22 -070041#include <asm/errno.h>
Bernd Schmidt5d750b92008-04-25 05:02:33 +080042#include <asm/fixed_code.h>
Bryan Wu1394f032007-05-06 14:50:22 -070043#include <asm/thread_info.h> /* TIF_NEED_RESCHED */
44#include <asm/asm-offsets.h>
Robin Getz669b7922007-06-21 16:34:08 +080045#include <asm/trace.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;
88 R6 = 0x26; /* Data CPLB Miss */
89 cc = R6 == R7;
90 if cc jump _ex_dcplb_miss (BP);
Bernd Schmidtb97b8a92008-01-27 18:39:16 +080091 R6 = 0x23; /* Data CPLB Miss */
92 cc = R6 == R7;
93 if cc jump _ex_dcplb_viol (BP);
Robin Getzf26fbc42007-11-12 22:21:30 +080094 /* Handle 0x23 Data CPLB Protection Violation
95 * and Data CPLB Multiple Hits - Linux Trap Zero
96 */
97 jump _ex_trap_c;
98ENDPROC(_ex_workaround_261)
Bryan Wu1394f032007-05-06 14:50:22 -070099
Robin Getzf26fbc42007-11-12 22:21:30 +0800100#else
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800101#ifdef CONFIG_MPU
102#define _ex_dviol _ex_dcplb_viol
103#else
Robin Getzf26fbc42007-11-12 22:21:30 +0800104#define _ex_dviol _ex_trap_c
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800105#endif
Robin Getzf26fbc42007-11-12 22:21:30 +0800106#define _ex_dmiss _ex_dcplb_miss
107#define _ex_dmult _ex_trap_c
108#endif
109
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800110
111ENTRY(_ex_dcplb_viol)
Robin Getzf26fbc42007-11-12 22:21:30 +0800112ENTRY(_ex_dcplb_miss)
113ENTRY(_ex_icplb_miss)
Bryan Wu1394f032007-05-06 14:50:22 -0700114 (R7:6,P5:4) = [sp++];
Bernd Schmidtdbdf20d2009-01-07 23:14:38 +0800115 /* We leave the previously pushed ASTAT on the stack. */
116 SAVE_CONTEXT_CPLB
117
Bernd Schmidt2a0c4fd2008-04-23 07:17:34 +0800118 /* We must load R1 here, _before_ DEBUG_HWTRACE_SAVE, since that
119 * will change the stack pointer. */
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800120 R0 = SEQSTAT;
121 R1 = SP;
Bernd Schmidtdbdf20d2009-01-07 23:14:38 +0800122
Bernd Schmidt2a0c4fd2008-04-23 07:17:34 +0800123 DEBUG_HWTRACE_SAVE(p5, r7)
Bernd Schmidtdbdf20d2009-01-07 23:14:38 +0800124
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800125 sp += -12;
126 call _cplb_hdr;
127 sp += 12;
128 CC = R0 == 0;
129 IF !CC JUMP _handle_bad_cplb;
Robin Getz0c7a6b22008-10-08 16:27:12 +0800130
131#ifdef CONFIG_DEBUG_DOUBLEFAULT
132 /* While we were processing this, did we double fault? */
133 r7 = SEQSTAT; /* reason code is in bit 5:0 */
134 r6.l = lo(SEQSTAT_EXCAUSE);
135 r6.h = hi(SEQSTAT_EXCAUSE);
136 r7 = r7 & r6;
137 r6 = 0x25;
138 CC = R7 == R6;
139 if CC JUMP _double_fault;
140#endif
141
Mike Frysinger80f31c82008-02-02 15:47:24 +0800142 DEBUG_HWTRACE_RESTORE(p5, r7)
Bernd Schmidtdbdf20d2009-01-07 23:14:38 +0800143 RESTORE_CONTEXT_CPLB
144 ASTAT = [SP++];
Mike Frysingerf0b5d122007-08-05 17:03:59 +0800145 SP = EX_SCRATCH_REG;
Bryan Wu1394f032007-05-06 14:50:22 -0700146 rtx;
Robin Getzf26fbc42007-11-12 22:21:30 +0800147ENDPROC(_ex_icplb_miss)
Bryan Wu1394f032007-05-06 14:50:22 -0700148
Bryan Wu1394f032007-05-06 14:50:22 -0700149ENTRY(_ex_syscall)
Bryan Wu1394f032007-05-06 14:50:22 -0700150 raise 15; /* invoked by TRAP #0, for sys call */
Robin Getz0c7a6b22008-10-08 16:27:12 +0800151 jump.s _bfin_return_from_exception;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800152ENDPROC(_ex_syscall)
Bryan Wu1394f032007-05-06 14:50:22 -0700153
Bryan Wu1394f032007-05-06 14:50:22 -0700154ENTRY(_ex_soft_bp)
155 r7 = retx;
156 r7 += -2;
157 retx = r7;
158 jump.s _ex_trap_c;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800159ENDPROC(_ex_soft_bp)
Bryan Wu1394f032007-05-06 14:50:22 -0700160
161ENTRY(_ex_single_step)
Bernd Schmidt0893f122008-05-07 11:41:26 +0800162 /* If we just returned from an interrupt, the single step event is
163 for the RTI instruction. */
Bryan Wu1394f032007-05-06 14:50:22 -0700164 r7 = retx;
165 r6 = reti;
166 cc = r7 == r6;
Bernd Schmidt0893f122008-05-07 11:41:26 +0800167 if cc jump _bfin_return_from_exception;
168
Jie Zhang5400c5a2008-08-05 17:33:38 +0800169#ifdef CONFIG_KGDB
Sonic Zhang0d1cdd72008-07-26 18:54:38 +0800170 /* Don't do single step in hardware exception handler */
171 p5.l = lo(IPEND);
172 p5.h = hi(IPEND);
173 r6 = [p5];
Sonic Zhangd6a29892008-08-05 18:28:26 +0800174 cc = bittst(r6, 4);
175 if cc jump _bfin_return_from_exception;
Sonic Zhang0d1cdd72008-07-26 18:54:38 +0800176 cc = bittst(r6, 5);
177 if cc jump _bfin_return_from_exception;
178
Sonic Zhang0d1cdd72008-07-26 18:54:38 +0800179 /* skip single step if current interrupt priority is higher than
180 * that of the first instruction, from which gdb starts single step */
181 r6 >>= 6;
182 r7 = 10;
183.Lfind_priority_start:
184 cc = bittst(r6, 0);
185 if cc jump .Lfind_priority_done;
186 r6 >>= 1;
187 r7 += -1;
188 cc = r7 == 0;
189 if cc jump .Lfind_priority_done;
190 jump.s .Lfind_priority_start;
191.Lfind_priority_done:
Sonic Zhanga5ac0122008-10-13 14:07:19 +0800192 p4.l = _kgdb_single_step;
193 p4.h = _kgdb_single_step;
Sonic Zhang0d1cdd72008-07-26 18:54:38 +0800194 r6 = [p4];
195 cc = r6 == 0;
196 if cc jump .Ldo_single_step;
197 r6 += -1;
198 cc = r6 < r7;
Sonic Zhangd6a29892008-08-05 18:28:26 +0800199 if cc jump 1f;
Sonic Zhang0d1cdd72008-07-26 18:54:38 +0800200.Ldo_single_step:
Sonic Zhangd6a29892008-08-05 18:28:26 +0800201#else
Bernd Schmidt0893f122008-05-07 11:41:26 +0800202 /* If we were in user mode, do the single step normally. */
Jie Zhang5400c5a2008-08-05 17:33:38 +0800203 p5.l = lo(IPEND);
204 p5.h = hi(IPEND);
Bernd Schmidt0893f122008-05-07 11:41:26 +0800205 r6 = [p5];
206 r7 = 0xffe0 (z);
207 r7 = r7 & r6;
208 cc = r7 == 0;
Jie Zhang5400c5a2008-08-05 17:33:38 +0800209 if !cc jump 1f;
Sonic Zhangd6a29892008-08-05 18:28:26 +0800210#endif
Bernd Schmidt0893f122008-05-07 11:41:26 +0800211
Jie Zhang5400c5a2008-08-05 17:33:38 +0800212 /* Single stepping only a single instruction, so clear the trace
213 * bit here. */
214 r7 = syscfg;
215 bitclr (r7, 0);
216 syscfg = R7;
217 jump _ex_trap_c;
218
2191:
Bernd Schmidt0893f122008-05-07 11:41:26 +0800220 /*
221 * We were in an interrupt handler. By convention, all of them save
222 * SYSCFG with their first instruction, so by checking whether our
223 * RETX points at the entry point, we can determine whether to allow
224 * a single step, or whether to clear SYSCFG.
225 *
226 * First, find out the interrupt level and the event vector for it.
227 */
228 p5.l = lo(EVT0);
229 p5.h = hi(EVT0);
230 p5 += -4;
2312:
232 r7 = rot r7 by -1;
233 p5 += 4;
234 if !cc jump 2b;
235
236 /* What we actually do is test for the _second_ instruction in the
237 * IRQ handler. That way, if there are insns following the restore
238 * of SYSCFG after leaving the handler, we will not turn off SYSCFG
239 * for them. */
240
241 r7 = [p5];
242 r7 += 2;
243 r6 = RETX;
244 cc = R7 == R6;
245 if !cc jump _bfin_return_from_exception;
246
Bryan Wu1394f032007-05-06 14:50:22 -0700247 r7 = syscfg;
248 bitclr (r7, 0);
249 syscfg = R7;
250
Jie Zhang5400c5a2008-08-05 17:33:38 +0800251 /* Fall through to _bfin_return_from_exception. */
Mike Frysinger46c87c32007-11-21 16:15:48 +0800252ENDPROC(_ex_single_step)
Bryan Wu1394f032007-05-06 14:50:22 -0700253
Mike Frysinger8d6c2422007-11-21 15:53:49 +0800254ENTRY(_bfin_return_from_exception)
Mike Frysinger1aafd902007-07-25 11:19:14 +0800255#if ANOMALY_05000257
Michael Hennerich8af10b72007-05-21 18:09:09 +0800256 R7=LC0;
257 LC0=R7;
258 R7=LC1;
259 LC1=R7;
260#endif
Robin Getz0c7a6b22008-10-08 16:27:12 +0800261
262#ifdef CONFIG_DEBUG_DOUBLEFAULT
263 /* While we were processing the current exception,
264 * did we cause another, and double fault?
265 */
266 r7 = SEQSTAT; /* reason code is in bit 5:0 */
267 r6.l = lo(SEQSTAT_EXCAUSE);
268 r6.h = hi(SEQSTAT_EXCAUSE);
269 r7 = r7 & r6;
270 r6 = 0x25;
271 CC = R7 == R6;
272 if CC JUMP _double_fault;
273
274 /* Did we cause a HW error? */
275 p5.l = lo(ILAT);
276 p5.h = hi(ILAT);
277 r6 = [p5];
278 r7 = 0x20; /* Did I just cause anther HW error? */
Graf Yang4213cb62008-11-18 17:48:22 +0800279 r6 = r7 & r6;
Robin Getz0c7a6b22008-10-08 16:27:12 +0800280 CC = R7 == R6;
281 if CC JUMP _double_fault;
282#endif
283
Bryan Wu1394f032007-05-06 14:50:22 -0700284 (R7:6,P5:4) = [sp++];
285 ASTAT = [sp++];
Mike Frysingerf0b5d122007-08-05 17:03:59 +0800286 sp = EX_SCRATCH_REG;
Bryan Wu1394f032007-05-06 14:50:22 -0700287 rtx;
Mike Frysinger46c87c32007-11-21 16:15:48 +0800288ENDPROC(_bfin_return_from_exception)
Bryan Wu1394f032007-05-06 14:50:22 -0700289
290ENTRY(_handle_bad_cplb)
Bernd Schmidt2a0c4fd2008-04-23 07:17:34 +0800291 DEBUG_HWTRACE_RESTORE(p5, r7)
Bryan Wu1394f032007-05-06 14:50:22 -0700292 /* To get here, we just tried and failed to change a CPLB
293 * so, handle things in trap_c (C code), by lowering to
294 * IRQ5, just like we normally do. Since this is not a
295 * "normal" return path, we have a do alot of stuff to
296 * the stack to get ready so, we can fall through - we
297 * need to make a CPLB exception look like a normal exception
298 */
Bernd Schmidtdbdf20d2009-01-07 23:14:38 +0800299 RESTORE_CONTEXT_CPLB
300 /* ASTAT is still on the stack, where it is needed. */
Mike Frysinger80f31c82008-02-02 15:47:24 +0800301 [--sp] = (R7:6,P5:4);
Bryan Wu1394f032007-05-06 14:50:22 -0700302
Mike Frysinger1ffe6642007-08-05 17:14:04 +0800303ENTRY(_ex_replaceable)
304 nop;
305
Bryan Wu1394f032007-05-06 14:50:22 -0700306ENTRY(_ex_trap_c)
Robin Getz2ebcade2007-10-09 17:24:30 +0800307 /* Make sure we are not in a double fault */
308 p4.l = lo(IPEND);
309 p4.h = hi(IPEND);
310 r7 = [p4];
311 CC = BITTST (r7, 5);
312 if CC jump _double_fault;
313
Bryan Wu1394f032007-05-06 14:50:22 -0700314 /* Call C code (trap_c) to handle the exception, which most
315 * likely involves sending a signal to the current process.
316 * To avoid double faults, lower our priority to IRQ5 first.
317 */
318 P5.h = _exception_to_level5;
319 P5.l = _exception_to_level5;
320 p4.l = lo(EVT5);
321 p4.h = hi(EVT5);
322 [p4] = p5;
323 csync;
324
Graf Yang6b3087c2009-01-07 23:14:39 +0800325 GET_PDA(p5, r6);
Robin Getz0c7a6b22008-10-08 16:27:12 +0800326#ifndef CONFIG_DEBUG_DOUBLEFAULT
Graf Yang6b3087c2009-01-07 23:14:39 +0800327
Robin Getz0c7a6b22008-10-08 16:27:12 +0800328 /*
329 * Save these registers, as they are only valid in exception context
330 * (where we are now - as soon as we defer to IRQ5, they can change)
331 * DCPLB_STATUS and ICPLB_STATUS are also only valid in EVT3,
332 * but they are not very interesting, so don't save them
333 */
334
Bernd Schmidt5d750b92008-04-25 05:02:33 +0800335 p4.l = lo(DCPLB_FAULT_ADDR);
336 p4.h = hi(DCPLB_FAULT_ADDR);
337 r7 = [p4];
Graf Yang6b3087c2009-01-07 23:14:39 +0800338 [p5 + PDA_DCPLB] = r7;
Bernd Schmidt5d750b92008-04-25 05:02:33 +0800339
Graf Yang6b3087c2009-01-07 23:14:39 +0800340 p4.l = lo(ICPLB_FAULT_ADDR);
341 p4.h = hi(ICPLB_FAULT_ADDR);
342 r6 = [p4];
343 [p5 + PDA_ICPLB] = r6;
Bernd Schmidt5d750b92008-04-25 05:02:33 +0800344
Bernd Schmidt5d750b92008-04-25 05:02:33 +0800345 r6 = retx;
Graf Yang6b3087c2009-01-07 23:14:39 +0800346 [p5 + PDA_RETX] = r6;
Robin Getz0c7a6b22008-10-08 16:27:12 +0800347#endif
Bernd Schmidt0893f122008-05-07 11:41:26 +0800348 r6 = SYSCFG;
Graf Yang6b3087c2009-01-07 23:14:39 +0800349 [p5 + PDA_SYSCFG] = r6;
Bernd Schmidt0893f122008-05-07 11:41:26 +0800350 BITCLR(r6, 0);
351 SYSCFG = r6;
Bernd Schmidt5d750b92008-04-25 05:02:33 +0800352
Bryan Wu1394f032007-05-06 14:50:22 -0700353 /* Disable all interrupts, but make sure level 5 is enabled so
354 * we can switch to that level. Save the old mask. */
355 cli r6;
Graf Yang6b3087c2009-01-07 23:14:39 +0800356 [p5 + PDA_EXIMASK] = r6;
Bernd Schmidt0893f122008-05-07 11:41:26 +0800357
358 p4.l = lo(SAFE_USER_INSTRUCTION);
359 p4.h = hi(SAFE_USER_INSTRUCTION);
360 retx = p4;
361
Bryan Wu1394f032007-05-06 14:50:22 -0700362 r6 = 0x3f;
363 sti r6;
364
Bryan Wu1394f032007-05-06 14:50:22 -0700365 raise 5;
Robin Getz0c7a6b22008-10-08 16:27:12 +0800366 jump.s _bfin_return_from_exception;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800367ENDPROC(_ex_trap_c)
Bryan Wu1394f032007-05-06 14:50:22 -0700368
Robin Getz2ebcade2007-10-09 17:24:30 +0800369/* We just realized we got an exception, while we were processing a different
Mike Frysinger33c86912008-11-18 17:48:22 +0800370 * exception. This is a unrecoverable event, so crash.
371 * Note: this cannot be ENTRY() as we jump here with "if cc jump" ...
Robin Getz2ebcade2007-10-09 17:24:30 +0800372 */
Mike Frysinger33c86912008-11-18 17:48:22 +0800373_double_fault:
Robin Getz0c7a6b22008-10-08 16:27:12 +0800374 /* Turn caches & protection off, to ensure we don't get any more
375 * double exceptions
376 */
Robin Getz2ebcade2007-10-09 17:24:30 +0800377
Robin Getz0c7a6b22008-10-08 16:27:12 +0800378 P4.L = LO(IMEM_CONTROL);
379 P4.H = HI(IMEM_CONTROL);
Robin Getz2ebcade2007-10-09 17:24:30 +0800380
Robin Getz0c7a6b22008-10-08 16:27:12 +0800381 R5 = [P4]; /* Control Register*/
382 BITCLR(R5,ENICPLB_P);
383 SSYNC; /* SSYNC required before writing to IMEM_CONTROL. */
384 .align 8;
385 [P4] = R5;
386 SSYNC;
Robin Getz2ebcade2007-10-09 17:24:30 +0800387
Robin Getz0c7a6b22008-10-08 16:27:12 +0800388 P4.L = LO(DMEM_CONTROL);
389 P4.H = HI(DMEM_CONTROL);
390 R5 = [P4];
391 BITCLR(R5,ENDCPLB_P);
392 SSYNC; /* SSYNC required before writing to DMEM_CONTROL. */
393 .align 8;
394 [P4] = R5;
395 SSYNC;
Robin Getz2ebcade2007-10-09 17:24:30 +0800396
Robin Getz0c7a6b22008-10-08 16:27:12 +0800397 /* Fix up the stack */
398 (R7:6,P5:4) = [sp++];
399 ASTAT = [sp++];
400 SP = EX_SCRATCH_REG;
Robin Getz2ebcade2007-10-09 17:24:30 +0800401
Robin Getz0c7a6b22008-10-08 16:27:12 +0800402 /* We should be out of the exception stack, and back down into
403 * kernel or user space stack
404 */
405 SAVE_ALL_SYS
Robin Getz2ebcade2007-10-09 17:24:30 +0800406
Bernd Schmidtddb3f002008-05-07 11:41:26 +0800407 /* The dumping functions expect the return address in the RETI
408 * slot. */
409 r6 = retx;
410 [sp + PT_PC] = r6;
411
Robin Getz0c7a6b22008-10-08 16:27:12 +0800412 r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */
413 SP += -12;
414 call _double_fault_c;
415 SP += 12;
Robin Getz2ebcade2007-10-09 17:24:30 +0800416.L_double_fault_panic:
417 JUMP .L_double_fault_panic
418
419ENDPROC(_double_fault)
420
Bryan Wu1394f032007-05-06 14:50:22 -0700421ENTRY(_exception_to_level5)
422 SAVE_ALL_SYS
423
Graf Yang6b3087c2009-01-07 23:14:39 +0800424 GET_PDA(p4, r7); /* Fetch current PDA */
425 r6 = [p4 + PDA_RETX];
Bernd Schmidt5d750b92008-04-25 05:02:33 +0800426 [sp + PT_PC] = r6;
427
Graf Yang6b3087c2009-01-07 23:14:39 +0800428 r6 = [p4 + PDA_SYSCFG];
Bernd Schmidt0893f122008-05-07 11:41:26 +0800429 [sp + PT_SYSCFG] = r6;
430
Bryan Wu1394f032007-05-06 14:50:22 -0700431 /* Restore interrupt mask. We haven't pushed RETI, so this
432 * doesn't enable interrupts until we return from this handler. */
Graf Yang6b3087c2009-01-07 23:14:39 +0800433 r6 = [p4 + PDA_EXIMASK];
Bryan Wu1394f032007-05-06 14:50:22 -0700434 sti r6;
435
436 /* Restore the hardware error vector. */
437 P5.h = _evt_ivhw;
438 P5.l = _evt_ivhw;
439 p4.l = lo(EVT5);
440 p4.h = hi(EVT5);
441 [p4] = p5;
442 csync;
443
444 p2.l = lo(IPEND);
445 p2.h = hi(IPEND);
446 csync;
447 r0 = [p2]; /* Read current IPEND */
448 [sp + PT_IPEND] = r0; /* Store IPEND */
449
Bryan Wu1394f032007-05-06 14:50:22 -0700450 r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */
451 SP += -12;
452 call _trap_c;
453 SP += 12;
454
Robin Getz0c7a6b22008-10-08 16:27:12 +0800455#ifdef CONFIG_DEBUG_DOUBLEFAULT
456 /* Grab ILAT */
457 p2.l = lo(ILAT);
458 p2.h = hi(ILAT);
459 r0 = [p2];
460 r1 = 0x20; /* Did I just cause anther HW error? */
461 r0 = r0 & r1;
462 CC = R0 == R1;
463 if CC JUMP _double_fault;
464#endif
465
Bryan Wu1394f032007-05-06 14:50:22 -0700466 call _ret_from_exception;
467 RESTORE_ALL_SYS
468 rti;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800469ENDPROC(_exception_to_level5)
Bryan Wu1394f032007-05-06 14:50:22 -0700470
471ENTRY(_trap) /* Exception: 4th entry into system event table(supervisor mode)*/
472 /* Since the kernel stack can be anywhere, it's not guaranteed to be
473 * covered by a CPLB. Switch to an exception stack; use RETN as a
474 * scratch register (for want of a better option).
475 */
Mike Frysingerf0b5d122007-08-05 17:03:59 +0800476 EX_SCRATCH_REG = sp;
Graf Yang6b3087c2009-01-07 23:14:39 +0800477 GET_PDA_SAFE(sp);
478 sp = [sp + PDA_EXSTACK]
Bryan Wu1394f032007-05-06 14:50:22 -0700479 /* Try to deal with syscalls quickly. */
480 [--sp] = ASTAT;
Mike Frysinger80f31c82008-02-02 15:47:24 +0800481 [--sp] = (R7:6,P5:4);
Robin Getz0c7a6b22008-10-08 16:27:12 +0800482
Michael Hennerich5e9e7682008-10-09 12:31:03 +0800483#if ANOMALY_05000283 || ANOMALY_05000315
484 cc = r7 == r7;
485 p5.h = HI(CHIPID);
486 p5.l = LO(CHIPID);
487 if cc jump 1f;
488 r7.l = W[p5];
4891:
490#endif
491
Robin Getz0c7a6b22008-10-08 16:27:12 +0800492#ifdef CONFIG_DEBUG_DOUBLEFAULT
493 /*
494 * Save these registers, as they are only valid in exception context
495 * (where we are now - as soon as we defer to IRQ5, they can change)
496 * DCPLB_STATUS and ICPLB_STATUS are also only valid in EVT3,
497 * but they are not very interesting, so don't save them
498 */
499
Graf Yang6b3087c2009-01-07 23:14:39 +0800500 GET_PDA(p5, r7);
Robin Getz0c7a6b22008-10-08 16:27:12 +0800501 p4.l = lo(DCPLB_FAULT_ADDR);
502 p4.h = hi(DCPLB_FAULT_ADDR);
503 r7 = [p4];
Graf Yang6b3087c2009-01-07 23:14:39 +0800504 [p5 + PDA_DCPLB] = r7;
Robin Getz0c7a6b22008-10-08 16:27:12 +0800505
Graf Yang6b3087c2009-01-07 23:14:39 +0800506 p4.l = lo(ICPLB_FAULT_ADDR);
507 p4.h = hi(ICPLB_FAULT_ADDR);
508 r7 = [p4];
509 [p5 + PDA_ICPLB] = r7;
Robin Getz0c7a6b22008-10-08 16:27:12 +0800510
Robin Getz0c7a6b22008-10-08 16:27:12 +0800511 r6 = retx;
Graf Yang6b3087c2009-01-07 23:14:39 +0800512 [p5 + PDA_RETX] = r6;
Robin Getz0c7a6b22008-10-08 16:27:12 +0800513
Bryan Wu1394f032007-05-06 14:50:22 -0700514 r7 = SEQSTAT; /* reason code is in bit 5:0 */
Graf Yang6b3087c2009-01-07 23:14:39 +0800515 [p5 + PDA_SEQSTAT] = r7;
Robin Getz0c7a6b22008-10-08 16:27:12 +0800516#else
517 r7 = SEQSTAT; /* reason code is in bit 5:0 */
518#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700519 r6.l = lo(SEQSTAT_EXCAUSE);
520 r6.h = hi(SEQSTAT_EXCAUSE);
521 r7 = r7 & r6;
Mike Frysinger1ffe6642007-08-05 17:14:04 +0800522 p5.h = _ex_table;
523 p5.l = _ex_table;
Bryan Wu1394f032007-05-06 14:50:22 -0700524 p4 = r7;
525 p5 = p5 + (p4 << 2);
526 p4 = [p5];
527 jump (p4);
528
529.Lbadsys:
530 r7 = -ENOSYS; /* signextending enough */
531 [sp + PT_R0] = r7; /* return value from system call */
532 jump .Lsyscall_really_exit;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800533ENDPROC(_trap)
Bryan Wu1394f032007-05-06 14:50:22 -0700534
535ENTRY(_kernel_execve)
536 link SIZEOF_PTREGS;
537 p0 = sp;
538 r3 = SIZEOF_PTREGS / 4;
539 r4 = 0(x);
Graf Yang6b3087c2009-01-07 23:14:39 +0800540.Lclear_regs:
Bryan Wu1394f032007-05-06 14:50:22 -0700541 [p0++] = r4;
542 r3 += -1;
543 cc = r3 == 0;
Graf Yang6b3087c2009-01-07 23:14:39 +0800544 if !cc jump .Lclear_regs (bp);
Bryan Wu1394f032007-05-06 14:50:22 -0700545
546 p0 = sp;
547 sp += -16;
548 [sp + 12] = p0;
549 call _do_execve;
550 SP += 16;
551 cc = r0 == 0;
Graf Yang6b3087c2009-01-07 23:14:39 +0800552 if ! cc jump .Lexecve_failed;
Bryan Wu1394f032007-05-06 14:50:22 -0700553 /* Success. Copy our temporary pt_regs to the top of the kernel
554 * stack and do a normal exception return.
555 */
556 r1 = sp;
557 r0 = (-KERNEL_STACK_SIZE) (x);
558 r1 = r1 & r0;
559 p2 = r1;
560 p3 = [p2];
561 r0 = KERNEL_STACK_SIZE - 4 (z);
562 p1 = r0;
563 p1 = p1 + p2;
564
565 p0 = fp;
566 r4 = [p0--];
567 r3 = SIZEOF_PTREGS / 4;
Graf Yang6b3087c2009-01-07 23:14:39 +0800568.Lcopy_regs:
Bryan Wu1394f032007-05-06 14:50:22 -0700569 r4 = [p0--];
570 [p1--] = r4;
571 r3 += -1;
572 cc = r3 == 0;
Graf Yang6b3087c2009-01-07 23:14:39 +0800573 if ! cc jump .Lcopy_regs (bp);
Bryan Wu1394f032007-05-06 14:50:22 -0700574
575 r0 = (KERNEL_STACK_SIZE - SIZEOF_PTREGS) (z);
576 p1 = r0;
577 p1 = p1 + p2;
578 sp = p1;
579 r0 = syscfg;
580 [SP + PT_SYSCFG] = r0;
581 [p3 + (TASK_THREAD + THREAD_KSP)] = sp;
582
583 RESTORE_CONTEXT;
584 rti;
Graf Yang6b3087c2009-01-07 23:14:39 +0800585.Lexecve_failed:
Bryan Wu1394f032007-05-06 14:50:22 -0700586 unlink;
587 rts;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800588ENDPROC(_kernel_execve)
Bryan Wu1394f032007-05-06 14:50:22 -0700589
590ENTRY(_system_call)
591 /* Store IPEND */
592 p2.l = lo(IPEND);
593 p2.h = hi(IPEND);
594 csync;
595 r0 = [p2];
596 [sp + PT_IPEND] = r0;
597
598 /* Store RETS for now */
599 r0 = rets;
600 [sp + PT_RESERVED] = r0;
601 /* Set the stack for the current process */
602 r7 = sp;
603 r6.l = lo(ALIGN_PAGE_MASK);
604 r6.h = hi(ALIGN_PAGE_MASK);
605 r7 = r7 & r6; /* thread_info */
606 p2 = r7;
607 p2 = [p2];
608
609 [p2+(TASK_THREAD+THREAD_KSP)] = sp;
610
611 /* Check the System Call */
612 r7 = __NR_syscall;
613 /* System call number is passed in P0 */
614 r6 = p0;
615 cc = r6 < r7;
616 if ! cc jump .Lbadsys;
617
618 /* are we tracing syscalls?*/
619 r7 = sp;
620 r6.l = lo(ALIGN_PAGE_MASK);
621 r6.h = hi(ALIGN_PAGE_MASK);
622 r7 = r7 & r6;
623 p2 = r7;
624 r7 = [p2+TI_FLAGS];
625 CC = BITTST(r7,TIF_SYSCALL_TRACE);
626 if CC JUMP _sys_trace;
627
628 /* Execute the appropriate system call */
629
630 p4 = p0;
631 p5.l = _sys_call_table;
632 p5.h = _sys_call_table;
633 p5 = p5 + (p4 << 2);
634 r0 = [sp + PT_R0];
635 r1 = [sp + PT_R1];
636 r2 = [sp + PT_R2];
637 p5 = [p5];
638
639 [--sp] = r5;
640 [--sp] = r4;
641 [--sp] = r3;
642 SP += -12;
643 call (p5);
644 SP += 24;
645 [sp + PT_R0] = r0;
646
647.Lresume_userspace:
648 r7 = sp;
649 r4.l = lo(ALIGN_PAGE_MASK);
650 r4.h = hi(ALIGN_PAGE_MASK);
651 r7 = r7 & r4; /* thread_info->flags */
652 p5 = r7;
653.Lresume_userspace_1:
654 /* Disable interrupts. */
655 [--sp] = reti;
656 reti = [sp++];
657
658 r7 = [p5 + TI_FLAGS];
659 r4.l = lo(_TIF_WORK_MASK);
660 r4.h = hi(_TIF_WORK_MASK);
661 r7 = r7 & r4;
662
663.Lsyscall_resched:
664 cc = BITTST(r7, TIF_NEED_RESCHED);
665 if !cc jump .Lsyscall_sigpending;
666
667 /* Reenable interrupts. */
668 [--sp] = reti;
669 r0 = [sp++];
670
671 SP += -12;
672 call _schedule;
673 SP += 12;
674
675 jump .Lresume_userspace_1;
676
677.Lsyscall_sigpending:
678 cc = BITTST(r7, TIF_RESTORE_SIGMASK);
679 if cc jump .Lsyscall_do_signals;
680 cc = BITTST(r7, TIF_SIGPENDING);
681 if !cc jump .Lsyscall_really_exit;
682.Lsyscall_do_signals:
683 /* Reenable interrupts. */
684 [--sp] = reti;
685 r0 = [sp++];
686
687 r0 = sp;
688 SP += -12;
689 call _do_signal;
690 SP += 12;
691
692.Lsyscall_really_exit:
693 r5 = [sp + PT_RESERVED];
694 rets = r5;
695 rts;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800696ENDPROC(_system_call)
Bryan Wu1394f032007-05-06 14:50:22 -0700697
Mike Frysinger47664c12008-10-09 15:32:18 +0800698/* Do not mark as ENTRY() to avoid error in assembler ...
699 * this symbol need not be global anyways, so ...
700 */
Bryan Wu1394f032007-05-06 14:50:22 -0700701_sys_trace:
702 call _syscall_trace;
703
704 /* Execute the appropriate system call */
705
706 p4 = [SP + PT_P0];
707 p5.l = _sys_call_table;
708 p5.h = _sys_call_table;
709 p5 = p5 + (p4 << 2);
710 r0 = [sp + PT_R0];
711 r1 = [sp + PT_R1];
712 r2 = [sp + PT_R2];
713 r3 = [sp + PT_R3];
714 r4 = [sp + PT_R4];
715 r5 = [sp + PT_R5];
716 p5 = [p5];
717
718 [--sp] = r5;
719 [--sp] = r4;
720 [--sp] = r3;
721 SP += -12;
722 call (p5);
723 SP += 24;
724 [sp + PT_R0] = r0;
725
726 call _syscall_trace;
727 jump .Lresume_userspace;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800728ENDPROC(_sys_trace)
Bryan Wu1394f032007-05-06 14:50:22 -0700729
730ENTRY(_resume)
731 /*
732 * Beware - when entering resume, prev (the current task) is
733 * in r0, next (the new task) is in r1.
734 */
735 p0 = r0;
736 p1 = r1;
737 [--sp] = rets;
738 [--sp] = fp;
739 [--sp] = (r7:4, p5:3);
740
741 /* save usp */
742 p2 = usp;
743 [p0+(TASK_THREAD+THREAD_USP)] = p2;
744
745 /* save current kernel stack pointer */
746 [p0+(TASK_THREAD+THREAD_KSP)] = sp;
747
748 /* save program counter */
749 r1.l = _new_old_task;
750 r1.h = _new_old_task;
751 [p0+(TASK_THREAD+THREAD_PC)] = r1;
752
753 /* restore the kernel stack pointer */
754 sp = [p1+(TASK_THREAD+THREAD_KSP)];
755
756 /* restore user stack pointer */
757 p0 = [p1+(TASK_THREAD+THREAD_USP)];
758 usp = p0;
759
760 /* restore pc */
761 p0 = [p1+(TASK_THREAD+THREAD_PC)];
762 jump (p0);
763
764 /*
765 * Following code actually lands up in a new (old) task.
766 */
767
768_new_old_task:
769 (r7:4, p5:3) = [sp++];
770 fp = [sp++];
771 rets = [sp++];
772
773 /*
774 * When we come out of resume, r0 carries "old" task, becuase we are
775 * in "new" task.
776 */
777 rts;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800778ENDPROC(_resume)
Bryan Wu1394f032007-05-06 14:50:22 -0700779
780ENTRY(_ret_from_exception)
781 p2.l = lo(IPEND);
782 p2.h = hi(IPEND);
783
784 csync;
785 r0 = [p2];
786 [sp + PT_IPEND] = r0;
787
7881:
Robin Getzd5c4b5e2007-12-21 17:49:53 +0800789 r2 = LO(~0x37) (Z);
Bryan Wu1394f032007-05-06 14:50:22 -0700790 r0 = r2 & r0;
791 cc = r0 == 0;
792 if !cc jump 4f; /* if not return to user mode, get out */
793
794 /* Make sure any pending system call or deferred exception
795 * return in ILAT for this process to get executed, otherwise
796 * in case context switch happens, system call of
797 * first process (i.e in ILAT) will be carried
798 * forward to the switched process
799 */
800
801 p2.l = lo(ILAT);
802 p2.h = hi(ILAT);
803 r0 = [p2];
804 r1 = (EVT_IVG14 | EVT_IVG15) (z);
805 r0 = r0 & r1;
806 cc = r0 == 0;
807 if !cc jump 5f;
808
809 /* Set the stack for the current process */
810 r7 = sp;
811 r4.l = lo(ALIGN_PAGE_MASK);
812 r4.h = hi(ALIGN_PAGE_MASK);
813 r7 = r7 & r4; /* thread_info->flags */
814 p5 = r7;
815 r7 = [p5 + TI_FLAGS];
816 r4.l = lo(_TIF_WORK_MASK);
817 r4.h = hi(_TIF_WORK_MASK);
818 r7 = r7 & r4;
819 cc = r7 == 0;
820 if cc jump 4f;
821
822 p0.l = lo(EVT15);
823 p0.h = hi(EVT15);
824 p1.l = _schedule_and_signal;
825 p1.h = _schedule_and_signal;
826 [p0] = p1;
827 csync;
828 raise 15; /* raise evt14 to do signal or reschedule */
8294:
830 r0 = syscfg;
831 bitclr(r0, 0);
832 syscfg = r0;
8335:
834 rts;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800835ENDPROC(_ret_from_exception)
Bryan Wu1394f032007-05-06 14:50:22 -0700836
837ENTRY(_return_from_int)
838 /* If someone else already raised IRQ 15, do nothing. */
839 csync;
840 p2.l = lo(ILAT);
841 p2.h = hi(ILAT);
842 r0 = [p2];
843 cc = bittst (r0, EVT_IVG15_P);
844 if cc jump 2f;
845
846 /* if not return to user mode, get out */
847 p2.l = lo(IPEND);
848 p2.h = hi(IPEND);
849 r0 = [p2];
850 r1 = 0x17(Z);
851 r2 = ~r1;
852 r2.h = 0;
853 r0 = r2 & r0;
854 r1 = 1;
855 r1 = r0 - r1;
856 r2 = r0 & r1;
857 cc = r2 == 0;
858 if !cc jump 2f;
859
860 /* Lower the interrupt level to 15. */
861 p0.l = lo(EVT15);
862 p0.h = hi(EVT15);
863 p1.l = _schedule_and_signal_from_int;
864 p1.h = _schedule_and_signal_from_int;
865 [p0] = p1;
866 csync;
Mike Frysinger1aafd902007-07-25 11:19:14 +0800867#if ANOMALY_05000281
Bernd Schmidt5d750b92008-04-25 05:02:33 +0800868 r0.l = lo(SAFE_USER_INSTRUCTION);
869 r0.h = hi(SAFE_USER_INSTRUCTION);
Bryan Wu1394f032007-05-06 14:50:22 -0700870 reti = r0;
871#endif
872 r0 = 0x801f (z);
873 STI r0;
874 raise 15; /* raise evt15 to do signal or reschedule */
875 rti;
8762:
877 rts;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800878ENDPROC(_return_from_int)
Bryan Wu1394f032007-05-06 14:50:22 -0700879
880ENTRY(_lower_to_irq14)
Mike Frysinger1aafd902007-07-25 11:19:14 +0800881#if ANOMALY_05000281
Bernd Schmidt5d750b92008-04-25 05:02:33 +0800882 r0.l = lo(SAFE_USER_INSTRUCTION);
883 r0.h = hi(SAFE_USER_INSTRUCTION);
Bryan Wu1394f032007-05-06 14:50:22 -0700884 reti = r0;
885#endif
886 r0 = 0x401f;
887 sti r0;
888 raise 14;
889 rti;
890ENTRY(_evt14_softirq)
891#ifdef CONFIG_DEBUG_HWERR
892 r0 = 0x3f;
893 sti r0;
894#else
895 cli r0;
896#endif
897 [--sp] = RETI;
898 SP += 4;
899 rts;
900
901_schedule_and_signal_from_int:
902 /* To end up here, vector 15 was changed - so we have to change it
903 * back.
904 */
905 p0.l = lo(EVT15);
906 p0.h = hi(EVT15);
907 p1.l = _evt_system_call;
908 p1.h = _evt_system_call;
909 [p0] = p1;
910 csync;
Bernd Schmidtc8244982007-05-21 18:09:33 +0800911
912 /* Set orig_p0 to -1 to indicate this isn't the end of a syscall. */
913 r0 = -1 (x);
914 [sp + PT_ORIG_P0] = r0;
915
Bryan Wu1394f032007-05-06 14:50:22 -0700916 p1 = rets;
917 [sp + PT_RESERVED] = p1;
918
Graf Yang6b3087c2009-01-07 23:14:39 +0800919#ifdef CONFIG_SMP
920 GET_PDA(p0, r0); /* Fetch current PDA (can't migrate to other CPU here) */
921 r0 = [p0 + PDA_IRQFLAGS];
922#else
Mike Frysinger40059782008-11-18 17:48:22 +0800923 p0.l = _bfin_irq_flags;
924 p0.h = _bfin_irq_flags;
Bryan Wu1394f032007-05-06 14:50:22 -0700925 r0 = [p0];
Graf Yang6b3087c2009-01-07 23:14:39 +0800926#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700927 sti r0;
928
Bernd Schmidt7adfb582007-06-21 11:34:16 +0800929 r0 = sp;
930 sp += -12;
931 call _finish_atomic_sections;
932 sp += 12;
Bryan Wu1394f032007-05-06 14:50:22 -0700933 jump.s .Lresume_userspace;
934
935_schedule_and_signal:
936 SAVE_CONTEXT_SYSCALL
937 /* To end up here, vector 15 was changed - so we have to change it
938 * back.
939 */
940 p0.l = lo(EVT15);
941 p0.h = hi(EVT15);
942 p1.l = _evt_system_call;
943 p1.h = _evt_system_call;
944 [p0] = p1;
945 csync;
946 p0.l = 1f;
947 p0.h = 1f;
948 [sp + PT_RESERVED] = P0;
949 call .Lresume_userspace;
9501:
951 RESTORE_CONTEXT
952 rti;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800953ENDPROC(_lower_to_irq14)
Bryan Wu1394f032007-05-06 14:50:22 -0700954
Robin Getz518039b2007-07-25 11:03:28 +0800955/* We handle this 100% in exception space - to reduce overhead
956 * Only potiential problem is if the software buffer gets swapped out of the
957 * CPLB table - then double fault. - so we don't let this happen in other places
958 */
959#ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
960ENTRY(_ex_trace_buff_full)
961 [--sp] = P3;
962 [--sp] = P2;
963 [--sp] = LC0;
964 [--sp] = LT0;
965 [--sp] = LB0;
966 P5.L = _trace_buff_offset;
967 P5.H = _trace_buff_offset;
968 P3 = [P5]; /* trace_buff_offset */
969 P5.L = lo(TBUFSTAT);
970 P5.H = hi(TBUFSTAT);
971 R7 = [P5];
972 R7 <<= 1; /* double, since we need to read twice */
973 LC0 = R7;
974 R7 <<= 2; /* need to shift over again,
975 * to get the number of bytes */
976 P5.L = lo(TBUF);
977 P5.H = hi(TBUF);
978 R6 = ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN)*1024) - 1;
979
980 P2 = R7;
981 P3 = P3 + P2;
982 R7 = P3;
983 R7 = R7 & R6;
984 P3 = R7;
985 P2.L = _trace_buff_offset;
986 P2.H = _trace_buff_offset;
987 [P2] = P3;
988
989 P2.L = _software_trace_buff;
990 P2.H = _software_trace_buff;
991
992 LSETUP (.Lstart, .Lend) LC0;
993.Lstart:
994 R7 = [P5]; /* read TBUF */
995 P4 = P3 + P2;
996 [P4] = R7;
997 P3 += -4;
998 R7 = P3;
999 R7 = R7 & R6;
1000.Lend:
1001 P3 = R7;
1002
1003 LB0 = [sp++];
1004 LT0 = [sp++];
1005 LC0 = [sp++];
1006 P2 = [sp++];
1007 P3 = [sp++];
Mike Frysinger8d6c2422007-11-21 15:53:49 +08001008 jump _bfin_return_from_exception;
Robin Getz337d3902007-10-09 17:31:46 +08001009ENDPROC(_ex_trace_buff_full)
Robin Getz518039b2007-07-25 11:03:28 +08001010
1011#if CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN == 4
1012.data
1013#else
1014.section .l1.data.B
Robin Getz337d3902007-10-09 17:31:46 +08001015#endif /* CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN */
Robin Getz518039b2007-07-25 11:03:28 +08001016ENTRY(_trace_buff_offset)
1017 .long 0;
1018ALIGN
1019ENTRY(_software_trace_buff)
1020 .rept ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN)*256);
1021 .long 0
1022 .endr
Robin Getz337d3902007-10-09 17:31:46 +08001023#endif /* CONFIG_DEBUG_BFIN_HWTRACE_EXPAND */
1024
1025#if CONFIG_EARLY_PRINTK
Mike Frysinger9cb07b22007-11-21 16:45:08 +08001026__INIT
Robin Getz337d3902007-10-09 17:31:46 +08001027ENTRY(_early_trap)
1028 SAVE_ALL_SYS
1029 trace_buffer_stop(p0,r0);
1030
Michael Hennerich5e9e7682008-10-09 12:31:03 +08001031#if ANOMALY_05000283 || ANOMALY_05000315
1032 cc = r5 == r5;
1033 p4.h = HI(CHIPID);
1034 p4.l = LO(CHIPID);
1035 if cc jump 1f;
1036 r5.l = W[p4];
10371:
1038#endif
1039
Robin Getz337d3902007-10-09 17:31:46 +08001040 /* Turn caches off, to ensure we don't get double exceptions */
1041
1042 P4.L = LO(IMEM_CONTROL);
1043 P4.H = HI(IMEM_CONTROL);
1044
1045 R5 = [P4]; /* Control Register*/
1046 BITCLR(R5,ENICPLB_P);
1047 CLI R1;
1048 SSYNC; /* SSYNC required before writing to IMEM_CONTROL. */
1049 .align 8;
1050 [P4] = R5;
1051 SSYNC;
1052
1053 P4.L = LO(DMEM_CONTROL);
1054 P4.H = HI(DMEM_CONTROL);
1055 R5 = [P4];
1056 BITCLR(R5,ENDCPLB_P);
1057 SSYNC; /* SSYNC required before writing to DMEM_CONTROL. */
1058 .align 8;
1059 [P4] = R5;
1060 SSYNC;
1061 STI R1;
1062
1063 r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */
1064 r1 = RETX;
1065
1066 SP += -12;
1067 call _early_trap_c;
1068 SP += 12;
1069ENDPROC(_early_trap)
Mike Frysinger9cb07b22007-11-21 16:45:08 +08001070__FINIT
Robin Getz337d3902007-10-09 17:31:46 +08001071#endif /* CONFIG_EARLY_PRINTK */
Robin Getz518039b2007-07-25 11:03:28 +08001072
Bryan Wu1394f032007-05-06 14:50:22 -07001073/*
1074 * Put these in the kernel data section - that should always be covered by
1075 * a CPLB. This is needed to ensure we don't get double fault conditions
1076 */
1077
1078#ifdef CONFIG_SYSCALL_TAB_L1
1079.section .l1.data
1080#else
1081.data
1082#endif
Robin Getzf26fbc42007-11-12 22:21:30 +08001083
Mike Frysinger1ffe6642007-08-05 17:14:04 +08001084ENTRY(_ex_table)
Bryan Wu1394f032007-05-06 14:50:22 -07001085 /* entry for each EXCAUSE[5:0]
Mike Frysinger9401e612007-07-12 11:50:43 +08001086 * This table must be in sync with the table in ./kernel/traps.c
Bryan Wu1394f032007-05-06 14:50:22 -07001087 * EXCPT instruction can provide 4 bits of EXCAUSE, allowing 16 to be user defined
1088 */
Mike Frysinger1ffe6642007-08-05 17:14:04 +08001089 .long _ex_syscall /* 0x00 - User Defined - Linux Syscall */
Bryan Wu1394f032007-05-06 14:50:22 -07001090 .long _ex_soft_bp /* 0x01 - User Defined - Software breakpoint */
Sonic Zhanga5ac0122008-10-13 14:07:19 +08001091#ifdef CONFIG_KGDB
1092 .long _ex_trap_c /* 0x02 - User Defined - KGDB initial connection
1093 and break signal trap */
1094#else
Mike Frysinger1ffe6642007-08-05 17:14:04 +08001095 .long _ex_replaceable /* 0x02 - User Defined */
Sonic Zhanga5ac0122008-10-13 14:07:19 +08001096#endif
Mike Frysinger9401e612007-07-12 11:50:43 +08001097 .long _ex_trap_c /* 0x03 - User Defined - userspace stack overflow */
Robin Getz9f336a52007-10-29 18:23:28 +08001098 .long _ex_trap_c /* 0x04 - User Defined - dump trace buffer */
Mike Frysinger1ffe6642007-08-05 17:14:04 +08001099 .long _ex_replaceable /* 0x05 - User Defined */
1100 .long _ex_replaceable /* 0x06 - User Defined */
1101 .long _ex_replaceable /* 0x07 - User Defined */
1102 .long _ex_replaceable /* 0x08 - User Defined */
1103 .long _ex_replaceable /* 0x09 - User Defined */
1104 .long _ex_replaceable /* 0x0A - User Defined */
1105 .long _ex_replaceable /* 0x0B - User Defined */
1106 .long _ex_replaceable /* 0x0C - User Defined */
1107 .long _ex_replaceable /* 0x0D - User Defined */
1108 .long _ex_replaceable /* 0x0E - User Defined */
1109 .long _ex_replaceable /* 0x0F - User Defined */
Bryan Wu1394f032007-05-06 14:50:22 -07001110 .long _ex_single_step /* 0x10 - HW Single step */
Robin Getz518039b2007-07-25 11:03:28 +08001111#ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
1112 .long _ex_trace_buff_full /* 0x11 - Trace Buffer Full */
1113#else
Bryan Wu1394f032007-05-06 14:50:22 -07001114 .long _ex_trap_c /* 0x11 - Trace Buffer Full */
Robin Getz518039b2007-07-25 11:03:28 +08001115#endif
Bryan Wu1394f032007-05-06 14:50:22 -07001116 .long _ex_trap_c /* 0x12 - Reserved */
1117 .long _ex_trap_c /* 0x13 - Reserved */
1118 .long _ex_trap_c /* 0x14 - Reserved */
1119 .long _ex_trap_c /* 0x15 - Reserved */
1120 .long _ex_trap_c /* 0x16 - Reserved */
1121 .long _ex_trap_c /* 0x17 - Reserved */
1122 .long _ex_trap_c /* 0x18 - Reserved */
1123 .long _ex_trap_c /* 0x19 - Reserved */
1124 .long _ex_trap_c /* 0x1A - Reserved */
1125 .long _ex_trap_c /* 0x1B - Reserved */
1126 .long _ex_trap_c /* 0x1C - Reserved */
1127 .long _ex_trap_c /* 0x1D - Reserved */
1128 .long _ex_trap_c /* 0x1E - Reserved */
1129 .long _ex_trap_c /* 0x1F - Reserved */
1130 .long _ex_trap_c /* 0x20 - Reserved */
1131 .long _ex_trap_c /* 0x21 - Undefined Instruction */
1132 .long _ex_trap_c /* 0x22 - Illegal Instruction Combination */
Robin Getzf26fbc42007-11-12 22:21:30 +08001133 .long _ex_dviol /* 0x23 - Data CPLB Protection Violation */
Bryan Wu1394f032007-05-06 14:50:22 -07001134 .long _ex_trap_c /* 0x24 - Data access misaligned */
1135 .long _ex_trap_c /* 0x25 - Unrecoverable Event */
Robin Getzf26fbc42007-11-12 22:21:30 +08001136 .long _ex_dmiss /* 0x26 - Data CPLB Miss */
1137 .long _ex_dmult /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero */
Bryan Wu1394f032007-05-06 14:50:22 -07001138 .long _ex_trap_c /* 0x28 - Emulation Watchpoint */
1139 .long _ex_trap_c /* 0x29 - Instruction fetch access error (535 only) */
1140 .long _ex_trap_c /* 0x2A - Instruction fetch misaligned */
Robin Getzf26fbc42007-11-12 22:21:30 +08001141 .long _ex_trap_c /* 0x2B - Instruction CPLB protection Violation */
1142 .long _ex_icplb_miss /* 0x2C - Instruction CPLB miss */
Bryan Wu1394f032007-05-06 14:50:22 -07001143 .long _ex_trap_c /* 0x2D - Instruction CPLB Multiple Hits */
1144 .long _ex_trap_c /* 0x2E - Illegal use of Supervisor Resource */
1145 .long _ex_trap_c /* 0x2E - Illegal use of Supervisor Resource */
1146 .long _ex_trap_c /* 0x2F - Reserved */
1147 .long _ex_trap_c /* 0x30 - Reserved */
1148 .long _ex_trap_c /* 0x31 - Reserved */
1149 .long _ex_trap_c /* 0x32 - Reserved */
1150 .long _ex_trap_c /* 0x33 - Reserved */
1151 .long _ex_trap_c /* 0x34 - Reserved */
1152 .long _ex_trap_c /* 0x35 - Reserved */
1153 .long _ex_trap_c /* 0x36 - Reserved */
1154 .long _ex_trap_c /* 0x37 - Reserved */
1155 .long _ex_trap_c /* 0x38 - Reserved */
1156 .long _ex_trap_c /* 0x39 - Reserved */
1157 .long _ex_trap_c /* 0x3A - Reserved */
1158 .long _ex_trap_c /* 0x3B - Reserved */
1159 .long _ex_trap_c /* 0x3C - Reserved */
1160 .long _ex_trap_c /* 0x3D - Reserved */
1161 .long _ex_trap_c /* 0x3E - Reserved */
1162 .long _ex_trap_c /* 0x3F - Reserved */
Mike Frysinger1ffe6642007-08-05 17:14:04 +08001163END(_ex_table)
Bryan Wu1394f032007-05-06 14:50:22 -07001164
Bryan Wu1394f032007-05-06 14:50:22 -07001165ENTRY(_sys_call_table)
Bryan Wu0b95f222007-09-23 00:51:32 +08001166 .long _sys_restart_syscall /* 0 */
Bryan Wu1394f032007-05-06 14:50:22 -07001167 .long _sys_exit
1168 .long _sys_fork
1169 .long _sys_read
1170 .long _sys_write
1171 .long _sys_open /* 5 */
1172 .long _sys_close
1173 .long _sys_ni_syscall /* old waitpid */
1174 .long _sys_creat
1175 .long _sys_link
1176 .long _sys_unlink /* 10 */
1177 .long _sys_execve
1178 .long _sys_chdir
1179 .long _sys_time
1180 .long _sys_mknod
1181 .long _sys_chmod /* 15 */
1182 .long _sys_chown /* chown16 */
1183 .long _sys_ni_syscall /* old break syscall holder */
1184 .long _sys_ni_syscall /* old stat */
1185 .long _sys_lseek
1186 .long _sys_getpid /* 20 */
1187 .long _sys_mount
1188 .long _sys_ni_syscall /* old umount */
1189 .long _sys_setuid
1190 .long _sys_getuid
1191 .long _sys_stime /* 25 */
1192 .long _sys_ptrace
1193 .long _sys_alarm
1194 .long _sys_ni_syscall /* old fstat */
1195 .long _sys_pause
1196 .long _sys_ni_syscall /* old utime */ /* 30 */
1197 .long _sys_ni_syscall /* old stty syscall holder */
1198 .long _sys_ni_syscall /* old gtty syscall holder */
1199 .long _sys_access
1200 .long _sys_nice
1201 .long _sys_ni_syscall /* 35 */ /* old ftime syscall holder */
1202 .long _sys_sync
1203 .long _sys_kill
1204 .long _sys_rename
1205 .long _sys_mkdir
1206 .long _sys_rmdir /* 40 */
1207 .long _sys_dup
1208 .long _sys_pipe
1209 .long _sys_times
1210 .long _sys_ni_syscall /* old prof syscall holder */
1211 .long _sys_brk /* 45 */
1212 .long _sys_setgid
1213 .long _sys_getgid
1214 .long _sys_ni_syscall /* old sys_signal */
1215 .long _sys_geteuid /* geteuid16 */
1216 .long _sys_getegid /* getegid16 */ /* 50 */
1217 .long _sys_acct
1218 .long _sys_umount /* recycled never used phys() */
1219 .long _sys_ni_syscall /* old lock syscall holder */
1220 .long _sys_ioctl
1221 .long _sys_fcntl /* 55 */
1222 .long _sys_ni_syscall /* old mpx syscall holder */
1223 .long _sys_setpgid
1224 .long _sys_ni_syscall /* old ulimit syscall holder */
1225 .long _sys_ni_syscall /* old old uname */
1226 .long _sys_umask /* 60 */
1227 .long _sys_chroot
1228 .long _sys_ustat
1229 .long _sys_dup2
1230 .long _sys_getppid
1231 .long _sys_getpgrp /* 65 */
1232 .long _sys_setsid
1233 .long _sys_ni_syscall /* old sys_sigaction */
1234 .long _sys_sgetmask
1235 .long _sys_ssetmask
1236 .long _sys_setreuid /* setreuid16 */ /* 70 */
1237 .long _sys_setregid /* setregid16 */
1238 .long _sys_ni_syscall /* old sys_sigsuspend */
1239 .long _sys_ni_syscall /* old sys_sigpending */
1240 .long _sys_sethostname
1241 .long _sys_setrlimit /* 75 */
1242 .long _sys_ni_syscall /* old getrlimit */
1243 .long _sys_getrusage
1244 .long _sys_gettimeofday
1245 .long _sys_settimeofday
1246 .long _sys_getgroups /* getgroups16 */ /* 80 */
1247 .long _sys_setgroups /* setgroups16 */
1248 .long _sys_ni_syscall /* old_select */
1249 .long _sys_symlink
1250 .long _sys_ni_syscall /* old lstat */
1251 .long _sys_readlink /* 85 */
1252 .long _sys_uselib
1253 .long _sys_ni_syscall /* sys_swapon */
1254 .long _sys_reboot
1255 .long _sys_ni_syscall /* old_readdir */
1256 .long _sys_ni_syscall /* sys_mmap */ /* 90 */
1257 .long _sys_munmap
1258 .long _sys_truncate
1259 .long _sys_ftruncate
1260 .long _sys_fchmod
1261 .long _sys_fchown /* fchown16 */ /* 95 */
1262 .long _sys_getpriority
1263 .long _sys_setpriority
1264 .long _sys_ni_syscall /* old profil syscall holder */
1265 .long _sys_statfs
1266 .long _sys_fstatfs /* 100 */
1267 .long _sys_ni_syscall
1268 .long _sys_ni_syscall /* old sys_socketcall */
1269 .long _sys_syslog
1270 .long _sys_setitimer
1271 .long _sys_getitimer /* 105 */
1272 .long _sys_newstat
1273 .long _sys_newlstat
1274 .long _sys_newfstat
1275 .long _sys_ni_syscall /* old uname */
1276 .long _sys_ni_syscall /* iopl for i386 */ /* 110 */
1277 .long _sys_vhangup
1278 .long _sys_ni_syscall /* obsolete idle() syscall */
1279 .long _sys_ni_syscall /* vm86old for i386 */
1280 .long _sys_wait4
1281 .long _sys_ni_syscall /* 115 */ /* sys_swapoff */
1282 .long _sys_sysinfo
1283 .long _sys_ni_syscall /* old sys_ipc */
1284 .long _sys_fsync
1285 .long _sys_ni_syscall /* old sys_sigreturn */
1286 .long _sys_clone /* 120 */
1287 .long _sys_setdomainname
1288 .long _sys_newuname
1289 .long _sys_ni_syscall /* old sys_modify_ldt */
1290 .long _sys_adjtimex
1291 .long _sys_ni_syscall /* 125 */ /* sys_mprotect */
1292 .long _sys_ni_syscall /* old sys_sigprocmask */
1293 .long _sys_ni_syscall /* old "creat_module" */
1294 .long _sys_init_module
1295 .long _sys_delete_module
1296 .long _sys_ni_syscall /* 130: old "get_kernel_syms" */
1297 .long _sys_quotactl
1298 .long _sys_getpgid
1299 .long _sys_fchdir
1300 .long _sys_bdflush
1301 .long _sys_ni_syscall /* 135 */ /* sys_sysfs */
1302 .long _sys_personality
1303 .long _sys_ni_syscall /* for afs_syscall */
1304 .long _sys_setfsuid /* setfsuid16 */
1305 .long _sys_setfsgid /* setfsgid16 */
1306 .long _sys_llseek /* 140 */
1307 .long _sys_getdents
1308 .long _sys_ni_syscall /* sys_select */
1309 .long _sys_flock
1310 .long _sys_ni_syscall /* sys_msync */
1311 .long _sys_readv /* 145 */
1312 .long _sys_writev
1313 .long _sys_getsid
1314 .long _sys_fdatasync
1315 .long _sys_sysctl
1316 .long _sys_ni_syscall /* 150 */ /* sys_mlock */
1317 .long _sys_ni_syscall /* sys_munlock */
1318 .long _sys_ni_syscall /* sys_mlockall */
1319 .long _sys_ni_syscall /* sys_munlockall */
1320 .long _sys_sched_setparam
1321 .long _sys_sched_getparam /* 155 */
1322 .long _sys_sched_setscheduler
1323 .long _sys_sched_getscheduler
1324 .long _sys_sched_yield
1325 .long _sys_sched_get_priority_max
1326 .long _sys_sched_get_priority_min /* 160 */
1327 .long _sys_sched_rr_get_interval
1328 .long _sys_nanosleep
Bryan Wu0b95f222007-09-23 00:51:32 +08001329 .long _sys_mremap
Bryan Wu1394f032007-05-06 14:50:22 -07001330 .long _sys_setresuid /* setresuid16 */
1331 .long _sys_getresuid /* getresuid16 */ /* 165 */
1332 .long _sys_ni_syscall /* for vm86 */
1333 .long _sys_ni_syscall /* old "query_module" */
1334 .long _sys_ni_syscall /* sys_poll */
Bryan Wu0b95f222007-09-23 00:51:32 +08001335 .long _sys_nfsservctl
Bryan Wu1394f032007-05-06 14:50:22 -07001336 .long _sys_setresgid /* setresgid16 */ /* 170 */
1337 .long _sys_getresgid /* getresgid16 */
1338 .long _sys_prctl
1339 .long _sys_rt_sigreturn
1340 .long _sys_rt_sigaction
1341 .long _sys_rt_sigprocmask /* 175 */
1342 .long _sys_rt_sigpending
1343 .long _sys_rt_sigtimedwait
1344 .long _sys_rt_sigqueueinfo
1345 .long _sys_rt_sigsuspend
1346 .long _sys_pread64 /* 180 */
1347 .long _sys_pwrite64
1348 .long _sys_lchown /* lchown16 */
1349 .long _sys_getcwd
1350 .long _sys_capget
1351 .long _sys_capset /* 185 */
1352 .long _sys_sigaltstack
1353 .long _sys_sendfile
1354 .long _sys_ni_syscall /* streams1 */
1355 .long _sys_ni_syscall /* streams2 */
1356 .long _sys_vfork /* 190 */
1357 .long _sys_getrlimit
1358 .long _sys_mmap2
1359 .long _sys_truncate64
1360 .long _sys_ftruncate64
1361 .long _sys_stat64 /* 195 */
1362 .long _sys_lstat64
1363 .long _sys_fstat64
1364 .long _sys_chown
1365 .long _sys_getuid
1366 .long _sys_getgid /* 200 */
1367 .long _sys_geteuid
1368 .long _sys_getegid
1369 .long _sys_setreuid
1370 .long _sys_setregid
1371 .long _sys_getgroups /* 205 */
1372 .long _sys_setgroups
1373 .long _sys_fchown
1374 .long _sys_setresuid
1375 .long _sys_getresuid
1376 .long _sys_setresgid /* 210 */
1377 .long _sys_getresgid
1378 .long _sys_lchown
1379 .long _sys_setuid
1380 .long _sys_setgid
1381 .long _sys_setfsuid /* 215 */
1382 .long _sys_setfsgid
1383 .long _sys_pivot_root
1384 .long _sys_ni_syscall /* sys_mincore */
1385 .long _sys_ni_syscall /* sys_madvise */
1386 .long _sys_getdents64 /* 220 */
1387 .long _sys_fcntl64
1388 .long _sys_ni_syscall /* reserved for TUX */
1389 .long _sys_ni_syscall
1390 .long _sys_gettid
Bryan Wu0b95f222007-09-23 00:51:32 +08001391 .long _sys_readahead /* 225 */
Bryan Wu1394f032007-05-06 14:50:22 -07001392 .long _sys_setxattr
1393 .long _sys_lsetxattr
1394 .long _sys_fsetxattr
1395 .long _sys_getxattr
1396 .long _sys_lgetxattr /* 230 */
1397 .long _sys_fgetxattr
1398 .long _sys_listxattr
1399 .long _sys_llistxattr
1400 .long _sys_flistxattr
1401 .long _sys_removexattr /* 235 */
1402 .long _sys_lremovexattr
1403 .long _sys_fremovexattr
1404 .long _sys_tkill
1405 .long _sys_sendfile64
1406 .long _sys_futex /* 240 */
1407 .long _sys_sched_setaffinity
1408 .long _sys_sched_getaffinity
1409 .long _sys_ni_syscall /* sys_set_thread_area */
1410 .long _sys_ni_syscall /* sys_get_thread_area */
1411 .long _sys_io_setup /* 245 */
1412 .long _sys_io_destroy
1413 .long _sys_io_getevents
1414 .long _sys_io_submit
1415 .long _sys_io_cancel
1416 .long _sys_ni_syscall /* 250 */ /* sys_alloc_hugepages */
1417 .long _sys_ni_syscall /* sys_freec_hugepages */
1418 .long _sys_exit_group
1419 .long _sys_lookup_dcookie
1420 .long _sys_bfin_spinlock
1421 .long _sys_epoll_create /* 255 */
1422 .long _sys_epoll_ctl
1423 .long _sys_epoll_wait
1424 .long _sys_ni_syscall /* remap_file_pages */
1425 .long _sys_set_tid_address
1426 .long _sys_timer_create /* 260 */
1427 .long _sys_timer_settime
1428 .long _sys_timer_gettime
1429 .long _sys_timer_getoverrun
1430 .long _sys_timer_delete
1431 .long _sys_clock_settime /* 265 */
1432 .long _sys_clock_gettime
1433 .long _sys_clock_getres
1434 .long _sys_clock_nanosleep
1435 .long _sys_statfs64
1436 .long _sys_fstatfs64 /* 270 */
1437 .long _sys_tgkill
1438 .long _sys_utimes
1439 .long _sys_fadvise64_64
1440 .long _sys_ni_syscall /* vserver */
1441 .long _sys_ni_syscall /* 275, mbind */
1442 .long _sys_ni_syscall /* get_mempolicy */
1443 .long _sys_ni_syscall /* set_mempolicy */
1444 .long _sys_mq_open
1445 .long _sys_mq_unlink
1446 .long _sys_mq_timedsend /* 280 */
1447 .long _sys_mq_timedreceive
1448 .long _sys_mq_notify
1449 .long _sys_mq_getsetattr
1450 .long _sys_ni_syscall /* kexec_load */
1451 .long _sys_waitid /* 285 */
1452 .long _sys_add_key
1453 .long _sys_request_key
1454 .long _sys_keyctl
1455 .long _sys_ioprio_set
1456 .long _sys_ioprio_get /* 290 */
1457 .long _sys_inotify_init
1458 .long _sys_inotify_add_watch
1459 .long _sys_inotify_rm_watch
1460 .long _sys_ni_syscall /* migrate_pages */
1461 .long _sys_openat /* 295 */
1462 .long _sys_mkdirat
1463 .long _sys_mknodat
1464 .long _sys_fchownat
1465 .long _sys_futimesat
1466 .long _sys_fstatat64 /* 300 */
1467 .long _sys_unlinkat
1468 .long _sys_renameat
1469 .long _sys_linkat
1470 .long _sys_symlinkat
1471 .long _sys_readlinkat /* 305 */
1472 .long _sys_fchmodat
1473 .long _sys_faccessat
1474 .long _sys_pselect6
1475 .long _sys_ppoll
1476 .long _sys_unshare /* 310 */
1477 .long _sys_sram_alloc
1478 .long _sys_sram_free
1479 .long _sys_dma_memcpy
1480 .long _sys_accept
1481 .long _sys_bind /* 315 */
1482 .long _sys_connect
1483 .long _sys_getpeername
1484 .long _sys_getsockname
1485 .long _sys_getsockopt
1486 .long _sys_listen /* 320 */
1487 .long _sys_recv
1488 .long _sys_recvfrom
1489 .long _sys_recvmsg
1490 .long _sys_send
1491 .long _sys_sendmsg /* 325 */
1492 .long _sys_sendto
1493 .long _sys_setsockopt
1494 .long _sys_shutdown
1495 .long _sys_socket
1496 .long _sys_socketpair /* 330 */
1497 .long _sys_semctl
1498 .long _sys_semget
1499 .long _sys_semop
1500 .long _sys_msgctl
1501 .long _sys_msgget /* 335 */
1502 .long _sys_msgrcv
1503 .long _sys_msgsnd
1504 .long _sys_shmat
1505 .long _sys_shmctl
1506 .long _sys_shmdt /* 340 */
1507 .long _sys_shmget
Bryan Wu0b95f222007-09-23 00:51:32 +08001508 .long _sys_splice
1509 .long _sys_sync_file_range
1510 .long _sys_tee
1511 .long _sys_vmsplice /* 345 */
1512 .long _sys_epoll_pwait
1513 .long _sys_utimensat
1514 .long _sys_signalfd
Bryan Wu2f775db2008-03-06 16:04:58 -07001515 .long _sys_timerfd_create
Bryan Wu0b95f222007-09-23 00:51:32 +08001516 .long _sys_eventfd /* 350 */
1517 .long _sys_pread64
1518 .long _sys_pwrite64
1519 .long _sys_fadvise64
1520 .long _sys_set_robust_list
1521 .long _sys_get_robust_list /* 355 */
1522 .long _sys_fallocate
Bernd Schmidtfc975512008-01-27 19:56:43 +08001523 .long _sys_semtimedop
Bryan Wu2f775db2008-03-06 16:04:58 -07001524 .long _sys_timerfd_settime
1525 .long _sys_timerfd_gettime
Bryan Wua4b7b6d2008-08-14 15:40:19 +08001526 .long _sys_signalfd4 /* 360 */
1527 .long _sys_eventfd2
1528 .long _sys_epoll_create1
1529 .long _sys_dup3
1530 .long _sys_pipe2
1531 .long _sys_inotify_init1 /* 365 */
Bryan Wu2f775db2008-03-06 16:04:58 -07001532
Bryan Wu1394f032007-05-06 14:50:22 -07001533 .rept NR_syscalls-(.-_sys_call_table)/4
1534 .long _sys_ni_syscall
1535 .endr
Robin Getz0c7a6b22008-10-08 16:27:12 +08001536END(_sys_call_table)
Bryan Wu1394f032007-05-06 14:50:22 -07001537
Mike Frysinger6ad2b842008-10-28 11:03:09 +08001538#ifdef CONFIG_EXCEPTION_L1_SCRATCH
1539/* .section .l1.bss.scratch */
1540.set _exception_stack_top, L1_SCRATCH_START + L1_SCRATCH_LENGTH
1541#else
1542#ifdef CONFIG_SYSCALL_TAB_L1
1543.section .l1.bss
1544#else
1545.bss
1546#endif
Graf Yang6b3087c2009-01-07 23:14:39 +08001547ENTRY(_exception_stack)
1548 .rept 1024 * NR_CPUS
Graf Yangefe065a2008-10-28 14:00:52 +08001549 .long 0
1550 .endr
1551_exception_stack_top:
Mike Frysinger6ad2b842008-10-28 11:03:09 +08001552#endif