entry.S 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419
  1. /*
  2. * File: arch/blackfin/mach-common/entry.S
  3. * Based on:
  4. * Author: Linus Torvalds
  5. *
  6. * Created: ?
  7. * Description: contains the system-call and fault low-level handling routines.
  8. * This also contains the timer-interrupt handler, as well as all
  9. * interrupts and faults that can result in a task-switch.
  10. *
  11. * Modified:
  12. * Copyright 2004-2006 Analog Devices Inc.
  13. *
  14. * Bugs: Enter bugs at http://blackfin.uclinux.org/
  15. *
  16. * This program is free software; you can redistribute it and/or modify
  17. * it under the terms of the GNU General Public License as published by
  18. * the Free Software Foundation; either version 2 of the License, or
  19. * (at your option) any later version.
  20. *
  21. * This program is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. * GNU General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU General Public License
  27. * along with this program; if not, see the file COPYING, or write
  28. * to the Free Software Foundation, Inc.,
  29. * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  30. */
  31. /* NOTE: This code handles signal-recognition, which happens every time
  32. * after a timer-interrupt and after each system call.
  33. */
  34. #include <linux/init.h>
  35. #include <linux/linkage.h>
  36. #include <linux/unistd.h>
  37. #include <asm/blackfin.h>
  38. #include <asm/errno.h>
  39. #include <asm/thread_info.h> /* TIF_NEED_RESCHED */
  40. #include <asm/asm-offsets.h>
  41. #include <asm/trace.h>
  42. #include <asm/mach-common/context.S>
  43. #if defined(CONFIG_BFIN_SCRATCH_REG_RETN)
  44. # define EX_SCRATCH_REG RETN
  45. #elif defined(CONFIG_BFIN_SCRATCH_REG_RETE)
  46. # define EX_SCRATCH_REG RETE
  47. #else
  48. # define EX_SCRATCH_REG CYCLES
  49. #endif
  50. #if ANOMALY_05000281
  51. ENTRY(_safe_speculative_execution)
  52. NOP;
  53. NOP;
  54. NOP;
  55. jump _safe_speculative_execution;
  56. ENDPROC(_safe_speculative_execution)
  57. #endif
  58. #ifdef CONFIG_EXCPT_IRQ_SYSC_L1
  59. .section .l1.text
  60. #else
  61. .text
  62. #endif
  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. */
  67. #if ANOMALY_05000261
  68. #define _ex_dviol _ex_workaround_261
  69. #define _ex_dmiss _ex_workaround_261
  70. #define _ex_dmult _ex_workaround_261
  71. ENTRY(_ex_workaround_261)
  72. /*
  73. * Work around an anomaly: if we see a new DCPLB fault, return
  74. * without doing anything. Then, if we get the same fault again,
  75. * handle it.
  76. */
  77. P4 = R7; /* Store EXCAUSE */
  78. p5.l = _last_cplb_fault_retx;
  79. p5.h = _last_cplb_fault_retx;
  80. r7 = [p5];
  81. r6 = retx;
  82. [p5] = r6;
  83. cc = r6 == r7;
  84. if !cc jump _bfin_return_from_exception;
  85. /* fall through */
  86. R7 = P4;
  87. R6 = 0x26; /* Data CPLB Miss */
  88. cc = R6 == R7;
  89. if cc jump _ex_dcplb_miss (BP);
  90. R6 = 0x23; /* Data CPLB Miss */
  91. cc = R6 == R7;
  92. if cc jump _ex_dcplb_viol (BP);
  93. /* Handle 0x23 Data CPLB Protection Violation
  94. * and Data CPLB Multiple Hits - Linux Trap Zero
  95. */
  96. jump _ex_trap_c;
  97. ENDPROC(_ex_workaround_261)
  98. #else
  99. #ifdef CONFIG_MPU
  100. #define _ex_dviol _ex_dcplb_viol
  101. #else
  102. #define _ex_dviol _ex_trap_c
  103. #endif
  104. #define _ex_dmiss _ex_dcplb_miss
  105. #define _ex_dmult _ex_trap_c
  106. #endif
  107. ENTRY(_ex_dcplb_viol)
  108. ENTRY(_ex_dcplb_miss)
  109. ENTRY(_ex_icplb_miss)
  110. (R7:6,P5:4) = [sp++];
  111. ASTAT = [sp++];
  112. SAVE_ALL_SYS
  113. #ifdef CONFIG_MPU
  114. /* We must load R1 here, _before_ DEBUG_HWTRACE_SAVE, since that
  115. * will change the stack pointer. */
  116. R0 = SEQSTAT;
  117. R1 = SP;
  118. #endif
  119. DEBUG_HWTRACE_SAVE(p5, r7)
  120. #ifdef CONFIG_MPU
  121. sp += -12;
  122. call _cplb_hdr;
  123. sp += 12;
  124. CC = R0 == 0;
  125. IF !CC JUMP _handle_bad_cplb;
  126. #else
  127. call __cplb_hdr;
  128. #endif
  129. DEBUG_HWTRACE_RESTORE(p5, r7)
  130. RESTORE_ALL_SYS
  131. SP = EX_SCRATCH_REG;
  132. rtx;
  133. ENDPROC(_ex_icplb_miss)
  134. ENTRY(_ex_syscall)
  135. (R7:6,P5:4) = [sp++];
  136. ASTAT = [sp++];
  137. raise 15; /* invoked by TRAP #0, for sys call */
  138. sp = EX_SCRATCH_REG;
  139. rtx
  140. ENDPROC(_ex_syscall)
  141. ENTRY(_ex_soft_bp)
  142. r7 = retx;
  143. r7 += -2;
  144. retx = r7;
  145. jump.s _ex_trap_c;
  146. ENDPROC(_ex_soft_bp)
  147. ENTRY(_ex_single_step)
  148. r7 = retx;
  149. r6 = reti;
  150. cc = r7 == r6;
  151. if cc jump _bfin_return_from_exception
  152. r7 = syscfg;
  153. bitclr (r7, 0);
  154. syscfg = R7;
  155. p5.l = lo(IPEND);
  156. p5.h = hi(IPEND);
  157. r6 = [p5];
  158. cc = bittst(r6, 5);
  159. if !cc jump _ex_trap_c;
  160. p4.l = lo(EVT5);
  161. p4.h = hi(EVT5);
  162. r6.h = _exception_to_level5;
  163. r6.l = _exception_to_level5;
  164. r7 = [p4];
  165. cc = r6 == r7;
  166. if !cc jump _ex_trap_c;
  167. ENDPROC(_ex_single_step)
  168. ENTRY(_bfin_return_from_exception)
  169. #if ANOMALY_05000257
  170. R7=LC0;
  171. LC0=R7;
  172. R7=LC1;
  173. LC1=R7;
  174. #endif
  175. (R7:6,P5:4) = [sp++];
  176. ASTAT = [sp++];
  177. sp = EX_SCRATCH_REG;
  178. rtx;
  179. ENDPROC(_bfin_return_from_exception)
  180. ENTRY(_handle_bad_cplb)
  181. DEBUG_HWTRACE_RESTORE(p5, r7)
  182. /* To get here, we just tried and failed to change a CPLB
  183. * so, handle things in trap_c (C code), by lowering to
  184. * IRQ5, just like we normally do. Since this is not a
  185. * "normal" return path, we have a do alot of stuff to
  186. * the stack to get ready so, we can fall through - we
  187. * need to make a CPLB exception look like a normal exception
  188. */
  189. RESTORE_ALL_SYS
  190. [--sp] = ASTAT;
  191. [--sp] = (R7:6,P5:4);
  192. ENTRY(_ex_replaceable)
  193. nop;
  194. ENTRY(_ex_trap_c)
  195. /* Make sure we are not in a double fault */
  196. p4.l = lo(IPEND);
  197. p4.h = hi(IPEND);
  198. r7 = [p4];
  199. CC = BITTST (r7, 5);
  200. if CC jump _double_fault;
  201. /* Call C code (trap_c) to handle the exception, which most
  202. * likely involves sending a signal to the current process.
  203. * To avoid double faults, lower our priority to IRQ5 first.
  204. */
  205. P5.h = _exception_to_level5;
  206. P5.l = _exception_to_level5;
  207. p4.l = lo(EVT5);
  208. p4.h = hi(EVT5);
  209. [p4] = p5;
  210. csync;
  211. /* Disable all interrupts, but make sure level 5 is enabled so
  212. * we can switch to that level. Save the old mask. */
  213. cli r6;
  214. p4.l = _excpt_saved_imask;
  215. p4.h = _excpt_saved_imask;
  216. [p4] = r6;
  217. r6 = 0x3f;
  218. sti r6;
  219. /* Save the excause into a circular buffer, in case the instruction
  220. * which caused this excecptions causes others.
  221. */
  222. P5.l = _in_ptr_excause;
  223. P5.h = _in_ptr_excause;
  224. R7 = [P5];
  225. R7 += 4;
  226. R6 = 0xF;
  227. R7 = R7 & R6;
  228. [P5] = R7;
  229. R6.l = _excause_circ_buf;
  230. R6.h = _excause_circ_buf;
  231. R7 = R7 + R6;
  232. p5 = R7;
  233. R6 = SEQSTAT;
  234. [P5] = R6;
  235. (R7:6,P5:4) = [sp++];
  236. ASTAT = [sp++];
  237. SP = EX_SCRATCH_REG;
  238. raise 5;
  239. rtx;
  240. ENDPROC(_ex_trap_c)
  241. /* We just realized we got an exception, while we were processing a different
  242. * exception. This is a unrecoverable event, so crash
  243. */
  244. ENTRY(_double_fault)
  245. /* Turn caches & protection off, to ensure we don't get any more
  246. * double exceptions
  247. */
  248. P4.L = LO(IMEM_CONTROL);
  249. P4.H = HI(IMEM_CONTROL);
  250. R5 = [P4]; /* Control Register*/
  251. BITCLR(R5,ENICPLB_P);
  252. SSYNC; /* SSYNC required before writing to IMEM_CONTROL. */
  253. .align 8;
  254. [P4] = R5;
  255. SSYNC;
  256. P4.L = LO(DMEM_CONTROL);
  257. P4.H = HI(DMEM_CONTROL);
  258. R5 = [P4];
  259. BITCLR(R5,ENDCPLB_P);
  260. SSYNC; /* SSYNC required before writing to DMEM_CONTROL. */
  261. .align 8;
  262. [P4] = R5;
  263. SSYNC;
  264. /* Fix up the stack */
  265. (R7:6,P5:4) = [sp++];
  266. ASTAT = [sp++];
  267. SP = EX_SCRATCH_REG;
  268. /* We should be out of the exception stack, and back down into
  269. * kernel or user space stack
  270. */
  271. SAVE_ALL_SYS
  272. r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */
  273. SP += -12;
  274. call _double_fault_c;
  275. SP += 12;
  276. .L_double_fault_panic:
  277. JUMP .L_double_fault_panic
  278. ENDPROC(_double_fault)
  279. ENTRY(_exception_to_level5)
  280. SAVE_ALL_SYS
  281. /* Restore interrupt mask. We haven't pushed RETI, so this
  282. * doesn't enable interrupts until we return from this handler. */
  283. p4.l = _excpt_saved_imask;
  284. p4.h = _excpt_saved_imask;
  285. r6 = [p4];
  286. sti r6;
  287. /* Restore the hardware error vector. */
  288. P5.h = _evt_ivhw;
  289. P5.l = _evt_ivhw;
  290. p4.l = lo(EVT5);
  291. p4.h = hi(EVT5);
  292. [p4] = p5;
  293. csync;
  294. p2.l = lo(IPEND);
  295. p2.h = hi(IPEND);
  296. csync;
  297. r0 = [p2]; /* Read current IPEND */
  298. [sp + PT_IPEND] = r0; /* Store IPEND */
  299. /* Pop the excause from the circular buffer and push it on the stack
  300. * (in the right place - if you change the location of SEQSTAT, you
  301. * must change this offset.
  302. */
  303. .L_excep_to_5_again:
  304. P5.l = _out_ptr_excause;
  305. P5.h = _out_ptr_excause;
  306. R7 = [P5];
  307. R7 += 4;
  308. R6 = 0xF;
  309. R7 = R7 & R6;
  310. [P5] = R7;
  311. R6.l = _excause_circ_buf;
  312. R6.h = _excause_circ_buf;
  313. R7 = R7 + R6;
  314. P5 = R7;
  315. R1 = [P5];
  316. [SP + PT_SEQSTAT] = r1;
  317. r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */
  318. SP += -12;
  319. call _trap_c;
  320. SP += 12;
  321. /* See if anything else is in the exception buffer
  322. * if there is, process it
  323. */
  324. P5.l = _out_ptr_excause;
  325. P5.h = _out_ptr_excause;
  326. P4.l = _in_ptr_excause;
  327. P4.h = _in_ptr_excause;
  328. R6 = [P5];
  329. R7 = [P4];
  330. CC = R6 == R7;
  331. if ! CC JUMP .L_excep_to_5_again
  332. call _ret_from_exception;
  333. RESTORE_ALL_SYS
  334. rti;
  335. ENDPROC(_exception_to_level5)
  336. ENTRY(_trap) /* Exception: 4th entry into system event table(supervisor mode)*/
  337. /* Since the kernel stack can be anywhere, it's not guaranteed to be
  338. * covered by a CPLB. Switch to an exception stack; use RETN as a
  339. * scratch register (for want of a better option).
  340. */
  341. EX_SCRATCH_REG = sp;
  342. sp.l = _exception_stack_top;
  343. sp.h = _exception_stack_top;
  344. /* Try to deal with syscalls quickly. */
  345. [--sp] = ASTAT;
  346. [--sp] = (R7:6,P5:4);
  347. r7 = SEQSTAT; /* reason code is in bit 5:0 */
  348. r6.l = lo(SEQSTAT_EXCAUSE);
  349. r6.h = hi(SEQSTAT_EXCAUSE);
  350. r7 = r7 & r6;
  351. p5.h = _ex_table;
  352. p5.l = _ex_table;
  353. p4 = r7;
  354. p5 = p5 + (p4 << 2);
  355. p4 = [p5];
  356. jump (p4);
  357. .Lbadsys:
  358. r7 = -ENOSYS; /* signextending enough */
  359. [sp + PT_R0] = r7; /* return value from system call */
  360. jump .Lsyscall_really_exit;
  361. ENDPROC(_trap)
  362. ENTRY(_kernel_execve)
  363. link SIZEOF_PTREGS;
  364. p0 = sp;
  365. r3 = SIZEOF_PTREGS / 4;
  366. r4 = 0(x);
  367. 0:
  368. [p0++] = r4;
  369. r3 += -1;
  370. cc = r3 == 0;
  371. if !cc jump 0b (bp);
  372. p0 = sp;
  373. sp += -16;
  374. [sp + 12] = p0;
  375. call _do_execve;
  376. SP += 16;
  377. cc = r0 == 0;
  378. if ! cc jump 1f;
  379. /* Success. Copy our temporary pt_regs to the top of the kernel
  380. * stack and do a normal exception return.
  381. */
  382. r1 = sp;
  383. r0 = (-KERNEL_STACK_SIZE) (x);
  384. r1 = r1 & r0;
  385. p2 = r1;
  386. p3 = [p2];
  387. r0 = KERNEL_STACK_SIZE - 4 (z);
  388. p1 = r0;
  389. p1 = p1 + p2;
  390. p0 = fp;
  391. r4 = [p0--];
  392. r3 = SIZEOF_PTREGS / 4;
  393. 0:
  394. r4 = [p0--];
  395. [p1--] = r4;
  396. r3 += -1;
  397. cc = r3 == 0;
  398. if ! cc jump 0b (bp);
  399. r0 = (KERNEL_STACK_SIZE - SIZEOF_PTREGS) (z);
  400. p1 = r0;
  401. p1 = p1 + p2;
  402. sp = p1;
  403. r0 = syscfg;
  404. [SP + PT_SYSCFG] = r0;
  405. [p3 + (TASK_THREAD + THREAD_KSP)] = sp;
  406. RESTORE_CONTEXT;
  407. rti;
  408. 1:
  409. unlink;
  410. rts;
  411. ENDPROC(_kernel_execve)
  412. ENTRY(_system_call)
  413. /* Store IPEND */
  414. p2.l = lo(IPEND);
  415. p2.h = hi(IPEND);
  416. csync;
  417. r0 = [p2];
  418. [sp + PT_IPEND] = r0;
  419. /* Store RETS for now */
  420. r0 = rets;
  421. [sp + PT_RESERVED] = r0;
  422. /* Set the stack for the current process */
  423. r7 = sp;
  424. r6.l = lo(ALIGN_PAGE_MASK);
  425. r6.h = hi(ALIGN_PAGE_MASK);
  426. r7 = r7 & r6; /* thread_info */
  427. p2 = r7;
  428. p2 = [p2];
  429. [p2+(TASK_THREAD+THREAD_KSP)] = sp;
  430. /* Check the System Call */
  431. r7 = __NR_syscall;
  432. /* System call number is passed in P0 */
  433. r6 = p0;
  434. cc = r6 < r7;
  435. if ! cc jump .Lbadsys;
  436. /* are we tracing syscalls?*/
  437. r7 = sp;
  438. r6.l = lo(ALIGN_PAGE_MASK);
  439. r6.h = hi(ALIGN_PAGE_MASK);
  440. r7 = r7 & r6;
  441. p2 = r7;
  442. r7 = [p2+TI_FLAGS];
  443. CC = BITTST(r7,TIF_SYSCALL_TRACE);
  444. if CC JUMP _sys_trace;
  445. /* Execute the appropriate system call */
  446. p4 = p0;
  447. p5.l = _sys_call_table;
  448. p5.h = _sys_call_table;
  449. p5 = p5 + (p4 << 2);
  450. r0 = [sp + PT_R0];
  451. r1 = [sp + PT_R1];
  452. r2 = [sp + PT_R2];
  453. p5 = [p5];
  454. [--sp] = r5;
  455. [--sp] = r4;
  456. [--sp] = r3;
  457. SP += -12;
  458. call (p5);
  459. SP += 24;
  460. [sp + PT_R0] = r0;
  461. .Lresume_userspace:
  462. r7 = sp;
  463. r4.l = lo(ALIGN_PAGE_MASK);
  464. r4.h = hi(ALIGN_PAGE_MASK);
  465. r7 = r7 & r4; /* thread_info->flags */
  466. p5 = r7;
  467. .Lresume_userspace_1:
  468. /* Disable interrupts. */
  469. [--sp] = reti;
  470. reti = [sp++];
  471. r7 = [p5 + TI_FLAGS];
  472. r4.l = lo(_TIF_WORK_MASK);
  473. r4.h = hi(_TIF_WORK_MASK);
  474. r7 = r7 & r4;
  475. .Lsyscall_resched:
  476. cc = BITTST(r7, TIF_NEED_RESCHED);
  477. if !cc jump .Lsyscall_sigpending;
  478. /* Reenable interrupts. */
  479. [--sp] = reti;
  480. r0 = [sp++];
  481. SP += -12;
  482. call _schedule;
  483. SP += 12;
  484. jump .Lresume_userspace_1;
  485. .Lsyscall_sigpending:
  486. cc = BITTST(r7, TIF_RESTORE_SIGMASK);
  487. if cc jump .Lsyscall_do_signals;
  488. cc = BITTST(r7, TIF_SIGPENDING);
  489. if !cc jump .Lsyscall_really_exit;
  490. .Lsyscall_do_signals:
  491. /* Reenable interrupts. */
  492. [--sp] = reti;
  493. r0 = [sp++];
  494. r0 = sp;
  495. SP += -12;
  496. call _do_signal;
  497. SP += 12;
  498. .Lsyscall_really_exit:
  499. r5 = [sp + PT_RESERVED];
  500. rets = r5;
  501. rts;
  502. ENDPROC(_system_call)
  503. _sys_trace:
  504. call _syscall_trace;
  505. /* Execute the appropriate system call */
  506. p4 = [SP + PT_P0];
  507. p5.l = _sys_call_table;
  508. p5.h = _sys_call_table;
  509. p5 = p5 + (p4 << 2);
  510. r0 = [sp + PT_R0];
  511. r1 = [sp + PT_R1];
  512. r2 = [sp + PT_R2];
  513. r3 = [sp + PT_R3];
  514. r4 = [sp + PT_R4];
  515. r5 = [sp + PT_R5];
  516. p5 = [p5];
  517. [--sp] = r5;
  518. [--sp] = r4;
  519. [--sp] = r3;
  520. SP += -12;
  521. call (p5);
  522. SP += 24;
  523. [sp + PT_R0] = r0;
  524. call _syscall_trace;
  525. jump .Lresume_userspace;
  526. ENDPROC(_sys_trace)
  527. ENTRY(_resume)
  528. /*
  529. * Beware - when entering resume, prev (the current task) is
  530. * in r0, next (the new task) is in r1.
  531. */
  532. p0 = r0;
  533. p1 = r1;
  534. [--sp] = rets;
  535. [--sp] = fp;
  536. [--sp] = (r7:4, p5:3);
  537. /* save usp */
  538. p2 = usp;
  539. [p0+(TASK_THREAD+THREAD_USP)] = p2;
  540. /* save current kernel stack pointer */
  541. [p0+(TASK_THREAD+THREAD_KSP)] = sp;
  542. /* save program counter */
  543. r1.l = _new_old_task;
  544. r1.h = _new_old_task;
  545. [p0+(TASK_THREAD+THREAD_PC)] = r1;
  546. /* restore the kernel stack pointer */
  547. sp = [p1+(TASK_THREAD+THREAD_KSP)];
  548. /* restore user stack pointer */
  549. p0 = [p1+(TASK_THREAD+THREAD_USP)];
  550. usp = p0;
  551. /* restore pc */
  552. p0 = [p1+(TASK_THREAD+THREAD_PC)];
  553. jump (p0);
  554. /*
  555. * Following code actually lands up in a new (old) task.
  556. */
  557. _new_old_task:
  558. (r7:4, p5:3) = [sp++];
  559. fp = [sp++];
  560. rets = [sp++];
  561. /*
  562. * When we come out of resume, r0 carries "old" task, becuase we are
  563. * in "new" task.
  564. */
  565. rts;
  566. ENDPROC(_resume)
  567. ENTRY(_ret_from_exception)
  568. p2.l = lo(IPEND);
  569. p2.h = hi(IPEND);
  570. csync;
  571. r0 = [p2];
  572. [sp + PT_IPEND] = r0;
  573. 1:
  574. r2 = LO(~0x37) (Z);
  575. r0 = r2 & r0;
  576. cc = r0 == 0;
  577. if !cc jump 4f; /* if not return to user mode, get out */
  578. /* Make sure any pending system call or deferred exception
  579. * return in ILAT for this process to get executed, otherwise
  580. * in case context switch happens, system call of
  581. * first process (i.e in ILAT) will be carried
  582. * forward to the switched process
  583. */
  584. p2.l = lo(ILAT);
  585. p2.h = hi(ILAT);
  586. r0 = [p2];
  587. r1 = (EVT_IVG14 | EVT_IVG15) (z);
  588. r0 = r0 & r1;
  589. cc = r0 == 0;
  590. if !cc jump 5f;
  591. /* Set the stack for the current process */
  592. r7 = sp;
  593. r4.l = lo(ALIGN_PAGE_MASK);
  594. r4.h = hi(ALIGN_PAGE_MASK);
  595. r7 = r7 & r4; /* thread_info->flags */
  596. p5 = r7;
  597. r7 = [p5 + TI_FLAGS];
  598. r4.l = lo(_TIF_WORK_MASK);
  599. r4.h = hi(_TIF_WORK_MASK);
  600. r7 = r7 & r4;
  601. cc = r7 == 0;
  602. if cc jump 4f;
  603. p0.l = lo(EVT15);
  604. p0.h = hi(EVT15);
  605. p1.l = _schedule_and_signal;
  606. p1.h = _schedule_and_signal;
  607. [p0] = p1;
  608. csync;
  609. raise 15; /* raise evt14 to do signal or reschedule */
  610. 4:
  611. r0 = syscfg;
  612. bitclr(r0, 0);
  613. syscfg = r0;
  614. 5:
  615. rts;
  616. ENDPROC(_ret_from_exception)
  617. ENTRY(_return_from_int)
  618. /* If someone else already raised IRQ 15, do nothing. */
  619. csync;
  620. p2.l = lo(ILAT);
  621. p2.h = hi(ILAT);
  622. r0 = [p2];
  623. cc = bittst (r0, EVT_IVG15_P);
  624. if cc jump 2f;
  625. /* if not return to user mode, get out */
  626. p2.l = lo(IPEND);
  627. p2.h = hi(IPEND);
  628. r0 = [p2];
  629. r1 = 0x17(Z);
  630. r2 = ~r1;
  631. r2.h = 0;
  632. r0 = r2 & r0;
  633. r1 = 1;
  634. r1 = r0 - r1;
  635. r2 = r0 & r1;
  636. cc = r2 == 0;
  637. if !cc jump 2f;
  638. /* Lower the interrupt level to 15. */
  639. p0.l = lo(EVT15);
  640. p0.h = hi(EVT15);
  641. p1.l = _schedule_and_signal_from_int;
  642. p1.h = _schedule_and_signal_from_int;
  643. [p0] = p1;
  644. csync;
  645. #if ANOMALY_05000281
  646. r0.l = _safe_speculative_execution;
  647. r0.h = _safe_speculative_execution;
  648. reti = r0;
  649. #endif
  650. r0 = 0x801f (z);
  651. STI r0;
  652. raise 15; /* raise evt15 to do signal or reschedule */
  653. rti;
  654. 2:
  655. rts;
  656. ENDPROC(_return_from_int)
  657. ENTRY(_lower_to_irq14)
  658. #if ANOMALY_05000281
  659. r0.l = _safe_speculative_execution;
  660. r0.h = _safe_speculative_execution;
  661. reti = r0;
  662. #endif
  663. r0 = 0x401f;
  664. sti r0;
  665. raise 14;
  666. rti;
  667. ENTRY(_evt14_softirq)
  668. #ifdef CONFIG_DEBUG_HWERR
  669. r0 = 0x3f;
  670. sti r0;
  671. #else
  672. cli r0;
  673. #endif
  674. [--sp] = RETI;
  675. SP += 4;
  676. rts;
  677. _schedule_and_signal_from_int:
  678. /* To end up here, vector 15 was changed - so we have to change it
  679. * back.
  680. */
  681. p0.l = lo(EVT15);
  682. p0.h = hi(EVT15);
  683. p1.l = _evt_system_call;
  684. p1.h = _evt_system_call;
  685. [p0] = p1;
  686. csync;
  687. /* Set orig_p0 to -1 to indicate this isn't the end of a syscall. */
  688. r0 = -1 (x);
  689. [sp + PT_ORIG_P0] = r0;
  690. p1 = rets;
  691. [sp + PT_RESERVED] = p1;
  692. p0.l = _irq_flags;
  693. p0.h = _irq_flags;
  694. r0 = [p0];
  695. sti r0;
  696. r0 = sp;
  697. sp += -12;
  698. call _finish_atomic_sections;
  699. sp += 12;
  700. jump.s .Lresume_userspace;
  701. _schedule_and_signal:
  702. SAVE_CONTEXT_SYSCALL
  703. /* To end up here, vector 15 was changed - so we have to change it
  704. * back.
  705. */
  706. p0.l = lo(EVT15);
  707. p0.h = hi(EVT15);
  708. p1.l = _evt_system_call;
  709. p1.h = _evt_system_call;
  710. [p0] = p1;
  711. csync;
  712. p0.l = 1f;
  713. p0.h = 1f;
  714. [sp + PT_RESERVED] = P0;
  715. call .Lresume_userspace;
  716. 1:
  717. RESTORE_CONTEXT
  718. rti;
  719. ENDPROC(_lower_to_irq14)
  720. /* Make sure when we start, that the circular buffer is initialized properly
  721. * R0 and P0 are call clobbered, so we can use them here.
  722. */
  723. ENTRY(_init_exception_buff)
  724. r0 = 0;
  725. p0.h = _in_ptr_excause;
  726. p0.l = _in_ptr_excause;
  727. [p0] = r0;
  728. p0.h = _out_ptr_excause;
  729. p0.l = _out_ptr_excause;
  730. [p0] = r0;
  731. rts;
  732. ENDPROC(_init_exception_buff)
  733. /* We handle this 100% in exception space - to reduce overhead
  734. * Only potiential problem is if the software buffer gets swapped out of the
  735. * CPLB table - then double fault. - so we don't let this happen in other places
  736. */
  737. #ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
  738. ENTRY(_ex_trace_buff_full)
  739. [--sp] = P3;
  740. [--sp] = P2;
  741. [--sp] = LC0;
  742. [--sp] = LT0;
  743. [--sp] = LB0;
  744. P5.L = _trace_buff_offset;
  745. P5.H = _trace_buff_offset;
  746. P3 = [P5]; /* trace_buff_offset */
  747. P5.L = lo(TBUFSTAT);
  748. P5.H = hi(TBUFSTAT);
  749. R7 = [P5];
  750. R7 <<= 1; /* double, since we need to read twice */
  751. LC0 = R7;
  752. R7 <<= 2; /* need to shift over again,
  753. * to get the number of bytes */
  754. P5.L = lo(TBUF);
  755. P5.H = hi(TBUF);
  756. R6 = ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN)*1024) - 1;
  757. P2 = R7;
  758. P3 = P3 + P2;
  759. R7 = P3;
  760. R7 = R7 & R6;
  761. P3 = R7;
  762. P2.L = _trace_buff_offset;
  763. P2.H = _trace_buff_offset;
  764. [P2] = P3;
  765. P2.L = _software_trace_buff;
  766. P2.H = _software_trace_buff;
  767. LSETUP (.Lstart, .Lend) LC0;
  768. .Lstart:
  769. R7 = [P5]; /* read TBUF */
  770. P4 = P3 + P2;
  771. [P4] = R7;
  772. P3 += -4;
  773. R7 = P3;
  774. R7 = R7 & R6;
  775. .Lend:
  776. P3 = R7;
  777. LB0 = [sp++];
  778. LT0 = [sp++];
  779. LC0 = [sp++];
  780. P2 = [sp++];
  781. P3 = [sp++];
  782. jump _bfin_return_from_exception;
  783. ENDPROC(_ex_trace_buff_full)
  784. #if CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN == 4
  785. .data
  786. #else
  787. .section .l1.data.B
  788. #endif /* CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN */
  789. ENTRY(_trace_buff_offset)
  790. .long 0;
  791. ALIGN
  792. ENTRY(_software_trace_buff)
  793. .rept ((1 << CONFIG_DEBUG_BFIN_HWTRACE_EXPAND_LEN)*256);
  794. .long 0
  795. .endr
  796. #endif /* CONFIG_DEBUG_BFIN_HWTRACE_EXPAND */
  797. #if CONFIG_EARLY_PRINTK
  798. __INIT
  799. ENTRY(_early_trap)
  800. SAVE_ALL_SYS
  801. trace_buffer_stop(p0,r0);
  802. /* Turn caches off, to ensure we don't get double exceptions */
  803. P4.L = LO(IMEM_CONTROL);
  804. P4.H = HI(IMEM_CONTROL);
  805. R5 = [P4]; /* Control Register*/
  806. BITCLR(R5,ENICPLB_P);
  807. CLI R1;
  808. SSYNC; /* SSYNC required before writing to IMEM_CONTROL. */
  809. .align 8;
  810. [P4] = R5;
  811. SSYNC;
  812. P4.L = LO(DMEM_CONTROL);
  813. P4.H = HI(DMEM_CONTROL);
  814. R5 = [P4];
  815. BITCLR(R5,ENDCPLB_P);
  816. SSYNC; /* SSYNC required before writing to DMEM_CONTROL. */
  817. .align 8;
  818. [P4] = R5;
  819. SSYNC;
  820. STI R1;
  821. r0 = sp; /* stack frame pt_regs pointer argument ==> r0 */
  822. r1 = RETX;
  823. SP += -12;
  824. call _early_trap_c;
  825. SP += 12;
  826. ENDPROC(_early_trap)
  827. __FINIT
  828. #endif /* CONFIG_EARLY_PRINTK */
  829. /*
  830. * Put these in the kernel data section - that should always be covered by
  831. * a CPLB. This is needed to ensure we don't get double fault conditions
  832. */
  833. #ifdef CONFIG_SYSCALL_TAB_L1
  834. .section .l1.data
  835. #else
  836. .data
  837. #endif
  838. ENTRY(_ex_table)
  839. /* entry for each EXCAUSE[5:0]
  840. * This table must be in sync with the table in ./kernel/traps.c
  841. * EXCPT instruction can provide 4 bits of EXCAUSE, allowing 16 to be user defined
  842. */
  843. .long _ex_syscall /* 0x00 - User Defined - Linux Syscall */
  844. .long _ex_soft_bp /* 0x01 - User Defined - Software breakpoint */
  845. .long _ex_replaceable /* 0x02 - User Defined */
  846. .long _ex_trap_c /* 0x03 - User Defined - userspace stack overflow */
  847. .long _ex_trap_c /* 0x04 - User Defined - dump trace buffer */
  848. .long _ex_replaceable /* 0x05 - User Defined */
  849. .long _ex_replaceable /* 0x06 - User Defined */
  850. .long _ex_replaceable /* 0x07 - User Defined */
  851. .long _ex_replaceable /* 0x08 - User Defined */
  852. .long _ex_replaceable /* 0x09 - User Defined */
  853. .long _ex_replaceable /* 0x0A - User Defined */
  854. .long _ex_replaceable /* 0x0B - User Defined */
  855. .long _ex_replaceable /* 0x0C - User Defined */
  856. .long _ex_replaceable /* 0x0D - User Defined */
  857. .long _ex_replaceable /* 0x0E - User Defined */
  858. .long _ex_replaceable /* 0x0F - User Defined */
  859. .long _ex_single_step /* 0x10 - HW Single step */
  860. #ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
  861. .long _ex_trace_buff_full /* 0x11 - Trace Buffer Full */
  862. #else
  863. .long _ex_trap_c /* 0x11 - Trace Buffer Full */
  864. #endif
  865. .long _ex_trap_c /* 0x12 - Reserved */
  866. .long _ex_trap_c /* 0x13 - Reserved */
  867. .long _ex_trap_c /* 0x14 - Reserved */
  868. .long _ex_trap_c /* 0x15 - Reserved */
  869. .long _ex_trap_c /* 0x16 - Reserved */
  870. .long _ex_trap_c /* 0x17 - Reserved */
  871. .long _ex_trap_c /* 0x18 - Reserved */
  872. .long _ex_trap_c /* 0x19 - Reserved */
  873. .long _ex_trap_c /* 0x1A - Reserved */
  874. .long _ex_trap_c /* 0x1B - Reserved */
  875. .long _ex_trap_c /* 0x1C - Reserved */
  876. .long _ex_trap_c /* 0x1D - Reserved */
  877. .long _ex_trap_c /* 0x1E - Reserved */
  878. .long _ex_trap_c /* 0x1F - Reserved */
  879. .long _ex_trap_c /* 0x20 - Reserved */
  880. .long _ex_trap_c /* 0x21 - Undefined Instruction */
  881. .long _ex_trap_c /* 0x22 - Illegal Instruction Combination */
  882. .long _ex_dviol /* 0x23 - Data CPLB Protection Violation */
  883. .long _ex_trap_c /* 0x24 - Data access misaligned */
  884. .long _ex_trap_c /* 0x25 - Unrecoverable Event */
  885. .long _ex_dmiss /* 0x26 - Data CPLB Miss */
  886. .long _ex_dmult /* 0x27 - Data CPLB Multiple Hits - Linux Trap Zero */
  887. .long _ex_trap_c /* 0x28 - Emulation Watchpoint */
  888. .long _ex_trap_c /* 0x29 - Instruction fetch access error (535 only) */
  889. .long _ex_trap_c /* 0x2A - Instruction fetch misaligned */
  890. .long _ex_trap_c /* 0x2B - Instruction CPLB protection Violation */
  891. .long _ex_icplb_miss /* 0x2C - Instruction CPLB miss */
  892. .long _ex_trap_c /* 0x2D - Instruction CPLB Multiple Hits */
  893. .long _ex_trap_c /* 0x2E - Illegal use of Supervisor Resource */
  894. .long _ex_trap_c /* 0x2E - Illegal use of Supervisor Resource */
  895. .long _ex_trap_c /* 0x2F - Reserved */
  896. .long _ex_trap_c /* 0x30 - Reserved */
  897. .long _ex_trap_c /* 0x31 - Reserved */
  898. .long _ex_trap_c /* 0x32 - Reserved */
  899. .long _ex_trap_c /* 0x33 - Reserved */
  900. .long _ex_trap_c /* 0x34 - Reserved */
  901. .long _ex_trap_c /* 0x35 - Reserved */
  902. .long _ex_trap_c /* 0x36 - Reserved */
  903. .long _ex_trap_c /* 0x37 - Reserved */
  904. .long _ex_trap_c /* 0x38 - Reserved */
  905. .long _ex_trap_c /* 0x39 - Reserved */
  906. .long _ex_trap_c /* 0x3A - Reserved */
  907. .long _ex_trap_c /* 0x3B - Reserved */
  908. .long _ex_trap_c /* 0x3C - Reserved */
  909. .long _ex_trap_c /* 0x3D - Reserved */
  910. .long _ex_trap_c /* 0x3E - Reserved */
  911. .long _ex_trap_c /* 0x3F - Reserved */
  912. END(_ex_table)
  913. ENTRY(_sys_call_table)
  914. .long _sys_restart_syscall /* 0 */
  915. .long _sys_exit
  916. .long _sys_fork
  917. .long _sys_read
  918. .long _sys_write
  919. .long _sys_open /* 5 */
  920. .long _sys_close
  921. .long _sys_ni_syscall /* old waitpid */
  922. .long _sys_creat
  923. .long _sys_link
  924. .long _sys_unlink /* 10 */
  925. .long _sys_execve
  926. .long _sys_chdir
  927. .long _sys_time
  928. .long _sys_mknod
  929. .long _sys_chmod /* 15 */
  930. .long _sys_chown /* chown16 */
  931. .long _sys_ni_syscall /* old break syscall holder */
  932. .long _sys_ni_syscall /* old stat */
  933. .long _sys_lseek
  934. .long _sys_getpid /* 20 */
  935. .long _sys_mount
  936. .long _sys_ni_syscall /* old umount */
  937. .long _sys_setuid
  938. .long _sys_getuid
  939. .long _sys_stime /* 25 */
  940. .long _sys_ptrace
  941. .long _sys_alarm
  942. .long _sys_ni_syscall /* old fstat */
  943. .long _sys_pause
  944. .long _sys_ni_syscall /* old utime */ /* 30 */
  945. .long _sys_ni_syscall /* old stty syscall holder */
  946. .long _sys_ni_syscall /* old gtty syscall holder */
  947. .long _sys_access
  948. .long _sys_nice
  949. .long _sys_ni_syscall /* 35 */ /* old ftime syscall holder */
  950. .long _sys_sync
  951. .long _sys_kill
  952. .long _sys_rename
  953. .long _sys_mkdir
  954. .long _sys_rmdir /* 40 */
  955. .long _sys_dup
  956. .long _sys_pipe
  957. .long _sys_times
  958. .long _sys_ni_syscall /* old prof syscall holder */
  959. .long _sys_brk /* 45 */
  960. .long _sys_setgid
  961. .long _sys_getgid
  962. .long _sys_ni_syscall /* old sys_signal */
  963. .long _sys_geteuid /* geteuid16 */
  964. .long _sys_getegid /* getegid16 */ /* 50 */
  965. .long _sys_acct
  966. .long _sys_umount /* recycled never used phys() */
  967. .long _sys_ni_syscall /* old lock syscall holder */
  968. .long _sys_ioctl
  969. .long _sys_fcntl /* 55 */
  970. .long _sys_ni_syscall /* old mpx syscall holder */
  971. .long _sys_setpgid
  972. .long _sys_ni_syscall /* old ulimit syscall holder */
  973. .long _sys_ni_syscall /* old old uname */
  974. .long _sys_umask /* 60 */
  975. .long _sys_chroot
  976. .long _sys_ustat
  977. .long _sys_dup2
  978. .long _sys_getppid
  979. .long _sys_getpgrp /* 65 */
  980. .long _sys_setsid
  981. .long _sys_ni_syscall /* old sys_sigaction */
  982. .long _sys_sgetmask
  983. .long _sys_ssetmask
  984. .long _sys_setreuid /* setreuid16 */ /* 70 */
  985. .long _sys_setregid /* setregid16 */
  986. .long _sys_ni_syscall /* old sys_sigsuspend */
  987. .long _sys_ni_syscall /* old sys_sigpending */
  988. .long _sys_sethostname
  989. .long _sys_setrlimit /* 75 */
  990. .long _sys_ni_syscall /* old getrlimit */
  991. .long _sys_getrusage
  992. .long _sys_gettimeofday
  993. .long _sys_settimeofday
  994. .long _sys_getgroups /* getgroups16 */ /* 80 */
  995. .long _sys_setgroups /* setgroups16 */
  996. .long _sys_ni_syscall /* old_select */
  997. .long _sys_symlink
  998. .long _sys_ni_syscall /* old lstat */
  999. .long _sys_readlink /* 85 */
  1000. .long _sys_uselib
  1001. .long _sys_ni_syscall /* sys_swapon */
  1002. .long _sys_reboot
  1003. .long _sys_ni_syscall /* old_readdir */
  1004. .long _sys_ni_syscall /* sys_mmap */ /* 90 */
  1005. .long _sys_munmap
  1006. .long _sys_truncate
  1007. .long _sys_ftruncate
  1008. .long _sys_fchmod
  1009. .long _sys_fchown /* fchown16 */ /* 95 */
  1010. .long _sys_getpriority
  1011. .long _sys_setpriority
  1012. .long _sys_ni_syscall /* old profil syscall holder */
  1013. .long _sys_statfs
  1014. .long _sys_fstatfs /* 100 */
  1015. .long _sys_ni_syscall
  1016. .long _sys_ni_syscall /* old sys_socketcall */
  1017. .long _sys_syslog
  1018. .long _sys_setitimer
  1019. .long _sys_getitimer /* 105 */
  1020. .long _sys_newstat
  1021. .long _sys_newlstat
  1022. .long _sys_newfstat
  1023. .long _sys_ni_syscall /* old uname */
  1024. .long _sys_ni_syscall /* iopl for i386 */ /* 110 */
  1025. .long _sys_vhangup
  1026. .long _sys_ni_syscall /* obsolete idle() syscall */
  1027. .long _sys_ni_syscall /* vm86old for i386 */
  1028. .long _sys_wait4
  1029. .long _sys_ni_syscall /* 115 */ /* sys_swapoff */
  1030. .long _sys_sysinfo
  1031. .long _sys_ni_syscall /* old sys_ipc */
  1032. .long _sys_fsync
  1033. .long _sys_ni_syscall /* old sys_sigreturn */
  1034. .long _sys_clone /* 120 */
  1035. .long _sys_setdomainname
  1036. .long _sys_newuname
  1037. .long _sys_ni_syscall /* old sys_modify_ldt */
  1038. .long _sys_adjtimex
  1039. .long _sys_ni_syscall /* 125 */ /* sys_mprotect */
  1040. .long _sys_ni_syscall /* old sys_sigprocmask */
  1041. .long _sys_ni_syscall /* old "creat_module" */
  1042. .long _sys_init_module
  1043. .long _sys_delete_module
  1044. .long _sys_ni_syscall /* 130: old "get_kernel_syms" */
  1045. .long _sys_quotactl
  1046. .long _sys_getpgid
  1047. .long _sys_fchdir
  1048. .long _sys_bdflush
  1049. .long _sys_ni_syscall /* 135 */ /* sys_sysfs */
  1050. .long _sys_personality
  1051. .long _sys_ni_syscall /* for afs_syscall */
  1052. .long _sys_setfsuid /* setfsuid16 */
  1053. .long _sys_setfsgid /* setfsgid16 */
  1054. .long _sys_llseek /* 140 */
  1055. .long _sys_getdents
  1056. .long _sys_ni_syscall /* sys_select */
  1057. .long _sys_flock
  1058. .long _sys_ni_syscall /* sys_msync */
  1059. .long _sys_readv /* 145 */
  1060. .long _sys_writev
  1061. .long _sys_getsid
  1062. .long _sys_fdatasync
  1063. .long _sys_sysctl
  1064. .long _sys_ni_syscall /* 150 */ /* sys_mlock */
  1065. .long _sys_ni_syscall /* sys_munlock */
  1066. .long _sys_ni_syscall /* sys_mlockall */
  1067. .long _sys_ni_syscall /* sys_munlockall */
  1068. .long _sys_sched_setparam
  1069. .long _sys_sched_getparam /* 155 */
  1070. .long _sys_sched_setscheduler
  1071. .long _sys_sched_getscheduler
  1072. .long _sys_sched_yield
  1073. .long _sys_sched_get_priority_max
  1074. .long _sys_sched_get_priority_min /* 160 */
  1075. .long _sys_sched_rr_get_interval
  1076. .long _sys_nanosleep
  1077. .long _sys_mremap
  1078. .long _sys_setresuid /* setresuid16 */
  1079. .long _sys_getresuid /* getresuid16 */ /* 165 */
  1080. .long _sys_ni_syscall /* for vm86 */
  1081. .long _sys_ni_syscall /* old "query_module" */
  1082. .long _sys_ni_syscall /* sys_poll */
  1083. .long _sys_nfsservctl
  1084. .long _sys_setresgid /* setresgid16 */ /* 170 */
  1085. .long _sys_getresgid /* getresgid16 */
  1086. .long _sys_prctl
  1087. .long _sys_rt_sigreturn
  1088. .long _sys_rt_sigaction
  1089. .long _sys_rt_sigprocmask /* 175 */
  1090. .long _sys_rt_sigpending
  1091. .long _sys_rt_sigtimedwait
  1092. .long _sys_rt_sigqueueinfo
  1093. .long _sys_rt_sigsuspend
  1094. .long _sys_pread64 /* 180 */
  1095. .long _sys_pwrite64
  1096. .long _sys_lchown /* lchown16 */
  1097. .long _sys_getcwd
  1098. .long _sys_capget
  1099. .long _sys_capset /* 185 */
  1100. .long _sys_sigaltstack
  1101. .long _sys_sendfile
  1102. .long _sys_ni_syscall /* streams1 */
  1103. .long _sys_ni_syscall /* streams2 */
  1104. .long _sys_vfork /* 190 */
  1105. .long _sys_getrlimit
  1106. .long _sys_mmap2
  1107. .long _sys_truncate64
  1108. .long _sys_ftruncate64
  1109. .long _sys_stat64 /* 195 */
  1110. .long _sys_lstat64
  1111. .long _sys_fstat64
  1112. .long _sys_chown
  1113. .long _sys_getuid
  1114. .long _sys_getgid /* 200 */
  1115. .long _sys_geteuid
  1116. .long _sys_getegid
  1117. .long _sys_setreuid
  1118. .long _sys_setregid
  1119. .long _sys_getgroups /* 205 */
  1120. .long _sys_setgroups
  1121. .long _sys_fchown
  1122. .long _sys_setresuid
  1123. .long _sys_getresuid
  1124. .long _sys_setresgid /* 210 */
  1125. .long _sys_getresgid
  1126. .long _sys_lchown
  1127. .long _sys_setuid
  1128. .long _sys_setgid
  1129. .long _sys_setfsuid /* 215 */
  1130. .long _sys_setfsgid
  1131. .long _sys_pivot_root
  1132. .long _sys_ni_syscall /* sys_mincore */
  1133. .long _sys_ni_syscall /* sys_madvise */
  1134. .long _sys_getdents64 /* 220 */
  1135. .long _sys_fcntl64
  1136. .long _sys_ni_syscall /* reserved for TUX */
  1137. .long _sys_ni_syscall
  1138. .long _sys_gettid
  1139. .long _sys_readahead /* 225 */
  1140. .long _sys_setxattr
  1141. .long _sys_lsetxattr
  1142. .long _sys_fsetxattr
  1143. .long _sys_getxattr
  1144. .long _sys_lgetxattr /* 230 */
  1145. .long _sys_fgetxattr
  1146. .long _sys_listxattr
  1147. .long _sys_llistxattr
  1148. .long _sys_flistxattr
  1149. .long _sys_removexattr /* 235 */
  1150. .long _sys_lremovexattr
  1151. .long _sys_fremovexattr
  1152. .long _sys_tkill
  1153. .long _sys_sendfile64
  1154. .long _sys_futex /* 240 */
  1155. .long _sys_sched_setaffinity
  1156. .long _sys_sched_getaffinity
  1157. .long _sys_ni_syscall /* sys_set_thread_area */
  1158. .long _sys_ni_syscall /* sys_get_thread_area */
  1159. .long _sys_io_setup /* 245 */
  1160. .long _sys_io_destroy
  1161. .long _sys_io_getevents
  1162. .long _sys_io_submit
  1163. .long _sys_io_cancel
  1164. .long _sys_ni_syscall /* 250 */ /* sys_alloc_hugepages */
  1165. .long _sys_ni_syscall /* sys_freec_hugepages */
  1166. .long _sys_exit_group
  1167. .long _sys_lookup_dcookie
  1168. .long _sys_bfin_spinlock
  1169. .long _sys_epoll_create /* 255 */
  1170. .long _sys_epoll_ctl
  1171. .long _sys_epoll_wait
  1172. .long _sys_ni_syscall /* remap_file_pages */
  1173. .long _sys_set_tid_address
  1174. .long _sys_timer_create /* 260 */
  1175. .long _sys_timer_settime
  1176. .long _sys_timer_gettime
  1177. .long _sys_timer_getoverrun
  1178. .long _sys_timer_delete
  1179. .long _sys_clock_settime /* 265 */
  1180. .long _sys_clock_gettime
  1181. .long _sys_clock_getres
  1182. .long _sys_clock_nanosleep
  1183. .long _sys_statfs64
  1184. .long _sys_fstatfs64 /* 270 */
  1185. .long _sys_tgkill
  1186. .long _sys_utimes
  1187. .long _sys_fadvise64_64
  1188. .long _sys_ni_syscall /* vserver */
  1189. .long _sys_ni_syscall /* 275, mbind */
  1190. .long _sys_ni_syscall /* get_mempolicy */
  1191. .long _sys_ni_syscall /* set_mempolicy */
  1192. .long _sys_mq_open
  1193. .long _sys_mq_unlink
  1194. .long _sys_mq_timedsend /* 280 */
  1195. .long _sys_mq_timedreceive
  1196. .long _sys_mq_notify
  1197. .long _sys_mq_getsetattr
  1198. .long _sys_ni_syscall /* kexec_load */
  1199. .long _sys_waitid /* 285 */
  1200. .long _sys_add_key
  1201. .long _sys_request_key
  1202. .long _sys_keyctl
  1203. .long _sys_ioprio_set
  1204. .long _sys_ioprio_get /* 290 */
  1205. .long _sys_inotify_init
  1206. .long _sys_inotify_add_watch
  1207. .long _sys_inotify_rm_watch
  1208. .long _sys_ni_syscall /* migrate_pages */
  1209. .long _sys_openat /* 295 */
  1210. .long _sys_mkdirat
  1211. .long _sys_mknodat
  1212. .long _sys_fchownat
  1213. .long _sys_futimesat
  1214. .long _sys_fstatat64 /* 300 */
  1215. .long _sys_unlinkat
  1216. .long _sys_renameat
  1217. .long _sys_linkat
  1218. .long _sys_symlinkat
  1219. .long _sys_readlinkat /* 305 */
  1220. .long _sys_fchmodat
  1221. .long _sys_faccessat
  1222. .long _sys_pselect6
  1223. .long _sys_ppoll
  1224. .long _sys_unshare /* 310 */
  1225. .long _sys_sram_alloc
  1226. .long _sys_sram_free
  1227. .long _sys_dma_memcpy
  1228. .long _sys_accept
  1229. .long _sys_bind /* 315 */
  1230. .long _sys_connect
  1231. .long _sys_getpeername
  1232. .long _sys_getsockname
  1233. .long _sys_getsockopt
  1234. .long _sys_listen /* 320 */
  1235. .long _sys_recv
  1236. .long _sys_recvfrom
  1237. .long _sys_recvmsg
  1238. .long _sys_send
  1239. .long _sys_sendmsg /* 325 */
  1240. .long _sys_sendto
  1241. .long _sys_setsockopt
  1242. .long _sys_shutdown
  1243. .long _sys_socket
  1244. .long _sys_socketpair /* 330 */
  1245. .long _sys_semctl
  1246. .long _sys_semget
  1247. .long _sys_semop
  1248. .long _sys_msgctl
  1249. .long _sys_msgget /* 335 */
  1250. .long _sys_msgrcv
  1251. .long _sys_msgsnd
  1252. .long _sys_shmat
  1253. .long _sys_shmctl
  1254. .long _sys_shmdt /* 340 */
  1255. .long _sys_shmget
  1256. .long _sys_splice
  1257. .long _sys_sync_file_range
  1258. .long _sys_tee
  1259. .long _sys_vmsplice /* 345 */
  1260. .long _sys_epoll_pwait
  1261. .long _sys_utimensat
  1262. .long _sys_signalfd
  1263. .long _sys_timerfd_create
  1264. .long _sys_eventfd /* 350 */
  1265. .long _sys_pread64
  1266. .long _sys_pwrite64
  1267. .long _sys_fadvise64
  1268. .long _sys_set_robust_list
  1269. .long _sys_get_robust_list /* 355 */
  1270. .long _sys_fallocate
  1271. .long _sys_semtimedop
  1272. .long _sys_timerfd_settime
  1273. .long _sys_timerfd_gettime
  1274. .rept NR_syscalls-(.-_sys_call_table)/4
  1275. .long _sys_ni_syscall
  1276. .endr
  1277. _excpt_saved_imask:
  1278. .long 0;
  1279. _exception_stack:
  1280. .rept 1024
  1281. .long 0;
  1282. .endr
  1283. _exception_stack_top:
  1284. #if ANOMALY_05000261
  1285. /* Used by the assembly entry point to work around an anomaly. */
  1286. _last_cplb_fault_retx:
  1287. .long 0;
  1288. #endif
  1289. /*
  1290. * Single instructions can have multiple faults, which need to be
  1291. * handled by traps.c, in irq5. We store the exception cause to ensure
  1292. * we don't miss a double fault condition
  1293. */
  1294. ENTRY(_in_ptr_excause)
  1295. .long 0;
  1296. ENTRY(_out_ptr_excause)
  1297. .long 0;
  1298. ALIGN
  1299. ENTRY(_excause_circ_buf)
  1300. .rept 4
  1301. .long 0
  1302. .endr