entry.S 39 KB

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