entry.S 42.7 KB
Newer Older
B
Bryan Wu 已提交
1
/*
2 3 4
 * Contains the system-call and fault low-level handling routines.
 * This also contains the timer-interrupt handler, as well as all
 * interrupts and faults that can result in a task-switch.
B
Bryan Wu 已提交
5
 *
6
 * Copyright 2005-2009 Analog Devices Inc.
B
Bryan Wu 已提交
7
 *
8
 * Licensed under the GPL-2 or later.
B
Bryan Wu 已提交
9 10
 */

11
/* NOTE: This code handles signal-recognition, which happens every time
B
Bryan Wu 已提交
12 13 14
 * after a timer-interrupt and after each system call.
 */

15
#include <linux/init.h>
B
Bryan Wu 已提交
16
#include <linux/linkage.h>
17
#include <linux/unistd.h>
B
Bryan Wu 已提交
18 19
#include <asm/blackfin.h>
#include <asm/errno.h>
20
#include <asm/fixed_code.h>
B
Bryan Wu 已提交
21 22
#include <asm/thread_info.h>  /* TIF_NEED_RESCHED */
#include <asm/asm-offsets.h>
23
#include <asm/trace.h>
24
#include <asm/traps.h>
B
Bryan Wu 已提交
25

26
#include <asm/context.S>
B
Bryan Wu 已提交
27

28 29 30 31 32 33 34 35
#if defined(CONFIG_BFIN_SCRATCH_REG_RETN)
# define EX_SCRATCH_REG RETN
#elif defined(CONFIG_BFIN_SCRATCH_REG_RETE)
# define EX_SCRATCH_REG RETE
#else
# define EX_SCRATCH_REG CYCLES
#endif

B
Bryan Wu 已提交
36 37 38 39 40 41 42 43 44 45
#ifdef CONFIG_EXCPT_IRQ_SYSC_L1
.section .l1.text
#else
.text
#endif

/* Slightly simplified and streamlined entry point for CPLB misses.
 * This one does not lower the level to IRQ5, and thus can be used to
 * patch up CPLB misses on the kernel stack.
 */
46
#if ANOMALY_05000261
47 48 49 50 51
#define _ex_dviol _ex_workaround_261
#define _ex_dmiss _ex_workaround_261
#define _ex_dmult _ex_workaround_261

ENTRY(_ex_workaround_261)
B
Bryan Wu 已提交
52 53 54 55 56
	/*
	 * Work around an anomaly: if we see a new DCPLB fault, return
	 * without doing anything.  Then, if we get the same fault again,
	 * handle it.
	 */
57
	P4 = R7;	/* Store EXCAUSE */
58 59 60

	GET_PDA(p5, r7);
	r7 = [p5 + PDA_LFRETX];
B
Bryan Wu 已提交
61
	r6 = retx;
62
	[p5 + PDA_LFRETX] = r6;
B
Bryan Wu 已提交
63
	cc = r6 == r7;
64
	if !cc jump _bfin_return_from_exception;
B
Bryan Wu 已提交
65
	/* fall through */
66
	R7 = P4;
67
	R6 = VEC_CPLB_M;	/* Data CPLB Miss */
68 69
	cc = R6 == R7;
	if cc jump _ex_dcplb_miss (BP);
70 71
#ifdef CONFIG_MPU
	R6 = VEC_CPLB_VL;	/* Data CPLB Violation */
72 73
	cc = R6 == R7;
	if cc jump _ex_dcplb_viol (BP);
74 75
#endif
	/* Handle Data CPLB Protection Violation
76 77 78 79 80
	 * and Data CPLB Multiple Hits - Linux Trap Zero
	 */
	jump _ex_trap_c;
ENDPROC(_ex_workaround_261)

81 82 83
#else
#ifdef CONFIG_MPU
#define _ex_dviol _ex_dcplb_viol
84 85
#else
#define _ex_dviol _ex_trap_c
86
#endif
87 88
#define _ex_dmiss _ex_dcplb_miss
#define _ex_dmult _ex_trap_c
B
Bryan Wu 已提交
89 90
#endif

91 92

ENTRY(_ex_dcplb_viol)
93 94
ENTRY(_ex_dcplb_miss)
ENTRY(_ex_icplb_miss)
B
Bryan Wu 已提交
95
	(R7:6,P5:4) = [sp++];
96 97 98
	/* We leave the previously pushed ASTAT on the stack.  */
	SAVE_CONTEXT_CPLB

99 100
	/* We must load R1 here, _before_ DEBUG_HWTRACE_SAVE, since that
	 * will change the stack pointer.  */
101 102
	R0 = SEQSTAT;
	R1 = SP;
103

104
	DEBUG_HWTRACE_SAVE(p5, r7)
105

106 107 108 109 110
	sp += -12;
	call _cplb_hdr;
	sp += 12;
	CC = R0 == 0;
	IF !CC JUMP _handle_bad_cplb;
111 112 113 114 115 116 117 118 119 120 121 122

#ifdef CONFIG_DEBUG_DOUBLEFAULT
	/* While we were processing this, did we double fault? */
	r7 = SEQSTAT;           /* reason code is in bit 5:0 */
	r6.l = lo(SEQSTAT_EXCAUSE);
	r6.h = hi(SEQSTAT_EXCAUSE);
	r7 = r7 & r6;
	r6 = 0x25;
	CC = R7 == R6;
	if CC JUMP _double_fault;
#endif

123
	DEBUG_HWTRACE_RESTORE(p5, r7)
124 125
	RESTORE_CONTEXT_CPLB
	ASTAT = [SP++];
126
	SP = EX_SCRATCH_REG;
B
Bryan Wu 已提交
127
	rtx;
128
ENDPROC(_ex_icplb_miss)
B
Bryan Wu 已提交
129 130 131

ENTRY(_ex_syscall)
	raise 15;		/* invoked by TRAP #0, for sys call */
132
	jump.s _bfin_return_from_exception;
133
ENDPROC(_ex_syscall)
B
Bryan Wu 已提交
134 135

ENTRY(_ex_single_step)
136 137
	/* If we just returned from an interrupt, the single step event is
	   for the RTI instruction.  */
B
Bryan Wu 已提交
138 139 140
	r7 = retx;
	r6 = reti;
	cc = r7 == r6;
141
	if cc jump _bfin_return_from_exception;
B
Bryan Wu 已提交
142

143
#ifdef CONFIG_KGDB
144 145 146 147
	/* Don't do single step in hardware exception handler */
        p5.l = lo(IPEND);
        p5.h = hi(IPEND);
	r6 = [p5];
148 149
	cc = bittst(r6, 4);
	if cc jump _bfin_return_from_exception;
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165
	cc = bittst(r6, 5);
	if cc jump _bfin_return_from_exception;

	/* skip single step if current interrupt priority is higher than
	 * that of the first instruction, from which gdb starts single step */
	r6 >>= 6;
	r7 = 10;
.Lfind_priority_start:
	cc = bittst(r6, 0);
	if cc jump .Lfind_priority_done;
	r6 >>= 1;
	r7 += -1;
	cc = r7 == 0;
	if cc jump .Lfind_priority_done;
	jump.s .Lfind_priority_start;
.Lfind_priority_done:
166 167
	p4.l = _kgdb_single_step;
	p4.h = _kgdb_single_step;
168 169 170 171 172
	r6 = [p4];
	cc = r6 == 0;
	if cc jump .Ldo_single_step;
	r6 += -1;
	cc = r6 < r7;
173
	if cc jump 1f;
174
.Ldo_single_step:
175
#else
176
	/* If we were in user mode, do the single step normally.  */
177 178
	p5.l = lo(IPEND);
	p5.h = hi(IPEND);
B
Bryan Wu 已提交
179
	r6 = [p5];
180 181 182
	r7 = 0xffe0 (z);
	r7 = r7 & r6;
	cc = r7 == 0;
183
	if !cc jump 1f;
184
#endif
185 186 187 188 189 190 191 192 193 194 195 196
#ifdef CONFIG_EXACT_HWERR
	/* Read the ILAT, and to check to see if the process we are
	 * single stepping caused a previous hardware error
	 * If so, do not single step, (which lowers to IRQ5, and makes
	 * us miss the error).
	 */
	p5.l = lo(ILAT);
	p5.h = hi(ILAT);
	r7 = [p5];
	cc = bittst(r7, EVT_IVHW_P);
	if cc jump 1f;
#endif
197 198 199
	/* Single stepping only a single instruction, so clear the trace
	 * bit here.  */
	r7 = syscfg;
200
	bitclr (r7, SYSCFG_SSSTEP_P);
201 202 203 204
	syscfg = R7;
	jump _ex_trap_c;

1:
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232
	/*
	 * We were in an interrupt handler.  By convention, all of them save
	 * SYSCFG with their first instruction, so by checking whether our
	 * RETX points at the entry point, we can determine whether to allow
	 * a single step, or whether to clear SYSCFG.
	 *
	 * First, find out the interrupt level and the event vector for it.
	 */
	p5.l = lo(EVT0);
	p5.h = hi(EVT0);
	p5 += -4;
