entry.S 39 KB

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