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