blob: 0efd5f5b7ba057f8a4ed113457c19173c53c9f5e [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++];
115 ASTAT = [sp++];
116 SAVE_ALL_SYS
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800117#ifdef CONFIG_MPU
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 Schmidt2a0c4fd2008-04-23 07:17:34 +0800122#endif
123 DEBUG_HWTRACE_SAVE(p5, r7)
124#ifdef CONFIG_MPU
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;
130#else
Bryan Wu1394f032007-05-06 14:50:22 -0700131 call __cplb_hdr;
Bernd Schmidtb97b8a92008-01-27 18:39:16 +0800132#endif
Robin Getz0c7a6b22008-10-08 16:27:12 +0800133
134#ifdef CONFIG_DEBUG_DOUBLEFAULT
135 /* While we were processing this, did we double fault? */
136 r7 = SEQSTAT; /* reason code is in bit 5:0 */
137 r6.l = lo(SEQSTAT_EXCAUSE);
138 r6.h = hi(SEQSTAT_EXCAUSE);
139 r7 = r7 & r6;
140 r6 = 0x25;
141 CC = R7 == R6;
142 if CC JUMP _double_fault;
143#endif
144
Mike Frysinger80f31c82008-02-02 15:47:24 +0800145 DEBUG_HWTRACE_RESTORE(p5, r7)
Bryan Wu1394f032007-05-06 14:50:22 -0700146 RESTORE_ALL_SYS
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_soft_bp)
157 r7 = retx;
158 r7 += -2;
159 retx = r7;
160 jump.s _ex_trap_c;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800161ENDPROC(_ex_soft_bp)
Bryan Wu1394f032007-05-06 14:50:22 -0700162
163ENTRY(_ex_single_step)
Bernd Schmidt0893f122008-05-07 11:41:26 +0800164 /* If we just returned from an interrupt, the single step event is
165 for the RTI instruction. */
Bryan Wu1394f032007-05-06 14:50:22 -0700166 r7 = retx;
167 r6 = reti;
168 cc = r7 == r6;
Bernd Schmidt0893f122008-05-07 11:41:26 +0800169 if cc jump _bfin_return_from_exception;
170
Jie Zhang5400c5a2008-08-05 17:33:38 +0800171#ifdef CONFIG_KGDB
Sonic Zhang0d1cdd72008-07-26 18:54:38 +0800172 /* Don't do single step in hardware exception handler */
173 p5.l = lo(IPEND);
174 p5.h = hi(IPEND);
175 r6 = [p5];
Sonic Zhangd6a29892008-08-05 18:28:26 +0800176 cc = bittst(r6, 4);
177 if cc jump _bfin_return_from_exception;
Sonic Zhang0d1cdd72008-07-26 18:54:38 +0800178 cc = bittst(r6, 5);
179 if cc jump _bfin_return_from_exception;
180
Sonic Zhang0d1cdd72008-07-26 18:54:38 +0800181 /* skip single step if current interrupt priority is higher than
182 * that of the first instruction, from which gdb starts single step */
183 r6 >>= 6;
184 r7 = 10;
185.Lfind_priority_start:
186 cc = bittst(r6, 0);
187 if cc jump .Lfind_priority_done;
188 r6 >>= 1;
189 r7 += -1;
190 cc = r7 == 0;
191 if cc jump .Lfind_priority_done;
192 jump.s .Lfind_priority_start;
193.Lfind_priority_done:
Sonic Zhanga5ac0122008-10-13 14:07:19 +0800194 p4.l = _kgdb_single_step;
195 p4.h = _kgdb_single_step;
Sonic Zhang0d1cdd72008-07-26 18:54:38 +0800196 r6 = [p4];
197 cc = r6 == 0;
198 if cc jump .Ldo_single_step;
199 r6 += -1;
200 cc = r6 < r7;
Sonic Zhangd6a29892008-08-05 18:28:26 +0800201 if cc jump 1f;
Sonic Zhang0d1cdd72008-07-26 18:54:38 +0800202.Ldo_single_step:
Sonic Zhangd6a29892008-08-05 18:28:26 +0800203#else
Bernd Schmidt0893f122008-05-07 11:41:26 +0800204 /* If we were in user mode, do the single step normally. */
Jie Zhang5400c5a2008-08-05 17:33:38 +0800205 p5.l = lo(IPEND);
206 p5.h = hi(IPEND);
Bernd Schmidt0893f122008-05-07 11:41:26 +0800207 r6 = [p5];
208 r7 = 0xffe0 (z);
209 r7 = r7 & r6;
210 cc = r7 == 0;
Jie Zhang5400c5a2008-08-05 17:33:38 +0800211 if !cc jump 1f;
Sonic Zhangd6a29892008-08-05 18:28:26 +0800212#endif
Bernd Schmidt0893f122008-05-07 11:41:26 +0800213
Jie Zhang5400c5a2008-08-05 17:33:38 +0800214 /* Single stepping only a single instruction, so clear the trace
215 * bit here. */
216 r7 = syscfg;
217 bitclr (r7, 0);
218 syscfg = R7;
219 jump _ex_trap_c;
220
2211:
Bernd Schmidt0893f122008-05-07 11:41:26 +0800222 /*
223 * We were in an interrupt handler. By convention, all of them save
224 * SYSCFG with their first instruction, so by checking whether our
225 * RETX points at the entry point, we can determine whether to allow
226 * a single step, or whether to clear SYSCFG.
227 *
228 * First, find out the interrupt level and the event vector for it.
229 */
230 p5.l = lo(EVT0);
231 p5.h = hi(EVT0);
232 p5 += -4;
2332:
234 r7 = rot r7 by -1;
235 p5 += 4;
236 if !cc jump 2b;
237
238 /* What we actually do is test for the _second_ instruction in the
239 * IRQ handler. That way, if there are insns following the restore
240 * of SYSCFG after leaving the handler, we will not turn off SYSCFG
241 * for them. */
242
243 r7 = [p5];
244 r7 += 2;
245 r6 = RETX;
246 cc = R7 == R6;
247 if !cc jump _bfin_return_from_exception;
248
Bryan Wu1394f032007-05-06 14:50:22 -0700249 r7 = syscfg;
250 bitclr (r7, 0);
251 syscfg = R7;
252
Jie Zhang5400c5a2008-08-05 17:33:38 +0800253 /* Fall through to _bfin_return_from_exception. */
Mike Frysinger46c87c32007-11-21 16:15:48 +0800254ENDPROC(_ex_single_step)
Bryan Wu1394f032007-05-06 14:50:22 -0700255
Mike Frysinger8d6c2422007-11-21 15:53:49 +0800256ENTRY(_bfin_return_from_exception)
Mike Frysinger1aafd902007-07-25 11:19:14 +0800257#if ANOMALY_05000257
Michael Hennerich8af10b72007-05-21 18:09:09 +0800258 R7=LC0;
259 LC0=R7;
260 R7=LC1;
261 LC1=R7;
262#endif
Robin Getz0c7a6b22008-10-08 16:27:12 +0800263
264#ifdef CONFIG_DEBUG_DOUBLEFAULT
265 /* While we were processing the current exception,
266 * did we cause another, and double fault?
267 */
268 r7 = SEQSTAT; /* reason code is in bit 5:0 */
269 r6.l = lo(SEQSTAT_EXCAUSE);
270 r6.h = hi(SEQSTAT_EXCAUSE);
271 r7 = r7 & r6;
272 r6 = 0x25;
273 CC = R7 == R6;
274 if CC JUMP _double_fault;
275
276 /* Did we cause a HW error? */
277 p5.l = lo(ILAT);
278 p5.h = hi(ILAT);
279 r6 = [p5];
280 r7 = 0x20; /* Did I just cause anther HW error? */
Graf Yang4213cb62008-11-18 17:48:22 +0800281 r6 = r7 & r6;
Robin Getz0c7a6b22008-10-08 16:27:12 +0800282 CC = R7 == R6;
283 if CC JUMP _double_fault;
284#endif
285
Bryan Wu1394f032007-05-06 14:50:22 -0700286 (R7:6,P5:4) = [sp++];
287 ASTAT = [sp++];
Mike Frysingerf0b5d122007-08-05 17:03:59 +0800288 sp = EX_SCRATCH_REG;
Bryan Wu1394f032007-05-06 14:50:22 -0700289 rtx;
Mike Frysinger46c87c32007-11-21 16:15:48 +0800290ENDPROC(_bfin_return_from_exception)
Bryan Wu1394f032007-05-06 14:50:22 -0700291
292ENTRY(_handle_bad_cplb)
Bernd Schmidt2a0c4fd2008-04-23 07:17:34 +0800293 DEBUG_HWTRACE_RESTORE(p5, r7)
Bryan Wu1394f032007-05-06 14:50:22 -0700294 /* To get here, we just tried and failed to change a CPLB
295 * so, handle things in trap_c (C code), by lowering to
296 * IRQ5, just like we normally do. Since this is not a
297 * "normal" return path, we have a do alot of stuff to
298 * the stack to get ready so, we can fall through - we
299 * need to make a CPLB exception look like a normal exception
300 */
301
Bryan Wu1394f032007-05-06 14:50:22 -0700302 RESTORE_ALL_SYS
303 [--sp] = ASTAT;
Mike Frysinger80f31c82008-02-02 15:47:24 +0800304 [--sp] = (R7:6,P5:4);
Bryan Wu1394f032007-05-06 14:50:22 -0700305
Mike Frysinger1ffe6642007-08-05 17:14:04 +0800306ENTRY(_ex_replaceable)
307 nop;
308
Bryan Wu1394f032007-05-06 14:50:22 -0700309ENTRY(_ex_trap_c)
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;
316
Bryan Wu1394f032007-05-06 14:50:22 -0700317 /* Call C code (trap_c) to handle the exception, which most
318 * likely involves sending a signal to the current process.
319 * To avoid double faults, lower our priority to IRQ5 first.
320 */
321 P5.h = _exception_to_level5;
322 P5.l = _exception_to_level5;
323 p4.l = lo(EVT5);
324 p4.h = hi(EVT5);
325 [p4] = p5;
326 csync;
327
Graf Yang6b3087c2009-01-07 23:14:39 +0800328 GET_PDA(p5, r6);
Robin Getz0c7a6b22008-10-08 16:27:12 +0800329#ifndef CONFIG_DEBUG_DOUBLEFAULT
Graf Yang6b3087c2009-01-07 23:14:39 +0800330
Robin Getz0c7a6b22008-10-08 16:27:12 +0800331 /*
332 * Save these registers, as they are only valid in exception context
333 * (where we are now - as soon as we defer to IRQ5, they can change)
334 * DCPLB_STATUS and ICPLB_STATUS are also only valid in EVT3,
335 * but they are not very interesting, so don't save them
336 */
337
Bernd Schmidt5d750b92008-04-25 05:02:33 +0800338 p4.l = lo(DCPLB_FAULT_ADDR);
339 p4.h = hi(DCPLB_FAULT_ADDR);
340 r7 = [p4];
Graf Yang6b3087c2009-01-07 23:14:39 +0800341 [p5 + PDA_DCPLB] = r7;
Bernd Schmidt5d750b92008-04-25 05:02:33 +0800342
Graf Yang6b3087c2009-01-07 23:14:39 +0800343 p4.l = lo(ICPLB_FAULT_ADDR);
344 p4.h = hi(ICPLB_FAULT_ADDR);
345 r6 = [p4];
346 [p5 + PDA_ICPLB] = r6;
Bernd Schmidt5d750b92008-04-25 05:02:33 +0800347
Bernd Schmidt5d750b92008-04-25 05:02:33 +0800348 r6 = retx;
Graf Yang6b3087c2009-01-07 23:14:39 +0800349 [p5 + PDA_RETX] = r6;
Robin Getz0c7a6b22008-10-08 16:27:12 +0800350#endif
Bernd Schmidt0893f122008-05-07 11:41:26 +0800351 r6 = SYSCFG;
Graf Yang6b3087c2009-01-07 23:14:39 +0800352 [p5 + PDA_SYSCFG] = r6;
Bernd Schmidt0893f122008-05-07 11:41:26 +0800353 BITCLR(r6, 0);
354 SYSCFG = r6;
Bernd Schmidt5d750b92008-04-25 05:02:33 +0800355
Bryan Wu1394f032007-05-06 14:50:22 -0700356 /* Disable all interrupts, but make sure level 5 is enabled so
357 * we can switch to that level. Save the old mask. */
358 cli r6;
Graf Yang6b3087c2009-01-07 23:14:39 +0800359 [p5 + PDA_EXIMASK] = r6;
Bernd Schmidt0893f122008-05-07 11:41:26 +0800360
361 p4.l = lo(SAFE_USER_INSTRUCTION);
362 p4.h = hi(SAFE_USER_INSTRUCTION);
363 retx = p4;
364
Bryan Wu1394f032007-05-06 14:50:22 -0700365 r6 = 0x3f;
366 sti r6;
367
Bryan Wu1394f032007-05-06 14:50:22 -0700368 raise 5;
Robin Getz0c7a6b22008-10-08 16:27:12 +0800369 jump.s _bfin_return_from_exception;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800370ENDPROC(_ex_trap_c)
Bryan Wu1394f032007-05-06 14:50:22 -0700371
Robin Getz2ebcade2007-10-09 17:24:30 +0800372/* We just realized we got an exception, while we were processing a different
Mike Frysinger33c86912008-11-18 17:48:22 +0800373 * exception. This is a unrecoverable event, so crash.
374 * Note: this cannot be ENTRY() as we jump here with "if cc jump" ...
Robin Getz2ebcade2007-10-09 17:24:30 +0800375 */
Mike Frysinger33c86912008-11-18 17:48:22 +0800376_double_fault:
Robin Getz0c7a6b22008-10-08 16:27:12 +0800377 /* Turn caches & protection off, to ensure we don't get any more
378 * double exceptions
379 */
Robin Getz2ebcade2007-10-09 17:24:30 +0800380
Robin Getz0c7a6b22008-10-08 16:27:12 +0800381 P4.L = LO(IMEM_CONTROL);
382 P4.H = HI(IMEM_CONTROL);
Robin Getz2ebcade2007-10-09 17:24:30 +0800383
Robin Getz0c7a6b22008-10-08 16:27:12 +0800384 R5 = [P4]; /* Control Register*/
385 BITCLR(R5,ENICPLB_P);
386 SSYNC; /* SSYNC required before writing to IMEM_CONTROL. */
387 .align 8;
388 [P4] = R5;
389 SSYNC;
Robin Getz2ebcade2007-10-09 17:24:30 +0800390
Robin Getz0c7a6b22008-10-08 16:27:12 +0800391 P4.L = LO(DMEM_CONTROL);
392 P4.H = HI(DMEM_CONTROL);
393 R5 = [P4];
394 BITCLR(R5,ENDCPLB_P);
395 SSYNC; /* SSYNC required before writing to DMEM_CONTROL. */
396 .align 8;
397 [P4] = R5;
398 SSYNC;
Robin Getz2ebcade2007-10-09 17:24:30 +0800399
Robin Getz0c7a6b22008-10-08 16:27:12 +0800400 /* Fix up the stack */
401 (R7:6,P5:4) = [sp++];
402 ASTAT = [sp++];
403 SP = EX_SCRATCH_REG;
Robin Getz2ebcade2007-10-09 17:24:30 +0800404
Robin Getz0c7a6b22008-10-08 16:27:12 +0800405 /* We should be out of the exception stack, and back down into
406 * kernel or user space stack
407 */
408 SAVE_ALL_SYS
Robin Getz2ebcade2007-10-09 17:24:30 +0800409
Bernd Schmidtddb3f002008-05-07 11:41:26 +0800410 /* The dumping functions expect the return address in the RETI
411 * slot. */
412 r6 = retx;
413 [sp + PT_PC] = r6;
414
Robin Getz0c7a6b22008-10-08 16:27:12 +0800415 r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */
416 SP += -12;
417 call _double_fault_c;
418 SP += 12;
Robin Getz2ebcade2007-10-09 17:24:30 +0800419.L_double_fault_panic:
420 JUMP .L_double_fault_panic
421
422ENDPROC(_double_fault)
423
Bryan Wu1394f032007-05-06 14:50:22 -0700424ENTRY(_exception_to_level5)
425 SAVE_ALL_SYS
426
Graf Yang6b3087c2009-01-07 23:14:39 +0800427 GET_PDA(p4, r7); /* Fetch current PDA */
428 r6 = [p4 + PDA_RETX];
Bernd Schmidt5d750b92008-04-25 05:02:33 +0800429 [sp + PT_PC] = r6;
430
Graf Yang6b3087c2009-01-07 23:14:39 +0800431 r6 = [p4 + PDA_SYSCFG];
Bernd Schmidt0893f122008-05-07 11:41:26 +0800432 [sp + PT_SYSCFG] = r6;
433
Bryan Wu1394f032007-05-06 14:50:22 -0700434 /* Restore interrupt mask. We haven't pushed RETI, so this
435 * doesn't enable interrupts until we return from this handler. */
Graf Yang6b3087c2009-01-07 23:14:39 +0800436 r6 = [p4 + PDA_EXIMASK];
Bryan Wu1394f032007-05-06 14:50:22 -0700437 sti r6;
438
439 /* Restore the hardware error vector. */
440 P5.h = _evt_ivhw;
441 P5.l = _evt_ivhw;
442 p4.l = lo(EVT5);
443 p4.h = hi(EVT5);
444 [p4] = p5;
445 csync;
446
447 p2.l = lo(IPEND);
448 p2.h = hi(IPEND);
449 csync;
450 r0 = [p2]; /* Read current IPEND */
451 [sp + PT_IPEND] = r0; /* Store IPEND */
452
Bryan Wu1394f032007-05-06 14:50:22 -0700453 r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */
454 SP += -12;
455 call _trap_c;
456 SP += 12;
457
Robin Getz0c7a6b22008-10-08 16:27:12 +0800458#ifdef CONFIG_DEBUG_DOUBLEFAULT
459 /* Grab ILAT */
460 p2.l = lo(ILAT);
461 p2.h = hi(ILAT);
462 r0 = [p2];
463 r1 = 0x20; /* Did I just cause anther HW error? */
464 r0 = r0 & r1;
465 CC = R0 == R1;
466 if CC JUMP _double_fault;
467#endif
468
Bryan Wu1394f032007-05-06 14:50:22 -0700469 call _ret_from_exception;
470 RESTORE_ALL_SYS
471 rti;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800472ENDPROC(_exception_to_level5)
Bryan Wu1394f032007-05-06 14:50:22 -0700473
474ENTRY(_trap) /* Exception: 4th entry into system event table(supervisor mode)*/
475 /* Since the kernel stack can be anywhere, it's not guaranteed to be
476 * covered by a CPLB. Switch to an exception stack; use RETN as a
477 * scratch register (for want of a better option).
478 */
Mike Frysingerf0b5d122007-08-05 17:03:59 +0800479 EX_SCRATCH_REG = sp;
Graf Yang6b3087c2009-01-07 23:14:39 +0800480 GET_PDA_SAFE(sp);
481 sp = [sp + PDA_EXSTACK]
Bryan Wu1394f032007-05-06 14:50:22 -0700482 /* Try to deal with syscalls quickly. */
483 [--sp] = ASTAT;
Mike Frysinger80f31c82008-02-02 15:47:24 +0800484 [--sp] = (R7:6,P5:4);
Robin Getz0c7a6b22008-10-08 16:27:12 +0800485
Michael Hennerich5e9e7682008-10-09 12:31:03 +0800486#if ANOMALY_05000283 || ANOMALY_05000315
487 cc = r7 == r7;
488 p5.h = HI(CHIPID);
489 p5.l = LO(CHIPID);
490 if cc jump 1f;
491 r7.l = W[p5];
4921:
493#endif
494
Robin Getz0c7a6b22008-10-08 16:27:12 +0800495#ifdef CONFIG_DEBUG_DOUBLEFAULT
496 /*
497 * Save these registers, as they are only valid in exception context
498 * (where we are now - as soon as we defer to IRQ5, they can change)
499 * DCPLB_STATUS and ICPLB_STATUS are also only valid in EVT3,
500 * but they are not very interesting, so don't save them
501 */
502
Graf Yang6b3087c2009-01-07 23:14:39 +0800503 GET_PDA(p5, r7);
Robin Getz0c7a6b22008-10-08 16:27:12 +0800504 p4.l = lo(DCPLB_FAULT_ADDR);
505 p4.h = hi(DCPLB_FAULT_ADDR);
506 r7 = [p4];
Graf Yang6b3087c2009-01-07 23:14:39 +0800507 [p5 + PDA_DCPLB] = r7;
Robin Getz0c7a6b22008-10-08 16:27:12 +0800508
Graf Yang6b3087c2009-01-07 23:14:39 +0800509 p4.l = lo(ICPLB_FAULT_ADDR);
510 p4.h = hi(ICPLB_FAULT_ADDR);
511 r7 = [p4];
512 [p5 + PDA_ICPLB] = r7;
Robin Getz0c7a6b22008-10-08 16:27:12 +0800513
Robin Getz0c7a6b22008-10-08 16:27:12 +0800514 r6 = retx;
Graf Yang6b3087c2009-01-07 23:14:39 +0800515 [p5 + PDA_RETX] = r6;
Robin Getz0c7a6b22008-10-08 16:27:12 +0800516
Bryan Wu1394f032007-05-06 14:50:22 -0700517 r7 = SEQSTAT; /* reason code is in bit 5:0 */
Graf Yang6b3087c2009-01-07 23:14:39 +0800518 [p5 + PDA_SEQSTAT] = r7;
Robin Getz0c7a6b22008-10-08 16:27:12 +0800519#else
520 r7 = SEQSTAT; /* reason code is in bit 5:0 */
521#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700522 r6.l = lo(SEQSTAT_EXCAUSE);
523 r6.h = hi(SEQSTAT_EXCAUSE);
524 r7 = r7 & r6;
Mike Frysinger1ffe6642007-08-05 17:14:04 +0800525 p5.h = _ex_table;
526 p5.l = _ex_table;
Bryan Wu1394f032007-05-06 14:50:22 -0700527 p4 = r7;
528 p5 = p5 + (p4 << 2);
529 p4 = [p5];
530 jump (p4);
531
532.Lbadsys:
533 r7 = -ENOSYS; /* signextending enough */
534 [sp + PT_R0] = r7; /* return value from system call */
535 jump .Lsyscall_really_exit;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800536ENDPROC(_trap)
Bryan Wu1394f032007-05-06 14:50:22 -0700537
538ENTRY(_kernel_execve)
539 link SIZEOF_PTREGS;
540 p0 = sp;
541 r3 = SIZEOF_PTREGS / 4;
542 r4 = 0(x);
Graf Yang6b3087c2009-01-07 23:14:39 +0800543.Lclear_regs:
Bryan Wu1394f032007-05-06 14:50:22 -0700544 [p0++] = r4;
545 r3 += -1;
546 cc = r3 == 0;
Graf Yang6b3087c2009-01-07 23:14:39 +0800547 if !cc jump .Lclear_regs (bp);
Bryan Wu1394f032007-05-06 14:50:22 -0700548
549 p0 = sp;
550 sp += -16;
551 [sp + 12] = p0;
552 call _do_execve;
553 SP += 16;
554 cc = r0 == 0;
Graf Yang6b3087c2009-01-07 23:14:39 +0800555 if ! cc jump .Lexecve_failed;
Bryan Wu1394f032007-05-06 14:50:22 -0700556 /* Success. Copy our temporary pt_regs to the top of the kernel
557 * stack and do a normal exception return.
558 */
559 r1 = sp;
560 r0 = (-KERNEL_STACK_SIZE) (x);
561 r1 = r1 & r0;
562 p2 = r1;
563 p3 = [p2];
564 r0 = KERNEL_STACK_SIZE - 4 (z);
565 p1 = r0;
566 p1 = p1 + p2;
567
568 p0 = fp;
569 r4 = [p0--];
570 r3 = SIZEOF_PTREGS / 4;
Graf Yang6b3087c2009-01-07 23:14:39 +0800571.Lcopy_regs:
Bryan Wu1394f032007-05-06 14:50:22 -0700572 r4 = [p0--];
573 [p1--] = r4;
574 r3 += -1;
575 cc = r3 == 0;
Graf Yang6b3087c2009-01-07 23:14:39 +0800576 if ! cc jump .Lcopy_regs (bp);
Bryan Wu1394f032007-05-06 14:50:22 -0700577
578 r0 = (KERNEL_STACK_SIZE - SIZEOF_PTREGS) (z);
579 p1 = r0;
580 p1 = p1 + p2;
581 sp = p1;
582 r0 = syscfg;
583 [SP + PT_SYSCFG] = r0;
584 [p3 + (TASK_THREAD + THREAD_KSP)] = sp;
585
586 RESTORE_CONTEXT;
587 rti;
Graf Yang6b3087c2009-01-07 23:14:39 +0800588.Lexecve_failed:
Bryan Wu1394f032007-05-06 14:50:22 -0700589 unlink;
590 rts;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800591ENDPROC(_kernel_execve)
Bryan Wu1394f032007-05-06 14:50:22 -0700592
593ENTRY(_system_call)
594 /* Store IPEND */
595 p2.l = lo(IPEND);
596 p2.h = hi(IPEND);
597 csync;
598 r0 = [p2];
599 [sp + PT_IPEND] = r0;
600
601 /* Store RETS for now */
602 r0 = rets;
603 [sp + PT_RESERVED] = r0;
604 /* Set the stack for the current process */
605 r7 = sp;
606 r6.l = lo(ALIGN_PAGE_MASK);
607 r6.h = hi(ALIGN_PAGE_MASK);
608 r7 = r7 & r6; /* thread_info */
609 p2 = r7;
610 p2 = [p2];
611
612 [p2+(TASK_THREAD+THREAD_KSP)] = sp;
613
614 /* Check the System Call */
615 r7 = __NR_syscall;
616 /* System call number is passed in P0 */
617 r6 = p0;
618 cc = r6 < r7;
619 if ! cc jump .Lbadsys;
620
621 /* are we tracing syscalls?*/
622 r7 = sp;
623 r6.l = lo(ALIGN_PAGE_MASK);
624 r6.h = hi(ALIGN_PAGE_MASK);
625 r7 = r7 & r6;
626 p2 = r7;
627 r7 = [p2+TI_FLAGS];
628 CC = BITTST(r7,TIF_SYSCALL_TRACE);
629 if CC JUMP _sys_trace;
630
631 /* Execute the appropriate system call */
632
633 p4 = p0;
634 p5.l = _sys_call_table;
635 p5.h = _sys_call_table;
636 p5 = p5 + (p4 << 2);
637 r0 = [sp + PT_R0];
638 r1 = [sp + PT_R1];
639 r2 = [sp + PT_R2];
640 p5 = [p5];
641
642 [--sp] = r5;
643 [--sp] = r4;
644 [--sp] = r3;
645 SP += -12;
646 call (p5);
647 SP += 24;
648 [sp + PT_R0] = r0;
649
650.Lresume_userspace:
651 r7 = sp;
652 r4.l = lo(ALIGN_PAGE_MASK);
653 r4.h = hi(ALIGN_PAGE_MASK);
654 r7 = r7 & r4; /* thread_info->flags */
655 p5 = r7;
656.Lresume_userspace_1:
657 /* Disable interrupts. */
658 [--sp] = reti;
659 reti = [sp++];
660
661 r7 = [p5 + TI_FLAGS];
662 r4.l = lo(_TIF_WORK_MASK);
663 r4.h = hi(_TIF_WORK_MASK);
664 r7 = r7 & r4;
665
666.Lsyscall_resched:
667 cc = BITTST(r7, TIF_NEED_RESCHED);
668 if !cc jump .Lsyscall_sigpending;
669
670 /* Reenable interrupts. */
671 [--sp] = reti;
672 r0 = [sp++];
673
674 SP += -12;
675 call _schedule;
676 SP += 12;
677
678 jump .Lresume_userspace_1;
679
680.Lsyscall_sigpending:
681 cc = BITTST(r7, TIF_RESTORE_SIGMASK);
682 if cc jump .Lsyscall_do_signals;
683 cc = BITTST(r7, TIF_SIGPENDING);
684 if !cc jump .Lsyscall_really_exit;
685.Lsyscall_do_signals:
686 /* Reenable interrupts. */
687 [--sp] = reti;
688 r0 = [sp++];
689
690 r0 = sp;
691 SP += -12;
692 call _do_signal;
693 SP += 12;
694
695.Lsyscall_really_exit:
696 r5 = [sp + PT_RESERVED];
697 rets = r5;
698 rts;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800699ENDPROC(_system_call)
Bryan Wu1394f032007-05-06 14:50:22 -0700700
Mike Frysinger47664c12008-10-09 15:32:18 +0800701/* Do not mark as ENTRY() to avoid error in assembler ...
702 * this symbol need not be global anyways, so ...
703 */
Bryan Wu1394f032007-05-06 14:50:22 -0700704_sys_trace:
705 call _syscall_trace;
706
707 /* Execute the appropriate system call */
708
709 p4 = [SP + PT_P0];
710 p5.l = _sys_call_table;
711 p5.h = _sys_call_table;
712 p5 = p5 + (p4 << 2);
713 r0 = [sp + PT_R0];
714 r1 = [sp + PT_R1];
715 r2 = [sp + PT_R2];
716 r3 = [sp + PT_R3];
717 r4 = [sp + PT_R4];
718 r5 = [sp + PT_R5];
719 p5 = [p5];
720
721 [--sp] = r5;
722 [--sp] = r4;
723 [--sp] = r3;
724 SP += -12;
725 call (p5);
726 SP += 24;
727 [sp + PT_R0] = r0;
728
729 call _syscall_trace;
730 jump .Lresume_userspace;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800731ENDPROC(_sys_trace)
Bryan Wu1394f032007-05-06 14:50:22 -0700732
733ENTRY(_resume)
734 /*
735 * Beware - when entering resume, prev (the current task) is
736 * in r0, next (the new task) is in r1.
737 */
738 p0 = r0;
739 p1 = r1;
740 [--sp] = rets;
741 [--sp] = fp;
742 [--sp] = (r7:4, p5:3);
743
744 /* save usp */
745 p2 = usp;
746 [p0+(TASK_THREAD+THREAD_USP)] = p2;
747
748 /* save current kernel stack pointer */
749 [p0+(TASK_THREAD+THREAD_KSP)] = sp;
750
751 /* save program counter */
752 r1.l = _new_old_task;
753 r1.h = _new_old_task;
754 [p0+(TASK_THREAD+THREAD_PC)] = r1;
755
756 /* restore the kernel stack pointer */
757 sp = [p1+(TASK_THREAD+THREAD_KSP)];
758
759 /* restore user stack pointer */
760 p0 = [p1+(TASK_THREAD+THREAD_USP)];
761 usp = p0;
762
763 /* restore pc */
764 p0 = [p1+(TASK_THREAD+THREAD_PC)];
765 jump (p0);
766
767 /*
768 * Following code actually lands up in a new (old) task.
769 */
770
771_new_old_task:
772 (r7:4, p5:3) = [sp++];
773 fp = [sp++];
774 rets = [sp++];
775
776 /*
777 * When we come out of resume, r0 carries "old" task, becuase we are
778 * in "new" task.
779 */
780 rts;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800781ENDPROC(_resume)
Bryan Wu1394f032007-05-06 14:50:22 -0700782
783ENTRY(_ret_from_exception)
784 p2.l = lo(IPEND);
785 p2.h = hi(IPEND);
786
787 csync;
788 r0 = [p2];
789 [sp + PT_IPEND] = r0;
790
7911:
Robin Getzd5c4b5e2007-12-21 17:49:53 +0800792 r2 = LO(~0x37) (Z);
Bryan Wu1394f032007-05-06 14:50:22 -0700793 r0 = r2 & r0;
794 cc = r0 == 0;
795 if !cc jump 4f; /* if not return to user mode, get out */
796
797 /* Make sure any pending system call or deferred exception
798 * return in ILAT for this process to get executed, otherwise
799 * in case context switch happens, system call of
800 * first process (i.e in ILAT) will be carried
801 * forward to the switched process
802 */
803
804 p2.l = lo(ILAT);
805 p2.h = hi(ILAT);
806 r0 = [p2];
807 r1 = (EVT_IVG14 | EVT_IVG15) (z);
808 r0 = r0 & r1;
809 cc = r0 == 0;
810 if !cc jump 5f;
811
812 /* Set the stack for the current process */
813 r7 = sp;
814 r4.l = lo(ALIGN_PAGE_MASK);
815 r4.h = hi(ALIGN_PAGE_MASK);
816 r7 = r7 & r4; /* thread_info->flags */
817 p5 = r7;
818 r7 = [p5 + TI_FLAGS];
819 r4.l = lo(_TIF_WORK_MASK);
820 r4.h = hi(_TIF_WORK_MASK);
821 r7 = r7 & r4;
822 cc = r7 == 0;
823 if cc jump 4f;
824
825 p0.l = lo(EVT15);
826 p0.h = hi(EVT15);
827 p1.l = _schedule_and_signal;
828 p1.h = _schedule_and_signal;
829 [p0] = p1;
830 csync;
831 raise 15; /* raise evt14 to do signal or reschedule */
8324:
833 r0 = syscfg;
834 bitclr(r0, 0);
835 syscfg = r0;
8365:
837 rts;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800838ENDPROC(_ret_from_exception)
Bryan Wu1394f032007-05-06 14:50:22 -0700839
840ENTRY(_return_from_int)
841 /* If someone else already raised IRQ 15, do nothing. */
842 csync;
843 p2.l = lo(ILAT);
844 p2.h = hi(ILAT);
845 r0 = [p2];
846 cc = bittst (r0, EVT_IVG15_P);
847 if cc jump 2f;
848
849 /* if not return to user mode, get out */
850 p2.l = lo(IPEND);
851 p2.h = hi(IPEND);
852 r0 = [p2];
853 r1 = 0x17(Z);
854 r2 = ~r1;
855 r2.h = 0;
856 r0 = r2 & r0;
857 r1 = 1;
858 r1 = r0 - r1;
859 r2 = r0 & r1;
860 cc = r2 == 0;
861 if !cc jump 2f;
862
863 /* Lower the interrupt level to 15. */
864 p0.l = lo(EVT15);
865 p0.h = hi(EVT15);
866 p1.l = _schedule_and_signal_from_int;
867 p1.h = _schedule_and_signal_from_int;
868 [p0] = p1;
869 csync;
Mike Frysinger1aafd902007-07-25 11:19:14 +0800870#if ANOMALY_05000281
Bernd Schmidt5d750b92008-04-25 05:02:33 +0800871 r0.l = lo(SAFE_USER_INSTRUCTION);
872 r0.h = hi(SAFE_USER_INSTRUCTION);
Bryan Wu1394f032007-05-06 14:50:22 -0700873 reti = r0;
874#endif
875 r0 = 0x801f (z);
876 STI r0;
877 raise 15; /* raise evt15 to do signal or reschedule */
878 rti;
8792:
880 rts;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800881ENDPROC(_return_from_int)
Bryan Wu1394f032007-05-06 14:50:22 -0700882
883ENTRY(_lower_to_irq14)
Mike Frysinger1aafd902007-07-25 11:19:14 +0800884#if ANOMALY_05000281
Bernd Schmidt5d750b92008-04-25 05:02:33 +0800885 r0.l = lo(SAFE_USER_INSTRUCTION);
886 r0.h = hi(SAFE_USER_INSTRUCTION);
Bryan Wu1394f032007-05-06 14:50:22 -0700887 reti = r0;
888#endif
889 r0 = 0x401f;
890 sti r0;
891 raise 14;
892 rti;
893ENTRY(_evt14_softirq)
894#ifdef CONFIG_DEBUG_HWERR
895 r0 = 0x3f;
896 sti r0;
897#else
898 cli r0;
899#endif
900 [--sp] = RETI;
901 SP += 4;
902 rts;
903
904_schedule_and_signal_from_int:
905 /* To end up here, vector 15 was changed - so we have to change it
906 * back.
907 */
908 p0.l = lo(EVT15);
909 p0.h = hi(EVT15);
910 p1.l = _evt_system_call;
911 p1.h = _evt_system_call;
912 [p0] = p1;
913 csync;
Bernd Schmidtc8244982007-05-21 18:09:33 +0800914
915 /* Set orig_p0 to -1 to indicate this isn't the end of a syscall. */
916 r0 = -1 (x);
917 [sp + PT_ORIG_P0] = r0;
918
Bryan Wu1394f032007-05-06 14:50:22 -0700919 p1 = rets;
920 [sp + PT_RESERVED] = p1;
921
Graf Yang6b3087c2009-01-07 23:14:39 +0800922#ifdef CONFIG_SMP
923 GET_PDA(p0, r0); /* Fetch current PDA (can't migrate to other CPU here) */
924 r0 = [p0 + PDA_IRQFLAGS];
925#else
Mike Frysinger40059782008-11-18 17:48:22 +0800926 p0.l = _bfin_irq_flags;
927 p0.h = _bfin_irq_flags;
Bryan Wu1394f032007-05-06 14:50:22 -0700928 r0 = [p0];
Graf Yang6b3087c2009-01-07 23:14:39 +0800929#endif
Bryan Wu1394f032007-05-06 14:50:22 -0700930 sti r0;
931
Bernd Schmidt7adfb582007-06-21 11:34:16 +0800932 r0 = sp;
933 sp += -12;
934 call _finish_atomic_sections;
935 sp += 12;
Bryan Wu1394f032007-05-06 14:50:22 -0700936 jump.s .Lresume_userspace;
937
938_schedule_and_signal:
939 SAVE_CONTEXT_SYSCALL
940 /* To end up here, vector 15 was changed - so we have to change it
941 * back.
942 */
943 p0.l = lo(EVT15);
944 p0.h = hi(EVT15);
945 p1.l = _evt_system_call;
946 p1.h = _evt_system_call;
947 [p0] = p1;
948 csync;
949 p0.l = 1f;
950 p0.h = 1f;
951 [sp + PT_RESERVED] = P0;
952 call .Lresume_userspace;
9531:
954 RESTORE_CONTEXT
955 rti;
Mike Frysinger51be24c2007-06-11 15:31:30 +0800956ENDPROC(_lower_to_irq14)
Bryan Wu1394f032007-05-06 14:50:22 -0700957
Robin Getz518039b2007-07-25 11:03:28 +0800958/* We handle this 100% in exception space - to reduce overhead
959 * Only potiential problem is if the software buffer gets swapped out of the
960 * CPLB table - then double fault. - so we don't let this happen in other places
961 */
962#ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
963ENTRY(_ex_trace_buff_full)
964 [--sp] = P3;
965 [--sp] = P2;
966 [--sp] = LC0;
967 [--sp] = LT0;
968 [--sp] = LB0;
969 P5.L = _trace_buff_offset;
970 P5.H = _trace_buff_offset;
971 P3 = [P5]; /* trace_buff_offset */
972 P5.L = lo(TBUFSTAT);
973 P5.H = hi(TBUFSTAT);
974 R7 = [P5];
975 R7 <<= 1; /* double, since we need to read twice */
976 LC0 = R7;
977 R7 <<= 2; /* need to shift over again,
978 * to get the number of bytes */
979 P5.L = lo(TBUF);
980 P5.H = hi(TBUF);
981 R6 = ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN)*1024) - 1;
982
983 P2 = R7;
984 P3 = P3 + P2;
985 R7 = P3;
986 R7 = R7 & R6;
987 P3 = R7;
988 P2.L = _trace_buff_offset;
989 P2.H = _trace_buff_offset;
990 [P2] = P3;
991
992 P2.L = _software_trace_buff;
993 P2.H = _software_trace_buff;
994
995 LSETUP (.Lstart, .Lend) LC0;
996.Lstart:
997 R7 = [P5]; /* read TBUF */
998 P4 = P3 + P2;
999 [P4] = R7;
1000 P3 += -4;
1001 R7 = P3;
1002 R7 = R7 & R6;
1003.Lend:
1004 P3 = R7;
1005
1006 LB0 = [sp++];
1007 LT0 = [sp++];
1008 LC0 = [sp++];
1009 P2 = [sp++];
1010 P3 = [sp++];
Mike Frysinger8d6c2422007-11-21 15:53:49 +08001011 jump _bfin_return_from_exception;
Robin Getz337d3902007-10-09 17:31:46 +08001012ENDPROC(_ex_trace_buff_full)
Robin Getz518039b2007-07-25 11:03:28 +08001013
1014#if CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN == 4
1015.data
1016#else
1017.section .l1.data.B
Robin Getz337d3902007-10-09 17:31:46 +08001018#endif /* CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN */
Robin Getz518039b2007-07-25 11:03:28 +08001019ENTRY(_trace_buff_offset)
1020 .long 0;
1021ALIGN
1022ENTRY(_software_trace_buff)
1023 .rept ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN)*256);
1024 .long 0
1025 .endr
Robin Getz337d3902007-10-09 17:31:46 +08001026#endif /* CONFIG_DEBUG_BFIN_HWTRACE_EXPAND */
1027
1028#if CONFIG_EARLY_PRINTK
Mike Frysinger9cb07b22007-11-21 16:45:08 +08001029__INIT
Robin Getz337d3902007-10-09 17:31:46 +08001030ENTRY(_early_trap)
1031 SAVE_ALL_SYS
1032 trace_buffer_stop(p0,r0);
1033
Michael Hennerich5e9e7682008-10-09 12:31:03 +08001034#if ANOMALY_05000283 || ANOMALY_05000315
1035 cc = r5 == r5;
1036 p4.h = HI(CHIPID);
1037 p4.l = LO(CHIPID);
1038 if cc jump 1f;
1039 r5.l = W[p4];
10401:
1041#endif
1042
Robin Getz337d3902007-10-09 17:31:46 +08001043 /* Turn caches off, to ensure we don't get double exceptions */
1044
1045 P4.L = LO(IMEM_CONTROL);
1046 P4.H = HI(IMEM_CONTROL);
1047
1048 R5 = [P4]; /* Control Register*/
1049 BITCLR(R5,ENICPLB_P);
1050 CLI R1;
1051 SSYNC; /* SSYNC required before writing to IMEM_CONTROL. */
1052 .align 8;
1053 [P4] = R5;
1054 SSYNC;
1055
1056 P4.L = LO(DMEM_CONTROL);
1057 P4.H = HI(DMEM_CONTROL);
1058 R5 = [P4];
1059 BITCLR(R5,ENDCPLB_P);
1060 SSYNC; /* SSYNC required before writing to DMEM_CONTROL. */
1061 .align 8;
1062 [P4] = R5;
1063 SSYNC;
1064 STI R1;
1065
1066 r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */
1067 r1 = RETX;
1068
1069 SP += -12;
1070 call _early_trap_c;
1071 SP += 12;
1072ENDPROC(_early_trap)
Mike Frysinger9cb07b22007-11-21 16:45:08 +08001073__FINIT
Robin Getz337d3902007-10-09 17:31:46 +08001074#endif /* CONFIG_EARLY_PRINTK */
Robin Getz518039b2007-07-25 11:03:28 +08001075
Bryan Wu1394f032007-05-06 14:50:22 -07001076/*
1077 * Put these in the kernel data section - that should always be covered by
1078 * a CPLB. This is needed to ensure we don't get double fault conditions
1079 */
1080
1081#ifdef CONFIG_SYSCALL_TAB_L1
1082.section .l1.data
1083#else
1084.data
1085#endif
Robin Getzf26fbc42007-11-12 22:21:30 +08001086
Mike Frysinger1ffe6642007-08-05 17:14:04 +08001087ENTRY(_ex_table)
Bryan Wu1394f032007-05-06 14:50:22 -07001088 /* entry for each EXCAUSE[5:0]
Mike Frysinger9401e612007-07-12 11:50:43 +08001089 * This table must be in sync with the table in ./kernel/traps.c
Bryan Wu1394f032007-05-06 14:50:22 -07001090 * EXCPT instruction can provide 4 bits of EXCAUSE, allowing 16 to be user defined
1091 */
Mike Frysinger1ffe6642007-08-05 17:14:04 +08001092 .long _ex_syscall /* 0x00 - User Defined - Linux Syscall */
Bryan Wu1394f032007-05-06 14:50:22 -07001093 .long _ex_soft_bp /* 0x01 - User Defined - Software breakpoint */
Sonic Zhanga5ac0122008-10-13 14:07:19 +08001094#ifdef CONFIG_KGDB
1095 .long _ex_trap_c /* 0x02 - User Defined - KGDB initial connection
1096 and break signal trap */
1097#else
Mike Frysinger1ffe6642007-08-05 17:14:04 +08001098 .long _ex_replaceable /* 0x02 - User Defined */
Sonic Zhanga5ac0122008-10-13 14:07:19 +08001099#endif
Mike Frysinger9401e612007-07-12 11:50:43 +08001100 .long _ex_trap_c /* 0x03 - User Defined - userspace stack overflow */
Robin Getz9f336a52007-10-29 18:23:28 +08001101 .long _ex_trap_c /* 0x04 - User Defined - dump trace buffer */
Mike Frysinger1ffe6642007-08-05 17:14:04 +08001102 .long _ex_replaceable /* 0x05 - User Defined */
1103 .long _ex_replaceable /* 0x06 - User Defined */
1104 .long _ex_replaceable /* 0x07 - User Defined */
1105 .long _ex_replaceable /* 0x08 - User Defined */
1106 .long _ex_replaceable /* 0x09 - User Defined */
1107 .long _ex_replaceable /* 0x0A - User Defined */
1108 .long _ex_replaceable /* 0x0B - User Defined */
1109 .long _ex_replaceable /* 0x0C - User Defined */
1110 .long _ex_replaceable /* 0x0D - User Defined */
1111 .long _ex_replaceable /* 0x0E - User Defined */
1112 .long _ex_replaceable /* 0x0F - User Defined */
Bryan Wu1394f032007-05-06 14:50:22 -07001113 .long _ex_single_step /* 0x10 - HW Single step */
Robin Getz518039b2007-07-25 11:03:28 +08001114#ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
1115 .long _ex_trace_buff_full /* 0x11 - Trace Buffer Full */
1116#else
Bryan Wu1394f032007-05-06 14:50:22 -07001117 .long _ex_trap_c /* 0x11 - Trace Buffer Full */
Robin Getz518039b2007-07-25 11:03:28 +08001118#endif
Bryan Wu1394f032007-05-06 14:50:22 -07001119 .long _ex_trap_c /* 0x12 - Reserved */
1120 .long _ex_trap_c /* 0x13 - Reserved */
1121 .long _ex_trap_c /* 0x14 - Reserved */
1122 .long _ex_trap_c /* 0x15 - Reserved */
1123 .long _ex_trap_c /* 0x16 - Reserved */
1124 .long _ex_trap_c /* 0x17 - Reserved */
1125 .long _ex_trap_c /* 0x18 - Reserved */
1126 .long _ex_trap_c /* 0x19 - Reserved */
1127 .long _ex_trap_c /* 0x1A - Reserved */
1128 .long _ex_trap_c /* 0x1B - Reserved */
1129 .long _ex_trap_c /* 0x1C - Reserved */
1130 .long _ex_trap_c /* 0x1D - Reserved */
1131 .long _ex_trap_c /* 0x1E - Reserved */
1132 .long _ex_trap_c /* 0x1F - Reserved */
1133 .long _ex_trap_c /* 0x20 - Reserved */
1134 .long _ex_trap_c /* 0x21 - Undefined Instruction */
1135 .long _ex_trap_c /* 0x22 - Illegal Instruction Combination */
Robin Getzf26fbc42007-11-12 22:21:30 +08001136 .long _ex_dviol /* 0x23 - Data CPLB Protection Violation */
Bryan Wu1394f032007-05-06 14:50:22 -07001137 .long _ex_trap_c /* 0x24 - Data access misaligned */
1138 .long _ex_trap_c /* 0x25 - Unrecoverable Event */
Robin Getzf26fbc42007-11-12 22:21:30 +08001139 .long _ex_dmiss /* 0x26 - Data CPLB Miss */
1140 .long _ex_dmult /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero */
Bryan Wu1394f032007-05-06 14:50:22 -07001141 .long _ex_trap_c /* 0x28 - Emulation Watchpoint */
1142 .long _ex_trap_c /* 0x29 - Instruction fetch access error (535 only) */
1143 .long _ex_trap_c /* 0x2A - Instruction fetch misaligned */
Robin Getzf26fbc42007-11-12 22:21:30 +08001144 .long _ex_trap_c /* 0x2B - Instruction CPLB protection Violation */
1145 .long _ex_icplb_miss /* 0x2C - Instruction CPLB miss */
Bryan Wu1394f032007-05-06 14:50:22 -07001146 .long _ex_trap_c /* 0x2D - Instruction CPLB Multiple Hits */
1147 .long _ex_trap_c /* 0x2E - Illegal use of Supervisor Resource */
1148 .long _ex_trap_c /* 0x2E - Illegal use of Supervisor Resource */
1149 .long _ex_trap_c /* 0x2F - Reserved */
1150 .long _ex_trap_c /* 0x30 - Reserved */
1151 .long _ex_trap_c /* 0x31 - Reserved */
1152 .long _ex_trap_c /* 0x32 - Reserved */
1153 .long _ex_trap_c /* 0x33 - Reserved */
1154 .long _ex_trap_c /* 0x34 - Reserved */
1155 .long _ex_trap_c /* 0x35 - Reserved */
1156 .long _ex_trap_c /* 0x36 - Reserved */
1157 .long _ex_trap_c /* 0x37 - Reserved */
1158 .long _ex_trap_c /* 0x38 - Reserved */
1159 .long _ex_trap_c /* 0x39 - Reserved */
1160 .long _ex_trap_c /* 0x3A - Reserved */
1161 .long _ex_trap_c /* 0x3B - Reserved */
1162 .long _ex_trap_c /* 0x3C - Reserved */
1163 .long _ex_trap_c /* 0x3D - Reserved */
1164 .long _ex_trap_c /* 0x3E - Reserved */
1165 .long _ex_trap_c /* 0x3F - Reserved */
Mike Frysinger1ffe6642007-08-05 17:14:04 +08001166END(_ex_table)
Bryan Wu1394f032007-05-06 14:50:22 -07001167
Bryan Wu1394f032007-05-06 14:50:22 -07001168ENTRY(_sys_call_table)
Bryan Wu0b95f222007-09-23 00:51:32 +08001169 .long _sys_restart_syscall /* 0 */
Bryan Wu1394f032007-05-06 14:50:22 -07001170 .long _sys_exit
1171 .long _sys_fork
1172 .long _sys_read
1173 .long _sys_write
1174 .long _sys_open /* 5 */
1175 .long _sys_close
1176 .long _sys_ni_syscall /* old waitpid */
1177 .long _sys_creat
1178 .long _sys_link
1179 .long _sys_unlink /* 10 */
1180 .long _sys_execve
1181 .long _sys_chdir
1182 .long _sys_time
1183 .long _sys_mknod
1184 .long _sys_chmod /* 15 */
1185 .long _sys_chown /* chown16 */
1186 .long _sys_ni_syscall /* old break syscall holder */
1187 .long _sys_ni_syscall /* old stat */
1188 .long _sys_lseek
1189 .long _sys_getpid /* 20 */
1190 .long _sys_mount
1191 .long _sys_ni_syscall /* old umount */
1192 .long _sys_setuid
1193 .long _sys_getuid
1194 .long _sys_stime /* 25 */
1195 .long _sys_ptrace
1196 .long _sys_alarm
1197 .long _sys_ni_syscall /* old fstat */
1198 .long _sys_pause
1199 .long _sys_ni_syscall /* old utime */ /* 30 */
1200 .long _sys_ni_syscall /* old stty syscall holder */
1201 .long _sys_ni_syscall /* old gtty syscall holder */
1202 .long _sys_access
1203 .long _sys_nice
1204 .long _sys_ni_syscall /* 35 */ /* old ftime syscall holder */
1205 .long _sys_sync
1206 .long _sys_kill
1207 .long _sys_rename
1208 .long _sys_mkdir
1209 .long _sys_rmdir /* 40 */
1210 .long _sys_dup
1211 .long _sys_pipe
1212 .long _sys_times
1213 .long _sys_ni_syscall /* old prof syscall holder */
1214 .long _sys_brk /* 45 */
1215 .long _sys_setgid
1216 .long _sys_getgid
1217 .long _sys_ni_syscall /* old sys_signal */
1218 .long _sys_geteuid /* geteuid16 */
1219 .long _sys_getegid /* getegid16 */ /* 50 */
1220 .long _sys_acct
1221 .long _sys_umount /* recycled never used phys() */
1222 .long _sys_ni_syscall /* old lock syscall holder */
1223 .long _sys_ioctl
1224 .long _sys_fcntl /* 55 */
1225 .long _sys_ni_syscall /* old mpx syscall holder */
1226 .long _sys_setpgid
1227 .long _sys_ni_syscall /* old ulimit syscall holder */
1228 .long _sys_ni_syscall /* old old uname */
1229 .long _sys_umask /* 60 */
1230 .long _sys_chroot
1231 .long _sys_ustat
1232 .long _sys_dup2
1233 .long _sys_getppid
1234 .long _sys_getpgrp /* 65 */
1235 .long _sys_setsid
1236 .long _sys_ni_syscall /* old sys_sigaction */
1237 .long _sys_sgetmask
1238 .long _sys_ssetmask
1239 .long _sys_setreuid /* setreuid16 */ /* 70 */
1240 .long _sys_setregid /* setregid16 */
1241 .long _sys_ni_syscall /* old sys_sigsuspend */
1242 .long _sys_ni_syscall /* old sys_sigpending */
1243 .long _sys_sethostname
1244 .long _sys_setrlimit /* 75 */
1245 .long _sys_ni_syscall /* old getrlimit */
1246 .long _sys_getrusage
1247 .long _sys_gettimeofday
1248 .long _sys_settimeofday
1249 .long _sys_getgroups /* getgroups16 */ /* 80 */
1250 .long _sys_setgroups /* setgroups16 */
1251 .long _sys_ni_syscall /* old_select */
1252 .long _sys_symlink
1253 .long _sys_ni_syscall /* old lstat */
1254 .long _sys_readlink /* 85 */
1255 .long _sys_uselib
1256 .long _sys_ni_syscall /* sys_swapon */
1257 .long _sys_reboot
1258 .long _sys_ni_syscall /* old_readdir */
1259 .long _sys_ni_syscall /* sys_mmap */ /* 90 */
1260 .long _sys_munmap
1261 .long _sys_truncate
1262 .long _sys_ftruncate
1263 .long _sys_fchmod
1264 .long _sys_fchown /* fchown16 */ /* 95 */
1265 .long _sys_getpriority
1266 .long _sys_setpriority
1267 .long _sys_ni_syscall /* old profil syscall holder */
1268 .long _sys_statfs
1269 .long _sys_fstatfs /* 100 */
1270 .long _sys_ni_syscall
1271 .long _sys_ni_syscall /* old sys_socketcall */
1272 .long _sys_syslog
1273 .long _sys_setitimer
1274 .long _sys_getitimer /* 105 */
1275 .long _sys_newstat
1276 .long _sys_newlstat
1277 .long _sys_newfstat
1278 .long _sys_ni_syscall /* old uname */
1279 .long _sys_ni_syscall /* iopl for i386 */ /* 110 */
1280 .long _sys_vhangup
1281 .long _sys_ni_syscall /* obsolete idle() syscall */
1282 .long _sys_ni_syscall /* vm86old for i386 */
1283 .long _sys_wait4
1284 .long _sys_ni_syscall /* 115 */ /* sys_swapoff */
1285 .long _sys_sysinfo
1286 .long _sys_ni_syscall /* old sys_ipc */
1287 .long _sys_fsync
1288 .long _sys_ni_syscall /* old sys_sigreturn */
1289 .long _sys_clone /* 120 */
1290 .long _sys_setdomainname
1291 .long _sys_newuname
1292 .long _sys_ni_syscall /* old sys_modify_ldt */
1293 .long _sys_adjtimex
1294 .long _sys_ni_syscall /* 125 */ /* sys_mprotect */
1295 .long _sys_ni_syscall /* old sys_sigprocmask */
1296 .long _sys_ni_syscall /* old "creat_module" */
1297 .long _sys_init_module
1298 .long _sys_delete_module
1299 .long _sys_ni_syscall /* 130: old "get_kernel_syms" */
1300 .long _sys_quotactl
1301 .long _sys_getpgid
1302 .long _sys_fchdir
1303 .long _sys_bdflush
1304 .long _sys_ni_syscall /* 135 */ /* sys_sysfs */
1305 .long _sys_personality
1306 .long _sys_ni_syscall /* for afs_syscall */
1307 .long _sys_setfsuid /* setfsuid16 */
1308 .long _sys_setfsgid /* setfsgid16 */
1309 .long _sys_llseek /* 140 */
1310 .long _sys_getdents
1311 .long _sys_ni_syscall /* sys_select */
1312 .long _sys_flock
1313 .long _sys_ni_syscall /* sys_msync */
1314 .long _sys_readv /* 145 */
1315 .long _sys_writev
1316 .long _sys_getsid
1317 .long _sys_fdatasync
1318 .long _sys_sysctl
1319 .long _sys_ni_syscall /* 150 */ /* sys_mlock */
1320 .long _sys_ni_syscall /* sys_munlock */
1321 .long _sys_ni_syscall /* sys_mlockall */
1322 .long _sys_ni_syscall /* sys_munlockall */
1323 .long _sys_sched_setparam
1324 .long _sys_sched_getparam /* 155 */
1325 .long _sys_sched_setscheduler
1326 .long _sys_sched_getscheduler
1327 .long _sys_sched_yield
1328 .long _sys_sched_get_priority_max
1329 .long _sys_sched_get_priority_min /* 160 */
1330 .long _sys_sched_rr_get_interval
1331 .long _sys_nanosleep
Bryan Wu0b95f222007-09-23 00:51:32 +08001332 .long _sys_mremap
Bryan Wu1394f032007-05-06 14:50:22 -07001333 .long _sys_setresuid /* setresuid16 */
1334 .long _sys_getresuid /* getresuid16 */ /* 165 */
1335 .long _sys_ni_syscall /* for vm86 */
1336 .long _sys_ni_syscall /* old "query_module" */
1337 .long _sys_ni_syscall /* sys_poll */
Bryan Wu0b95f222007-09-23 00:51:32 +08001338 .long _sys_nfsservctl
Bryan Wu1394f032007-05-06 14:50:22 -07001339 .long _sys_setresgid /* setresgid16 */ /* 170 */
1340 .long _sys_getresgid /* getresgid16 */
1341 .long _sys_prctl
1342 .long _sys_rt_sigreturn
1343 .long _sys_rt_sigaction
1344 .long _sys_rt_sigprocmask /* 175 */
1345 .long _sys_rt_sigpending
1346 .long _sys_rt_sigtimedwait
1347 .long _sys_rt_sigqueueinfo
1348 .long _sys_rt_sigsuspend
1349 .long _sys_pread64 /* 180 */
1350 .long _sys_pwrite64
1351 .long _sys_lchown /* lchown16 */
1352 .long _sys_getcwd
1353 .long _sys_capget
1354 .long _sys_capset /* 185 */
1355 .long _sys_sigaltstack
1356 .long _sys_sendfile
1357 .long _sys_ni_syscall /* streams1 */
1358 .long _sys_ni_syscall /* streams2 */
1359 .long _sys_vfork /* 190 */
1360 .long _sys_getrlimit
1361 .long _sys_mmap2
1362 .long _sys_truncate64
1363 .long _sys_ftruncate64
1364 .long _sys_stat64 /* 195 */
1365 .long _sys_lstat64
1366 .long _sys_fstat64
1367 .long _sys_chown
1368 .long _sys_getuid
1369 .long _sys_getgid /* 200 */
1370 .long _sys_geteuid
1371 .long _sys_getegid
1372 .long _sys_setreuid
1373 .long _sys_setregid
1374 .long _sys_getgroups /* 205 */
1375 .long _sys_setgroups
1376 .long _sys_fchown
1377 .long _sys_setresuid
1378 .long _sys_getresuid
1379 .long _sys_setresgid /* 210 */
1380 .long _sys_getresgid
1381 .long _sys_lchown
1382 .long _sys_setuid
1383 .long _sys_setgid
1384 .long _sys_setfsuid /* 215 */
1385 .long _sys_setfsgid
1386 .long _sys_pivot_root
1387 .long _sys_ni_syscall /* sys_mincore */
1388 .long _sys_ni_syscall /* sys_madvise */
1389 .long _sys_getdents64 /* 220 */
1390 .long _sys_fcntl64
1391 .long _sys_ni_syscall /* reserved for TUX */
1392 .long _sys_ni_syscall
1393 .long _sys_gettid
Bryan Wu0b95f222007-09-23 00:51:32 +08001394 .long _sys_readahead /* 225 */
Bryan Wu1394f032007-05-06 14:50:22 -07001395 .long _sys_setxattr
1396 .long _sys_lsetxattr
1397 .long _sys_fsetxattr
1398 .long _sys_getxattr
1399 .long _sys_lgetxattr /* 230 */
1400 .long _sys_fgetxattr
1401 .long _sys_listxattr
1402 .long _sys_llistxattr
1403 .long _sys_flistxattr
1404 .long _sys_removexattr /* 235 */
1405 .long _sys_lremovexattr
1406 .long _sys_fremovexattr
1407 .long _sys_tkill
1408 .long _sys_sendfile64
1409 .long _sys_futex /* 240 */
1410 .long _sys_sched_setaffinity
1411 .long _sys_sched_getaffinity
1412 .long _sys_ni_syscall /* sys_set_thread_area */
1413 .long _sys_ni_syscall /* sys_get_thread_area */
1414 .long _sys_io_setup /* 245 */
1415 .long _sys_io_destroy
1416 .long _sys_io_getevents
1417 .long _sys_io_submit
1418 .long _sys_io_cancel
1419 .long _sys_ni_syscall /* 250 */ /* sys_alloc_hugepages */
1420 .long _sys_ni_syscall /* sys_freec_hugepages */
1421 .long _sys_exit_group
1422 .long _sys_lookup_dcookie
1423 .long _sys_bfin_spinlock
1424 .long _sys_epoll_create /* 255 */
1425 .long _sys_epoll_ctl
1426 .long _sys_epoll_wait
1427 .long _sys_ni_syscall /* remap_file_pages */
1428 .long _sys_set_tid_address
1429 .long _sys_timer_create /* 260 */
1430 .long _sys_timer_settime
1431 .long _sys_timer_gettime
1432 .long _sys_timer_getoverrun
1433 .long _sys_timer_delete
1434 .long _sys_clock_settime /* 265 */
1435 .long _sys_clock_gettime
1436 .long _sys_clock_getres
1437 .long _sys_clock_nanosleep
1438 .long _sys_statfs64
1439 .long _sys_fstatfs64 /* 270 */
1440 .long _sys_tgkill
1441 .long _sys_utimes
1442 .long _sys_fadvise64_64
1443 .long _sys_ni_syscall /* vserver */
1444 .long _sys_ni_syscall /* 275, mbind */
1445 .long _sys_ni_syscall /* get_mempolicy */
1446 .long _sys_ni_syscall /* set_mempolicy */
1447 .long _sys_mq_open
1448 .long _sys_mq_unlink
1449 .long _sys_mq_timedsend /* 280 */
1450 .long _sys_mq_timedreceive
1451 .long _sys_mq_notify
1452 .long _sys_mq_getsetattr
1453 .long _sys_ni_syscall /* kexec_load */
1454 .long _sys_waitid /* 285 */
1455 .long _sys_add_key
1456 .long _sys_request_key
1457 .long _sys_keyctl
1458 .long _sys_ioprio_set
1459 .long _sys_ioprio_get /* 290 */
1460 .long _sys_inotify_init
1461 .long _sys_inotify_add_watch
1462 .long _sys_inotify_rm_watch
1463 .long _sys_ni_syscall /* migrate_pages */
1464 .long _sys_openat /* 295 */
1465 .long _sys_mkdirat
1466 .long _sys_mknodat
1467 .long _sys_fchownat
1468 .long _sys_futimesat
1469 .long _sys_fstatat64 /* 300 */
1470 .long _sys_unlinkat
1471 .long _sys_renameat
1472 .long _sys_linkat
1473 .long _sys_symlinkat
1474 .long _sys_readlinkat /* 305 */
1475 .long _sys_fchmodat
1476 .long _sys_faccessat
1477 .long _sys_pselect6
1478 .long _sys_ppoll
1479 .long _sys_unshare /* 310 */
1480 .long _sys_sram_alloc
1481 .long _sys_sram_free
1482 .long _sys_dma_memcpy
1483 .long _sys_accept
1484 .long _sys_bind /* 315 */
1485 .long _sys_connect
1486 .long _sys_getpeername
1487 .long _sys_getsockname
1488 .long _sys_getsockopt
1489 .long _sys_listen /* 320 */
1490 .long _sys_recv
1491 .long _sys_recvfrom
1492 .long _sys_recvmsg
1493 .long _sys_send
1494 .long _sys_sendmsg /* 325 */
1495 .long _sys_sendto
1496 .long _sys_setsockopt
1497 .long _sys_shutdown
1498 .long _sys_socket
1499 .long _sys_socketpair /* 330 */
1500 .long _sys_semctl
1501 .long _sys_semget
1502 .long _sys_semop
1503 .long _sys_msgctl
1504 .long _sys_msgget /* 335 */
1505 .long _sys_msgrcv
1506 .long _sys_msgsnd
1507 .long _sys_shmat
1508 .long _sys_shmctl
1509 .long _sys_shmdt /* 340 */
1510 .long _sys_shmget
Bryan Wu0b95f222007-09-23 00:51:32 +08001511 .long _sys_splice
1512 .long _sys_sync_file_range
1513 .long _sys_tee
1514 .long _sys_vmsplice /* 345 */
1515 .long _sys_epoll_pwait
1516 .long _sys_utimensat
1517 .long _sys_signalfd
Bryan Wu2f775db2008-03-06 16:04:58 -07001518 .long _sys_timerfd_create
Bryan Wu0b95f222007-09-23 00:51:32 +08001519 .long _sys_eventfd /* 350 */
1520 .long _sys_pread64
1521 .long _sys_pwrite64
1522 .long _sys_fadvise64
1523 .long _sys_set_robust_list
1524 .long _sys_get_robust_list /* 355 */
1525 .long _sys_fallocate
Bernd Schmidtfc975512008-01-27 19:56:43 +08001526 .long _sys_semtimedop
Bryan Wu2f775db2008-03-06 16:04:58 -07001527 .long _sys_timerfd_settime
1528 .long _sys_timerfd_gettime
Bryan Wua4b7b6d2008-08-14 15:40:19 +08001529 .long _sys_signalfd4 /* 360 */
1530 .long _sys_eventfd2
1531 .long _sys_epoll_create1
1532 .long _sys_dup3
1533 .long _sys_pipe2
1534 .long _sys_inotify_init1 /* 365 */
Bryan Wu2f775db2008-03-06 16:04:58 -07001535
Bryan Wu1394f032007-05-06 14:50:22 -07001536 .rept NR_syscalls-(.-_sys_call_table)/4
1537 .long _sys_ni_syscall
1538 .endr
Robin Getz0c7a6b22008-10-08 16:27:12 +08001539END(_sys_call_table)
Bryan Wu1394f032007-05-06 14:50:22 -07001540
Mike Frysinger6ad2b842008-10-28 11:03:09 +08001541#ifdef CONFIG_EXCEPTION_L1_SCRATCH
1542/* .section .l1.bss.scratch */
1543.set _exception_stack_top, L1_SCRATCH_START + L1_SCRATCH_LENGTH
1544#else
1545#ifdef CONFIG_SYSCALL_TAB_L1
1546.section .l1.bss
1547#else
1548.bss
1549#endif
Graf Yang6b3087c2009-01-07 23:14:39 +08001550ENTRY(_exception_stack)
1551 .rept 1024 * NR_CPUS
Graf Yangefe065a2008-10-28 14:00:52 +08001552 .long 0
1553 .endr
1554_exception_stack_top:
Mike Frysinger6ad2b842008-10-28 11:03:09 +08001555#endif