entry.S 37 KB

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