2:
	r7 = rot r7 by -1;
	p5 += 4;
	if !cc jump 2b;

	/* What we actually do is test for the _second_ instruction in the
	 * IRQ handler.  That way, if there are insns following the restore
	 * of SYSCFG after leaving the handler, we will not turn off SYSCFG
	 * for them.  */

	r7 = [p5];
	r7 += 2;
	r6 = RETX;
	cc = R7 == R6;
	if !cc jump _bfin_return_from_exception;

	r7 = syscfg;
233
	bitclr (r7, SYSCFG_SSSTEP_P);	/* Turn off single step */
234 235
	syscfg = R7;

236
	/* Fall through to _bfin_return_from_exception.  */
237
ENDPROC(_ex_single_step)
B
Bryan Wu 已提交
238

239
ENTRY(_bfin_return_from_exception)
240
#if ANOMALY_05000257
241 242 243 244 245
	R7=LC0;
	LC0=R7;
	R7=LC1;
	LC1=R7;
#endif
246 247 248 249 250 251 252 253 254

#ifdef CONFIG_DEBUG_DOUBLEFAULT
	/* While we were processing the current exception,
	 * did we cause another, and double fault?
	 */
	r7 = SEQSTAT;           /* reason code is in bit 5:0 */
	r6.l = lo(SEQSTAT_EXCAUSE);
	r6.h = hi(SEQSTAT_EXCAUSE);
	r7 = r7 & r6;
255
	r6 = VEC_UNCOV;
256 257 258 259
	CC = R7 == R6;
	if CC JUMP _double_fault;
#endif

B
Bryan Wu 已提交
260 261
	(R7:6,P5:4) = [sp++];
	ASTAT = [sp++];
262
	sp = EX_SCRATCH_REG;
B
Bryan Wu 已提交
263
	rtx;
264
ENDPROC(_bfin_return_from_exception)
B
Bryan Wu 已提交
265 266

ENTRY(_handle_bad_cplb)
267
	DEBUG_HWTRACE_RESTORE(p5, r7)
B
Bryan Wu 已提交
268 269 270
	/* To get here, we just tried and failed to change a CPLB
	 * so, handle things in trap_c (C code), by lowering to
	 * IRQ5, just like we normally do. Since this is not a
L
Lucas De Marchi 已提交
271
	 * "normal" return path, we have a do a lot of stuff to
B
Bryan Wu 已提交
272 273 274
	 * the stack to get ready so, we can fall through - we
	 * need to make a CPLB exception look like a normal exception
	 */
275 276
	RESTORE_CONTEXT_CPLB
	/* ASTAT is still on the stack, where it is needed.  */
277
	[--sp] = (R7:6,P5:4);
B
Bryan Wu 已提交
278

279 280 281
ENTRY(_ex_replaceable)
	nop;

B
Bryan Wu 已提交
282
ENTRY(_ex_trap_c)
283 284 285 286 287 288
	/* The only thing that has been saved in this context is
	 * (R7:6,P5:4), ASTAT & SP - don't use anything else
	 */

	GET_PDA(p5, r6);

289 290 291 292 293 294
	/* Make sure we are not in a double fault */
	p4.l = lo(IPEND);
	p4.h = hi(IPEND);
	r7 = [p4];
	CC = BITTST (r7, 5);
	if CC jump _double_fault;
295
	[p5 + PDA_EXIPEND] = r7;
296

B
Bryan Wu 已提交
297 298 299 300
	/* Call C code (trap_c) to handle the exception, which most
	 * likely involves sending a signal to the current process.
	 * To avoid double faults, lower our priority to IRQ5 first.
	 */
301 302
	r7.h = _exception_to_level5;
	r7.l = _exception_to_level5;
B
Bryan Wu 已提交
303 304
	p4.l = lo(EVT5);
	p4.h = hi(EVT5);
305
	[p4] = r7;
B
Bryan Wu 已提交
306 307
	csync;

308 309 310 311 312 313 314
	/*
	 * Save these registers, as they are only valid in exception context
	 *  (where we are now - as soon as we defer to IRQ5, they can change)
	 * DCPLB_STATUS and ICPLB_STATUS are also only valid in EVT3,
	 * but they are not very interesting, so don't save them
	 */

315 316 317
	p4.l = lo(DCPLB_FAULT_ADDR);
	p4.h = hi(DCPLB_FAULT_ADDR);
	r7 = [p4];
318
	[p5 + PDA_DCPLB] = r7;
319

320 321 322 323
	p4.l = lo(ICPLB_FAULT_ADDR);
	p4.h = hi(ICPLB_FAULT_ADDR);
	r6 = [p4];
	[p5 + PDA_ICPLB] = r6;
324 325

	r6 = retx;
326
	[p5 + PDA_RETX] = r6;
327 328 329 330

	r6 = SEQSTAT;
	[p5 + PDA_SEQSTAT] = r6;

331
	/* Save the state of single stepping */
332
	r6 = SYSCFG;
333
	[p5 + PDA_SYSCFG] = r6;
334 335
	/* Clear it while we handle the exception in IRQ5 mode */
	BITCLR(r6, SYSCFG_SSSTEP_P);
336
	SYSCFG = r6;
337

338
	/* Save the current IMASK, since we change in order to jump to level 5 */
B
Bryan Wu 已提交
339
	cli r6;
340
	[p5 + PDA_EXIMASK] = r6;
341 342 343 344 345

	p4.l = lo(SAFE_USER_INSTRUCTION);
	p4.h = hi(SAFE_USER_INSTRUCTION);
	retx = p4;

346 347 348
	/* Disable all interrupts, but make sure level 5 is enabled so
	 * we can switch to that level.
	 */
B
Bryan Wu 已提交
349 350 351
	r6 = 0x3f;
	sti r6;

352 353 354 355 356 357 358 359 360
	/* In case interrupts are disabled IPEND[4] (global interrupt disable bit)
	 * clear it (re-enabling interrupts again) by the special sequence of pushing
	 * RETI onto the stack.  This way we can lower ourselves to IVG5 even if the
	 * exception was taken after the interrupt handler was called but before it
	 * got a chance to enable global interrupts itself.
	 */
	[--sp] = reti;
	sp += 4;

B
Bryan Wu 已提交
361
	raise 5;
362
	jump.s _bfin_return_from_exception;
363
ENDPROC(_ex_trap_c)
B
Bryan Wu 已提交
364

365
/* We just realized we got an exception, while we were processing a different
366 367
 * exception. This is a unrecoverable event, so crash.
 * Note: this cannot be ENTRY() as we jump here with "if cc jump" ...
368
 */
369
ENTRY(_double_fault)
370 371 372 373 374 375 376 377 378
	/* Turn caches & protection off, to ensure we don't get any more
	 * double exceptions
	 */

	P4.L = LO(IMEM_CONTROL);
	P4.H = HI(IMEM_CONTROL);

	R5 = [P4];              /* Control Register*/
	BITCLR(R5,ENICPLB_P);
379
	CSYNC;          /* Disabling of CPLBs should be proceeded by a CSYNC */
380 381 382 383 384 385 386
	[P4] = R5;
	SSYNC;

	P4.L = LO(DMEM_CONTROL);
	P4.H = HI(DMEM_CONTROL);
	R5 = [P4];
	BITCLR(R5,ENDCPLB_P);
387
	CSYNC;          /* Disabling of CPLBs should be proceeded by a CSYNC */
388 389 390 391 392 393 394 395 396 397 398 399
	[P4] = R5;
	SSYNC;

	/* Fix up the stack */
	(R7:6,P5:4) = [sp++];
	ASTAT = [sp++];
	SP = EX_SCRATCH_REG;

	/* We should be out of the exception stack, and back down into
	 * kernel or user space stack
	 */
	SAVE_ALL_SYS
400

401 402 403 404 405
	/* The dumping functions expect the return address in the RETI
	 * slot.  */
	r6 = retx;
	[sp + PT_PC] = r6;

406 407
	r0 = sp;        /* stack frame pt_regs pointer argument ==> r0 */
	SP += -12;
B
Barry Song 已提交
408
	pseudo_long_call _double_fault_c, p5;
409
	SP += 12;
410 411 412 413 414
.L_double_fault_panic:
        JUMP .L_double_fault_panic

ENDPROC(_double_fault)

B
Bryan Wu 已提交
415 416 417
ENTRY(_exception_to_level5)
	SAVE_ALL_SYS

418 419
	GET_PDA(p5, r7);        /* Fetch current PDA */
	r6 = [p5 + PDA_RETX];
420 421
	[sp + PT_PC] = r6;

422
	r6 = [p5 + PDA_SYSCFG];
423 424
	[sp + PT_SYSCFG] = r6;

425 426 427
	r6 = [p5 + PDA_SEQSTAT]; /* Read back seqstat */
	[sp + PT_SEQSTAT] = r6;

B
Bryan Wu 已提交
428
	/* Restore the hardware error vector.  */
429 430
	r7.h = _evt_ivhw;
	r7.l = _evt_ivhw;
B
Bryan Wu 已提交
431 432
	p4.l = lo(EVT5);
	p4.h = hi(EVT5);
433
	[p4] = r7;
B
Bryan Wu 已提交
434 435
	csync;

436 437 438 439 440 441 442 443 444 445 446
#ifdef CONFIG_DEBUG_DOUBLEFAULT
	/* Now that we have the hardware error vector programmed properly
	 * we can re-enable interrupts (IPEND[4]), so if the _trap_c causes
	 * another hardware error, we can catch it (self-nesting).
	 */
	[--sp] = reti;
	sp += 4;
