intvec_64.S 34 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231
  1. /*
  2. * Copyright 2011 Tilera Corporation. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation, version 2.
  7. *
  8. * This program is distributed in the hope that it will be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  11. * NON INFRINGEMENT. See the GNU General Public License for
  12. * more details.
  13. *
  14. * Linux interrupt vectors.
  15. */
  16. #include <linux/linkage.h>
  17. #include <linux/errno.h>
  18. #include <linux/unistd.h>
  19. #include <asm/ptrace.h>
  20. #include <asm/thread_info.h>
  21. #include <asm/irqflags.h>
  22. #include <asm/asm-offsets.h>
  23. #include <asm/types.h>
  24. #include <hv/hypervisor.h>
  25. #include <arch/abi.h>
  26. #include <arch/interrupts.h>
  27. #include <arch/spr_def.h>
  28. #ifdef CONFIG_PREEMPT
  29. # error "No support for kernel preemption currently"
  30. #endif
  31. #define PTREGS_PTR(reg, ptreg) addli reg, sp, C_ABI_SAVE_AREA_SIZE + (ptreg)
  32. #define PTREGS_OFFSET_SYSCALL PTREGS_OFFSET_REG(TREG_SYSCALL_NR)
  33. .macro push_reg reg, ptr=sp, delta=-8
  34. {
  35. st \ptr, \reg
  36. addli \ptr, \ptr, \delta
  37. }
  38. .endm
  39. .macro pop_reg reg, ptr=sp, delta=8
  40. {
  41. ld \reg, \ptr
  42. addli \ptr, \ptr, \delta
  43. }
  44. .endm
  45. .macro pop_reg_zero reg, zreg, ptr=sp, delta=8
  46. {
  47. move \zreg, zero
  48. ld \reg, \ptr
  49. addi \ptr, \ptr, \delta
  50. }
  51. .endm
  52. .macro push_extra_callee_saves reg
  53. PTREGS_PTR(\reg, PTREGS_OFFSET_REG(51))
  54. push_reg r51, \reg
  55. push_reg r50, \reg
  56. push_reg r49, \reg
  57. push_reg r48, \reg
  58. push_reg r47, \reg
  59. push_reg r46, \reg
  60. push_reg r45, \reg
  61. push_reg r44, \reg
  62. push_reg r43, \reg
  63. push_reg r42, \reg
  64. push_reg r41, \reg
  65. push_reg r40, \reg
  66. push_reg r39, \reg
  67. push_reg r38, \reg
  68. push_reg r37, \reg
  69. push_reg r36, \reg
  70. push_reg r35, \reg
  71. push_reg r34, \reg, PTREGS_OFFSET_BASE - PTREGS_OFFSET_REG(34)
  72. .endm
  73. .macro panic str
  74. .pushsection .rodata, "a"
  75. 1:
  76. .asciz "\str"
  77. .popsection
  78. {
  79. moveli r0, hw2_last(1b)
  80. }
  81. {
  82. shl16insli r0, r0, hw1(1b)
  83. }
  84. {
  85. shl16insli r0, r0, hw0(1b)
  86. jal panic
  87. }
  88. .endm
  89. #ifdef __COLLECT_LINKER_FEEDBACK__
  90. .pushsection .text.intvec_feedback,"ax"
  91. intvec_feedback:
  92. .popsection
  93. #endif
  94. /*
  95. * Default interrupt handler.
  96. *
  97. * vecnum is where we'll put this code.
  98. * c_routine is the C routine we'll call.
  99. *
  100. * The C routine is passed two arguments:
  101. * - A pointer to the pt_regs state.
  102. * - The interrupt vector number.
  103. *
  104. * The "processing" argument specifies the code for processing
  105. * the interrupt. Defaults to "handle_interrupt".
  106. */
  107. .macro int_hand vecnum, vecname, c_routine, processing=handle_interrupt
  108. .org (\vecnum << 8)
  109. intvec_\vecname:
  110. /* Temporarily save a register so we have somewhere to work. */
  111. mtspr SPR_SYSTEM_SAVE_K_1, r0
  112. mfspr r0, SPR_EX_CONTEXT_K_1
  113. andi r0, r0, SPR_EX_CONTEXT_1_1__PL_MASK /* mask off ICS */
  114. .ifc \vecnum, INT_DOUBLE_FAULT
  115. /*
  116. * For double-faults from user-space, fall through to the normal
  117. * register save and stack setup path. Otherwise, it's the
  118. * hypervisor giving us one last chance to dump diagnostics, and we
  119. * branch to the kernel_double_fault routine to do so.
  120. */
  121. beqz r0, 1f
  122. j _kernel_double_fault
  123. 1:
  124. .else
  125. /*
  126. * If we're coming from user-space, then set sp to the top of
  127. * the kernel stack. Otherwise, assume sp is already valid.
  128. */
  129. {
  130. bnez r0, 0f
  131. move r0, sp
  132. }
  133. .endif
  134. .ifc \c_routine, do_page_fault
  135. /*
  136. * The page_fault handler may be downcalled directly by the
  137. * hypervisor even when Linux is running and has ICS set.
  138. *
  139. * In this case the contents of EX_CONTEXT_K_1 reflect the
  140. * previous fault and can't be relied on to choose whether or
  141. * not to reinitialize the stack pointer. So we add a test
  142. * to see whether SYSTEM_SAVE_K_2 has the high bit set,
  143. * and if so we don't reinitialize sp, since we must be coming
  144. * from Linux. (In fact the precise case is !(val & ~1),
  145. * but any Linux PC has to have the high bit set.)
  146. *
  147. * Note that the hypervisor *always* sets SYSTEM_SAVE_K_2 for
  148. * any path that turns into a downcall to one of our TLB handlers.
  149. *
  150. * FIXME: if we end up never using this path, perhaps we should
  151. * prevent the hypervisor from generating downcalls in this case.
  152. * The advantage of getting a downcall is we can panic in Linux.
  153. */
  154. mfspr r0, SPR_SYSTEM_SAVE_K_2
  155. {
  156. bltz r0, 0f /* high bit in S_S_1_2 is for a PC to use */
  157. move r0, sp
  158. }
  159. .endif
  160. /*
  161. * SYSTEM_SAVE_K_0 holds the cpu number in the low bits, and
  162. * the current stack top in the higher bits. So we recover
  163. * our stack top by just masking off the low bits, then
  164. * point sp at the top aligned address on the actual stack page.
  165. */
  166. mfspr r0, SPR_SYSTEM_SAVE_K_0
  167. mm r0, zero, LOG2_THREAD_SIZE, 63
  168. 0:
  169. /*
  170. * Align the stack mod 64 so we can properly predict what
  171. * cache lines we need to write-hint to reduce memory fetch
  172. * latency as we enter the kernel. The layout of memory is
  173. * as follows, with cache line 0 at the lowest VA, and cache
  174. * line 8 just below the r0 value this "andi" computes.
  175. * Note that we never write to cache line 8, and we skip
  176. * cache lines 1-3 for syscalls.
  177. *
  178. * cache line 8: ptregs padding (two words)
  179. * cache line 7: sp, lr, pc, ex1, faultnum, orig_r0, flags, cmpexch
  180. * cache line 6: r46...r53 (tp)
  181. * cache line 5: r38...r45
  182. * cache line 4: r30...r37
  183. * cache line 3: r22...r29
  184. * cache line 2: r14...r21
  185. * cache line 1: r6...r13
  186. * cache line 0: 2 x frame, r0..r5
  187. */
  188. andi r0, r0, -64
  189. /*
  190. * Push the first four registers on the stack, so that we can set
  191. * them to vector-unique values before we jump to the common code.
  192. *
  193. * Registers are pushed on the stack as a struct pt_regs,
  194. * with the sp initially just above the struct, and when we're
  195. * done, sp points to the base of the struct, minus
  196. * C_ABI_SAVE_AREA_SIZE, so we can directly jal to C code.
  197. *
  198. * This routine saves just the first four registers, plus the
  199. * stack context so we can do proper backtracing right away,
  200. * and defers to handle_interrupt to save the rest.
  201. * The backtracer needs pc, ex1, lr, sp, r52, and faultnum.
  202. */
  203. addli r0, r0, PTREGS_OFFSET_LR - (PTREGS_SIZE + KSTK_PTREGS_GAP)
  204. wh64 r0 /* cache line 7 */
  205. {
  206. st r0, lr
  207. addli r0, r0, PTREGS_OFFSET_SP - PTREGS_OFFSET_LR
  208. }
  209. {
  210. st r0, sp
  211. addli sp, r0, PTREGS_OFFSET_REG(52) - PTREGS_OFFSET_SP
  212. }
  213. wh64 sp /* cache line 6 */
  214. {
  215. st sp, r52
  216. addli sp, sp, PTREGS_OFFSET_REG(1) - PTREGS_OFFSET_REG(52)
  217. }
  218. wh64 sp /* cache line 0 */
  219. {
  220. st sp, r1
  221. addli sp, sp, PTREGS_OFFSET_REG(2) - PTREGS_OFFSET_REG(1)
  222. }
  223. {
  224. st sp, r2
  225. addli sp, sp, PTREGS_OFFSET_REG(3) - PTREGS_OFFSET_REG(2)
  226. }
  227. {
  228. st sp, r3
  229. addli sp, sp, PTREGS_OFFSET_PC - PTREGS_OFFSET_REG(3)
  230. }
  231. mfspr r0, SPR_EX_CONTEXT_K_0
  232. .ifc \processing,handle_syscall
  233. /*
  234. * Bump the saved PC by one bundle so that when we return, we won't
  235. * execute the same swint instruction again. We need to do this while
  236. * we're in the critical section.
  237. */
  238. addi r0, r0, 8
  239. .endif
  240. {
  241. st sp, r0
  242. addli sp, sp, PTREGS_OFFSET_EX1 - PTREGS_OFFSET_PC
  243. }
  244. mfspr r0, SPR_EX_CONTEXT_K_1
  245. {
  246. st sp, r0
  247. addi sp, sp, PTREGS_OFFSET_FAULTNUM - PTREGS_OFFSET_EX1
  248. /*
  249. * Use r0 for syscalls so it's a temporary; use r1 for interrupts
  250. * so that it gets passed through unchanged to the handler routine.
  251. * Note that the .if conditional confusingly spans bundles.
  252. */
  253. .ifc \processing,handle_syscall
  254. movei r0, \vecnum
  255. }
  256. {
  257. st sp, r0
  258. .else
  259. movei r1, \vecnum
  260. }
  261. {
  262. st sp, r1
  263. .endif
  264. addli sp, sp, PTREGS_OFFSET_REG(0) - PTREGS_OFFSET_FAULTNUM
  265. }
  266. mfspr r0, SPR_SYSTEM_SAVE_K_1 /* Original r0 */
  267. {
  268. st sp, r0
  269. addi sp, sp, -PTREGS_OFFSET_REG(0) - 8
  270. }
  271. {
  272. st sp, zero /* write zero into "Next SP" frame pointer */
  273. addi sp, sp, -8 /* leave SP pointing at bottom of frame */
  274. }
  275. .ifc \processing,handle_syscall
  276. j handle_syscall
  277. .else
  278. /* Capture per-interrupt SPR context to registers. */
  279. .ifc \c_routine, do_page_fault
  280. mfspr r2, SPR_SYSTEM_SAVE_K_3 /* address of page fault */
  281. mfspr r3, SPR_SYSTEM_SAVE_K_2 /* info about page fault */
  282. .else
  283. .ifc \vecnum, INT_ILL_TRANS
  284. mfspr r2, ILL_TRANS_REASON
  285. .else
  286. .ifc \vecnum, INT_DOUBLE_FAULT
  287. mfspr r2, SPR_SYSTEM_SAVE_K_2 /* double fault info from HV */
  288. .else
  289. .ifc \c_routine, do_trap
  290. mfspr r2, GPV_REASON
  291. .else
  292. .ifc \c_routine, op_handle_perf_interrupt
  293. mfspr r2, PERF_COUNT_STS
  294. #if CHIP_HAS_AUX_PERF_COUNTERS()
  295. .else
  296. .ifc \c_routine, op_handle_aux_perf_interrupt
  297. mfspr r2, AUX_PERF_COUNT_STS
  298. .endif
  299. #endif
  300. .endif
  301. .endif
  302. .endif
  303. .endif
  304. .endif
  305. /* Put function pointer in r0 */
  306. moveli r0, hw2_last(\c_routine)
  307. shl16insli r0, r0, hw1(\c_routine)
  308. {
  309. shl16insli r0, r0, hw0(\c_routine)
  310. j \processing
  311. }
  312. .endif
  313. ENDPROC(intvec_\vecname)
  314. #ifdef __COLLECT_LINKER_FEEDBACK__
  315. .pushsection .text.intvec_feedback,"ax"
  316. .org (\vecnum << 5)
  317. FEEDBACK_ENTER_EXPLICIT(intvec_\vecname, .intrpt1, 1 << 8)
  318. jrp lr
  319. .popsection
  320. #endif
  321. .endm
  322. /*
  323. * Save the rest of the registers that we didn't save in the actual
  324. * vector itself. We can't use r0-r10 inclusive here.
  325. */
  326. .macro finish_interrupt_save, function
  327. /* If it's a syscall, save a proper orig_r0, otherwise just zero. */
  328. PTREGS_PTR(r52, PTREGS_OFFSET_ORIG_R0)
  329. {
  330. .ifc \function,handle_syscall
  331. st r52, r0
  332. .else
  333. st r52, zero
  334. .endif
  335. PTREGS_PTR(r52, PTREGS_OFFSET_TP)
  336. }
  337. st r52, tp
  338. {
  339. mfspr tp, CMPEXCH_VALUE
  340. PTREGS_PTR(r52, PTREGS_OFFSET_CMPEXCH)
  341. }
  342. /*
  343. * For ordinary syscalls, we save neither caller- nor callee-
  344. * save registers, since the syscall invoker doesn't expect the
  345. * caller-saves to be saved, and the called kernel functions will
  346. * take care of saving the callee-saves for us.
  347. *
  348. * For interrupts we save just the caller-save registers. Saving
  349. * them is required (since the "caller" can't save them). Again,
  350. * the called kernel functions will restore the callee-save
  351. * registers for us appropriately.
  352. *
  353. * On return, we normally restore nothing special for syscalls,
  354. * and just the caller-save registers for interrupts.
  355. *
  356. * However, there are some important caveats to all this:
  357. *
  358. * - We always save a few callee-save registers to give us
  359. * some scratchpad registers to carry across function calls.
  360. *
  361. * - fork/vfork/etc require us to save all the callee-save
  362. * registers, which we do in PTREGS_SYSCALL_ALL_REGS, below.
  363. *
  364. * - We always save r0..r5 and r10 for syscalls, since we need
  365. * to reload them a bit later for the actual kernel call, and
  366. * since we might need them for -ERESTARTNOINTR, etc.
  367. *
  368. * - Before invoking a signal handler, we save the unsaved
  369. * callee-save registers so they are visible to the
  370. * signal handler or any ptracer.
  371. *
  372. * - If the unsaved callee-save registers are modified, we set
  373. * a bit in pt_regs so we know to reload them from pt_regs
  374. * and not just rely on the kernel function unwinding.
  375. * (Done for ptrace register writes and SA_SIGINFO handler.)
  376. */
  377. {
  378. st r52, tp
  379. PTREGS_PTR(r52, PTREGS_OFFSET_REG(33))
  380. }
  381. wh64 r52 /* cache line 4 */
  382. push_reg r33, r52
  383. push_reg r32, r52
  384. push_reg r31, r52
  385. .ifc \function,handle_syscall
  386. push_reg r30, r52, PTREGS_OFFSET_SYSCALL - PTREGS_OFFSET_REG(30)
  387. push_reg TREG_SYSCALL_NR_NAME, r52, \
  388. PTREGS_OFFSET_REG(5) - PTREGS_OFFSET_SYSCALL
  389. .else
  390. push_reg r30, r52, PTREGS_OFFSET_REG(29) - PTREGS_OFFSET_REG(30)
  391. wh64 r52 /* cache line 3 */
  392. push_reg r29, r52
  393. push_reg r28, r52
  394. push_reg r27, r52
  395. push_reg r26, r52
  396. push_reg r25, r52
  397. push_reg r24, r52
  398. push_reg r23, r52
  399. push_reg r22, r52
  400. wh64 r52 /* cache line 2 */
  401. push_reg r21, r52
  402. push_reg r20, r52
  403. push_reg r19, r52
  404. push_reg r18, r52
  405. push_reg r17, r52
  406. push_reg r16, r52
  407. push_reg r15, r52
  408. push_reg r14, r52
  409. wh64 r52 /* cache line 1 */
  410. push_reg r13, r52
  411. push_reg r12, r52
  412. push_reg r11, r52
  413. push_reg r10, r52
  414. push_reg r9, r52
  415. push_reg r8, r52
  416. push_reg r7, r52
  417. push_reg r6, r52
  418. .endif
  419. push_reg r5, r52
  420. st r52, r4
  421. /* Load tp with our per-cpu offset. */
  422. #ifdef CONFIG_SMP
  423. {
  424. mfspr r20, SPR_SYSTEM_SAVE_K_0
  425. moveli r21, hw2_last(__per_cpu_offset)
  426. }
  427. {
  428. shl16insli r21, r21, hw1(__per_cpu_offset)
  429. bfextu r20, r20, 0, LOG2_THREAD_SIZE-1
  430. }
  431. shl16insli r21, r21, hw0(__per_cpu_offset)
  432. shl3add r20, r20, r21
  433. ld tp, r20
  434. #else
  435. move tp, zero
  436. #endif
  437. /*
  438. * If we will be returning to the kernel, we will need to
  439. * reset the interrupt masks to the state they had before.
  440. * Set DISABLE_IRQ in flags iff we came from PL1 with irqs disabled.
  441. */
  442. mfspr r32, SPR_EX_CONTEXT_K_1
  443. {
  444. andi r32, r32, SPR_EX_CONTEXT_1_1__PL_MASK /* mask off ICS */
  445. PTREGS_PTR(r21, PTREGS_OFFSET_FLAGS)
  446. }
  447. beqzt r32, 1f /* zero if from user space */
  448. IRQS_DISABLED(r32) /* zero if irqs enabled */
  449. #if PT_FLAGS_DISABLE_IRQ != 1
  450. # error Value of IRQS_DISABLED used to set PT_FLAGS_DISABLE_IRQ; fix
  451. #endif
  452. 1:
  453. .ifnc \function,handle_syscall
  454. /* Record the fact that we saved the caller-save registers above. */
  455. ori r32, r32, PT_FLAGS_CALLER_SAVES
  456. .endif
  457. st r21, r32
  458. #ifdef __COLLECT_LINKER_FEEDBACK__
  459. /*
  460. * Notify the feedback routines that we were in the
  461. * appropriate fixed interrupt vector area. Note that we
  462. * still have ICS set at this point, so we can't invoke any
  463. * atomic operations or we will panic. The feedback
  464. * routines internally preserve r0..r10 and r30 up.
  465. */
  466. .ifnc \function,handle_syscall
  467. shli r20, r1, 5
  468. .else
  469. moveli r20, INT_SWINT_1 << 5
  470. .endif
  471. moveli r21, hw2_last(intvec_feedback)
  472. shl16insli r21, r21, hw1(intvec_feedback)
  473. shl16insli r21, r21, hw0(intvec_feedback)
  474. add r20, r20, r21
  475. jalr r20
  476. /* And now notify the feedback routines that we are here. */
  477. FEEDBACK_ENTER(\function)
  478. #endif
  479. /*
  480. * we've captured enough state to the stack (including in
  481. * particular our EX_CONTEXT state) that we can now release
  482. * the interrupt critical section and replace it with our
  483. * standard "interrupts disabled" mask value. This allows
  484. * synchronous interrupts (and profile interrupts) to punch
  485. * through from this point onwards.
  486. */
  487. .ifc \function,handle_nmi
  488. IRQ_DISABLE_ALL(r20)
  489. .else
  490. IRQ_DISABLE(r20, r21)
  491. .endif
  492. mtspr INTERRUPT_CRITICAL_SECTION, zero
  493. /*
  494. * Prepare the first 256 stack bytes to be rapidly accessible
  495. * without having to fetch the background data.
  496. */
  497. addi r52, sp, -64
  498. {
  499. wh64 r52
  500. addi r52, r52, -64
  501. }
  502. {
  503. wh64 r52
  504. addi r52, r52, -64
  505. }
  506. {
  507. wh64 r52
  508. addi r52, r52, -64
  509. }
  510. wh64 r52
  511. #ifdef CONFIG_TRACE_IRQFLAGS
  512. .ifnc \function,handle_nmi
  513. /*
  514. * We finally have enough state set up to notify the irq
  515. * tracing code that irqs were disabled on entry to the handler.
  516. * The TRACE_IRQS_OFF call clobbers registers r0-r29.
  517. * For syscalls, we already have the register state saved away
  518. * on the stack, so we don't bother to do any register saves here,
  519. * and later we pop the registers back off the kernel stack.
  520. * For interrupt handlers, save r0-r3 in callee-saved registers.
  521. */
  522. .ifnc \function,handle_syscall
  523. { move r30, r0; move r31, r1 }
  524. { move r32, r2; move r33, r3 }
  525. .endif
  526. TRACE_IRQS_OFF
  527. .ifnc \function,handle_syscall
  528. { move r0, r30; move r1, r31 }
  529. { move r2, r32; move r3, r33 }
  530. .endif
  531. .endif
  532. #endif
  533. .endm
  534. /*
  535. * Redispatch a downcall.
  536. */
  537. .macro dc_dispatch vecnum, vecname
  538. .org (\vecnum << 8)
  539. intvec_\vecname:
  540. j hv_downcall_dispatch
  541. ENDPROC(intvec_\vecname)
  542. .endm
  543. /*
  544. * Common code for most interrupts. The C function we're eventually
  545. * going to is in r0, and the faultnum is in r1; the original
  546. * values for those registers are on the stack.
  547. */
  548. .pushsection .text.handle_interrupt,"ax"
  549. handle_interrupt:
  550. finish_interrupt_save handle_interrupt
  551. /* Jump to the C routine; it should enable irqs as soon as possible. */
  552. {
  553. jalr r0
  554. PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
  555. }
  556. FEEDBACK_REENTER(handle_interrupt)
  557. {
  558. movei r30, 0 /* not an NMI */
  559. j interrupt_return
  560. }
  561. STD_ENDPROC(handle_interrupt)
  562. /*
  563. * This routine takes a boolean in r30 indicating if this is an NMI.
  564. * If so, we also expect a boolean in r31 indicating whether to
  565. * re-enable the oprofile interrupts.
  566. */
  567. STD_ENTRY(interrupt_return)
  568. /* If we're resuming to kernel space, don't check thread flags. */
  569. {
  570. bnez r30, .Lrestore_all /* NMIs don't special-case user-space */
  571. PTREGS_PTR(r29, PTREGS_OFFSET_EX1)
  572. }
  573. ld r29, r29
  574. andi r29, r29, SPR_EX_CONTEXT_1_1__PL_MASK /* mask off ICS */
  575. {
  576. beqzt r29, .Lresume_userspace
  577. PTREGS_PTR(r29, PTREGS_OFFSET_PC)
  578. }
  579. /* If we're resuming to _cpu_idle_nap, bump PC forward by 8. */
  580. moveli r27, hw2_last(_cpu_idle_nap)
  581. {
  582. ld r28, r29
  583. shl16insli r27, r27, hw1(_cpu_idle_nap)
  584. }
  585. {
  586. shl16insli r27, r27, hw0(_cpu_idle_nap)
  587. }
  588. {
  589. cmpeq r27, r27, r28
  590. }
  591. {
  592. blbc r27, .Lrestore_all
  593. addi r28, r28, 8
  594. }
  595. st r29, r28
  596. j .Lrestore_all
  597. .Lresume_userspace:
  598. FEEDBACK_REENTER(interrupt_return)
  599. /*
  600. * Disable interrupts so as to make sure we don't
  601. * miss an interrupt that sets any of the thread flags (like
  602. * need_resched or sigpending) between sampling and the iret.
  603. * Routines like schedule() or do_signal() may re-enable
  604. * interrupts before returning.
  605. */
  606. IRQ_DISABLE(r20, r21)
  607. TRACE_IRQS_OFF /* Note: clobbers registers r0-r29 */
  608. /* Get base of stack in r32; note r30/31 are used as arguments here. */
  609. GET_THREAD_INFO(r32)
  610. /* Check to see if there is any work to do before returning to user. */
  611. {
  612. addi r29, r32, THREAD_INFO_FLAGS_OFFSET
  613. moveli r1, hw1_last(_TIF_ALLWORK_MASK)
  614. }
  615. {
  616. ld r29, r29
  617. shl16insli r1, r1, hw0(_TIF_ALLWORK_MASK)
  618. }
  619. and r1, r29, r1
  620. beqzt r1, .Lrestore_all
  621. /*
  622. * Make sure we have all the registers saved for signal
  623. * handling or single-step. Call out to C code to figure out
  624. * exactly what we need to do for each flag bit, then if
  625. * necessary, reload the flags and recheck.
  626. */
  627. push_extra_callee_saves r0
  628. {
  629. PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
  630. jal do_work_pending
  631. }
  632. bnez r0, .Lresume_userspace
  633. /*
  634. * In the NMI case we
  635. * omit the call to single_process_check_nohz, which normally checks
  636. * to see if we should start or stop the scheduler tick, because
  637. * we can't call arbitrary Linux code from an NMI context.
  638. * We always call the homecache TLB deferral code to re-trigger
  639. * the deferral mechanism.
  640. *
  641. * The other chunk of responsibility this code has is to reset the
  642. * interrupt masks appropriately to reset irqs and NMIs. We have
  643. * to call TRACE_IRQS_OFF and TRACE_IRQS_ON to support all the
  644. * lockdep-type stuff, but we can't set ICS until afterwards, since
  645. * ICS can only be used in very tight chunks of code to avoid
  646. * tripping over various assertions that it is off.
  647. */
  648. .Lrestore_all:
  649. PTREGS_PTR(r0, PTREGS_OFFSET_EX1)
  650. {
  651. ld r0, r0
  652. PTREGS_PTR(r32, PTREGS_OFFSET_FLAGS)
  653. }
  654. {
  655. andi r0, r0, SPR_EX_CONTEXT_1_1__PL_MASK
  656. ld r32, r32
  657. }
  658. bnez r0, 1f
  659. j 2f
  660. #if PT_FLAGS_DISABLE_IRQ != 1
  661. # error Assuming PT_FLAGS_DISABLE_IRQ == 1 so we can use blbct below
  662. #endif
  663. 1: blbct r32, 2f
  664. IRQ_DISABLE(r20,r21)
  665. TRACE_IRQS_OFF
  666. movei r0, 1
  667. mtspr INTERRUPT_CRITICAL_SECTION, r0
  668. beqzt r30, .Lrestore_regs
  669. j 3f
  670. 2: TRACE_IRQS_ON
  671. movei r0, 1
  672. mtspr INTERRUPT_CRITICAL_SECTION, r0
  673. IRQ_ENABLE(r20, r21)
  674. beqzt r30, .Lrestore_regs
  675. 3:
  676. /*
  677. * We now commit to returning from this interrupt, since we will be
  678. * doing things like setting EX_CONTEXT SPRs and unwinding the stack
  679. * frame. No calls should be made to any other code after this point.
  680. * This code should only be entered with ICS set.
  681. * r32 must still be set to ptregs.flags.
  682. * We launch loads to each cache line separately first, so we can
  683. * get some parallelism out of the memory subsystem.
  684. * We start zeroing caller-saved registers throughout, since
  685. * that will save some cycles if this turns out to be a syscall.
  686. */
  687. .Lrestore_regs:
  688. FEEDBACK_REENTER(interrupt_return) /* called from elsewhere */
  689. /*
  690. * Rotate so we have one high bit and one low bit to test.
  691. * - low bit says whether to restore all the callee-saved registers,
  692. * or just r30-r33, and r52 up.
  693. * - high bit (i.e. sign bit) says whether to restore all the
  694. * caller-saved registers, or just r0.
  695. */
  696. #if PT_FLAGS_CALLER_SAVES != 2 || PT_FLAGS_RESTORE_REGS != 4
  697. # error Rotate trick does not work :-)
  698. #endif
  699. {
  700. rotli r20, r32, 62
  701. PTREGS_PTR(sp, PTREGS_OFFSET_REG(0))
  702. }
  703. /*
  704. * Load cache lines 0, 4, 6 and 7, in that order, then use
  705. * the last loaded value, which makes it likely that the other
  706. * cache lines have also loaded, at which point we should be
  707. * able to safely read all the remaining words on those cache
  708. * lines without waiting for the memory subsystem.
  709. */
  710. pop_reg r0, sp, PTREGS_OFFSET_REG(30) - PTREGS_OFFSET_REG(0)
  711. pop_reg r30, sp, PTREGS_OFFSET_REG(52) - PTREGS_OFFSET_REG(30)
  712. pop_reg_zero r52, r3, sp, PTREGS_OFFSET_CMPEXCH - PTREGS_OFFSET_REG(52)
  713. pop_reg_zero r21, r27, sp, PTREGS_OFFSET_EX1 - PTREGS_OFFSET_CMPEXCH
  714. pop_reg_zero lr, r2, sp, PTREGS_OFFSET_PC - PTREGS_OFFSET_EX1
  715. {
  716. mtspr CMPEXCH_VALUE, r21
  717. move r4, zero
  718. }
  719. pop_reg r21, sp, PTREGS_OFFSET_REG(31) - PTREGS_OFFSET_PC
  720. {
  721. mtspr SPR_EX_CONTEXT_K_1, lr
  722. andi lr, lr, SPR_EX_CONTEXT_1_1__PL_MASK /* mask off ICS */
  723. }
  724. {
  725. mtspr SPR_EX_CONTEXT_K_0, r21
  726. move r5, zero
  727. }
  728. /* Restore callee-saveds that we actually use. */
  729. pop_reg_zero r31, r6
  730. pop_reg_zero r32, r7
  731. pop_reg_zero r33, r8, sp, PTREGS_OFFSET_REG(29) - PTREGS_OFFSET_REG(33)
  732. /*
  733. * If we modified other callee-saveds, restore them now.
  734. * This is rare, but could be via ptrace or signal handler.
  735. */
  736. {
  737. move r9, zero
  738. blbs r20, .Lrestore_callees
  739. }
  740. .Lcontinue_restore_regs:
  741. /* Check if we're returning from a syscall. */
  742. {
  743. move r10, zero
  744. bltzt r20, 1f /* no, so go restore callee-save registers */
  745. }
  746. /*
  747. * Check if we're returning to userspace.
  748. * Note that if we're not, we don't worry about zeroing everything.
  749. */
  750. {
  751. addli sp, sp, PTREGS_OFFSET_LR - PTREGS_OFFSET_REG(29)
  752. bnez lr, .Lkernel_return
  753. }
  754. /*
  755. * On return from syscall, we've restored r0 from pt_regs, but we
  756. * clear the remainder of the caller-saved registers. We could
  757. * restore the syscall arguments, but there's not much point,
  758. * and it ensures user programs aren't trying to use the
  759. * caller-saves if we clear them, as well as avoiding leaking
  760. * kernel pointers into userspace.
  761. */
  762. pop_reg_zero lr, r11, sp, PTREGS_OFFSET_TP - PTREGS_OFFSET_LR
  763. pop_reg_zero tp, r12, sp, PTREGS_OFFSET_SP - PTREGS_OFFSET_TP
  764. {
  765. ld sp, sp
  766. move r13, zero
  767. move r14, zero
  768. }
  769. { move r15, zero; move r16, zero }
  770. { move r17, zero; move r18, zero }
  771. { move r19, zero; move r20, zero }
  772. { move r21, zero; move r22, zero }
  773. { move r23, zero; move r24, zero }
  774. { move r25, zero; move r26, zero }
  775. /* Set r1 to errno if we are returning an error, otherwise zero. */
  776. {
  777. moveli r29, 4096
  778. sub r1, zero, r0
  779. }
  780. {
  781. move r28, zero
  782. cmpltu r29, r1, r29
  783. }
  784. {
  785. mnz r1, r29, r1
  786. move r29, zero
  787. }
  788. iret
  789. /*
  790. * Not a syscall, so restore caller-saved registers.
  791. * First kick off loads for cache lines 1-3, which we're touching
  792. * for the first time here.
  793. */
  794. .align 64
  795. 1: pop_reg r29, sp, PTREGS_OFFSET_REG(21) - PTREGS_OFFSET_REG(29)
  796. pop_reg r21, sp, PTREGS_OFFSET_REG(13) - PTREGS_OFFSET_REG(21)
  797. pop_reg r13, sp, PTREGS_OFFSET_REG(1) - PTREGS_OFFSET_REG(13)
  798. pop_reg r1
  799. pop_reg r2
  800. pop_reg r3
  801. pop_reg r4
  802. pop_reg r5
  803. pop_reg r6
  804. pop_reg r7
  805. pop_reg r8
  806. pop_reg r9
  807. pop_reg r10
  808. pop_reg r11
  809. pop_reg r12, sp, 16
  810. /* r13 already restored above */
  811. pop_reg r14
  812. pop_reg r15
  813. pop_reg r16
  814. pop_reg r17
  815. pop_reg r18
  816. pop_reg r19
  817. pop_reg r20, sp, 16
  818. /* r21 already restored above */
  819. pop_reg r22
  820. pop_reg r23
  821. pop_reg r24
  822. pop_reg r25
  823. pop_reg r26
  824. pop_reg r27
  825. pop_reg r28, sp, PTREGS_OFFSET_LR - PTREGS_OFFSET_REG(28)
  826. /* r29 already restored above */
  827. bnez lr, .Lkernel_return
  828. pop_reg lr, sp, PTREGS_OFFSET_TP - PTREGS_OFFSET_LR
  829. pop_reg tp, sp, PTREGS_OFFSET_SP - PTREGS_OFFSET_TP
  830. ld sp, sp
  831. iret
  832. /*
  833. * We can't restore tp when in kernel mode, since a thread might
  834. * have migrated from another cpu and brought a stale tp value.
  835. */
  836. .Lkernel_return:
  837. pop_reg lr, sp, PTREGS_OFFSET_SP - PTREGS_OFFSET_LR
  838. ld sp, sp
  839. iret
  840. /* Restore callee-saved registers from r34 to r51. */
  841. .Lrestore_callees:
  842. addli sp, sp, PTREGS_OFFSET_REG(34) - PTREGS_OFFSET_REG(29)
  843. pop_reg r34
  844. pop_reg r35
  845. pop_reg r36
  846. pop_reg r37
  847. pop_reg r38
  848. pop_reg r39
  849. pop_reg r40
  850. pop_reg r41
  851. pop_reg r42
  852. pop_reg r43
  853. pop_reg r44
  854. pop_reg r45
  855. pop_reg r46
  856. pop_reg r47
  857. pop_reg r48
  858. pop_reg r49
  859. pop_reg r50
  860. pop_reg r51, sp, PTREGS_OFFSET_REG(29) - PTREGS_OFFSET_REG(51)
  861. j .Lcontinue_restore_regs
  862. STD_ENDPROC(interrupt_return)
  863. /*
  864. * "NMI" interrupts mask ALL interrupts before calling the
  865. * handler, and don't check thread flags, etc., on the way
  866. * back out. In general, the only things we do here for NMIs
  867. * are register save/restore and dataplane kernel-TLB management.
  868. * We don't (for example) deal with start/stop of the sched tick.
  869. */
  870. .pushsection .text.handle_nmi,"ax"
  871. handle_nmi:
  872. finish_interrupt_save handle_nmi
  873. {
  874. jalr r0
  875. PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
  876. }
  877. FEEDBACK_REENTER(handle_nmi)
  878. {
  879. movei r30, 1
  880. move r31, r0
  881. }
  882. j interrupt_return
  883. STD_ENDPROC(handle_nmi)
  884. /*
  885. * Parallel code for syscalls to handle_interrupt.
  886. */
  887. .pushsection .text.handle_syscall,"ax"
  888. handle_syscall:
  889. finish_interrupt_save handle_syscall
  890. /* Enable irqs. */
  891. TRACE_IRQS_ON
  892. IRQ_ENABLE(r20, r21)
  893. /* Bump the counter for syscalls made on this tile. */
  894. moveli r20, hw2_last(irq_stat + IRQ_CPUSTAT_SYSCALL_COUNT_OFFSET)
  895. shl16insli r20, r20, hw1(irq_stat + IRQ_CPUSTAT_SYSCALL_COUNT_OFFSET)
  896. shl16insli r20, r20, hw0(irq_stat + IRQ_CPUSTAT_SYSCALL_COUNT_OFFSET)
  897. add r20, r20, tp
  898. ld4s r21, r20
  899. addi r21, r21, 1
  900. st4 r20, r21
  901. /* Trace syscalls, if requested. */
  902. GET_THREAD_INFO(r31)
  903. addi r31, r31, THREAD_INFO_FLAGS_OFFSET
  904. ld r30, r31
  905. andi r30, r30, _TIF_SYSCALL_TRACE
  906. {
  907. addi r30, r31, THREAD_INFO_STATUS_OFFSET - THREAD_INFO_FLAGS_OFFSET
  908. beqzt r30, .Lrestore_syscall_regs
  909. }
  910. jal do_syscall_trace
  911. FEEDBACK_REENTER(handle_syscall)
  912. /*
  913. * We always reload our registers from the stack at this
  914. * point. They might be valid, if we didn't build with
  915. * TRACE_IRQFLAGS, and this isn't a dataplane tile, and we're not
  916. * doing syscall tracing, but there are enough cases now that it
  917. * seems simplest just to do the reload unconditionally.
  918. */
  919. .Lrestore_syscall_regs:
  920. {
  921. ld r30, r30
  922. PTREGS_PTR(r11, PTREGS_OFFSET_REG(0))
  923. }
  924. pop_reg r0, r11
  925. pop_reg r1, r11
  926. pop_reg r2, r11
  927. pop_reg r3, r11
  928. pop_reg r4, r11
  929. pop_reg r5, r11, PTREGS_OFFSET_SYSCALL - PTREGS_OFFSET_REG(5)
  930. {
  931. ld TREG_SYSCALL_NR_NAME, r11
  932. moveli r21, __NR_syscalls
  933. }
  934. /* Ensure that the syscall number is within the legal range. */
  935. {
  936. moveli r20, hw2(sys_call_table)
  937. blbs r30, .Lcompat_syscall
  938. }
  939. {
  940. cmpltu r21, TREG_SYSCALL_NR_NAME, r21
  941. shl16insli r20, r20, hw1(sys_call_table)
  942. }
  943. {
  944. blbc r21, .Linvalid_syscall
  945. shl16insli r20, r20, hw0(sys_call_table)
  946. }
  947. .Lload_syscall_pointer:
  948. shl3add r20, TREG_SYSCALL_NR_NAME, r20
  949. ld r20, r20
  950. /* Jump to syscall handler. */
  951. jalr r20
  952. .Lhandle_syscall_link: /* value of "lr" after "jalr r20" above */
  953. /*
  954. * Write our r0 onto the stack so it gets restored instead
  955. * of whatever the user had there before.
  956. * In compat mode, sign-extend r0 before storing it.
  957. */
  958. {
  959. PTREGS_PTR(r29, PTREGS_OFFSET_REG(0))
  960. blbct r30, 1f
  961. }
  962. addxi r0, r0, 0
  963. 1: st r29, r0
  964. .Lsyscall_sigreturn_skip:
  965. FEEDBACK_REENTER(handle_syscall)
  966. /* Do syscall trace again, if requested. */
  967. ld r30, r31
  968. andi r30, r30, _TIF_SYSCALL_TRACE
  969. beqzt r30, 1f
  970. jal do_syscall_trace
  971. FEEDBACK_REENTER(handle_syscall)
  972. 1: j .Lresume_userspace /* jump into middle of interrupt_return */
  973. .Lcompat_syscall:
  974. /*
  975. * Load the base of the compat syscall table in r20, and
  976. * range-check the syscall number (duplicated from 64-bit path).
  977. * Sign-extend all the user's passed arguments to make them consistent.
  978. * Also save the original "r(n)" values away in "r(11+n)" in
  979. * case the syscall table entry wants to validate them.
  980. */
  981. moveli r20, hw2(compat_sys_call_table)
  982. {
  983. cmpltu r21, TREG_SYSCALL_NR_NAME, r21
  984. shl16insli r20, r20, hw1(compat_sys_call_table)
  985. }
  986. {
  987. blbc r21, .Linvalid_syscall
  988. shl16insli r20, r20, hw0(compat_sys_call_table)
  989. }
  990. { move r11, r0; addxi r0, r0, 0 }
  991. { move r12, r1; addxi r1, r1, 0 }
  992. { move r13, r2; addxi r2, r2, 0 }
  993. { move r14, r3; addxi r3, r3, 0 }
  994. { move r15, r4; addxi r4, r4, 0 }
  995. { move r16, r5; addxi r5, r5, 0 }
  996. j .Lload_syscall_pointer
  997. .Linvalid_syscall:
  998. /* Report an invalid syscall back to the user program */
  999. {
  1000. PTREGS_PTR(r29, PTREGS_OFFSET_REG(0))
  1001. movei r28, -ENOSYS
  1002. }
  1003. st r29, r28
  1004. j .Lresume_userspace /* jump into middle of interrupt_return */
  1005. STD_ENDPROC(handle_syscall)
  1006. /* Return the address for oprofile to suppress in backtraces. */
  1007. STD_ENTRY_SECTION(handle_syscall_link_address, .text.handle_syscall)
  1008. lnk r0
  1009. {
  1010. addli r0, r0, .Lhandle_syscall_link - .
  1011. jrp lr
  1012. }
  1013. STD_ENDPROC(handle_syscall_link_address)
  1014. STD_ENTRY(ret_from_fork)
  1015. jal sim_notify_fork
  1016. jal schedule_tail
  1017. FEEDBACK_REENTER(ret_from_fork)
  1018. j .Lresume_userspace
  1019. STD_ENDPROC(ret_from_fork)
  1020. /* Various stub interrupt handlers and syscall handlers */
  1021. STD_ENTRY_LOCAL(_kernel_double_fault)
  1022. mfspr r1, SPR_EX_CONTEXT_K_0
  1023. move r2, lr
  1024. move r3, sp
  1025. move r4, r52
  1026. addi sp, sp, -C_ABI_SAVE_AREA_SIZE
  1027. j kernel_double_fault
  1028. STD_ENDPROC(_kernel_double_fault)
  1029. STD_ENTRY_LOCAL(bad_intr)
  1030. mfspr r2, SPR_EX_CONTEXT_K_0
  1031. panic "Unhandled interrupt %#x: PC %#lx"
  1032. STD_ENDPROC(bad_intr)
  1033. /* Put address of pt_regs in reg and jump. */
  1034. #define PTREGS_SYSCALL(x, reg) \
  1035. STD_ENTRY(_##x); \
  1036. { \
  1037. PTREGS_PTR(reg, PTREGS_OFFSET_BASE); \
  1038. j x \
  1039. }; \
  1040. STD_ENDPROC(_##x)
  1041. /*
  1042. * Special-case sigreturn to not write r0 to the stack on return.
  1043. * This is technically more efficient, but it also avoids difficulties
  1044. * in the 64-bit OS when handling 32-bit compat code, since we must not
  1045. * sign-extend r0 for the sigreturn return-value case.
  1046. */
  1047. #define PTREGS_SYSCALL_SIGRETURN(x, reg) \
  1048. STD_ENTRY(_##x); \
  1049. addli lr, lr, .Lsyscall_sigreturn_skip - .Lhandle_syscall_link; \
  1050. { \
  1051. PTREGS_PTR(reg, PTREGS_OFFSET_BASE); \
  1052. j x \
  1053. }; \
  1054. STD_ENDPROC(_##x)
  1055. PTREGS_SYSCALL(sys_execve, r3)
  1056. PTREGS_SYSCALL(sys_sigaltstack, r2)
  1057. PTREGS_SYSCALL_SIGRETURN(sys_rt_sigreturn, r0)
  1058. #ifdef CONFIG_COMPAT
  1059. PTREGS_SYSCALL(compat_sys_execve, r3)
  1060. PTREGS_SYSCALL(compat_sys_sigaltstack, r2)
  1061. PTREGS_SYSCALL_SIGRETURN(compat_sys_rt_sigreturn, r0)
  1062. #endif
  1063. /* Save additional callee-saves to pt_regs, put address in r4 and jump. */
  1064. STD_ENTRY(_sys_clone)
  1065. push_extra_callee_saves r4
  1066. j sys_clone
  1067. STD_ENDPROC(_sys_clone)
  1068. /* The single-step support may need to read all the registers. */
  1069. int_unalign:
  1070. push_extra_callee_saves r0
  1071. j do_trap
  1072. /* Include .intrpt1 array of interrupt vectors */
  1073. .section ".intrpt1", "ax"
  1074. #define op_handle_perf_interrupt bad_intr
  1075. #define op_handle_aux_perf_interrupt bad_intr
  1076. #ifndef CONFIG_HARDWALL
  1077. #define do_hardwall_trap bad_intr
  1078. #endif
  1079. int_hand INT_MEM_ERROR, MEM_ERROR, bad_intr
  1080. int_hand INT_SINGLE_STEP_3, SINGLE_STEP_3, bad_intr
  1081. #if CONFIG_KERNEL_PL == 2
  1082. int_hand INT_SINGLE_STEP_2, SINGLE_STEP_2, gx_singlestep_handle
  1083. int_hand INT_SINGLE_STEP_1, SINGLE_STEP_1, bad_intr
  1084. #else
  1085. int_hand INT_SINGLE_STEP_2, SINGLE_STEP_2, bad_intr
  1086. int_hand INT_SINGLE_STEP_1, SINGLE_STEP_1, gx_singlestep_handle
  1087. #endif
  1088. int_hand INT_SINGLE_STEP_0, SINGLE_STEP_0, bad_intr
  1089. int_hand INT_IDN_COMPLETE, IDN_COMPLETE, bad_intr
  1090. int_hand INT_UDN_COMPLETE, UDN_COMPLETE, bad_intr
  1091. int_hand INT_ITLB_MISS, ITLB_MISS, do_page_fault
  1092. int_hand INT_ILL, ILL, do_trap
  1093. int_hand INT_GPV, GPV, do_trap
  1094. int_hand INT_IDN_ACCESS, IDN_ACCESS, do_trap
  1095. int_hand INT_UDN_ACCESS, UDN_ACCESS, do_trap
  1096. int_hand INT_SWINT_3, SWINT_3, do_trap
  1097. int_hand INT_SWINT_2, SWINT_2, do_trap
  1098. int_hand INT_SWINT_1, SWINT_1, SYSCALL, handle_syscall
  1099. int_hand INT_SWINT_0, SWINT_0, do_trap
  1100. int_hand INT_ILL_TRANS, ILL_TRANS, do_trap
  1101. int_hand INT_UNALIGN_DATA, UNALIGN_DATA, int_unalign
  1102. int_hand INT_DTLB_MISS, DTLB_MISS, do_page_fault
  1103. int_hand INT_DTLB_ACCESS, DTLB_ACCESS, do_page_fault
  1104. int_hand INT_IDN_FIREWALL, IDN_FIREWALL, bad_intr
  1105. int_hand INT_UDN_FIREWALL, UDN_FIREWALL, do_hardwall_trap
  1106. int_hand INT_TILE_TIMER, TILE_TIMER, do_timer_interrupt
  1107. int_hand INT_IDN_TIMER, IDN_TIMER, bad_intr
  1108. int_hand INT_UDN_TIMER, UDN_TIMER, bad_intr
  1109. int_hand INT_IDN_AVAIL, IDN_AVAIL, bad_intr
  1110. int_hand INT_UDN_AVAIL, UDN_AVAIL, bad_intr
  1111. int_hand INT_IPI_3, IPI_3, bad_intr
  1112. #if CONFIG_KERNEL_PL == 2
  1113. int_hand INT_IPI_2, IPI_2, tile_dev_intr
  1114. int_hand INT_IPI_1, IPI_1, bad_intr
  1115. #else
  1116. int_hand INT_IPI_2, IPI_2, bad_intr
  1117. int_hand INT_IPI_1, IPI_1, tile_dev_intr
  1118. #endif
  1119. int_hand INT_IPI_0, IPI_0, bad_intr
  1120. int_hand INT_PERF_COUNT, PERF_COUNT, \
  1121. op_handle_perf_interrupt, handle_nmi
  1122. int_hand INT_AUX_PERF_COUNT, AUX_PERF_COUNT, \
  1123. op_handle_perf_interrupt, handle_nmi
  1124. int_hand INT_INTCTRL_3, INTCTRL_3, bad_intr
  1125. #if CONFIG_KERNEL_PL == 2
  1126. dc_dispatch INT_INTCTRL_2, INTCTRL_2
  1127. int_hand INT_INTCTRL_1, INTCTRL_1, bad_intr
  1128. #else
  1129. int_hand INT_INTCTRL_2, INTCTRL_2, bad_intr
  1130. dc_dispatch INT_INTCTRL_1, INTCTRL_1
  1131. #endif
  1132. int_hand INT_INTCTRL_0, INTCTRL_0, bad_intr
  1133. int_hand INT_MESSAGE_RCV_DWNCL, MESSAGE_RCV_DWNCL, \
  1134. hv_message_intr
  1135. int_hand INT_DEV_INTR_DWNCL, DEV_INTR_DWNCL, bad_intr
  1136. int_hand INT_I_ASID, I_ASID, bad_intr
  1137. int_hand INT_D_ASID, D_ASID, bad_intr
  1138. int_hand INT_DOUBLE_FAULT, DOUBLE_FAULT, do_trap
  1139. /* Synthetic interrupt delivered only by the simulator */
  1140. int_hand INT_BREAKPOINT, BREAKPOINT, do_breakpoint