entry.S 34 KB

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