#endif

	r7 = [p5 + PDA_EXIPEND]	/* Read the IPEND from the Exception state */
	[sp + PT_IPEND] = r7;   /* Store IPEND onto the stack */
B
Bryan Wu 已提交
447 448 449

	r0 = sp; 	/* stack frame pt_regs pointer argument ==> r0 */
	SP += -12;
B
Barry Song 已提交
450
	pseudo_long_call _trap_c, p4;
B
Bryan Wu 已提交
451 452
	SP += 12;

453 454 455 456 457 458 459 460 461 462 463 464 465 466
	/* If interrupts were off during the exception (IPEND[4] = 1), turn them off
	 * before we return.
	 */
	CC = BITTST(r7, EVT_IRPTEN_P)
	if !CC jump 1f;
	/* this will load a random value into the reti register - but that is OK,
	 * since we do restore it to the correct value in the 'RESTORE_ALL_SYS' macro
	 */
	sp += -4;
	reti = [sp++];
1:
	/* restore the interrupt mask (IMASK) */
	r6 = [p5 + PDA_EXIMASK];
	sti r6;
467

B
Bryan Wu 已提交
468 469 470
	call _ret_from_exception;
	RESTORE_ALL_SYS
	rti;
471
ENDPROC(_exception_to_level5)
B
Bryan Wu 已提交
472 473 474 475 476 477

ENTRY(_trap) /* Exception: 4th entry into system event table(supervisor mode)*/
	/* Since the kernel stack can be anywhere, it's not guaranteed to be
	 * covered by a CPLB.  Switch to an exception stack; use RETN as a
	 * scratch register (for want of a better option).
	 */
478
	EX_SCRATCH_REG = sp;
479
	GET_PDA_SAFE(sp);
480
	sp = [sp + PDA_EXSTACK];
B
Bryan Wu 已提交
481 482
	/* Try to deal with syscalls quickly.  */
	[--sp] = ASTAT;
483
	[--sp] = (R7:6,P5:4);
484

485 486
	ANOMALY_283_315_WORKAROUND(p5, r7)

487 488 489 490 491 492 493 494 495 496
#ifdef CONFIG_EXACT_HWERR
	/* Make sure all pending read/writes complete. This will ensure any
	 * accesses which could cause hardware errors completes, and signal
	 * the the hardware before we do something silly, like crash the
	 * kernel. We don't need to work around anomaly 05000312, since
	 * we are already atomic
	 */
	ssync;
#endif

497 498 499 500 501 502 503 504
#ifdef CONFIG_DEBUG_DOUBLEFAULT
	/*
	 * Save these registers, as they are only valid in exception context
	 * (where we are now - as soon as we defer to IRQ5, they can change)
	 * DCPLB_STATUS and ICPLB_STATUS are also only valid in EVT3,
	 * but they are not very interesting, so don't save them
	 */

505
	GET_PDA(p5, r7);
506 507 508
	p4.l = lo(DCPLB_FAULT_ADDR);
	p4.h = hi(DCPLB_FAULT_ADDR);
	r7 = [p4];
509
	[p5 + PDA_DF_DCPLB] = r7;
510

511 512 513
	p4.l = lo(ICPLB_FAULT_ADDR);
	p4.h = hi(ICPLB_FAULT_ADDR);
	r7 = [p4];
514
	[p5 + PDA_DF_ICPLB] = r7;
515

516 517
	r7 = retx;
	[p5 + PDA_DF_RETX] = r7;
518

B
Bryan Wu 已提交
519
	r7 = SEQSTAT;		/* reason code is in bit 5:0 */
520
	[p5 + PDA_DF_SEQSTAT] = r7;
521 522 523
#else
	r7 = SEQSTAT;           /* reason code is in bit 5:0 */
#endif
B
Bryan Wu 已提交
524 525 526
	r6.l = lo(SEQSTAT_EXCAUSE);
	r6.h = hi(SEQSTAT_EXCAUSE);
	r7 = r7 & r6;
527 528
	p5.h = _ex_table;
	p5.l = _ex_table;
B
Bryan Wu 已提交
529 530 531 532 533 534 535 536 537
	p4 = r7;
	p5 = p5 + (p4 << 2);
	p4 = [p5];
	jump (p4);

.Lbadsys:
	r7 = -ENOSYS; 		/* signextending enough */
	[sp + PT_R0] = r7;	/* return value from system call */
	jump .Lsyscall_really_exit;
538
ENDPROC(_trap)
B
Bryan Wu 已提交
539 540 541 542 543 544

ENTRY(_kernel_execve)
	link SIZEOF_PTREGS;
	p0 = sp;
	r3 = SIZEOF_PTREGS / 4;
	r4 = 0(x);
545
.Lclear_regs:
B
Bryan Wu 已提交
546 547 548
	[p0++] = r4;
	r3 += -1;
	cc = r3 == 0;
549
	if !cc jump .Lclear_regs (bp);
B
Bryan Wu 已提交
550 551 552 553

	p0 = sp;
	sp += -16;
	[sp + 12] = p0;
B
Barry Song 已提交
554
	pseudo_long_call _do_execve, p5;
B
Bryan Wu 已提交
555 556
	SP += 16;
	cc = r0 == 0;
557
	if ! cc jump .Lexecve_failed;
B
Bryan Wu 已提交
558 559 560 561 562 563 564 565 566 567 568 569 570 571 572
	/* Success.  Copy our temporary pt_regs to the top of the kernel
	 * stack and do a normal exception return.
	 */
	r1 = sp;
	r0 = (-KERNEL_STACK_SIZE) (x);
	r1 = r1 & r0;
	p2 = r1;
	p3 = [p2];
	r0 = KERNEL_STACK_SIZE - 4 (z);
	p1 = r0;
	p1 = p1 + p2;

	p0 = fp;
	r4 = [p0--];
	r3 = SIZEOF_PTREGS / 4;
573
.Lcopy_regs:
B
Bryan Wu 已提交
574 575 576 577
	r4 = [p0--];
	[p1--] = r4;
	r3 += -1;
	cc = r3 == 0;
578
	if ! cc jump .Lcopy_regs (bp);
B
Bryan Wu 已提交
579 580 581 582 583 584 585 586 587 588 589

	r0 = (KERNEL_STACK_SIZE - SIZEOF_PTREGS) (z);
	p1 = r0;
	p1 = p1 + p2;
	sp = p1;
	r0 = syscfg;
	[SP + PT_SYSCFG] = r0;
	[p3 + (TASK_THREAD + THREAD_KSP)] = sp;

	RESTORE_CONTEXT;
	rti;
590
.Lexecve_failed:
B
Bryan Wu 已提交
591 592
	unlink;
	rts;
593
ENDPROC(_kernel_execve)
B
Bryan Wu 已提交
594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614

ENTRY(_system_call)
	/* Store IPEND */
	p2.l = lo(IPEND);
	p2.h = hi(IPEND);
	csync;
	r0 = [p2];
	[sp + PT_IPEND] = r0;

	/* Store RETS for now */
	r0 = rets;
	[sp + PT_RESERVED] = r0;
	/* Set the stack for the current process */
	r7 = sp;
	r6.l = lo(ALIGN_PAGE_MASK);
	r6.h = hi(ALIGN_PAGE_MASK);
	r7 = r7 & r6;  		/* thread_info */
	p2 = r7;
	p2 = [p2];

	[p2+(TASK_THREAD+THREAD_KSP)] = sp;
615 616 617
#ifdef CONFIG_IPIPE
	r0 = sp;
	SP += -12;
618
	pseudo_long_call ___ipipe_syscall_root, p0;
619 620 621 622 623 624 625 626 627
	SP += 12;
	cc = r0 == 1;
	if cc jump .Lsyscall_really_exit;
	cc = r0 == -1;
	if cc jump .Lresume_userspace;
	r3 = [sp + PT_R3];
	r4 = [sp + PT_R4];
	p0 = [sp + PT_ORIG_P0];
#endif /* CONFIG_IPIPE */
B
Bryan Wu 已提交
628 629 630 631 632 633 634 635 636 637

	/* are we tracing syscalls?*/
	r7 = sp;
	r6.l = lo(ALIGN_PAGE_MASK);
	r6.h = hi(ALIGN_PAGE_MASK);
	r7 = r7 & r6;
	p2 = r7;
	r7 = [p2+TI_FLAGS];
	CC = BITTST(r7,TIF_SYSCALL_TRACE);
	if CC JUMP _sys_trace;
638 639
	CC = BITTST(r7,TIF_SINGLESTEP);
	if CC JUMP _sys_trace;
B
Bryan Wu 已提交
640

641 642 643 644 645 646
	/* Make sure the system call # is valid */
	p4 = __NR_syscall;
	/* System call number is passed in P0 */
	cc = p4 <= p0;
	if cc jump .Lbadsys;

B
Bryan Wu 已提交
647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682
	/* Execute the appropriate system call */

	p4 = p0;
	p5.l = _sys_call_table;
	p5.h = _sys_call_table;
	p5 = p5 + (p4 << 2);
	r0 = [sp + PT_R0];
	r1 = [sp + PT_R1];
	r2 = [sp + PT_R2];
	p5 = [p5];

	[--sp] = r5;
	[--sp] = r4;
	[--sp] = r3;
	SP += -12;
	call (p5);
	SP += 24;
	[sp + PT_R0] = r0;

