entry.S 39 KB

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