entry.S 34 KB

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