.Lresume_userspace:
	r7 = sp;
	r4.l = lo(ALIGN_PAGE_MASK);
	r4.h = hi(ALIGN_PAGE_MASK);
	r7 = r7 & r4;		/* thread_info->flags */
	p5 = r7;
.Lresume_userspace_1:
	/* Disable interrupts.  */
	[--sp] = reti;
	reti = [sp++];

	r7 = [p5 + TI_FLAGS];
	r4.l = lo(_TIF_WORK_MASK);
	r4.h = hi(_TIF_WORK_MASK);
	r7 =  r7 & r4;

.Lsyscall_resched:
683 684 685
#ifdef CONFIG_IPIPE
	cc = BITTST(r7, TIF_IRQ_SYNC);
	if !cc jump .Lsyscall_no_irqsync;
686 687 688 689 690 691
	/*
	 * Clear IPEND[4] manually to undo what resume_userspace_1 just did;
	 * we need this so that high priority domain interrupts may still
	 * preempt the current domain while the pipeline log is being played
	 * back.
	 */
692
	[--sp] = reti;
693
	SP += 4; /* don't merge with next insn to keep the pattern obvious */
694
	SP += -12;
695
	pseudo_long_call ___ipipe_sync_root, p4;
696 697 698 699
	SP += 12;
	jump .Lresume_userspace_1;
.Lsyscall_no_irqsync:
#endif
B
Bryan Wu 已提交
700 701 702 703 704
	cc = BITTST(r7, TIF_NEED_RESCHED);
	if !cc jump .Lsyscall_sigpending;

	/* Reenable interrupts.  */
	[--sp] = reti;
705
	sp += 4;
B
Bryan Wu 已提交
706 707

	SP += -12;
B
Barry Song 已提交
708
	pseudo_long_call _schedule, p4;
B
Bryan Wu 已提交
709 710 711 712 713 714 715 716
	SP += 12;

	jump .Lresume_userspace_1;

.Lsyscall_sigpending:
	cc = BITTST(r7, TIF_RESTORE_SIGMASK);
	if cc jump .Lsyscall_do_signals;
	cc = BITTST(r7, TIF_SIGPENDING);
717 718
	if cc jump .Lsyscall_do_signals;
	cc = BITTST(r7, TIF_NOTIFY_RESUME);
B
Bryan Wu 已提交
719 720 721 722
	if !cc jump .Lsyscall_really_exit;
.Lsyscall_do_signals:
	/* Reenable interrupts.  */
	[--sp] = reti;
723
	sp += 4;
B
Bryan Wu 已提交
724 725 726

	r0 = sp;
	SP += -12;
B
Barry Song 已提交
727
	pseudo_long_call _do_notify_resume, p5;
B
Bryan Wu 已提交
728 729 730 731 732 733
	SP += 12;

.Lsyscall_really_exit:
	r5 = [sp + PT_RESERVED];
	rets = r5;
	rts;
734
ENDPROC(_system_call)
B
Bryan Wu 已提交
735

736 737 738
/* Do not mark as ENTRY() to avoid error in assembler ...
 * this symbol need not be global anyways, so ...
 */
B
Bryan Wu 已提交
739
_sys_trace:
740 741
	r0 = sp;
	pseudo_long_call _syscall_trace_enter, p5;
B
Bryan Wu 已提交
742

743
	/* Make sure the system call # is valid */
B
Bryan Wu 已提交
744
	p4 = [SP + PT_P0];
745 746 747 748 749 750
	p3 = __NR_syscall;
	cc = p3 <= p4;
	r0 = -ENOSYS;
	if cc jump .Lsys_trace_badsys;

	/* Execute the appropriate system call */
B
Bryan Wu 已提交
751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767
	p5.l = _sys_call_table;
	p5.h = _sys_call_table;
	p5 = p5 + (p4 << 2);
	r0 = [sp + PT_R0];
	r1 = [sp + PT_R1];
	r2 = [sp + PT_R2];
	r3 = [sp + PT_R3];
	r4 = [sp + PT_R4];
	r5 = [sp + PT_R5];
	p5 = [p5];

	[--sp] = r5;
	[--sp] = r4;
	[--sp] = r3;
	SP += -12;
	call (p5);
	SP += 24;
768
.Lsys_trace_badsys:
B
Bryan Wu 已提交
769 770
	[sp + PT_R0] = r0;

771 772
	r0 = sp;
	pseudo_long_call _syscall_trace_leave, p5;
B
Bryan Wu 已提交
773
	jump .Lresume_userspace;
774
ENDPROC(_sys_trace)
B
Bryan Wu 已提交
775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819

ENTRY(_resume)
	/*
	 * Beware - when entering resume, prev (the current task) is
	 * in r0, next (the new task) is in r1.
	 */
	p0 = r0;
	p1 = r1;
	[--sp] = rets;
	[--sp] = fp;
	[--sp] = (r7:4, p5:3);

	/* save usp */
	p2 = usp;
	[p0+(TASK_THREAD+THREAD_USP)] = p2;

	/* save current kernel stack pointer */
	[p0+(TASK_THREAD+THREAD_KSP)] = sp;

	/* save program counter */
	r1.l = _new_old_task;
	r1.h = _new_old_task;
	[p0+(TASK_THREAD+THREAD_PC)] = r1;

	/* restore the kernel stack pointer */
	sp = [p1+(TASK_THREAD+THREAD_KSP)];

	/* restore user stack pointer */
	p0 = [p1+(TASK_THREAD+THREAD_USP)];
	usp = p0;

	/* restore pc */
	p0 = [p1+(TASK_THREAD+THREAD_PC)];
	jump (p0);

	/*
	 * Following code actually lands up in a new (old) task.
	 */

_new_old_task:
	(r7:4, p5:3) = [sp++];
	fp = [sp++];
	rets = [sp++];

	/*
L
Lucas De Marchi 已提交
820
	 * When we come out of resume, r0 carries "old" task, because we are
B
Bryan Wu 已提交
821 822 823
	 * in "new" task.
	 */
	rts;
824
ENDPROC(_resume)
B
Bryan Wu 已提交
825 826

ENTRY(_ret_from_exception)
827
#ifdef CONFIG_IPIPE
R
Rusty Russell 已提交
828 829
	p2.l = _ipipe_percpu_domain;
	p2.h = _ipipe_percpu_domain;
830 831 832 833 834
	r0.l = _ipipe_root;
	r0.h = _ipipe_root;
	r2 = [p2];
	cc = r0 == r2;
	if !cc jump 4f;  /* not on behalf of the root domain, get out */
835
#endif /* CONFIG_IPIPE */
B
Bryan Wu 已提交
836 837 838 839 840 841 842 843
	p2.l = lo(IPEND);
	p2.h = hi(IPEND);

	csync;
	r0 = [p2];
	[sp + PT_IPEND] = r0;

1:
844
	r2 = LO(~0x37) (Z);
B
Bryan Wu 已提交
845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882
	r0 = r2 & r0;
	cc = r0 == 0;
	if !cc jump 4f;	/* if not return to user mode, get out */

	/* Make sure any pending system call or deferred exception
	 * return in ILAT for this process to get executed, otherwise
	 * in case context switch happens, system call of
	 * first process (i.e in ILAT) will be carried
	 * forward to the switched process
	 */

	p2.l = lo(ILAT);
	p2.h = hi(ILAT);
	r0 = [p2];
	r1 = (EVT_IVG14 | EVT_IVG15) (z);
	r0 = r0 & r1;
	cc = r0 == 0;
	if !cc jump 5f;

	/* Set the stack for the current process */
	r7 = sp;
	r4.l = lo(ALIGN_PAGE_MASK);
	r4.h = hi(ALIGN_PAGE_MASK);
	r7 = r7 & r4;		/* thread_info->flags */
	p5 = r7;
	r7 = [p5 + TI_FLAGS];
	r4.l = lo(_TIF_WORK_MASK);
	r4.h = hi(_TIF_WORK_MASK);
	r7 =  r7 & r4;
	cc = r7 == 0;
	if cc jump 4f;

	p0.l = lo(EVT15);
	p0.h = hi(EVT15);
	p1.l = _schedule_and_signal;
	p1.h = _schedule_and_signal;
	[p0] = p1;
	csync;
883
	raise 15;		/* raise evt15 to do signal or reschedule */
B
Bryan Wu 已提交
884 885
4:
	r0 = syscfg;
886
	bitclr(r0, SYSCFG_SSSTEP_P);		/* Turn off single step */
B
Bryan Wu 已提交
887 888 889
	syscfg = r0;
5:
	rts;
890
ENDPROC(_ret_from_exception)
B
Bryan Wu 已提交
891

892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951
#if defined(CONFIG_PREEMPT)

ENTRY(_up_to_irq14)
#if ANOMALY_05000281 || ANOMALY_05000461
	r0.l = lo(SAFE_USER_INSTRUCTION);
	r0.h = hi(SAFE_USER_INSTRUCTION);
	reti = r0;
#endif

