entry.S 37 KB

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