traps.c 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 1994 - 1999, 2000, 01, 06 Ralf Baechle
  7. * Copyright (C) 1995, 1996 Paul M. Antoine
  8. * Copyright (C) 1998 Ulf Carlsson
  9. * Copyright (C) 1999 Silicon Graphics, Inc.
  10. * Kevin D. Kissell, kevink@mips.com and Carsten Langgaard, carstenl@mips.com
  11. * Copyright (C) 2000, 01 MIPS Technologies, Inc.
  12. * Copyright (C) 2002, 2003, 2004, 2005 Maciej W. Rozycki
  13. */
  14. #include <linux/config.h>
  15. #include <linux/init.h>
  16. #include <linux/mm.h>
  17. #include <linux/module.h>
  18. #include <linux/sched.h>
  19. #include <linux/smp.h>
  20. #include <linux/smp_lock.h>
  21. #include <linux/spinlock.h>
  22. #include <linux/kallsyms.h>
  23. #include <linux/bootmem.h>
  24. #include <asm/bootinfo.h>
  25. #include <asm/branch.h>
  26. #include <asm/break.h>
  27. #include <asm/cpu.h>
  28. #include <asm/dsp.h>
  29. #include <asm/fpu.h>
  30. #include <asm/mipsregs.h>
  31. #include <asm/mipsmtregs.h>
  32. #include <asm/module.h>
  33. #include <asm/pgtable.h>
  34. #include <asm/ptrace.h>
  35. #include <asm/sections.h>
  36. #include <asm/system.h>
  37. #include <asm/tlbdebug.h>
  38. #include <asm/traps.h>
  39. #include <asm/uaccess.h>
  40. #include <asm/mmu_context.h>
  41. #include <asm/watch.h>
  42. #include <asm/types.h>
  43. extern asmlinkage void handle_tlbm(void);
  44. extern asmlinkage void handle_tlbl(void);
  45. extern asmlinkage void handle_tlbs(void);
  46. extern asmlinkage void handle_adel(void);
  47. extern asmlinkage void handle_ades(void);
  48. extern asmlinkage void handle_ibe(void);
  49. extern asmlinkage void handle_dbe(void);
  50. extern asmlinkage void handle_sys(void);
  51. extern asmlinkage void handle_bp(void);
  52. extern asmlinkage void handle_ri(void);
  53. extern asmlinkage void handle_cpu(void);
  54. extern asmlinkage void handle_ov(void);
  55. extern asmlinkage void handle_tr(void);
  56. extern asmlinkage void handle_fpe(void);
  57. extern asmlinkage void handle_mdmx(void);
  58. extern asmlinkage void handle_watch(void);
  59. extern asmlinkage void handle_mt(void);
  60. extern asmlinkage void handle_dsp(void);
  61. extern asmlinkage void handle_mcheck(void);
  62. extern asmlinkage void handle_reserved(void);
  63. extern int fpu_emulator_cop1Handler(struct pt_regs *xcp,
  64. struct mips_fpu_soft_struct *ctx);
  65. void (*board_be_init)(void);
  66. int (*board_be_handler)(struct pt_regs *regs, int is_fixup);
  67. void (*board_nmi_handler_setup)(void);
  68. void (*board_ejtag_handler_setup)(void);
  69. void (*board_bind_eic_interrupt)(int irq, int regset);
  70. /*
  71. * These constant is for searching for possible module text segments.
  72. * MODULE_RANGE is a guess of how much space is likely to be vmalloced.
  73. */
  74. #define MODULE_RANGE (8*1024*1024)
  75. /*
  76. * This routine abuses get_user()/put_user() to reference pointers
  77. * with at least a bit of error checking ...
  78. */
  79. void show_stack(struct task_struct *task, unsigned long *sp)
  80. {
  81. const int field = 2 * sizeof(unsigned long);
  82. long stackdata;
  83. int i;
  84. if (!sp) {
  85. if (task && task != current)
  86. sp = (unsigned long *) task->thread.reg29;
  87. else
  88. sp = (unsigned long *) &sp;
  89. }
  90. printk("Stack :");
  91. i = 0;
  92. while ((unsigned long) sp & (PAGE_SIZE - 1)) {
  93. if (i && ((i % (64 / field)) == 0))
  94. printk("\n ");
  95. if (i > 39) {
  96. printk(" ...");
  97. break;
  98. }
  99. if (__get_user(stackdata, sp++)) {
  100. printk(" (Bad stack address)");
  101. break;
  102. }
  103. printk(" %0*lx", field, stackdata);
  104. i++;
  105. }
  106. printk("\n");
  107. }
  108. void show_trace(struct task_struct *task, unsigned long *stack)
  109. {
  110. const int field = 2 * sizeof(unsigned long);
  111. unsigned long addr;
  112. if (!stack) {
  113. if (task && task != current)
  114. stack = (unsigned long *) task->thread.reg29;
  115. else
  116. stack = (unsigned long *) &stack;
  117. }
  118. printk("Call Trace:");
  119. #ifdef CONFIG_KALLSYMS
  120. printk("\n");
  121. #endif
  122. while (!kstack_end(stack)) {
  123. addr = *stack++;
  124. if (__kernel_text_address(addr)) {
  125. printk(" [<%0*lx>] ", field, addr);
  126. print_symbol("%s\n", addr);
  127. }
  128. }
  129. printk("\n");
  130. }
  131. /*
  132. * The architecture-independent dump_stack generator
  133. */
  134. void dump_stack(void)
  135. {
  136. unsigned long stack;
  137. show_trace(current, &stack);
  138. }
  139. EXPORT_SYMBOL(dump_stack);
  140. void show_code(unsigned int *pc)
  141. {
  142. long i;
  143. printk("\nCode:");
  144. for(i = -3 ; i < 6 ; i++) {
  145. unsigned int insn;
  146. if (__get_user(insn, pc + i)) {
  147. printk(" (Bad address in epc)\n");
  148. break;
  149. }
  150. printk("%c%08x%c", (i?' ':'<'), insn, (i?' ':'>'));
  151. }
  152. }
  153. void show_regs(struct pt_regs *regs)
  154. {
  155. const int field = 2 * sizeof(unsigned long);
  156. unsigned int cause = regs->cp0_cause;
  157. int i;
  158. printk("Cpu %d\n", smp_processor_id());
  159. /*
  160. * Saved main processor registers
  161. */
  162. for (i = 0; i < 32; ) {
  163. if ((i % 4) == 0)
  164. printk("$%2d :", i);
  165. if (i == 0)
  166. printk(" %0*lx", field, 0UL);
  167. else if (i == 26 || i == 27)
  168. printk(" %*s", field, "");
  169. else
  170. printk(" %0*lx", field, regs->regs[i]);
  171. i++;
  172. if ((i % 4) == 0)
  173. printk("\n");
  174. }
  175. printk("Hi : %0*lx\n", field, regs->hi);
  176. printk("Lo : %0*lx\n", field, regs->lo);
  177. /*
  178. * Saved cp0 registers
  179. */
  180. printk("epc : %0*lx ", field, regs->cp0_epc);
  181. print_symbol("%s ", regs->cp0_epc);
  182. printk(" %s\n", print_tainted());
  183. printk("ra : %0*lx ", field, regs->regs[31]);
  184. print_symbol("%s\n", regs->regs[31]);
  185. printk("Status: %08x ", (uint32_t) regs->cp0_status);
  186. if (current_cpu_data.isa_level == MIPS_CPU_ISA_I) {
  187. if (regs->cp0_status & ST0_KUO)
  188. printk("KUo ");
  189. if (regs->cp0_status & ST0_IEO)
  190. printk("IEo ");
  191. if (regs->cp0_status & ST0_KUP)
  192. printk("KUp ");
  193. if (regs->cp0_status & ST0_IEP)
  194. printk("IEp ");
  195. if (regs->cp0_status & ST0_KUC)
  196. printk("KUc ");
  197. if (regs->cp0_status & ST0_IEC)
  198. printk("IEc ");
  199. } else {
  200. if (regs->cp0_status & ST0_KX)
  201. printk("KX ");
  202. if (regs->cp0_status & ST0_SX)
  203. printk("SX ");
  204. if (regs->cp0_status & ST0_UX)
  205. printk("UX ");
  206. switch (regs->cp0_status & ST0_KSU) {
  207. case KSU_USER:
  208. printk("USER ");
  209. break;
  210. case KSU_SUPERVISOR:
  211. printk("SUPERVISOR ");
  212. break;
  213. case KSU_KERNEL:
  214. printk("KERNEL ");
  215. break;
  216. default:
  217. printk("BAD_MODE ");
  218. break;
  219. }
  220. if (regs->cp0_status & ST0_ERL)
  221. printk("ERL ");
  222. if (regs->cp0_status & ST0_EXL)
  223. printk("EXL ");
  224. if (regs->cp0_status & ST0_IE)
  225. printk("IE ");
  226. }
  227. printk("\n");
  228. printk("Cause : %08x\n", cause);
  229. cause = (cause & CAUSEF_EXCCODE) >> CAUSEB_EXCCODE;
  230. if (1 <= cause && cause <= 5)
  231. printk("BadVA : %0*lx\n", field, regs->cp0_badvaddr);
  232. printk("PrId : %08x\n", read_c0_prid());
  233. }
  234. void show_registers(struct pt_regs *regs)
  235. {
  236. show_regs(regs);
  237. print_modules();
  238. printk("Process %s (pid: %d, threadinfo=%p, task=%p)\n",
  239. current->comm, current->pid, current_thread_info(), current);
  240. show_stack(current, (long *) regs->regs[29]);
  241. show_trace(current, (long *) regs->regs[29]);
  242. show_code((unsigned int *) regs->cp0_epc);
  243. printk("\n");
  244. }
  245. static DEFINE_SPINLOCK(die_lock);
  246. NORET_TYPE void ATTRIB_NORET die(const char * str, struct pt_regs * regs)
  247. {
  248. static int die_counter;
  249. console_verbose();
  250. spin_lock_irq(&die_lock);
  251. printk("%s[#%d]:\n", str, ++die_counter);
  252. show_registers(regs);
  253. spin_unlock_irq(&die_lock);
  254. do_exit(SIGSEGV);
  255. }
  256. extern const struct exception_table_entry __start___dbe_table[];
  257. extern const struct exception_table_entry __stop___dbe_table[];
  258. void __declare_dbe_table(void)
  259. {
  260. __asm__ __volatile__(
  261. ".section\t__dbe_table,\"a\"\n\t"
  262. ".previous"
  263. );
  264. }
  265. /* Given an address, look for it in the exception tables. */
  266. static const struct exception_table_entry *search_dbe_tables(unsigned long addr)
  267. {
  268. const struct exception_table_entry *e;
  269. e = search_extable(__start___dbe_table, __stop___dbe_table - 1, addr);
  270. if (!e)
  271. e = search_module_dbetables(addr);
  272. return e;
  273. }
  274. asmlinkage void do_be(struct pt_regs *regs)
  275. {
  276. const int field = 2 * sizeof(unsigned long);
  277. const struct exception_table_entry *fixup = NULL;
  278. int data = regs->cp0_cause & 4;
  279. int action = MIPS_BE_FATAL;
  280. /* XXX For now. Fixme, this searches the wrong table ... */
  281. if (data && !user_mode(regs))
  282. fixup = search_dbe_tables(exception_epc(regs));
  283. if (fixup)
  284. action = MIPS_BE_FIXUP;
  285. if (board_be_handler)
  286. action = board_be_handler(regs, fixup != 0);
  287. switch (action) {
  288. case MIPS_BE_DISCARD:
  289. return;
  290. case MIPS_BE_FIXUP:
  291. if (fixup) {
  292. regs->cp0_epc = fixup->nextinsn;
  293. return;
  294. }
  295. break;
  296. default:
  297. break;
  298. }
  299. /*
  300. * Assume it would be too dangerous to continue ...
  301. */
  302. printk(KERN_ALERT "%s bus error, epc == %0*lx, ra == %0*lx\n",
  303. data ? "Data" : "Instruction",
  304. field, regs->cp0_epc, field, regs->regs[31]);
  305. die_if_kernel("Oops", regs);
  306. force_sig(SIGBUS, current);
  307. }
  308. static inline int get_insn_opcode(struct pt_regs *regs, unsigned int *opcode)
  309. {
  310. unsigned int __user *epc;
  311. epc = (unsigned int __user *) regs->cp0_epc +
  312. ((regs->cp0_cause & CAUSEF_BD) != 0);
  313. if (!get_user(*opcode, epc))
  314. return 0;
  315. force_sig(SIGSEGV, current);
  316. return 1;
  317. }
  318. /*
  319. * ll/sc emulation
  320. */
  321. #define OPCODE 0xfc000000
  322. #define BASE 0x03e00000
  323. #define RT 0x001f0000
  324. #define OFFSET 0x0000ffff
  325. #define LL 0xc0000000
  326. #define SC 0xe0000000
  327. #define SPEC3 0x7c000000
  328. #define RD 0x0000f800
  329. #define FUNC 0x0000003f
  330. #define RDHWR 0x0000003b
  331. /*
  332. * The ll_bit is cleared by r*_switch.S
  333. */
  334. unsigned long ll_bit;
  335. static struct task_struct *ll_task = NULL;
  336. static inline void simulate_ll(struct pt_regs *regs, unsigned int opcode)
  337. {
  338. unsigned long value, __user *vaddr;
  339. long offset;
  340. int signal = 0;
  341. /*
  342. * analyse the ll instruction that just caused a ri exception
  343. * and put the referenced address to addr.
  344. */
  345. /* sign extend offset */
  346. offset = opcode & OFFSET;
  347. offset <<= 16;
  348. offset >>= 16;
  349. vaddr = (unsigned long __user *)
  350. ((unsigned long)(regs->regs[(opcode & BASE) >> 21]) + offset);
  351. if ((unsigned long)vaddr & 3) {
  352. signal = SIGBUS;
  353. goto sig;
  354. }
  355. if (get_user(value, vaddr)) {
  356. signal = SIGSEGV;
  357. goto sig;
  358. }
  359. preempt_disable();
  360. if (ll_task == NULL || ll_task == current) {
  361. ll_bit = 1;
  362. } else {
  363. ll_bit = 0;
  364. }
  365. ll_task = current;
  366. preempt_enable();
  367. compute_return_epc(regs);
  368. regs->regs[(opcode & RT) >> 16] = value;
  369. return;
  370. sig:
  371. force_sig(signal, current);
  372. }
  373. static inline void simulate_sc(struct pt_regs *regs, unsigned int opcode)
  374. {
  375. unsigned long __user *vaddr;
  376. unsigned long reg;
  377. long offset;
  378. int signal = 0;
  379. /*
  380. * analyse the sc instruction that just caused a ri exception
  381. * and put the referenced address to addr.
  382. */
  383. /* sign extend offset */
  384. offset = opcode & OFFSET;
  385. offset <<= 16;
  386. offset >>= 16;
  387. vaddr = (unsigned long __user *)
  388. ((unsigned long)(regs->regs[(opcode & BASE) >> 21]) + offset);
  389. reg = (opcode & RT) >> 16;
  390. if ((unsigned long)vaddr & 3) {
  391. signal = SIGBUS;
  392. goto sig;
  393. }
  394. preempt_disable();
  395. if (ll_bit == 0 || ll_task != current) {
  396. compute_return_epc(regs);
  397. regs->regs[reg] = 0;
  398. preempt_enable();
  399. return;
  400. }
  401. preempt_enable();
  402. if (put_user(regs->regs[reg], vaddr)) {
  403. signal = SIGSEGV;
  404. goto sig;
  405. }
  406. compute_return_epc(regs);
  407. regs->regs[reg] = 1;
  408. return;
  409. sig:
  410. force_sig(signal, current);
  411. }
  412. /*
  413. * ll uses the opcode of lwc0 and sc uses the opcode of swc0. That is both
  414. * opcodes are supposed to result in coprocessor unusable exceptions if
  415. * executed on ll/sc-less processors. That's the theory. In practice a
  416. * few processors such as NEC's VR4100 throw reserved instruction exceptions
  417. * instead, so we're doing the emulation thing in both exception handlers.
  418. */
  419. static inline int simulate_llsc(struct pt_regs *regs)
  420. {
  421. unsigned int opcode;
  422. if (unlikely(get_insn_opcode(regs, &opcode)))
  423. return -EFAULT;
  424. if ((opcode & OPCODE) == LL) {
  425. simulate_ll(regs, opcode);
  426. return 0;
  427. }
  428. if ((opcode & OPCODE) == SC) {
  429. simulate_sc(regs, opcode);
  430. return 0;
  431. }
  432. return -EFAULT; /* Strange things going on ... */
  433. }
  434. /*
  435. * Simulate trapping 'rdhwr' instructions to provide user accessible
  436. * registers not implemented in hardware. The only current use of this
  437. * is the thread area pointer.
  438. */
  439. static inline int simulate_rdhwr(struct pt_regs *regs)
  440. {
  441. struct thread_info *ti = task_thread_info(current);
  442. unsigned int opcode;
  443. if (unlikely(get_insn_opcode(regs, &opcode)))
  444. return -EFAULT;
  445. if (unlikely(compute_return_epc(regs)))
  446. return -EFAULT;
  447. if ((opcode & OPCODE) == SPEC3 && (opcode & FUNC) == RDHWR) {
  448. int rd = (opcode & RD) >> 11;
  449. int rt = (opcode & RT) >> 16;
  450. switch (rd) {
  451. case 29:
  452. regs->regs[rt] = ti->tp_value;
  453. return 0;
  454. default:
  455. return -EFAULT;
  456. }
  457. }
  458. /* Not ours. */
  459. return -EFAULT;
  460. }
  461. asmlinkage void do_ov(struct pt_regs *regs)
  462. {
  463. siginfo_t info;
  464. die_if_kernel("Integer overflow", regs);
  465. info.si_code = FPE_INTOVF;
  466. info.si_signo = SIGFPE;
  467. info.si_errno = 0;
  468. info.si_addr = (void __user *) regs->cp0_epc;
  469. force_sig_info(SIGFPE, &info, current);
  470. }
  471. /*
  472. * XXX Delayed fp exceptions when doing a lazy ctx switch XXX
  473. */
  474. asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
  475. {
  476. if (fcr31 & FPU_CSR_UNI_X) {
  477. int sig;
  478. preempt_disable();
  479. #ifdef CONFIG_PREEMPT
  480. if (!is_fpu_owner()) {
  481. /* We might lose fpu before disabling preempt... */
  482. own_fpu();
  483. BUG_ON(!used_math());
  484. restore_fp(current);
  485. }
  486. #endif
  487. /*
  488. * Unimplemented operation exception. If we've got the full
  489. * software emulator on-board, let's use it...
  490. *
  491. * Force FPU to dump state into task/thread context. We're
  492. * moving a lot of data here for what is probably a single
  493. * instruction, but the alternative is to pre-decode the FP
  494. * register operands before invoking the emulator, which seems
  495. * a bit extreme for what should be an infrequent event.
  496. */
  497. save_fp(current);
  498. /* Ensure 'resume' not overwrite saved fp context again. */
  499. lose_fpu();
  500. preempt_enable();
  501. /* Run the emulator */
  502. sig = fpu_emulator_cop1Handler (regs,
  503. &current->thread.fpu.soft);
  504. preempt_disable();
  505. own_fpu(); /* Using the FPU again. */
  506. /*
  507. * We can't allow the emulated instruction to leave any of
  508. * the cause bit set in $fcr31.
  509. */
  510. current->thread.fpu.soft.fcr31 &= ~FPU_CSR_ALL_X;
  511. /* Restore the hardware register state */
  512. restore_fp(current);
  513. preempt_enable();
  514. /* If something went wrong, signal */
  515. if (sig)
  516. force_sig(sig, current);
  517. return;
  518. }
  519. force_sig(SIGFPE, current);
  520. }
  521. asmlinkage void do_bp(struct pt_regs *regs)
  522. {
  523. unsigned int opcode, bcode;
  524. siginfo_t info;
  525. die_if_kernel("Break instruction in kernel code", regs);
  526. if (get_insn_opcode(regs, &opcode))
  527. return;
  528. /*
  529. * There is the ancient bug in the MIPS assemblers that the break
  530. * code starts left to bit 16 instead to bit 6 in the opcode.
  531. * Gas is bug-compatible, but not always, grrr...
  532. * We handle both cases with a simple heuristics. --macro
  533. */
  534. bcode = ((opcode >> 6) & ((1 << 20) - 1));
  535. if (bcode < (1 << 10))
  536. bcode <<= 10;
  537. /*
  538. * (A short test says that IRIX 5.3 sends SIGTRAP for all break
  539. * insns, even for break codes that indicate arithmetic failures.
  540. * Weird ...)
  541. * But should we continue the brokenness??? --macro
  542. */
  543. switch (bcode) {
  544. case BRK_OVERFLOW << 10:
  545. case BRK_DIVZERO << 10:
  546. if (bcode == (BRK_DIVZERO << 10))
  547. info.si_code = FPE_INTDIV;
  548. else
  549. info.si_code = FPE_INTOVF;
  550. info.si_signo = SIGFPE;
  551. info.si_errno = 0;
  552. info.si_addr = (void __user *) regs->cp0_epc;
  553. force_sig_info(SIGFPE, &info, current);
  554. break;
  555. default:
  556. force_sig(SIGTRAP, current);
  557. }
  558. }
  559. asmlinkage void do_tr(struct pt_regs *regs)
  560. {
  561. unsigned int opcode, tcode = 0;
  562. siginfo_t info;
  563. die_if_kernel("Trap instruction in kernel code", regs);
  564. if (get_insn_opcode(regs, &opcode))
  565. return;
  566. /* Immediate versions don't provide a code. */
  567. if (!(opcode & OPCODE))
  568. tcode = ((opcode >> 6) & ((1 << 10) - 1));
  569. /*
  570. * (A short test says that IRIX 5.3 sends SIGTRAP for all trap
  571. * insns, even for trap codes that indicate arithmetic failures.
  572. * Weird ...)
  573. * But should we continue the brokenness??? --macro
  574. */
  575. switch (tcode) {
  576. case BRK_OVERFLOW:
  577. case BRK_DIVZERO:
  578. if (tcode == BRK_DIVZERO)
  579. info.si_code = FPE_INTDIV;
  580. else
  581. info.si_code = FPE_INTOVF;
  582. info.si_signo = SIGFPE;
  583. info.si_errno = 0;
  584. info.si_addr = (void __user *) regs->cp0_epc;
  585. force_sig_info(SIGFPE, &info, current);
  586. break;
  587. default:
  588. force_sig(SIGTRAP, current);
  589. }
  590. }
  591. asmlinkage void do_ri(struct pt_regs *regs)
  592. {
  593. die_if_kernel("Reserved instruction in kernel code", regs);
  594. if (!cpu_has_llsc)
  595. if (!simulate_llsc(regs))
  596. return;
  597. if (!simulate_rdhwr(regs))
  598. return;
  599. force_sig(SIGILL, current);
  600. }
  601. asmlinkage void do_cpu(struct pt_regs *regs)
  602. {
  603. unsigned int cpid;
  604. die_if_kernel("do_cpu invoked from kernel context!", regs);
  605. cpid = (regs->cp0_cause >> CAUSEB_CE) & 3;
  606. switch (cpid) {
  607. case 0:
  608. if (!cpu_has_llsc)
  609. if (!simulate_llsc(regs))
  610. return;
  611. if (!simulate_rdhwr(regs))
  612. return;
  613. break;
  614. case 1:
  615. preempt_disable();
  616. own_fpu();
  617. if (used_math()) { /* Using the FPU again. */
  618. restore_fp(current);
  619. } else { /* First time FPU user. */
  620. init_fpu();
  621. set_used_math();
  622. }
  623. preempt_enable();
  624. if (!cpu_has_fpu) {
  625. int sig = fpu_emulator_cop1Handler(regs,
  626. &current->thread.fpu.soft);
  627. if (sig)
  628. force_sig(sig, current);
  629. }
  630. return;
  631. case 2:
  632. case 3:
  633. break;
  634. }
  635. force_sig(SIGILL, current);
  636. }
  637. asmlinkage void do_mdmx(struct pt_regs *regs)
  638. {
  639. force_sig(SIGILL, current);
  640. }
  641. asmlinkage void do_watch(struct pt_regs *regs)
  642. {
  643. /*
  644. * We use the watch exception where available to detect stack
  645. * overflows.
  646. */
  647. dump_tlb_all();
  648. show_regs(regs);
  649. panic("Caught WATCH exception - probably caused by stack overflow.");
  650. }
  651. asmlinkage void do_mcheck(struct pt_regs *regs)
  652. {
  653. show_regs(regs);
  654. dump_tlb_all();
  655. /*
  656. * Some chips may have other causes of machine check (e.g. SB1
  657. * graduation timer)
  658. */
  659. panic("Caught Machine Check exception - %scaused by multiple "
  660. "matching entries in the TLB.",
  661. (regs->cp0_status & ST0_TS) ? "" : "not ");
  662. }
  663. asmlinkage void do_mt(struct pt_regs *regs)
  664. {
  665. die_if_kernel("MIPS MT Thread exception in kernel", regs);
  666. force_sig(SIGILL, current);
  667. }
  668. asmlinkage void do_dsp(struct pt_regs *regs)
  669. {
  670. if (cpu_has_dsp)
  671. panic("Unexpected DSP exception\n");
  672. force_sig(SIGILL, current);
  673. }
  674. asmlinkage void do_reserved(struct pt_regs *regs)
  675. {
  676. /*
  677. * Game over - no way to handle this if it ever occurs. Most probably
  678. * caused by a new unknown cpu type or after another deadly
  679. * hard/software error.
  680. */
  681. show_regs(regs);
  682. panic("Caught reserved exception %ld - should not happen.",
  683. (regs->cp0_cause & 0x7f) >> 2);
  684. }
  685. asmlinkage void do_default_vi(struct pt_regs *regs)
  686. {
  687. show_regs(regs);
  688. panic("Caught unexpected vectored interrupt.");
  689. }
  690. /*
  691. * Some MIPS CPUs can enable/disable for cache parity detection, but do
  692. * it different ways.
  693. */
  694. static inline void parity_protection_init(void)
  695. {
  696. switch (current_cpu_data.cputype) {
  697. case CPU_24K:
  698. case CPU_5KC:
  699. write_c0_ecc(0x80000000);
  700. back_to_back_c0_hazard();
  701. /* Set the PE bit (bit 31) in the c0_errctl register. */
  702. printk(KERN_INFO "Cache parity protection %sabled\n",
  703. (read_c0_ecc() & 0x80000000) ? "en" : "dis");
  704. break;
  705. case CPU_20KC:
  706. case CPU_25KF:
  707. /* Clear the DE bit (bit 16) in the c0_status register. */
  708. printk(KERN_INFO "Enable cache parity protection for "
  709. "MIPS 20KC/25KF CPUs.\n");
  710. clear_c0_status(ST0_DE);
  711. break;
  712. default:
  713. break;
  714. }
  715. }
  716. asmlinkage void cache_parity_error(void)
  717. {
  718. const int field = 2 * sizeof(unsigned long);
  719. unsigned int reg_val;
  720. /* For the moment, report the problem and hang. */
  721. printk("Cache error exception:\n");
  722. printk("cp0_errorepc == %0*lx\n", field, read_c0_errorepc());
  723. reg_val = read_c0_cacheerr();
  724. printk("c0_cacheerr == %08x\n", reg_val);
  725. printk("Decoded c0_cacheerr: %s cache fault in %s reference.\n",
  726. reg_val & (1<<30) ? "secondary" : "primary",
  727. reg_val & (1<<31) ? "data" : "insn");
  728. printk("Error bits: %s%s%s%s%s%s%s\n",
  729. reg_val & (1<<29) ? "ED " : "",
  730. reg_val & (1<<28) ? "ET " : "",
  731. reg_val & (1<<26) ? "EE " : "",
  732. reg_val & (1<<25) ? "EB " : "",
  733. reg_val & (1<<24) ? "EI " : "",
  734. reg_val & (1<<23) ? "E1 " : "",
  735. reg_val & (1<<22) ? "E0 " : "");
  736. printk("IDX: 0x%08x\n", reg_val & ((1<<22)-1));
  737. #if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
  738. if (reg_val & (1<<22))
  739. printk("DErrAddr0: 0x%0*lx\n", field, read_c0_derraddr0());
  740. if (reg_val & (1<<23))
  741. printk("DErrAddr1: 0x%0*lx\n", field, read_c0_derraddr1());
  742. #endif
  743. panic("Can't handle the cache error!");
  744. }
  745. /*
  746. * SDBBP EJTAG debug exception handler.
  747. * We skip the instruction and return to the next instruction.
  748. */
  749. void ejtag_exception_handler(struct pt_regs *regs)
  750. {
  751. const int field = 2 * sizeof(unsigned long);
  752. unsigned long depc, old_epc;
  753. unsigned int debug;
  754. printk("SDBBP EJTAG debug exception - not handled yet, just ignored!\n");
  755. depc = read_c0_depc();
  756. debug = read_c0_debug();
  757. printk("c0_depc = %0*lx, DEBUG = %08x\n", field, depc, debug);
  758. if (debug & 0x80000000) {
  759. /*
  760. * In branch delay slot.
  761. * We cheat a little bit here and use EPC to calculate the
  762. * debug return address (DEPC). EPC is restored after the
  763. * calculation.
  764. */
  765. old_epc = regs->cp0_epc;
  766. regs->cp0_epc = depc;
  767. __compute_return_epc(regs);
  768. depc = regs->cp0_epc;
  769. regs->cp0_epc = old_epc;
  770. } else
  771. depc += 4;
  772. write_c0_depc(depc);
  773. #if 0
  774. printk("\n\n----- Enable EJTAG single stepping ----\n\n");
  775. write_c0_debug(debug | 0x100);
  776. #endif
  777. }
  778. /*
  779. * NMI exception handler.
  780. */
  781. void nmi_exception_handler(struct pt_regs *regs)
  782. {
  783. printk("NMI taken!!!!\n");
  784. die("NMI", regs);
  785. while(1) ;
  786. }
  787. #define VECTORSPACING 0x100 /* for EI/VI mode */
  788. unsigned long ebase;
  789. unsigned long exception_handlers[32];
  790. unsigned long vi_handlers[64];
  791. /*
  792. * As a side effect of the way this is implemented we're limited
  793. * to interrupt handlers in the address range from
  794. * KSEG0 <= x < KSEG0 + 256mb on the Nevada. Oh well ...
  795. */
  796. void *set_except_vector(int n, void *addr)
  797. {
  798. unsigned long handler = (unsigned long) addr;
  799. unsigned long old_handler = exception_handlers[n];
  800. exception_handlers[n] = handler;
  801. if (n == 0 && cpu_has_divec) {
  802. *(volatile u32 *)(ebase + 0x200) = 0x08000000 |
  803. (0x03ffffff & (handler >> 2));
  804. flush_icache_range(ebase + 0x200, ebase + 0x204);
  805. }
  806. return (void *)old_handler;
  807. }
  808. #ifdef CONFIG_CPU_MIPSR2
  809. /*
  810. * Shadow register allocation
  811. * FIXME: SMP...
  812. */
  813. /* MIPSR2 shadow register sets */
  814. struct shadow_registers {
  815. spinlock_t sr_lock; /* */
  816. int sr_supported; /* Number of shadow register sets supported */
  817. int sr_allocated; /* Bitmap of allocated shadow registers */
  818. } shadow_registers;
  819. void mips_srs_init(void)
  820. {
  821. #ifdef CONFIG_CPU_MIPSR2_SRS
  822. shadow_registers.sr_supported = ((read_c0_srsctl() >> 26) & 0x0f) + 1;
  823. printk ("%d MIPSR2 register sets available\n", shadow_registers.sr_supported);
  824. #else
  825. shadow_registers.sr_supported = 1;
  826. #endif
  827. shadow_registers.sr_allocated = 1; /* Set 0 used by kernel */
  828. spin_lock_init(&shadow_registers.sr_lock);
  829. }
  830. int mips_srs_max(void)
  831. {
  832. return shadow_registers.sr_supported;
  833. }
  834. int mips_srs_alloc (void)
  835. {
  836. struct shadow_registers *sr = &shadow_registers;
  837. unsigned long flags;
  838. int set;
  839. spin_lock_irqsave(&sr->sr_lock, flags);
  840. for (set = 0; set < sr->sr_supported; set++) {
  841. if ((sr->sr_allocated & (1 << set)) == 0) {
  842. sr->sr_allocated |= 1 << set;
  843. spin_unlock_irqrestore(&sr->sr_lock, flags);
  844. return set;
  845. }
  846. }
  847. /* None available */
  848. spin_unlock_irqrestore(&sr->sr_lock, flags);
  849. return -1;
  850. }
  851. void mips_srs_free (int set)
  852. {
  853. struct shadow_registers *sr = &shadow_registers;
  854. unsigned long flags;
  855. spin_lock_irqsave(&sr->sr_lock, flags);
  856. sr->sr_allocated &= ~(1 << set);
  857. spin_unlock_irqrestore(&sr->sr_lock, flags);
  858. }
  859. void *set_vi_srs_handler (int n, void *addr, int srs)
  860. {
  861. unsigned long handler;
  862. unsigned long old_handler = vi_handlers[n];
  863. u32 *w;
  864. unsigned char *b;
  865. if (!cpu_has_veic && !cpu_has_vint)
  866. BUG();
  867. if (addr == NULL) {
  868. handler = (unsigned long) do_default_vi;
  869. srs = 0;
  870. }
  871. else
  872. handler = (unsigned long) addr;
  873. vi_handlers[n] = (unsigned long) addr;
  874. b = (unsigned char *)(ebase + 0x200 + n*VECTORSPACING);
  875. if (srs >= mips_srs_max())
  876. panic("Shadow register set %d not supported", srs);
  877. if (cpu_has_veic) {
  878. if (board_bind_eic_interrupt)
  879. board_bind_eic_interrupt (n, srs);
  880. }
  881. else if (cpu_has_vint) {
  882. /* SRSMap is only defined if shadow sets are implemented */
  883. if (mips_srs_max() > 1)
  884. change_c0_srsmap (0xf << n*4, srs << n*4);
  885. }
  886. if (srs == 0) {
  887. /*
  888. * If no shadow set is selected then use the default handler
  889. * that does normal register saving and a standard interrupt exit
  890. */
  891. extern char except_vec_vi, except_vec_vi_lui;
  892. extern char except_vec_vi_ori, except_vec_vi_end;
  893. const int handler_len = &except_vec_vi_end - &except_vec_vi;
  894. const int lui_offset = &except_vec_vi_lui - &except_vec_vi;
  895. const int ori_offset = &except_vec_vi_ori - &except_vec_vi;
  896. if (handler_len > VECTORSPACING) {
  897. /*
  898. * Sigh... panicing won't help as the console
  899. * is probably not configured :(
  900. */
  901. panic ("VECTORSPACING too small");
  902. }
  903. memcpy (b, &except_vec_vi, handler_len);
  904. w = (u32 *)(b + lui_offset);
  905. *w = (*w & 0xffff0000) | (((u32)handler >> 16) & 0xffff);
  906. w = (u32 *)(b + ori_offset);
  907. *w = (*w & 0xffff0000) | ((u32)handler & 0xffff);
  908. flush_icache_range((unsigned long)b, (unsigned long)(b+handler_len));
  909. }
  910. else {
  911. /*
  912. * In other cases jump directly to the interrupt handler
  913. *
  914. * It is the handlers responsibility to save registers if required
  915. * (eg hi/lo) and return from the exception using "eret"
  916. */
  917. w = (u32 *)b;
  918. *w++ = 0x08000000 | (((u32)handler >> 2) & 0x03fffff); /* j handler */
  919. *w = 0;
  920. flush_icache_range((unsigned long)b, (unsigned long)(b+8));
  921. }
  922. return (void *)old_handler;
  923. }
  924. void *set_vi_handler (int n, void *addr)
  925. {
  926. return set_vi_srs_handler (n, addr, 0);
  927. }
  928. #endif
  929. /*
  930. * This is used by native signal handling
  931. */
  932. asmlinkage int (*save_fp_context)(struct sigcontext *sc);
  933. asmlinkage int (*restore_fp_context)(struct sigcontext *sc);
  934. extern asmlinkage int _save_fp_context(struct sigcontext *sc);
  935. extern asmlinkage int _restore_fp_context(struct sigcontext *sc);
  936. extern asmlinkage int fpu_emulator_save_context(struct sigcontext *sc);
  937. extern asmlinkage int fpu_emulator_restore_context(struct sigcontext *sc);
  938. static inline void signal_init(void)
  939. {
  940. if (cpu_has_fpu) {
  941. save_fp_context = _save_fp_context;
  942. restore_fp_context = _restore_fp_context;
  943. } else {
  944. save_fp_context = fpu_emulator_save_context;
  945. restore_fp_context = fpu_emulator_restore_context;
  946. }
  947. }
  948. #ifdef CONFIG_MIPS32_COMPAT
  949. /*
  950. * This is used by 32-bit signal stuff on the 64-bit kernel
  951. */
  952. asmlinkage int (*save_fp_context32)(struct sigcontext32 *sc);
  953. asmlinkage int (*restore_fp_context32)(struct sigcontext32 *sc);
  954. extern asmlinkage int _save_fp_context32(struct sigcontext32 *sc);
  955. extern asmlinkage int _restore_fp_context32(struct sigcontext32 *sc);
  956. extern asmlinkage int fpu_emulator_save_context32(struct sigcontext32 *sc);
  957. extern asmlinkage int fpu_emulator_restore_context32(struct sigcontext32 *sc);
  958. static inline void signal32_init(void)
  959. {
  960. if (cpu_has_fpu) {
  961. save_fp_context32 = _save_fp_context32;
  962. restore_fp_context32 = _restore_fp_context32;
  963. } else {
  964. save_fp_context32 = fpu_emulator_save_context32;
  965. restore_fp_context32 = fpu_emulator_restore_context32;
  966. }
  967. }
  968. #endif
  969. extern void cpu_cache_init(void);
  970. extern void tlb_init(void);
  971. extern void flush_tlb_handlers(void);
  972. void __init per_cpu_trap_init(void)
  973. {
  974. unsigned int cpu = smp_processor_id();
  975. unsigned int status_set = ST0_CU0;
  976. /*
  977. * Disable coprocessors and select 32-bit or 64-bit addressing
  978. * and the 16/32 or 32/32 FPR register model. Reset the BEV
  979. * flag that some firmware may have left set and the TS bit (for
  980. * IP27). Set XX for ISA IV code to work.
  981. */
  982. #ifdef CONFIG_64BIT
  983. status_set |= ST0_FR|ST0_KX|ST0_SX|ST0_UX;
  984. #endif
  985. if (current_cpu_data.isa_level == MIPS_CPU_ISA_IV)
  986. status_set |= ST0_XX;
  987. change_c0_status(ST0_CU|ST0_MX|ST0_RE|ST0_FR|ST0_BEV|ST0_TS|ST0_KX|ST0_SX|ST0_UX,
  988. status_set);
  989. if (cpu_has_dsp)
  990. set_c0_status(ST0_MX);
  991. #ifdef CONFIG_CPU_MIPSR2
  992. write_c0_hwrena (0x0000000f); /* Allow rdhwr to all registers */
  993. #endif
  994. /*
  995. * Interrupt handling.
  996. */
  997. if (cpu_has_veic || cpu_has_vint) {
  998. write_c0_ebase (ebase);
  999. /* Setting vector spacing enables EI/VI mode */
  1000. change_c0_intctl (0x3e0, VECTORSPACING);
  1001. }
  1002. if (cpu_has_divec) {
  1003. if (cpu_has_mipsmt) {
  1004. unsigned int vpflags = dvpe();
  1005. set_c0_cause(CAUSEF_IV);
  1006. evpe(vpflags);
  1007. } else
  1008. set_c0_cause(CAUSEF_IV);
  1009. }
  1010. cpu_data[cpu].asid_cache = ASID_FIRST_VERSION;
  1011. TLBMISS_HANDLER_SETUP();
  1012. atomic_inc(&init_mm.mm_count);
  1013. current->active_mm = &init_mm;
  1014. BUG_ON(current->mm);
  1015. enter_lazy_tlb(&init_mm, current);
  1016. cpu_cache_init();
  1017. tlb_init();
  1018. }
  1019. /* Install CPU exception handler */
  1020. void __init set_handler (unsigned long offset, void *addr, unsigned long size)
  1021. {
  1022. memcpy((void *)(ebase + offset), addr, size);
  1023. flush_icache_range(ebase + offset, ebase + offset + size);
  1024. }
  1025. /* Install uncached CPU exception handler */
  1026. void __init set_uncached_handler (unsigned long offset, void *addr, unsigned long size)
  1027. {
  1028. #ifdef CONFIG_32BIT
  1029. unsigned long uncached_ebase = KSEG1ADDR(ebase);
  1030. #endif
  1031. #ifdef CONFIG_64BIT
  1032. unsigned long uncached_ebase = TO_UNCAC(ebase);
  1033. #endif
  1034. memcpy((void *)(uncached_ebase + offset), addr, size);
  1035. }
  1036. void __init trap_init(void)
  1037. {
  1038. extern char except_vec3_generic, except_vec3_r4000;
  1039. extern char except_vec4;
  1040. unsigned long i;
  1041. if (cpu_has_veic || cpu_has_vint)
  1042. ebase = (unsigned long) alloc_bootmem_low_pages (0x200 + VECTORSPACING*64);
  1043. else
  1044. ebase = CAC_BASE;
  1045. #ifdef CONFIG_CPU_MIPSR2
  1046. mips_srs_init();
  1047. #endif
  1048. per_cpu_trap_init();
  1049. /*
  1050. * Copy the generic exception handlers to their final destination.
  1051. * This will be overriden later as suitable for a particular
  1052. * configuration.
  1053. */
  1054. set_handler(0x180, &except_vec3_generic, 0x80);
  1055. /*
  1056. * Setup default vectors
  1057. */
  1058. for (i = 0; i <= 31; i++)
  1059. set_except_vector(i, handle_reserved);
  1060. /*
  1061. * Copy the EJTAG debug exception vector handler code to it's final
  1062. * destination.
  1063. */
  1064. if (cpu_has_ejtag && board_ejtag_handler_setup)
  1065. board_ejtag_handler_setup ();
  1066. /*
  1067. * Only some CPUs have the watch exceptions.
  1068. */
  1069. if (cpu_has_watch)
  1070. set_except_vector(23, handle_watch);
  1071. /*
  1072. * Initialise interrupt handlers
  1073. */
  1074. if (cpu_has_veic || cpu_has_vint) {
  1075. int nvec = cpu_has_veic ? 64 : 8;
  1076. for (i = 0; i < nvec; i++)
  1077. set_vi_handler (i, NULL);
  1078. }
  1079. else if (cpu_has_divec)
  1080. set_handler(0x200, &except_vec4, 0x8);
  1081. /*
  1082. * Some CPUs can enable/disable for cache parity detection, but does
  1083. * it different ways.
  1084. */
  1085. parity_protection_init();
  1086. /*
  1087. * The Data Bus Errors / Instruction Bus Errors are signaled
  1088. * by external hardware. Therefore these two exceptions
  1089. * may have board specific handlers.
  1090. */
  1091. if (board_be_init)
  1092. board_be_init();
  1093. set_except_vector(1, handle_tlbm);
  1094. set_except_vector(2, handle_tlbl);
  1095. set_except_vector(3, handle_tlbs);
  1096. set_except_vector(4, handle_adel);
  1097. set_except_vector(5, handle_ades);
  1098. set_except_vector(6, handle_ibe);
  1099. set_except_vector(7, handle_dbe);
  1100. set_except_vector(8, handle_sys);
  1101. set_except_vector(9, handle_bp);
  1102. set_except_vector(10, handle_ri);
  1103. set_except_vector(11, handle_cpu);
  1104. set_except_vector(12, handle_ov);
  1105. set_except_vector(13, handle_tr);
  1106. if (current_cpu_data.cputype == CPU_R6000 ||
  1107. current_cpu_data.cputype == CPU_R6000A) {
  1108. /*
  1109. * The R6000 is the only R-series CPU that features a machine
  1110. * check exception (similar to the R4000 cache error) and
  1111. * unaligned ldc1/sdc1 exception. The handlers have not been
  1112. * written yet. Well, anyway there is no R6000 machine on the
  1113. * current list of targets for Linux/MIPS.
  1114. * (Duh, crap, there is someone with a triple R6k machine)
  1115. */
  1116. //set_except_vector(14, handle_mc);
  1117. //set_except_vector(15, handle_ndc);
  1118. }
  1119. if (board_nmi_handler_setup)
  1120. board_nmi_handler_setup();
  1121. if (cpu_has_fpu && !cpu_has_nofpuex)
  1122. set_except_vector(15, handle_fpe);
  1123. set_except_vector(22, handle_mdmx);
  1124. if (cpu_has_mcheck)
  1125. set_except_vector(24, handle_mcheck);
  1126. if (cpu_has_mipsmt)
  1127. set_except_vector(25, handle_mt);
  1128. if (cpu_has_dsp)
  1129. set_except_vector(26, handle_dsp);
  1130. if (cpu_has_vce)
  1131. /* Special exception: R4[04]00 uses also the divec space. */
  1132. memcpy((void *)(CAC_BASE + 0x180), &except_vec3_r4000, 0x100);
  1133. else if (cpu_has_4kex)
  1134. memcpy((void *)(CAC_BASE + 0x180), &except_vec3_generic, 0x80);
  1135. else
  1136. memcpy((void *)(CAC_BASE + 0x080), &except_vec3_generic, 0x80);
  1137. signal_init();
  1138. #ifdef CONFIG_MIPS32_COMPAT
  1139. signal32_init();
  1140. #endif
  1141. flush_icache_range(ebase, ebase + 0x400);
  1142. flush_tlb_handlers();
  1143. }