#ifdef CONFIG_DEBUG_HWERR
	/* enable irq14 & hwerr interrupt, until we transition to _evt_evt14 */
	r0 = (EVT_IVG14 | EVT_IVHW | EVT_IRPTEN | EVT_EVX | EVT_NMI | EVT_RST | EVT_EMU);
#else
	/* Only enable irq14 interrupt, until we transition to _evt_evt14 */
	r0 = (EVT_IVG14 | EVT_IRPTEN | EVT_EVX | EVT_NMI | EVT_RST | EVT_EMU);
#endif
	sti r0;

	p0.l = lo(EVT14);
	p0.h = hi(EVT14);
	p1.l = _evt_up_evt14;
	p1.h = _evt_up_evt14;
	[p0] = p1;
	csync;

	raise 14;
1:
	jump 1b;
ENDPROC(_up_to_irq14)

ENTRY(_evt_up_evt14)
#ifdef CONFIG_DEBUG_HWERR
	r0 = (EVT_IVHW | EVT_IRPTEN | EVT_EVX | EVT_NMI | EVT_RST | EVT_EMU);
	sti r0;
#else
	cli r0;
#endif
#ifdef CONFIG_TRACE_IRQFLAGS
	[--sp] = rets;
	sp += -12;
	call _trace_hardirqs_off;
	sp += 12;
	rets = [sp++];
#endif
	[--sp] = RETI;
	SP += 4;

	/* restore normal evt14 */
	p0.l = lo(EVT14);
	p0.h = hi(EVT14);
	p1.l = _evt_evt14;
	p1.h = _evt_evt14;
	[p0] = p1;
	csync;

	rts;
ENDPROC(_evt_up_evt14)

#endif

952 953 954
#ifdef CONFIG_IPIPE

_resume_kernel_from_int:
955 956 957 958 959 960 961 962
	r1 = LO(~0x8000) (Z);
	r1 = r0 & r1;
	r0 = 1;
	r0 = r1 - r0;
	r2 = r1 & r0;
	cc = r2 == 0;
	/* Sync the root stage only from the outer interrupt level. */
	if !cc jump .Lnosync;
963 964
	r0.l = ___ipipe_sync_root;
	r0.h = ___ipipe_sync_root;
965
	[--sp] = reti;
966 967 968 969 970 971 972
	[--sp] = rets;
	[--sp] = ( r7:4, p5:3 );
	SP += -12;
	call ___ipipe_call_irqtail
	SP += 12;
	( r7:4, p5:3 ) = [sp++];
	rets = [sp++];
973 974
	reti = [sp++];
.Lnosync:
975
	rts
976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020
#elif defined(CONFIG_PREEMPT)

_resume_kernel_from_int:
	/* check preempt_count */
	r7 = sp;
	r4.l = lo(ALIGN_PAGE_MASK);
	r4.h = hi(ALIGN_PAGE_MASK);
	r7 = r7 & r4;
	p5 = r7;
	r7 = [p5 + TI_PREEMPT];
	cc = r7 == 0x0;
	if !cc jump .Lreturn_to_kernel;
.Lneed_schedule:
	r7 = [p5 + TI_FLAGS];
	r4.l = lo(_TIF_WORK_MASK);
	r4.h = hi(_TIF_WORK_MASK);
	r7 =  r7 & r4;
	cc = BITTST(r7, TIF_NEED_RESCHED);
	if !cc jump .Lreturn_to_kernel;
	/*
	 * let schedule done at level 15, otherwise sheduled process will run
	 * at high level and block low level interrupt
	 */
	r6 = reti;  /* save reti */
	r5.l = .Lkernel_schedule;
	r5.h = .Lkernel_schedule;
	reti = r5;
	rti;
.Lkernel_schedule:
	[--sp] = rets;
	sp += -12;
	pseudo_long_call _preempt_schedule_irq, p4;
	sp += 12;
	rets = [sp++];

	[--sp] = rets;
	sp += -12;
	/* up to irq14 so that reti after restore_all can return to irq15(kernel) */
	pseudo_long_call _up_to_irq14, p4;
	sp += 12;
	rets = [sp++];

	reti = r6; /* restore reti so that origin process can return to interrupted point */

	jump .Lneed_schedule;
1021
#else
1022 1023

#define _resume_kernel_from_int	.Lreturn_to_kernel
1024 1025
#endif

B
Bryan Wu 已提交
1026 1027 1028 1029 1030 1031 1032
ENTRY(_return_from_int)
	/* If someone else already raised IRQ 15, do nothing.  */
	csync;
	p2.l = lo(ILAT);
	p2.h = hi(ILAT);
	r0 = [p2];
	cc = bittst (r0, EVT_IVG15_P);
1033
	if cc jump .Lreturn_to_kernel;
B
Bryan Wu 已提交
1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046

	/* if not return to user mode, get out */
	p2.l = lo(IPEND);
	p2.h = hi(IPEND);
	r0 = [p2];
	r1 = 0x17(Z);
	r2 = ~r1;
	r2.h = 0;
	r0 = r2 & r0;
	r1 = 1;
	r1 = r0 - r1;
	r2 = r0 & r1;
	cc = r2 == 0;
1047
	if !cc jump _resume_kernel_from_int;
B
Bryan Wu 已提交
1048 1049 1050 1051 1052 1053 1054 1055

	/* Lower the interrupt level to 15.  */
	p0.l = lo(EVT15);
	p0.h = hi(EVT15);
	p1.l = _schedule_and_signal_from_int;
	p1.h = _schedule_and_signal_from_int;
	[p0] = p1;
	csync;
1056
#if ANOMALY_05000281 || ANOMALY_05000461
1057 1058
	r0.l = lo(SAFE_USER_INSTRUCTION);
	r0.h = hi(SAFE_USER_INSTRUCTION);
B
Bryan Wu 已提交
1059 1060 1061 1062 1063 1064
	reti = r0;
#endif
	r0 = 0x801f (z);
	STI r0;
	raise 15;	/* raise evt15 to do signal or reschedule */
	rti;
1065
.Lreturn_to_kernel:
B
Bryan Wu 已提交
1066
	rts;
1067
ENDPROC(_return_from_int)
B
Bryan Wu 已提交
1068 1069

ENTRY(_lower_to_irq14)
1070
#if ANOMALY_05000281 || ANOMALY_05000461
1071 1072
	r0.l = lo(SAFE_USER_INSTRUCTION);
	r0.h = hi(SAFE_USER_INSTRUCTION);
B
Bryan Wu 已提交
1073 1074
	reti = r0;
#endif
1075 1076

#ifdef CONFIG_DEBUG_HWERR
1077
	/* enable irq14 & hwerr interrupt, until we transition to _evt_evt14 */
1078 1079
	r0 = (EVT_IVG14 | EVT_IVHW | EVT_IRPTEN | EVT_EVX | EVT_NMI | EVT_RST | EVT_EMU);
#else
1080
	/* Only enable irq14 interrupt, until we transition to _evt_evt14 */
1081 1082
	r0 = (EVT_IVG14 | EVT_IRPTEN | EVT_EVX | EVT_NMI | EVT_RST | EVT_EMU);
#endif
B
Bryan Wu 已提交
1083 1084 1085
	sti r0;
	raise 14;
	rti;
1086 1087
ENDPROC(_lower_to_irq14)

1088
ENTRY(_evt_evt14)
B
Bryan Wu 已提交
1089
#ifdef CONFIG_DEBUG_HWERR
1090
	r0 = (EVT_IVHW | EVT_IRPTEN | EVT_EVX | EVT_NMI | EVT_RST | EVT_EMU);
B
Bryan Wu 已提交
1091 1092 1093
	sti r0;
#else
	cli r0;
1094 1095 1096 1097 1098 1099 1100
#endif
#ifdef CONFIG_TRACE_IRQFLAGS
	[--sp] = rets;
	sp += -12;
	call _trace_hardirqs_off;
	sp += 12;
	rets = [sp++];
B
Bryan Wu 已提交
1101 1102 1103 1104
#endif
	[--sp] = RETI;
	SP += 4;
	rts;
1105
ENDPROC(_evt_evt14)
B
Bryan Wu 已提交
1106

1107
ENTRY(_schedule_and_signal_from_int)
B
Bryan Wu 已提交
1108 1109 1110 1111 1112 1113 1114 1115 1116
	/* To end up here, vector 15 was changed - so we have to change it
	 * back.
	 */
	p0.l = lo(EVT15);
	p0.h = hi(EVT15);
	p1.l = _evt_system_call;
	p1.h = _evt_system_call;
	[p0] = p1;
	csync;
1117 1118 1119 1120 1121

	/* Set orig_p0 to -1 to indicate this isn't the end of a syscall.  */
	r0 = -1 (x);
	[sp + PT_ORIG_P0] = r0;

B
Bryan Wu 已提交
1122 1123 1124
	p1 = rets;
	[sp + PT_RESERVED] = p1;

1125 1126 1127 1128 1129 1130 1131 1132
#ifdef CONFIG_TRACE_IRQFLAGS
	/* trace_hardirqs_on() checks if all irqs are disabled. But here IRQ 15
	 * is turned on, so disable all irqs. */
	cli r0;
	sp += -12;
	call _trace_hardirqs_on;
	sp += 12;
#endif
1133 1134 1135 1136
#ifdef CONFIG_SMP
	GET_PDA(p0, r0); 	/* Fetch current PDA (can't migrate to other CPU here) */
	r0 = [p0 + PDA_IRQFLAGS];
