entry.S 37 KB

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