entry.S 40 KB

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