#else
1137 1138
	p0.l = _bfin_irq_flags;
	p0.h = _bfin_irq_flags;
B
Bryan Wu 已提交
1139
	r0 = [p0];
1140
#endif
B
Bryan Wu 已提交
1141 1142
	sti r0;

1143 1144 1145 1146 1147 1148
	/* finish the userspace "atomic" functions for it */
	r1 = FIXED_CODE_END;
	r2 = [sp + PT_PC];
	cc = r1 <= r2;
	if cc jump .Lresume_userspace (bp);

1149 1150
	r0 = sp;
	sp += -12;
B
Barry Song 已提交
1151 1152

	pseudo_long_call _finish_atomic_sections, p5;
1153
	sp += 12;
B
Bryan Wu 已提交
1154
	jump.s .Lresume_userspace;
1155
ENDPROC(_schedule_and_signal_from_int)
B
Bryan Wu 已提交
1156

1157
ENTRY(_schedule_and_signal)
B
Bryan Wu 已提交
1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174
	SAVE_CONTEXT_SYSCALL
	/* To end up here, vector 15 was changed - so we have to change it
	 * back.
	 */
	p0.l = lo(EVT15);
	p0.h = hi(EVT15);
	p1.l = _evt_system_call;
	p1.h = _evt_system_call;
	[p0] = p1;
	csync;
	p0.l = 1f;
	p0.h = 1f;
	[sp + PT_RESERVED] = P0;
	call .Lresume_userspace;
1:
	RESTORE_CONTEXT
	rti;
1175
ENDPROC(_schedule_and_signal)
B
Bryan Wu 已提交
1176

1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229
/* We handle this 100% in exception space - to reduce overhead
 * Only potiential problem is if the software buffer gets swapped out of the
 * CPLB table - then double fault. - so we don't let this happen in other places
 */
#ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
ENTRY(_ex_trace_buff_full)
	[--sp] = P3;
	[--sp] = P2;
	[--sp] = LC0;
	[--sp] = LT0;
	[--sp] = LB0;
	P5.L = _trace_buff_offset;
	P5.H = _trace_buff_offset;
	P3 = [P5];              /* trace_buff_offset */
	P5.L = lo(TBUFSTAT);
	P5.H = hi(TBUFSTAT);
	R7 = [P5];
	R7 <<= 1;               /* double, since we need to read twice */
	LC0 = R7;
	R7 <<= 2;               /* need to shift over again,
				 * to get the number of bytes */
	P5.L = lo(TBUF);
	P5.H = hi(TBUF);
	R6 = ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN)*1024) - 1;

	P2 = R7;
	P3 = P3 + P2;
	R7 = P3;
	R7 = R7 & R6;
	P3 = R7;
	P2.L = _trace_buff_offset;
	P2.H = _trace_buff_offset;
	[P2] = P3;

	P2.L = _software_trace_buff;
	P2.H = _software_trace_buff;

	LSETUP (.Lstart, .Lend) LC0;
.Lstart:
	R7 = [P5];      /* read TBUF */
	P4 = P3 + P2;
	[P4] = R7;
	P3 += -4;
	R7 = P3;
	R7 = R7 & R6;
.Lend:
	P3 = R7;

	LB0 = [sp++];
	LT0 = [sp++];
	LC0 = [sp++];
	P2 = [sp++];
	P3 = [sp++];
1230
	jump _bfin_return_from_exception;
1231
ENDPROC(_ex_trace_buff_full)
1232 1233 1234 1235 1236

#if CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN == 4
.data
#else
.section .l1.data.B
1237
#endif /* CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN */
1238 1239 1240 1241 1242 1243 1244
ENTRY(_trace_buff_offset)
        .long 0;
ALIGN
ENTRY(_software_trace_buff)
	.rept ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN)*256);
	.long 0
	.endr
1245 1246 1247
#endif /* CONFIG_DEBUG_BFIN_HWTRACE_EXPAND */

#if CONFIG_EARLY_PRINTK
1248
__INIT
1249 1250 1251 1252
ENTRY(_early_trap)
	SAVE_ALL_SYS
	trace_buffer_stop(p0,r0);

1253
	ANOMALY_283_315_WORKAROUND(p4, r5)
1254

1255 1256 1257 1258 1259 1260 1261
	/* Turn caches off, to ensure we don't get double exceptions */

	P4.L = LO(IMEM_CONTROL);
	P4.H = HI(IMEM_CONTROL);

	R5 = [P4];              /* Control Register*/
	BITCLR(R5,ENICPLB_P);
1262
	CSYNC;          /* Disabling of CPLBs should be proceeded by a CSYNC */
1263 1264 1265 1266 1267 1268 1269
	[P4] = R5;
	SSYNC;

	P4.L = LO(DMEM_CONTROL);
	P4.H = HI(DMEM_CONTROL);
	R5 = [P4];
	BITCLR(R5,ENDCPLB_P);
1270
	CSYNC;          /* Disabling of CPLBs should be proceeded by a CSYNC */
1271 1272 1273 1274 1275 1276 1277 1278 1279 1280
	[P4] = R5;
	SSYNC;

	r0 = sp;        /* stack frame pt_regs pointer argument ==> r0 */
	r1 = RETX;

	SP += -12;
	call _early_trap_c;
	SP += 12;
ENDPROC(_early_trap)
1281
__FINIT
1282
#endif /* CONFIG_EARLY_PRINTK */
1283

B
Bryan Wu 已提交
1284 1285 1286 1287 1288 1289 1290 1291 1292 1293
/*
 * Put these in the kernel data section - that should always be covered by
 * a CPLB. This is needed to ensure we don't get double fault conditions
 */

#ifdef CONFIG_SYSCALL_TAB_L1
.section .l1.data
#else
.data
#endif
1294

1295
ENTRY(_ex_table)
B
Bryan Wu 已提交
1296
	/* entry for each EXCAUSE[5:0]
M
Mike Frysinger 已提交
1297
	 * This table must be in sync with the table in ./kernel/traps.c
B
Bryan Wu 已提交
1298 1299
	 * EXCPT instruction can provide 4 bits of EXCAUSE, allowing 16 to be user defined
	 */
1300
	.long _ex_syscall       /* 0x00 - User Defined - Linux Syscall */
1301
	.long _ex_trap_c        /* 0x01 - User Defined - Software breakpoint */
1302 1303 1304 1305
#ifdef	CONFIG_KGDB
	.long _ex_trap_c	/* 0x02 - User Defined - KGDB initial connection
							 and break signal trap */
#else
1306
	.long _ex_replaceable   /* 0x02 - User Defined */
1307
#endif
M
Mike Frysinger 已提交
1308
	.long _ex_trap_c        /* 0x03 - User Defined - userspace stack overflow */
1309
	.long _ex_trap_c        /* 0x04 - User Defined - dump trace buffer */
1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320
	.long _ex_replaceable   /* 0x05 - User Defined */
	.long _ex_replaceable   /* 0x06 - User Defined */
	.long _ex_replaceable   /* 0x07 - User Defined */
	.long _ex_replaceable   /* 0x08 - User Defined */
	.long _ex_replaceable   /* 0x09 - User Defined */
	.long _ex_replaceable   /* 0x0A - User Defined */
	.long _ex_replaceable   /* 0x0B - User Defined */
	.long _ex_replaceable   /* 0x0C - User Defined */
	.long _ex_replaceable   /* 0x0D - User Defined */
	.long _ex_replaceable   /* 0x0E - User Defined */
	.long _ex_replaceable   /* 0x0F - User Defined */
B
Bryan Wu 已提交
1321
	.long _ex_single_step   /* 0x10 - HW Single step */
1322 1323 1324
#ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
	.long _ex_trace_buff_full /* 0x11 - Trace Buffer Full */
#else
B
Bryan Wu 已提交
1325
	.long _ex_trap_c        /* 0x11 - Trace Buffer Full */
1326
#endif
B
Bryan Wu 已提交
1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343
	.long _ex_trap_c        /* 0x12 - Reserved */
	.long _ex_trap_c        /* 0x13 - Reserved */
	.long _ex_trap_c        /* 0x14 - Reserved */
	.long _ex_trap_c        /* 0x15 - Reserved */
	.long _ex_trap_c        /* 0x16 - Reserved */
	.long _ex_trap_c        /* 0x17 - Reserved */
	.long _ex_trap_c        /* 0x18 - Reserved */
	.long _ex_trap_c        /* 0x19 - Reserved */
	.long _ex_trap_c        /* 0x1A - Reserved */
	.long _ex_trap_c        /* 0x1B - Reserved */
	.long _ex_trap_c        /* 0x1C - Reserved */
	.long _ex_trap_c        /* 0x1D - Reserved */
	.long _ex_trap_c        /* 0x1E - Reserved */
	.long _ex_trap_c        /* 0x1F - Reserved */
	.long _ex_trap_c        /* 0x20 - Reserved */
	.long _ex_trap_c        /* 0x21 - Undefined Instruction */
	.long _ex_trap_c        /* 0x22 - Illegal Instruction Combination */
1344
	.long _ex_dviol         /* 0x23 - Data CPLB Protection Violation */
