entry.S 39 KB

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