entry.S 38 KB

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