B
Bryan Wu 已提交
1345 1346
	.long _ex_trap_c        /* 0x24 - Data access misaligned */
	.long _ex_trap_c        /* 0x25 - Unrecoverable Event */
1347 1348
	.long _ex_dmiss         /* 0x26 - Data CPLB Miss */
	.long _ex_dmult         /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero */
B
Bryan Wu 已提交
1349 1350 1351
	.long _ex_trap_c        /* 0x28 - Emulation Watchpoint */
	.long _ex_trap_c        /* 0x29 - Instruction fetch access error (535 only) */
	.long _ex_trap_c        /* 0x2A - Instruction fetch misaligned */
1352 1353
	.long _ex_trap_c        /* 0x2B - Instruction CPLB protection Violation */
	.long _ex_icplb_miss    /* 0x2C - Instruction CPLB miss */
B
Bryan Wu 已提交
1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373
	.long _ex_trap_c        /* 0x2D - Instruction CPLB Multiple Hits */
	.long _ex_trap_c        /* 0x2E - Illegal use of Supervisor Resource */
	.long _ex_trap_c        /* 0x2E - Illegal use of Supervisor Resource */
	.long _ex_trap_c        /* 0x2F - Reserved */
	.long _ex_trap_c        /* 0x30 - Reserved */
	.long _ex_trap_c        /* 0x31 - Reserved */
	.long _ex_trap_c        /* 0x32 - Reserved */
	.long _ex_trap_c        /* 0x33 - Reserved */
	.long _ex_trap_c        /* 0x34 - Reserved */
	.long _ex_trap_c        /* 0x35 - Reserved */
	.long _ex_trap_c        /* 0x36 - Reserved */
	.long _ex_trap_c        /* 0x37 - Reserved */
	.long _ex_trap_c        /* 0x38 - Reserved */
	.long _ex_trap_c        /* 0x39 - Reserved */
	.long _ex_trap_c        /* 0x3A - Reserved */
	.long _ex_trap_c        /* 0x3B - Reserved */
	.long _ex_trap_c        /* 0x3C - Reserved */
	.long _ex_trap_c        /* 0x3D - Reserved */
	.long _ex_trap_c        /* 0x3E - Reserved */
	.long _ex_trap_c        /* 0x3F - Reserved */
1374
END(_ex_table)
B
Bryan Wu 已提交
1375 1376

ENTRY(_sys_call_table)
1377
	.long _sys_restart_syscall	/* 0 */
B
Bryan Wu 已提交
1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501
	.long _sys_exit
	.long _sys_fork
	.long _sys_read
	.long _sys_write
	.long _sys_open		/* 5 */
	.long _sys_close
	.long _sys_ni_syscall	/* old waitpid */
	.long _sys_creat
	.long _sys_link
	.long _sys_unlink	/* 10 */
	.long _sys_execve
	.long _sys_chdir
	.long _sys_time
	.long _sys_mknod
	.long _sys_chmod		/* 15 */
	.long _sys_chown	/* chown16 */
	.long _sys_ni_syscall	/* old break syscall holder */
	.long _sys_ni_syscall	/* old stat */
	.long _sys_lseek
	.long _sys_getpid	/* 20 */
	.long _sys_mount
	.long _sys_ni_syscall	/* old umount */
	.long _sys_setuid
	.long _sys_getuid
	.long _sys_stime		/* 25 */
	.long _sys_ptrace
	.long _sys_alarm
	.long _sys_ni_syscall	/* old fstat */
	.long _sys_pause
	.long _sys_ni_syscall	/* old utime */ /* 30 */
	.long _sys_ni_syscall	/* old stty syscall holder */
	.long _sys_ni_syscall	/* old gtty syscall holder */
	.long _sys_access
	.long _sys_nice
	.long _sys_ni_syscall	/* 35 */ /* old ftime syscall holder */
	.long _sys_sync
	.long _sys_kill
	.long _sys_rename
	.long _sys_mkdir
	.long _sys_rmdir		/* 40 */
	.long _sys_dup
	.long _sys_pipe
	.long _sys_times
	.long _sys_ni_syscall	/* old prof syscall holder */
	.long _sys_brk		/* 45 */
	.long _sys_setgid
	.long _sys_getgid
	.long _sys_ni_syscall	/* old sys_signal */
	.long _sys_geteuid	/* geteuid16 */
	.long _sys_getegid	/* getegid16 */	/* 50 */
	.long _sys_acct
	.long _sys_umount	/* recycled never used phys() */
	.long _sys_ni_syscall	/* old lock syscall holder */
	.long _sys_ioctl
	.long _sys_fcntl		/* 55 */
	.long _sys_ni_syscall	/* old mpx syscall holder */
	.long _sys_setpgid
	.long _sys_ni_syscall	/* old ulimit syscall holder */
	.long _sys_ni_syscall	/* old old uname */
	.long _sys_umask		/* 60 */
	.long _sys_chroot
	.long _sys_ustat
	.long _sys_dup2
	.long _sys_getppid
	.long _sys_getpgrp	/* 65 */
	.long _sys_setsid
	.long _sys_ni_syscall	/* old sys_sigaction */
	.long _sys_sgetmask
	.long _sys_ssetmask
	.long _sys_setreuid	/* setreuid16 */	/* 70 */
	.long _sys_setregid	/* setregid16 */
	.long _sys_ni_syscall	/* old sys_sigsuspend */
	.long _sys_ni_syscall	/* old sys_sigpending */
	.long _sys_sethostname
	.long _sys_setrlimit	/* 75 */
	.long _sys_ni_syscall	/* old getrlimit */
	.long _sys_getrusage
	.long _sys_gettimeofday
	.long _sys_settimeofday
	.long _sys_getgroups	/* getgroups16 */	/* 80 */
	.long _sys_setgroups	/* setgroups16 */
	.long _sys_ni_syscall	/* old_select */
	.long _sys_symlink
	.long _sys_ni_syscall	/* old lstat */
	.long _sys_readlink	/* 85 */
	.long _sys_uselib
	.long _sys_ni_syscall	/* sys_swapon */
	.long _sys_reboot
	.long _sys_ni_syscall	/* old_readdir */
	.long _sys_ni_syscall	/* sys_mmap */	/* 90 */
	.long _sys_munmap
	.long _sys_truncate
	.long _sys_ftruncate
	.long _sys_fchmod
	.long _sys_fchown	/* fchown16 */	/* 95 */
	.long _sys_getpriority
	.long _sys_setpriority
	.long _sys_ni_syscall	/* old profil syscall holder */
	.long _sys_statfs
	.long _sys_fstatfs	/* 100 */
	.long _sys_ni_syscall
	.long _sys_ni_syscall	/* old sys_socketcall */
	.long _sys_syslog
	.long _sys_setitimer
	.long _sys_getitimer	/* 105 */
	.long _sys_newstat
	.long _sys_newlstat
	.long _sys_newfstat
	.long _sys_ni_syscall	/* old uname */
	.long _sys_ni_syscall	/* iopl for i386 */ /* 110 */
	.long _sys_vhangup
	.long _sys_ni_syscall	/* obsolete idle() syscall */
	.long _sys_ni_syscall	/* vm86old for i386 */
	.long _sys_wait4
	.long _sys_ni_syscall	/* 115 */ /* sys_swapoff */
	.long _sys_sysinfo
	.long _sys_ni_syscall	/* old sys_ipc */
	.long _sys_fsync
	.long _sys_ni_syscall	/* old sys_sigreturn */
	.long _sys_clone		/* 120 */
	.long _sys_setdomainname
	.long _sys_newuname
	.long _sys_ni_syscall	/* old sys_modify_ldt */
	.long _sys_adjtimex
1502
	.long _sys_mprotect	/* 125 */
B
Bryan Wu 已提交
1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520
	.long _sys_ni_syscall	/* old sys_sigprocmask */
	.long _sys_ni_syscall	/* old "creat_module" */
	.long _sys_init_module
	.long _sys_delete_module
	.long _sys_ni_syscall	/* 130: old "get_kernel_syms" */
	.long _sys_quotactl
	.long _sys_getpgid
	.long _sys_fchdir
	.long _sys_bdflush
	.long _sys_ni_syscall	/* 135 */ /* sys_sysfs */
	.long _sys_personality
	.long _sys_ni_syscall	/* for afs_syscall */
	.long _sys_setfsuid	/* setfsuid16 */
	.long _sys_setfsgid	/* setfsgid16 */
	.long _sys_llseek	/* 140 */
	.long _sys_getdents
	.long _sys_ni_syscall	/* sys_select */
	.long _sys_flock
1521
	.long _sys_msync
B
Bryan Wu 已提交
1522 1523 1524 1525 1526
	.long _sys_readv		/* 145 */
	.long _sys_writev
	.long _sys_getsid
	.long _sys_fdatasync
	.long _sys_sysctl
1527 1528 1529 1530
	.long _sys_mlock	/* 150 */
	.long _sys_munlock
	.long _sys_mlockall
	.long _sys_munlockall
B
Bryan Wu 已提交
1531 1532 1533 1534 1535 1536 1537 1538 1539
	.long _sys_sched_setparam
	.long _sys_sched_getparam /* 155 */
	.long _sys_sched_setscheduler
	.long _sys_sched_getscheduler
	.long _sys_sched_yield
	.long _sys_sched_get_priority_max
	.long _sys_sched_get_priority_min  /* 160 */
	.long _sys_sched_rr_get_interval
	.long _sys_nanosleep
1540
	.long _sys_mremap
B
Bryan Wu 已提交
1541 1542 1543 1544 1545
	.long _sys_setresuid	/* setresuid16 */
	.long _sys_getresuid	/* getresuid16 */	/* 165 */
	.long _sys_ni_syscall	/* for vm86 */
	.long _sys_ni_syscall	/* old "query_module" */
	.long _sys_ni_syscall	/* sys_poll */
1546
	.long _sys_nfsservctl
B
Bryan Wu 已提交
1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568
	.long _sys_setresgid	/* setresgid16 */	/* 170 */
	.long _sys_getresgid	/* getresgid16 */
	.long _sys_prctl
	.long _sys_rt_sigreturn
	.long _sys_rt_sigaction
	.long _sys_rt_sigprocmask /* 175 */
	.long _sys_rt_sigpending
	.long _sys_rt_sigtimedwait
	.long _sys_rt_sigqueueinfo
	.long _sys_rt_sigsuspend
	.long _sys_pread64	/* 180 */
	.long _sys_pwrite64
	.long _sys_lchown	/* lchown16 */
	.long _sys_getcwd
	.long _sys_capget
	.long _sys_capset	/* 185 */
	.long _sys_sigaltstack
	.long _sys_sendfile
	.long _sys_ni_syscall	/* streams1 */
	.long _sys_ni_syscall	/* streams2 */
	.long _sys_vfork		/* 190 */
	.long _sys_getrlimit
A
Al Viro 已提交
1569
	.long _sys_mmap_pgoff
B
Bryan Wu 已提交
1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594
	.long _sys_truncate64
	.long _sys_ftruncate64
	.long _sys_stat64	/* 195 */
	.long _sys_lstat64
	.long _sys_fstat64
	.long _sys_chown
	.long _sys_getuid
	.long _sys_getgid	/* 200 */
	.long _sys_geteuid
	.long _sys_getegid
	.long _sys_setreuid
	.long _sys_setregid
	.long _sys_getgroups	/* 205 */
	.long _sys_setgroups
	.long _sys_fchown
	.long _sys_setresuid
	.long _sys_getresuid
	.long _sys_setresgid	/* 210 */
	.long _sys_getresgid
	.long _sys_lchown
	.long _sys_setuid
	.long _sys_setgid
	.long _sys_setfsuid	/* 215 */
	.long _sys_setfsgid
	.long _sys_pivot_root
1595 1596
	.long _sys_mincore
	.long _sys_madvise
B
Bryan Wu 已提交
1597 1598 1599 1600 1601
	.long _sys_getdents64	/* 220 */
	.long _sys_fcntl64
	.long _sys_ni_syscall	/* reserved for TUX */
	.long _sys_ni_syscall
	.long _sys_gettid
1602
	.long _sys_readahead	/* 225 */
B
Bryan Wu 已提交
1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651
	.long _sys_setxattr
	.long _sys_lsetxattr
	.long _sys_fsetxattr
	.long _sys_getxattr
	.long _sys_lgetxattr	/* 230 */
	.long _sys_fgetxattr
	.long _sys_listxattr
	.long _sys_llistxattr
	.long _sys_flistxattr
	.long _sys_removexattr	/* 235 */
	.long _sys_lremovexattr
	.long _sys_fremovexattr
	.long _sys_tkill
	.long _sys_sendfile64
	.long _sys_futex		/* 240 */
	.long _sys_sched_setaffinity
	.long _sys_sched_getaffinity
	.long _sys_ni_syscall	/* sys_set_thread_area */
	.long _sys_ni_syscall	/* sys_get_thread_area */
	.long _sys_io_setup	/* 245 */
	.long _sys_io_destroy
	.long _sys_io_getevents
	.long _sys_io_submit
	.long _sys_io_cancel
	.long _sys_ni_syscall	/* 250 */ /* sys_alloc_hugepages */
	.long _sys_ni_syscall	/* sys_freec_hugepages */
	.long _sys_exit_group
	.long _sys_lookup_dcookie
	.long _sys_bfin_spinlock
	.long _sys_epoll_create	/* 255 */
	.long _sys_epoll_ctl
	.long _sys_epoll_wait
	.long _sys_ni_syscall /* remap_file_pages */
	.long _sys_set_tid_address
	.long _sys_timer_create	/* 260 */
	.long _sys_timer_settime
	.long _sys_timer_gettime
	.long _sys_timer_getoverrun
	.long _sys_timer_delete
	.long _sys_clock_settime /* 265 */
	.long _sys_clock_gettime
	.long _sys_clock_getres
	.long _sys_clock_nanosleep
	.long _sys_statfs64
	.long _sys_fstatfs64	/* 270 */
	.long _sys_tgkill
	.long _sys_utimes
	.long _sys_fadvise64_64
	.long _sys_ni_syscall /* vserver */
1652
	.long _sys_mbind	/* 275 */
B
Bryan Wu 已提交
1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718
	.long _sys_ni_syscall /* get_mempolicy */
	.long _sys_ni_syscall /* set_mempolicy */
	.long _sys_mq_open
	.long _sys_mq_unlink
	.long _sys_mq_timedsend	/* 280 */
	.long _sys_mq_timedreceive
	.long _sys_mq_notify
	.long _sys_mq_getsetattr
	.long _sys_ni_syscall /* kexec_load */
	.long _sys_waitid	/* 285 */
	.long _sys_add_key
	.long _sys_request_key
	.long _sys_keyctl
	.long _sys_ioprio_set
	.long _sys_ioprio_get	/* 290 */
	.long _sys_inotify_init
	.long _sys_inotify_add_watch
	.long _sys_inotify_rm_watch
	.long _sys_ni_syscall /* migrate_pages */
	.long _sys_openat	/* 295 */
	.long _sys_mkdirat
	.long _sys_mknodat
	.long _sys_fchownat
	.long _sys_futimesat
	.long _sys_fstatat64	/* 300 */
	.long _sys_unlinkat
	.long _sys_renameat
	.long _sys_linkat
	.long _sys_symlinkat
	.long _sys_readlinkat	/* 305 */
	.long _sys_fchmodat
	.long _sys_faccessat
	.long _sys_pselect6
	.long _sys_ppoll
	.long _sys_unshare	/* 310 */
	.long _sys_sram_alloc
	.long _sys_sram_free
	.long _sys_dma_memcpy
	.long _sys_accept
	.long _sys_bind		/* 315 */
	.long _sys_connect
	.long _sys_getpeername
	.long _sys_getsockname
	.long _sys_getsockopt
	.long _sys_listen	/* 320 */
	.long _sys_recv
	.long _sys_recvfrom
	.long _sys_recvmsg
	.long _sys_send
	.long _sys_sendmsg	/* 325 */
	.long _sys_sendto
	.long _sys_setsockopt
	.long _sys_shutdown
	.long _sys_socket
	.long _sys_socketpair	/* 330 */
	.long _sys_semctl
	.long _sys_semget
	.long _sys_semop
	.long _sys_msgctl
	.long _sys_msgget	/* 335 */
	.long _sys_msgrcv
	.long _sys_msgsnd
	.long _sys_shmat
	.long _sys_shmctl
	.long _sys_shmdt	/* 340 */
	.long _sys_shmget
1719 1720 1721 1722 1723 1724 1725
	.long _sys_splice
	.long _sys_sync_file_range
	.long _sys_tee
	.long _sys_vmsplice	/* 345 */
	.long _sys_epoll_pwait
	.long _sys_utimensat
	.long _sys_signalfd
1726
	.long _sys_timerfd_create
1727 1728 1729 1730 1731 1732 1733
	.long _sys_eventfd	/* 350 */
	.long _sys_pread64
	.long _sys_pwrite64
	.long _sys_fadvise64
	.long _sys_set_robust_list
	.long _sys_get_robust_list	/* 355 */
	.long _sys_fallocate
1734
	.long _sys_semtimedop
1735 1736
	.long _sys_timerfd_settime
	.long _sys_timerfd_gettime
1737 1738 1739 1740 1741 1742
	.long _sys_signalfd4		/* 360 */
	.long _sys_eventfd2
	.long _sys_epoll_create1
	.long _sys_dup3
	.long _sys_pipe2
	.long _sys_inotify_init1	/* 365 */
1743 1744
	.long _sys_preadv
	.long _sys_pwritev
1745
	.long _sys_rt_tgsigqueueinfo
1746
	.long _sys_perf_event_open
1747
	.long _sys_recvmmsg		/* 370 */
1748 1749 1750
	.long _sys_fanotify_init
	.long _sys_fanotify_mark
	.long _sys_prlimit64
S
Sonic Zhang 已提交
1751
	.long _sys_cacheflush
M
Mike Frysinger 已提交
1752 1753 1754
	.long _sys_name_to_handle_at	/* 375 */
	.long _sys_open_by_handle_at
	.long _sys_clock_adjtime
1755
	.long _sys_syncfs
1756
	.long _sys_setns
1757

B
Bryan Wu 已提交
1758 1759 1760
	.rept NR_syscalls-(.-_sys_call_table)/4
	.long _sys_ni_syscall
	.endr
1761
END(_sys_call_table)