exceptions-64s.S 40 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546
  1. /*
  2. * This file contains the 64-bit "server" PowerPC variant
  3. * of the low level exception handling including exception
  4. * vectors, exception return, part of the slb and stab
  5. * handling and other fixed offset specific things.
  6. *
  7. * This file is meant to be #included from head_64.S due to
  8. * position dependent assembly.
  9. *
  10. * Most of this originates from head_64.S and thus has the same
  11. * copyright history.
  12. *
  13. */
  14. #include <asm/hw_irq.h>
  15. #include <asm/exception-64s.h>
  16. #include <asm/ptrace.h>
  17. /*
  18. * We layout physical memory as follows:
  19. * 0x0000 - 0x00ff : Secondary processor spin code
  20. * 0x0100 - 0x17ff : pSeries Interrupt prologs
  21. * 0x1800 - 0x4000 : interrupt support common interrupt prologs
  22. * 0x4000 - 0x5fff : pSeries interrupts with IR=1,DR=1
  23. * 0x6000 - 0x6fff : more interrupt support including for IR=1,DR=1
  24. * 0x7000 - 0x7fff : FWNMI data area
  25. * 0x8000 - 0x8fff : Initial (CPU0) segment table
  26. * 0x9000 - : Early init and support code
  27. */
  28. /* Syscall routine is used twice, in reloc-off and reloc-on paths */
  29. #define SYSCALL_PSERIES_1 \
  30. BEGIN_FTR_SECTION \
  31. cmpdi r0,0x1ebe ; \
  32. beq- 1f ; \
  33. END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE) \
  34. mr r9,r13 ; \
  35. GET_PACA(r13) ; \
  36. mfspr r11,SPRN_SRR0 ; \
  37. 0:
  38. #define SYSCALL_PSERIES_2_RFID \
  39. mfspr r12,SPRN_SRR1 ; \
  40. ld r10,PACAKBASE(r13) ; \
  41. LOAD_HANDLER(r10, system_call_entry) ; \
  42. mtspr SPRN_SRR0,r10 ; \
  43. ld r10,PACAKMSR(r13) ; \
  44. mtspr SPRN_SRR1,r10 ; \
  45. rfid ; \
  46. b . ; /* prevent speculative execution */
  47. #define SYSCALL_PSERIES_3 \
  48. /* Fast LE/BE switch system call */ \
  49. 1: mfspr r12,SPRN_SRR1 ; \
  50. xori r12,r12,MSR_LE ; \
  51. mtspr SPRN_SRR1,r12 ; \
  52. rfid ; /* return to userspace */ \
  53. b . ; \
  54. 2: mfspr r12,SPRN_SRR1 ; \
  55. andi. r12,r12,MSR_PR ; \
  56. bne 0b ; \
  57. mtspr SPRN_SRR0,r3 ; \
  58. mtspr SPRN_SRR1,r4 ; \
  59. mtspr SPRN_SDR1,r5 ; \
  60. rfid ; \
  61. b . ; /* prevent speculative execution */
  62. #if defined(CONFIG_RELOCATABLE)
  63. /*
  64. * We can't branch directly; in the direct case we use LR
  65. * and system_call_entry restores LR. (We thus need to move
  66. * LR to r10 in the RFID case too.)
  67. */
  68. #define SYSCALL_PSERIES_2_DIRECT \
  69. mflr r10 ; \
  70. ld r12,PACAKBASE(r13) ; \
  71. LOAD_HANDLER(r12, system_call_entry_direct) ; \
  72. mtctr r12 ; \
  73. mfspr r12,SPRN_SRR1 ; \
  74. /* Re-use of r13... No spare regs to do this */ \
  75. li r13,MSR_RI ; \
  76. mtmsrd r13,1 ; \
  77. GET_PACA(r13) ; /* get r13 back */ \
  78. bctr ;
  79. #else
  80. /* We can branch directly */
  81. #define SYSCALL_PSERIES_2_DIRECT \
  82. mfspr r12,SPRN_SRR1 ; \
  83. li r10,MSR_RI ; \
  84. mtmsrd r10,1 ; /* Set RI (EE=0) */ \
  85. b system_call_entry_direct ;
  86. #endif
  87. /*
  88. * This is the start of the interrupt handlers for pSeries
  89. * This code runs with relocation off.
  90. * Code from here to __end_interrupts gets copied down to real
  91. * address 0x100 when we are running a relocatable kernel.
  92. * Therefore any relative branches in this section must only
  93. * branch to labels in this section.
  94. */
  95. . = 0x100
  96. .globl __start_interrupts
  97. __start_interrupts:
  98. .globl system_reset_pSeries;
  99. system_reset_pSeries:
  100. HMT_MEDIUM_PPR_DISCARD
  101. SET_SCRATCH0(r13)
  102. #ifdef CONFIG_PPC_P7_NAP
  103. BEGIN_FTR_SECTION
  104. /* Running native on arch 2.06 or later, check if we are
  105. * waking up from nap. We only handle no state loss and
  106. * supervisor state loss. We do -not- handle hypervisor
  107. * state loss at this time.
  108. */
  109. mfspr r13,SPRN_SRR1
  110. rlwinm. r13,r13,47-31,30,31
  111. beq 9f
  112. /* waking up from powersave (nap) state */
  113. cmpwi cr1,r13,2
  114. /* Total loss of HV state is fatal, we could try to use the
  115. * PIR to locate a PACA, then use an emergency stack etc...
  116. * but for now, let's just stay stuck here
  117. */
  118. bgt cr1,.
  119. GET_PACA(r13)
  120. #ifdef CONFIG_KVM_BOOK3S_HV_POSSIBLE
  121. li r0,KVM_HWTHREAD_IN_KERNEL
  122. stb r0,HSTATE_HWTHREAD_STATE(r13)
  123. /* Order setting hwthread_state vs. testing hwthread_req */
  124. sync
  125. lbz r0,HSTATE_HWTHREAD_REQ(r13)
  126. cmpwi r0,0
  127. beq 1f
  128. b kvm_start_guest
  129. 1:
  130. #endif
  131. beq cr1,2f
  132. b .power7_wakeup_noloss
  133. 2: b .power7_wakeup_loss
  134. 9:
  135. END_FTR_SECTION_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206)
  136. #endif /* CONFIG_PPC_P7_NAP */
  137. EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common, EXC_STD,
  138. NOTEST, 0x100)
  139. . = 0x200
  140. machine_check_pSeries_1:
  141. /* This is moved out of line as it can be patched by FW, but
  142. * some code path might still want to branch into the original
  143. * vector
  144. */
  145. HMT_MEDIUM_PPR_DISCARD
  146. SET_SCRATCH0(r13) /* save r13 */
  147. EXCEPTION_PROLOG_0(PACA_EXMC)
  148. b machine_check_pSeries_0
  149. . = 0x300
  150. .globl data_access_pSeries
  151. data_access_pSeries:
  152. HMT_MEDIUM_PPR_DISCARD
  153. SET_SCRATCH0(r13)
  154. BEGIN_FTR_SECTION
  155. b data_access_check_stab
  156. data_access_not_stab:
  157. END_MMU_FTR_SECTION_IFCLR(MMU_FTR_SLB)
  158. EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, data_access_common, EXC_STD,
  159. KVMTEST, 0x300)
  160. . = 0x380
  161. .globl data_access_slb_pSeries
  162. data_access_slb_pSeries:
  163. HMT_MEDIUM_PPR_DISCARD
  164. SET_SCRATCH0(r13)
  165. EXCEPTION_PROLOG_0(PACA_EXSLB)
  166. EXCEPTION_PROLOG_1(PACA_EXSLB, KVMTEST, 0x380)
  167. std r3,PACA_EXSLB+EX_R3(r13)
  168. mfspr r3,SPRN_DAR
  169. #ifdef __DISABLED__
  170. /* Keep that around for when we re-implement dynamic VSIDs */
  171. cmpdi r3,0
  172. bge slb_miss_user_pseries
  173. #endif /* __DISABLED__ */
  174. mfspr r12,SPRN_SRR1
  175. #ifndef CONFIG_RELOCATABLE
  176. b .slb_miss_realmode
  177. #else
  178. /*
  179. * We can't just use a direct branch to .slb_miss_realmode
  180. * because the distance from here to there depends on where
  181. * the kernel ends up being put.
  182. */
  183. mfctr r11
  184. ld r10,PACAKBASE(r13)
  185. LOAD_HANDLER(r10, .slb_miss_realmode)
  186. mtctr r10
  187. bctr
  188. #endif
  189. STD_EXCEPTION_PSERIES(0x400, 0x400, instruction_access)
  190. . = 0x480
  191. .globl instruction_access_slb_pSeries
  192. instruction_access_slb_pSeries:
  193. HMT_MEDIUM_PPR_DISCARD
  194. SET_SCRATCH0(r13)
  195. EXCEPTION_PROLOG_0(PACA_EXSLB)
  196. EXCEPTION_PROLOG_1(PACA_EXSLB, KVMTEST_PR, 0x480)
  197. std r3,PACA_EXSLB+EX_R3(r13)
  198. mfspr r3,SPRN_SRR0 /* SRR0 is faulting address */
  199. #ifdef __DISABLED__
  200. /* Keep that around for when we re-implement dynamic VSIDs */
  201. cmpdi r3,0
  202. bge slb_miss_user_pseries
  203. #endif /* __DISABLED__ */
  204. mfspr r12,SPRN_SRR1
  205. #ifndef CONFIG_RELOCATABLE
  206. b .slb_miss_realmode
  207. #else
  208. mfctr r11
  209. ld r10,PACAKBASE(r13)
  210. LOAD_HANDLER(r10, .slb_miss_realmode)
  211. mtctr r10
  212. bctr
  213. #endif
  214. /* We open code these as we can't have a ". = x" (even with
  215. * x = "." within a feature section
  216. */
  217. . = 0x500;
  218. .globl hardware_interrupt_pSeries;
  219. .globl hardware_interrupt_hv;
  220. hardware_interrupt_pSeries:
  221. hardware_interrupt_hv:
  222. HMT_MEDIUM_PPR_DISCARD
  223. BEGIN_FTR_SECTION
  224. _MASKABLE_EXCEPTION_PSERIES(0x502, hardware_interrupt,
  225. EXC_HV, SOFTEN_TEST_HV)
  226. KVM_HANDLER(PACA_EXGEN, EXC_HV, 0x502)
  227. FTR_SECTION_ELSE
  228. _MASKABLE_EXCEPTION_PSERIES(0x500, hardware_interrupt,
  229. EXC_STD, SOFTEN_TEST_HV_201)
  230. KVM_HANDLER(PACA_EXGEN, EXC_STD, 0x500)
  231. ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206)
  232. STD_EXCEPTION_PSERIES(0x600, 0x600, alignment)
  233. KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0x600)
  234. STD_EXCEPTION_PSERIES(0x700, 0x700, program_check)
  235. KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0x700)
  236. STD_EXCEPTION_PSERIES(0x800, 0x800, fp_unavailable)
  237. KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0x800)
  238. . = 0x900
  239. .globl decrementer_pSeries
  240. decrementer_pSeries:
  241. _MASKABLE_EXCEPTION_PSERIES(0x900, decrementer, EXC_STD, SOFTEN_TEST_PR)
  242. STD_EXCEPTION_HV(0x980, 0x982, hdecrementer)
  243. MASKABLE_EXCEPTION_PSERIES(0xa00, 0xa00, doorbell_super)
  244. KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xa00)
  245. STD_EXCEPTION_PSERIES(0xb00, 0xb00, trap_0b)
  246. KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xb00)
  247. . = 0xc00
  248. .globl system_call_pSeries
  249. system_call_pSeries:
  250. HMT_MEDIUM
  251. #ifdef CONFIG_KVM_BOOK3S_64_HANDLER
  252. SET_SCRATCH0(r13)
  253. GET_PACA(r13)
  254. std r9,PACA_EXGEN+EX_R9(r13)
  255. std r10,PACA_EXGEN+EX_R10(r13)
  256. mfcr r9
  257. KVMTEST(0xc00)
  258. GET_SCRATCH0(r13)
  259. #endif
  260. SYSCALL_PSERIES_1
  261. SYSCALL_PSERIES_2_RFID
  262. SYSCALL_PSERIES_3
  263. KVM_HANDLER(PACA_EXGEN, EXC_STD, 0xc00)
  264. STD_EXCEPTION_PSERIES(0xd00, 0xd00, single_step)
  265. KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xd00)
  266. /* At 0xe??? we have a bunch of hypervisor exceptions, we branch
  267. * out of line to handle them
  268. */
  269. . = 0xe00
  270. hv_data_storage_trampoline:
  271. SET_SCRATCH0(r13)
  272. EXCEPTION_PROLOG_0(PACA_EXGEN)
  273. b h_data_storage_hv
  274. . = 0xe20
  275. hv_instr_storage_trampoline:
  276. SET_SCRATCH0(r13)
  277. EXCEPTION_PROLOG_0(PACA_EXGEN)
  278. b h_instr_storage_hv
  279. . = 0xe40
  280. emulation_assist_trampoline:
  281. SET_SCRATCH0(r13)
  282. EXCEPTION_PROLOG_0(PACA_EXGEN)
  283. b emulation_assist_hv
  284. . = 0xe60
  285. hv_exception_trampoline:
  286. SET_SCRATCH0(r13)
  287. EXCEPTION_PROLOG_0(PACA_EXGEN)
  288. b hmi_exception_hv
  289. . = 0xe80
  290. hv_doorbell_trampoline:
  291. SET_SCRATCH0(r13)
  292. EXCEPTION_PROLOG_0(PACA_EXGEN)
  293. b h_doorbell_hv
  294. /* We need to deal with the Altivec unavailable exception
  295. * here which is at 0xf20, thus in the middle of the
  296. * prolog code of the PerformanceMonitor one. A little
  297. * trickery is thus necessary
  298. */
  299. . = 0xf00
  300. performance_monitor_pseries_trampoline:
  301. SET_SCRATCH0(r13)
  302. EXCEPTION_PROLOG_0(PACA_EXGEN)
  303. b performance_monitor_pSeries
  304. . = 0xf20
  305. altivec_unavailable_pseries_trampoline:
  306. SET_SCRATCH0(r13)
  307. EXCEPTION_PROLOG_0(PACA_EXGEN)
  308. b altivec_unavailable_pSeries
  309. . = 0xf40
  310. vsx_unavailable_pseries_trampoline:
  311. SET_SCRATCH0(r13)
  312. EXCEPTION_PROLOG_0(PACA_EXGEN)
  313. b vsx_unavailable_pSeries
  314. . = 0xf60
  315. facility_unavailable_trampoline:
  316. SET_SCRATCH0(r13)
  317. EXCEPTION_PROLOG_0(PACA_EXGEN)
  318. b facility_unavailable_pSeries
  319. . = 0xf80
  320. hv_facility_unavailable_trampoline:
  321. SET_SCRATCH0(r13)
  322. EXCEPTION_PROLOG_0(PACA_EXGEN)
  323. b facility_unavailable_hv
  324. #ifdef CONFIG_CBE_RAS
  325. STD_EXCEPTION_HV(0x1200, 0x1202, cbe_system_error)
  326. KVM_HANDLER_SKIP(PACA_EXGEN, EXC_HV, 0x1202)
  327. #endif /* CONFIG_CBE_RAS */
  328. STD_EXCEPTION_PSERIES(0x1300, 0x1300, instruction_breakpoint)
  329. KVM_HANDLER_PR_SKIP(PACA_EXGEN, EXC_STD, 0x1300)
  330. . = 0x1500
  331. .global denorm_exception_hv
  332. denorm_exception_hv:
  333. HMT_MEDIUM_PPR_DISCARD
  334. mtspr SPRN_SPRG_HSCRATCH0,r13
  335. EXCEPTION_PROLOG_0(PACA_EXGEN)
  336. EXCEPTION_PROLOG_1(PACA_EXGEN, NOTEST, 0x1500)
  337. #ifdef CONFIG_PPC_DENORMALISATION
  338. mfspr r10,SPRN_HSRR1
  339. mfspr r11,SPRN_HSRR0 /* save HSRR0 */
  340. andis. r10,r10,(HSRR1_DENORM)@h /* denorm? */
  341. addi r11,r11,-4 /* HSRR0 is next instruction */
  342. bne+ denorm_assist
  343. #endif
  344. KVMTEST(0x1500)
  345. EXCEPTION_PROLOG_PSERIES_1(denorm_common, EXC_HV)
  346. KVM_HANDLER_SKIP(PACA_EXGEN, EXC_STD, 0x1500)
  347. #ifdef CONFIG_CBE_RAS
  348. STD_EXCEPTION_HV(0x1600, 0x1602, cbe_maintenance)
  349. KVM_HANDLER_SKIP(PACA_EXGEN, EXC_HV, 0x1602)
  350. #endif /* CONFIG_CBE_RAS */
  351. STD_EXCEPTION_PSERIES(0x1700, 0x1700, altivec_assist)
  352. KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0x1700)
  353. #ifdef CONFIG_CBE_RAS
  354. STD_EXCEPTION_HV(0x1800, 0x1802, cbe_thermal)
  355. KVM_HANDLER_SKIP(PACA_EXGEN, EXC_HV, 0x1802)
  356. #else
  357. . = 0x1800
  358. #endif /* CONFIG_CBE_RAS */
  359. /*** Out of line interrupts support ***/
  360. .align 7
  361. /* moved from 0x200 */
  362. machine_check_pSeries:
  363. .globl machine_check_fwnmi
  364. machine_check_fwnmi:
  365. HMT_MEDIUM_PPR_DISCARD
  366. SET_SCRATCH0(r13) /* save r13 */
  367. EXCEPTION_PROLOG_0(PACA_EXMC)
  368. machine_check_pSeries_0:
  369. EXCEPTION_PROLOG_1(PACA_EXMC, KVMTEST, 0x200)
  370. EXCEPTION_PROLOG_PSERIES_1(machine_check_common, EXC_STD)
  371. KVM_HANDLER_SKIP(PACA_EXMC, EXC_STD, 0x200)
  372. /* moved from 0x300 */
  373. data_access_check_stab:
  374. GET_PACA(r13)
  375. std r9,PACA_EXSLB+EX_R9(r13)
  376. std r10,PACA_EXSLB+EX_R10(r13)
  377. mfspr r10,SPRN_DAR
  378. mfspr r9,SPRN_DSISR
  379. srdi r10,r10,60
  380. rlwimi r10,r9,16,0x20
  381. #ifdef CONFIG_KVM_BOOK3S_PR_POSSIBLE
  382. lbz r9,HSTATE_IN_GUEST(r13)
  383. rlwimi r10,r9,8,0x300
  384. #endif
  385. mfcr r9
  386. cmpwi r10,0x2c
  387. beq do_stab_bolted_pSeries
  388. mtcrf 0x80,r9
  389. ld r9,PACA_EXSLB+EX_R9(r13)
  390. ld r10,PACA_EXSLB+EX_R10(r13)
  391. b data_access_not_stab
  392. do_stab_bolted_pSeries:
  393. std r11,PACA_EXSLB+EX_R11(r13)
  394. std r12,PACA_EXSLB+EX_R12(r13)
  395. GET_SCRATCH0(r10)
  396. std r10,PACA_EXSLB+EX_R13(r13)
  397. EXCEPTION_PROLOG_PSERIES_1(.do_stab_bolted, EXC_STD)
  398. KVM_HANDLER_SKIP(PACA_EXGEN, EXC_STD, 0x300)
  399. KVM_HANDLER_SKIP(PACA_EXSLB, EXC_STD, 0x380)
  400. KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0x400)
  401. KVM_HANDLER_PR(PACA_EXSLB, EXC_STD, 0x480)
  402. KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0x900)
  403. KVM_HANDLER(PACA_EXGEN, EXC_HV, 0x982)
  404. #ifdef CONFIG_PPC_DENORMALISATION
  405. denorm_assist:
  406. BEGIN_FTR_SECTION
  407. /*
  408. * To denormalise we need to move a copy of the register to itself.
  409. * For POWER6 do that here for all FP regs.
  410. */
  411. mfmsr r10
  412. ori r10,r10,(MSR_FP|MSR_FE0|MSR_FE1)
  413. xori r10,r10,(MSR_FE0|MSR_FE1)
  414. mtmsrd r10
  415. sync
  416. #define FMR2(n) fmr (n), (n) ; fmr n+1, n+1
  417. #define FMR4(n) FMR2(n) ; FMR2(n+2)
  418. #define FMR8(n) FMR4(n) ; FMR4(n+4)
  419. #define FMR16(n) FMR8(n) ; FMR8(n+8)
  420. #define FMR32(n) FMR16(n) ; FMR16(n+16)
  421. FMR32(0)
  422. FTR_SECTION_ELSE
  423. /*
  424. * To denormalise we need to move a copy of the register to itself.
  425. * For POWER7 do that here for the first 32 VSX registers only.
  426. */
  427. mfmsr r10
  428. oris r10,r10,MSR_VSX@h
  429. mtmsrd r10
  430. sync
  431. #define XVCPSGNDP2(n) XVCPSGNDP(n,n,n) ; XVCPSGNDP(n+1,n+1,n+1)
  432. #define XVCPSGNDP4(n) XVCPSGNDP2(n) ; XVCPSGNDP2(n+2)
  433. #define XVCPSGNDP8(n) XVCPSGNDP4(n) ; XVCPSGNDP4(n+4)
  434. #define XVCPSGNDP16(n) XVCPSGNDP8(n) ; XVCPSGNDP8(n+8)
  435. #define XVCPSGNDP32(n) XVCPSGNDP16(n) ; XVCPSGNDP16(n+16)
  436. XVCPSGNDP32(0)
  437. ALT_FTR_SECTION_END_IFCLR(CPU_FTR_ARCH_206)
  438. BEGIN_FTR_SECTION
  439. b denorm_done
  440. END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S)
  441. /*
  442. * To denormalise we need to move a copy of the register to itself.
  443. * For POWER8 we need to do that for all 64 VSX registers
  444. */
  445. XVCPSGNDP32(32)
  446. denorm_done:
  447. mtspr SPRN_HSRR0,r11
  448. mtcrf 0x80,r9
  449. ld r9,PACA_EXGEN+EX_R9(r13)
  450. RESTORE_PPR_PACA(PACA_EXGEN, r10)
  451. BEGIN_FTR_SECTION
  452. ld r10,PACA_EXGEN+EX_CFAR(r13)
  453. mtspr SPRN_CFAR,r10
  454. END_FTR_SECTION_IFSET(CPU_FTR_CFAR)
  455. ld r10,PACA_EXGEN+EX_R10(r13)
  456. ld r11,PACA_EXGEN+EX_R11(r13)
  457. ld r12,PACA_EXGEN+EX_R12(r13)
  458. ld r13,PACA_EXGEN+EX_R13(r13)
  459. HRFID
  460. b .
  461. #endif
  462. .align 7
  463. /* moved from 0xe00 */
  464. STD_EXCEPTION_HV_OOL(0xe02, h_data_storage)
  465. KVM_HANDLER_SKIP(PACA_EXGEN, EXC_HV, 0xe02)
  466. STD_EXCEPTION_HV_OOL(0xe22, h_instr_storage)
  467. KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe22)
  468. STD_EXCEPTION_HV_OOL(0xe42, emulation_assist)
  469. KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe42)
  470. STD_EXCEPTION_HV_OOL(0xe62, hmi_exception) /* need to flush cache ? */
  471. KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe62)
  472. MASKABLE_EXCEPTION_HV_OOL(0xe82, h_doorbell)
  473. KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xe82)
  474. /* moved from 0xf00 */
  475. STD_EXCEPTION_PSERIES_OOL(0xf00, performance_monitor)
  476. KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xf00)
  477. STD_EXCEPTION_PSERIES_OOL(0xf20, altivec_unavailable)
  478. KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xf20)
  479. STD_EXCEPTION_PSERIES_OOL(0xf40, vsx_unavailable)
  480. KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xf40)
  481. STD_EXCEPTION_PSERIES_OOL(0xf60, facility_unavailable)
  482. KVM_HANDLER_PR(PACA_EXGEN, EXC_STD, 0xf60)
  483. STD_EXCEPTION_HV_OOL(0xf82, facility_unavailable)
  484. KVM_HANDLER(PACA_EXGEN, EXC_HV, 0xf82)
  485. /*
  486. * An interrupt came in while soft-disabled. We set paca->irq_happened, then:
  487. * - If it was a decrementer interrupt, we bump the dec to max and and return.
  488. * - If it was a doorbell we return immediately since doorbells are edge
  489. * triggered and won't automatically refire.
  490. * - else we hard disable and return.
  491. * This is called with r10 containing the value to OR to the paca field.
  492. */
  493. #define MASKED_INTERRUPT(_H) \
  494. masked_##_H##interrupt: \
  495. std r11,PACA_EXGEN+EX_R11(r13); \
  496. lbz r11,PACAIRQHAPPENED(r13); \
  497. or r11,r11,r10; \
  498. stb r11,PACAIRQHAPPENED(r13); \
  499. cmpwi r10,PACA_IRQ_DEC; \
  500. bne 1f; \
  501. lis r10,0x7fff; \
  502. ori r10,r10,0xffff; \
  503. mtspr SPRN_DEC,r10; \
  504. b 2f; \
  505. 1: cmpwi r10,PACA_IRQ_DBELL; \
  506. beq 2f; \
  507. mfspr r10,SPRN_##_H##SRR1; \
  508. rldicl r10,r10,48,1; /* clear MSR_EE */ \
  509. rotldi r10,r10,16; \
  510. mtspr SPRN_##_H##SRR1,r10; \
  511. 2: mtcrf 0x80,r9; \
  512. ld r9,PACA_EXGEN+EX_R9(r13); \
  513. ld r10,PACA_EXGEN+EX_R10(r13); \
  514. ld r11,PACA_EXGEN+EX_R11(r13); \
  515. GET_SCRATCH0(r13); \
  516. ##_H##rfid; \
  517. b .
  518. MASKED_INTERRUPT()
  519. MASKED_INTERRUPT(H)
  520. /*
  521. * Called from arch_local_irq_enable when an interrupt needs
  522. * to be resent. r3 contains 0x500, 0x900, 0xa00 or 0xe80 to indicate
  523. * which kind of interrupt. MSR:EE is already off. We generate a
  524. * stackframe like if a real interrupt had happened.
  525. *
  526. * Note: While MSR:EE is off, we need to make sure that _MSR
  527. * in the generated frame has EE set to 1 or the exception
  528. * handler will not properly re-enable them.
  529. */
  530. _GLOBAL(__replay_interrupt)
  531. /* We are going to jump to the exception common code which
  532. * will retrieve various register values from the PACA which
  533. * we don't give a damn about, so we don't bother storing them.
  534. */
  535. mfmsr r12
  536. mflr r11
  537. mfcr r9
  538. ori r12,r12,MSR_EE
  539. cmpwi r3,0x900
  540. beq decrementer_common
  541. cmpwi r3,0x500
  542. beq hardware_interrupt_common
  543. BEGIN_FTR_SECTION
  544. cmpwi r3,0xe80
  545. beq h_doorbell_common
  546. FTR_SECTION_ELSE
  547. cmpwi r3,0xa00
  548. beq doorbell_super_common
  549. ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE)
  550. blr
  551. #ifdef CONFIG_PPC_PSERIES
  552. /*
  553. * Vectors for the FWNMI option. Share common code.
  554. */
  555. .globl system_reset_fwnmi
  556. .align 7
  557. system_reset_fwnmi:
  558. HMT_MEDIUM_PPR_DISCARD
  559. SET_SCRATCH0(r13) /* save r13 */
  560. EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common, EXC_STD,
  561. NOTEST, 0x100)
  562. #endif /* CONFIG_PPC_PSERIES */
  563. #ifdef __DISABLED__
  564. /*
  565. * This is used for when the SLB miss handler has to go virtual,
  566. * which doesn't happen for now anymore but will once we re-implement
  567. * dynamic VSIDs for shared page tables
  568. */
  569. slb_miss_user_pseries:
  570. std r10,PACA_EXGEN+EX_R10(r13)
  571. std r11,PACA_EXGEN+EX_R11(r13)
  572. std r12,PACA_EXGEN+EX_R12(r13)
  573. GET_SCRATCH0(r10)
  574. ld r11,PACA_EXSLB+EX_R9(r13)
  575. ld r12,PACA_EXSLB+EX_R3(r13)
  576. std r10,PACA_EXGEN+EX_R13(r13)
  577. std r11,PACA_EXGEN+EX_R9(r13)
  578. std r12,PACA_EXGEN+EX_R3(r13)
  579. clrrdi r12,r13,32
  580. mfmsr r10
  581. mfspr r11,SRR0 /* save SRR0 */
  582. ori r12,r12,slb_miss_user_common@l /* virt addr of handler */
  583. ori r10,r10,MSR_IR|MSR_DR|MSR_RI
  584. mtspr SRR0,r12
  585. mfspr r12,SRR1 /* and SRR1 */
  586. mtspr SRR1,r10
  587. rfid
  588. b . /* prevent spec. execution */
  589. #endif /* __DISABLED__ */
  590. #ifdef CONFIG_KVM_BOOK3S_64_HANDLER
  591. kvmppc_skip_interrupt:
  592. /*
  593. * Here all GPRs are unchanged from when the interrupt happened
  594. * except for r13, which is saved in SPRG_SCRATCH0.
  595. */
  596. mfspr r13, SPRN_SRR0
  597. addi r13, r13, 4
  598. mtspr SPRN_SRR0, r13
  599. GET_SCRATCH0(r13)
  600. rfid
  601. b .
  602. kvmppc_skip_Hinterrupt:
  603. /*
  604. * Here all GPRs are unchanged from when the interrupt happened
  605. * except for r13, which is saved in SPRG_SCRATCH0.
  606. */
  607. mfspr r13, SPRN_HSRR0
  608. addi r13, r13, 4
  609. mtspr SPRN_HSRR0, r13
  610. GET_SCRATCH0(r13)
  611. hrfid
  612. b .
  613. #endif
  614. /*
  615. * Code from here down to __end_handlers is invoked from the
  616. * exception prologs above. Because the prologs assemble the
  617. * addresses of these handlers using the LOAD_HANDLER macro,
  618. * which uses an ori instruction, these handlers must be in
  619. * the first 64k of the kernel image.
  620. */
  621. /*** Common interrupt handlers ***/
  622. STD_EXCEPTION_COMMON(0x100, system_reset, .system_reset_exception)
  623. /*
  624. * Machine check is different because we use a different
  625. * save area: PACA_EXMC instead of PACA_EXGEN.
  626. */
  627. .align 7
  628. .globl machine_check_common
  629. machine_check_common:
  630. mfspr r10,SPRN_DAR
  631. std r10,PACA_EXGEN+EX_DAR(r13)
  632. mfspr r10,SPRN_DSISR
  633. stw r10,PACA_EXGEN+EX_DSISR(r13)
  634. EXCEPTION_PROLOG_COMMON(0x200, PACA_EXMC)
  635. FINISH_NAP
  636. DISABLE_INTS
  637. ld r3,PACA_EXGEN+EX_DAR(r13)
  638. lwz r4,PACA_EXGEN+EX_DSISR(r13)
  639. std r3,_DAR(r1)
  640. std r4,_DSISR(r1)
  641. bl .save_nvgprs
  642. addi r3,r1,STACK_FRAME_OVERHEAD
  643. bl .machine_check_exception
  644. b .ret_from_except
  645. STD_EXCEPTION_COMMON_ASYNC(0x500, hardware_interrupt, do_IRQ)
  646. STD_EXCEPTION_COMMON_ASYNC(0x900, decrementer, .timer_interrupt)
  647. STD_EXCEPTION_COMMON(0x980, hdecrementer, .hdec_interrupt)
  648. #ifdef CONFIG_PPC_DOORBELL
  649. STD_EXCEPTION_COMMON_ASYNC(0xa00, doorbell_super, .doorbell_exception)
  650. #else
  651. STD_EXCEPTION_COMMON_ASYNC(0xa00, doorbell_super, .unknown_exception)
  652. #endif
  653. STD_EXCEPTION_COMMON(0xb00, trap_0b, .unknown_exception)
  654. STD_EXCEPTION_COMMON(0xd00, single_step, .single_step_exception)
  655. STD_EXCEPTION_COMMON(0xe00, trap_0e, .unknown_exception)
  656. STD_EXCEPTION_COMMON(0xe40, emulation_assist, .emulation_assist_interrupt)
  657. STD_EXCEPTION_COMMON(0xe60, hmi_exception, .unknown_exception)
  658. #ifdef CONFIG_PPC_DOORBELL
  659. STD_EXCEPTION_COMMON_ASYNC(0xe80, h_doorbell, .doorbell_exception)
  660. #else
  661. STD_EXCEPTION_COMMON_ASYNC(0xe80, h_doorbell, .unknown_exception)
  662. #endif
  663. STD_EXCEPTION_COMMON_ASYNC(0xf00, performance_monitor, .performance_monitor_exception)
  664. STD_EXCEPTION_COMMON(0x1300, instruction_breakpoint, .instruction_breakpoint_exception)
  665. STD_EXCEPTION_COMMON(0x1502, denorm, .unknown_exception)
  666. #ifdef CONFIG_ALTIVEC
  667. STD_EXCEPTION_COMMON(0x1700, altivec_assist, .altivec_assist_exception)
  668. #else
  669. STD_EXCEPTION_COMMON(0x1700, altivec_assist, .unknown_exception)
  670. #endif
  671. #ifdef CONFIG_CBE_RAS
  672. STD_EXCEPTION_COMMON(0x1200, cbe_system_error, .cbe_system_error_exception)
  673. STD_EXCEPTION_COMMON(0x1600, cbe_maintenance, .cbe_maintenance_exception)
  674. STD_EXCEPTION_COMMON(0x1800, cbe_thermal, .cbe_thermal_exception)
  675. #endif /* CONFIG_CBE_RAS */
  676. /*
  677. * Relocation-on interrupts: A subset of the interrupts can be delivered
  678. * with IR=1/DR=1, if AIL==2 and MSR.HV won't be changed by delivering
  679. * it. Addresses are the same as the original interrupt addresses, but
  680. * offset by 0xc000000000004000.
  681. * It's impossible to receive interrupts below 0x300 via this mechanism.
  682. * KVM: None of these traps are from the guest ; anything that escalated
  683. * to HV=1 from HV=0 is delivered via real mode handlers.
  684. */
  685. /*
  686. * This uses the standard macro, since the original 0x300 vector
  687. * only has extra guff for STAB-based processors -- which never
  688. * come here.
  689. */
  690. STD_RELON_EXCEPTION_PSERIES(0x4300, 0x300, data_access)
  691. . = 0x4380
  692. .globl data_access_slb_relon_pSeries
  693. data_access_slb_relon_pSeries:
  694. SET_SCRATCH0(r13)
  695. EXCEPTION_PROLOG_0(PACA_EXSLB)
  696. EXCEPTION_PROLOG_1(PACA_EXSLB, NOTEST, 0x380)
  697. std r3,PACA_EXSLB+EX_R3(r13)
  698. mfspr r3,SPRN_DAR
  699. mfspr r12,SPRN_SRR1
  700. #ifndef CONFIG_RELOCATABLE
  701. b .slb_miss_realmode
  702. #else
  703. /*
  704. * We can't just use a direct branch to .slb_miss_realmode
  705. * because the distance from here to there depends on where
  706. * the kernel ends up being put.
  707. */
  708. mfctr r11
  709. ld r10,PACAKBASE(r13)
  710. LOAD_HANDLER(r10, .slb_miss_realmode)
  711. mtctr r10
  712. bctr
  713. #endif
  714. STD_RELON_EXCEPTION_PSERIES(0x4400, 0x400, instruction_access)
  715. . = 0x4480
  716. .globl instruction_access_slb_relon_pSeries
  717. instruction_access_slb_relon_pSeries:
  718. SET_SCRATCH0(r13)
  719. EXCEPTION_PROLOG_0(PACA_EXSLB)
  720. EXCEPTION_PROLOG_1(PACA_EXSLB, NOTEST, 0x480)
  721. std r3,PACA_EXSLB+EX_R3(r13)
  722. mfspr r3,SPRN_SRR0 /* SRR0 is faulting address */
  723. mfspr r12,SPRN_SRR1
  724. #ifndef CONFIG_RELOCATABLE
  725. b .slb_miss_realmode
  726. #else
  727. mfctr r11
  728. ld r10,PACAKBASE(r13)
  729. LOAD_HANDLER(r10, .slb_miss_realmode)
  730. mtctr r10
  731. bctr
  732. #endif
  733. . = 0x4500
  734. .globl hardware_interrupt_relon_pSeries;
  735. .globl hardware_interrupt_relon_hv;
  736. hardware_interrupt_relon_pSeries:
  737. hardware_interrupt_relon_hv:
  738. BEGIN_FTR_SECTION
  739. _MASKABLE_RELON_EXCEPTION_PSERIES(0x502, hardware_interrupt, EXC_HV, SOFTEN_TEST_HV)
  740. FTR_SECTION_ELSE
  741. _MASKABLE_RELON_EXCEPTION_PSERIES(0x500, hardware_interrupt, EXC_STD, SOFTEN_TEST_PR)
  742. ALT_FTR_SECTION_END_IFSET(CPU_FTR_HVMODE)
  743. STD_RELON_EXCEPTION_PSERIES(0x4600, 0x600, alignment)
  744. STD_RELON_EXCEPTION_PSERIES(0x4700, 0x700, program_check)
  745. STD_RELON_EXCEPTION_PSERIES(0x4800, 0x800, fp_unavailable)
  746. MASKABLE_RELON_EXCEPTION_PSERIES(0x4900, 0x900, decrementer)
  747. STD_RELON_EXCEPTION_HV(0x4980, 0x982, hdecrementer)
  748. MASKABLE_RELON_EXCEPTION_PSERIES(0x4a00, 0xa00, doorbell_super)
  749. STD_RELON_EXCEPTION_PSERIES(0x4b00, 0xb00, trap_0b)
  750. . = 0x4c00
  751. .globl system_call_relon_pSeries
  752. system_call_relon_pSeries:
  753. HMT_MEDIUM
  754. SYSCALL_PSERIES_1
  755. SYSCALL_PSERIES_2_DIRECT
  756. SYSCALL_PSERIES_3
  757. STD_RELON_EXCEPTION_PSERIES(0x4d00, 0xd00, single_step)
  758. . = 0x4e00
  759. b . /* Can't happen, see v2.07 Book III-S section 6.5 */
  760. . = 0x4e20
  761. b . /* Can't happen, see v2.07 Book III-S section 6.5 */
  762. . = 0x4e40
  763. emulation_assist_relon_trampoline:
  764. SET_SCRATCH0(r13)
  765. EXCEPTION_PROLOG_0(PACA_EXGEN)
  766. b emulation_assist_relon_hv
  767. . = 0x4e60
  768. b . /* Can't happen, see v2.07 Book III-S section 6.5 */
  769. . = 0x4e80
  770. h_doorbell_relon_trampoline:
  771. SET_SCRATCH0(r13)
  772. EXCEPTION_PROLOG_0(PACA_EXGEN)
  773. b h_doorbell_relon_hv
  774. . = 0x4f00
  775. performance_monitor_relon_pseries_trampoline:
  776. SET_SCRATCH0(r13)
  777. EXCEPTION_PROLOG_0(PACA_EXGEN)
  778. b performance_monitor_relon_pSeries
  779. . = 0x4f20
  780. altivec_unavailable_relon_pseries_trampoline:
  781. SET_SCRATCH0(r13)
  782. EXCEPTION_PROLOG_0(PACA_EXGEN)
  783. b altivec_unavailable_relon_pSeries
  784. . = 0x4f40
  785. vsx_unavailable_relon_pseries_trampoline:
  786. SET_SCRATCH0(r13)
  787. EXCEPTION_PROLOG_0(PACA_EXGEN)
  788. b vsx_unavailable_relon_pSeries
  789. . = 0x4f60
  790. facility_unavailable_relon_trampoline:
  791. SET_SCRATCH0(r13)
  792. EXCEPTION_PROLOG_0(PACA_EXGEN)
  793. b facility_unavailable_relon_pSeries
  794. . = 0x4f80
  795. hv_facility_unavailable_relon_trampoline:
  796. SET_SCRATCH0(r13)
  797. EXCEPTION_PROLOG_0(PACA_EXGEN)
  798. b hv_facility_unavailable_relon_hv
  799. STD_RELON_EXCEPTION_PSERIES(0x5300, 0x1300, instruction_breakpoint)
  800. #ifdef CONFIG_PPC_DENORMALISATION
  801. . = 0x5500
  802. b denorm_exception_hv
  803. #endif
  804. STD_RELON_EXCEPTION_PSERIES(0x5700, 0x1700, altivec_assist)
  805. /* Other future vectors */
  806. .align 7
  807. .globl __end_interrupts
  808. __end_interrupts:
  809. .align 7
  810. system_call_entry_direct:
  811. #if defined(CONFIG_RELOCATABLE)
  812. /* The first level prologue may have used LR to get here, saving
  813. * orig in r10. To save hacking/ifdeffing common code, restore here.
  814. */
  815. mtlr r10
  816. #endif
  817. system_call_entry:
  818. b system_call_common
  819. ppc64_runlatch_on_trampoline:
  820. b .__ppc64_runlatch_on
  821. /*
  822. * Here we have detected that the kernel stack pointer is bad.
  823. * R9 contains the saved CR, r13 points to the paca,
  824. * r10 contains the (bad) kernel stack pointer,
  825. * r11 and r12 contain the saved SRR0 and SRR1.
  826. * We switch to using an emergency stack, save the registers there,
  827. * and call kernel_bad_stack(), which panics.
  828. */
  829. bad_stack:
  830. ld r1,PACAEMERGSP(r13)
  831. subi r1,r1,64+INT_FRAME_SIZE
  832. std r9,_CCR(r1)
  833. std r10,GPR1(r1)
  834. std r11,_NIP(r1)
  835. std r12,_MSR(r1)
  836. mfspr r11,SPRN_DAR
  837. mfspr r12,SPRN_DSISR
  838. std r11,_DAR(r1)
  839. std r12,_DSISR(r1)
  840. mflr r10
  841. mfctr r11
  842. mfxer r12
  843. std r10,_LINK(r1)
  844. std r11,_CTR(r1)
  845. std r12,_XER(r1)
  846. SAVE_GPR(0,r1)
  847. SAVE_GPR(2,r1)
  848. ld r10,EX_R3(r3)
  849. std r10,GPR3(r1)
  850. SAVE_GPR(4,r1)
  851. SAVE_4GPRS(5,r1)
  852. ld r9,EX_R9(r3)
  853. ld r10,EX_R10(r3)
  854. SAVE_2GPRS(9,r1)
  855. ld r9,EX_R11(r3)
  856. ld r10,EX_R12(r3)
  857. ld r11,EX_R13(r3)
  858. std r9,GPR11(r1)
  859. std r10,GPR12(r1)
  860. std r11,GPR13(r1)
  861. BEGIN_FTR_SECTION
  862. ld r10,EX_CFAR(r3)
  863. std r10,ORIG_GPR3(r1)
  864. END_FTR_SECTION_IFSET(CPU_FTR_CFAR)
  865. SAVE_8GPRS(14,r1)
  866. SAVE_10GPRS(22,r1)
  867. lhz r12,PACA_TRAP_SAVE(r13)
  868. std r12,_TRAP(r1)
  869. addi r11,r1,INT_FRAME_SIZE
  870. std r11,0(r1)
  871. li r12,0
  872. std r12,0(r11)
  873. ld r2,PACATOC(r13)
  874. ld r11,exception_marker@toc(r2)
  875. std r12,RESULT(r1)
  876. std r11,STACK_FRAME_OVERHEAD-16(r1)
  877. 1: addi r3,r1,STACK_FRAME_OVERHEAD
  878. bl .kernel_bad_stack
  879. b 1b
  880. /*
  881. * Here r13 points to the paca, r9 contains the saved CR,
  882. * SRR0 and SRR1 are saved in r11 and r12,
  883. * r9 - r13 are saved in paca->exgen.
  884. */
  885. .align 7
  886. .globl data_access_common
  887. data_access_common:
  888. mfspr r10,SPRN_DAR
  889. std r10,PACA_EXGEN+EX_DAR(r13)
  890. mfspr r10,SPRN_DSISR
  891. stw r10,PACA_EXGEN+EX_DSISR(r13)
  892. EXCEPTION_PROLOG_COMMON(0x300, PACA_EXGEN)
  893. DISABLE_INTS
  894. ld r12,_MSR(r1)
  895. ld r3,PACA_EXGEN+EX_DAR(r13)
  896. lwz r4,PACA_EXGEN+EX_DSISR(r13)
  897. li r5,0x300
  898. b .do_hash_page /* Try to handle as hpte fault */
  899. .align 7
  900. .globl h_data_storage_common
  901. h_data_storage_common:
  902. mfspr r10,SPRN_HDAR
  903. std r10,PACA_EXGEN+EX_DAR(r13)
  904. mfspr r10,SPRN_HDSISR
  905. stw r10,PACA_EXGEN+EX_DSISR(r13)
  906. EXCEPTION_PROLOG_COMMON(0xe00, PACA_EXGEN)
  907. bl .save_nvgprs
  908. DISABLE_INTS
  909. addi r3,r1,STACK_FRAME_OVERHEAD
  910. bl .unknown_exception
  911. b .ret_from_except
  912. .align 7
  913. .globl instruction_access_common
  914. instruction_access_common:
  915. EXCEPTION_PROLOG_COMMON(0x400, PACA_EXGEN)
  916. DISABLE_INTS
  917. ld r12,_MSR(r1)
  918. ld r3,_NIP(r1)
  919. andis. r4,r12,0x5820
  920. li r5,0x400
  921. b .do_hash_page /* Try to handle as hpte fault */
  922. STD_EXCEPTION_COMMON(0xe20, h_instr_storage, .unknown_exception)
  923. /*
  924. * Here is the common SLB miss user that is used when going to virtual
  925. * mode for SLB misses, that is currently not used
  926. */
  927. #ifdef __DISABLED__
  928. .align 7
  929. .globl slb_miss_user_common
  930. slb_miss_user_common:
  931. mflr r10
  932. std r3,PACA_EXGEN+EX_DAR(r13)
  933. stw r9,PACA_EXGEN+EX_CCR(r13)
  934. std r10,PACA_EXGEN+EX_LR(r13)
  935. std r11,PACA_EXGEN+EX_SRR0(r13)
  936. bl .slb_allocate_user
  937. ld r10,PACA_EXGEN+EX_LR(r13)
  938. ld r3,PACA_EXGEN+EX_R3(r13)
  939. lwz r9,PACA_EXGEN+EX_CCR(r13)
  940. ld r11,PACA_EXGEN+EX_SRR0(r13)
  941. mtlr r10
  942. beq- slb_miss_fault
  943. andi. r10,r12,MSR_RI /* check for unrecoverable exception */
  944. beq- unrecov_user_slb
  945. mfmsr r10
  946. .machine push
  947. .machine "power4"
  948. mtcrf 0x80,r9
  949. .machine pop
  950. clrrdi r10,r10,2 /* clear RI before setting SRR0/1 */
  951. mtmsrd r10,1
  952. mtspr SRR0,r11
  953. mtspr SRR1,r12
  954. ld r9,PACA_EXGEN+EX_R9(r13)
  955. ld r10,PACA_EXGEN+EX_R10(r13)
  956. ld r11,PACA_EXGEN+EX_R11(r13)
  957. ld r12,PACA_EXGEN+EX_R12(r13)
  958. ld r13,PACA_EXGEN+EX_R13(r13)
  959. rfid
  960. b .
  961. slb_miss_fault:
  962. EXCEPTION_PROLOG_COMMON(0x380, PACA_EXGEN)
  963. ld r4,PACA_EXGEN+EX_DAR(r13)
  964. li r5,0
  965. std r4,_DAR(r1)
  966. std r5,_DSISR(r1)
  967. b handle_page_fault
  968. unrecov_user_slb:
  969. EXCEPTION_PROLOG_COMMON(0x4200, PACA_EXGEN)
  970. DISABLE_INTS
  971. bl .save_nvgprs
  972. 1: addi r3,r1,STACK_FRAME_OVERHEAD
  973. bl .unrecoverable_exception
  974. b 1b
  975. #endif /* __DISABLED__ */
  976. .align 7
  977. .globl alignment_common
  978. alignment_common:
  979. mfspr r10,SPRN_DAR
  980. std r10,PACA_EXGEN+EX_DAR(r13)
  981. mfspr r10,SPRN_DSISR
  982. stw r10,PACA_EXGEN+EX_DSISR(r13)
  983. EXCEPTION_PROLOG_COMMON(0x600, PACA_EXGEN)
  984. ld r3,PACA_EXGEN+EX_DAR(r13)
  985. lwz r4,PACA_EXGEN+EX_DSISR(r13)
  986. std r3,_DAR(r1)
  987. std r4,_DSISR(r1)
  988. bl .save_nvgprs
  989. DISABLE_INTS
  990. addi r3,r1,STACK_FRAME_OVERHEAD
  991. bl .alignment_exception
  992. b .ret_from_except
  993. .align 7
  994. .globl program_check_common
  995. program_check_common:
  996. EXCEPTION_PROLOG_COMMON(0x700, PACA_EXGEN)
  997. bl .save_nvgprs
  998. DISABLE_INTS
  999. addi r3,r1,STACK_FRAME_OVERHEAD
  1000. bl .program_check_exception
  1001. b .ret_from_except
  1002. .align 7
  1003. .globl fp_unavailable_common
  1004. fp_unavailable_common:
  1005. EXCEPTION_PROLOG_COMMON(0x800, PACA_EXGEN)
  1006. bne 1f /* if from user, just load it up */
  1007. bl .save_nvgprs
  1008. DISABLE_INTS
  1009. addi r3,r1,STACK_FRAME_OVERHEAD
  1010. bl .kernel_fp_unavailable_exception
  1011. BUG_OPCODE
  1012. 1:
  1013. #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
  1014. BEGIN_FTR_SECTION
  1015. /* Test if 2 TM state bits are zero. If non-zero (ie. userspace was in
  1016. * transaction), go do TM stuff
  1017. */
  1018. rldicl. r0, r12, (64-MSR_TS_LG), (64-2)
  1019. bne- 2f
  1020. END_FTR_SECTION_IFSET(CPU_FTR_TM)
  1021. #endif
  1022. bl .load_up_fpu
  1023. b fast_exception_return
  1024. #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
  1025. 2: /* User process was in a transaction */
  1026. bl .save_nvgprs
  1027. DISABLE_INTS
  1028. addi r3,r1,STACK_FRAME_OVERHEAD
  1029. bl .fp_unavailable_tm
  1030. b .ret_from_except
  1031. #endif
  1032. .align 7
  1033. .globl altivec_unavailable_common
  1034. altivec_unavailable_common:
  1035. EXCEPTION_PROLOG_COMMON(0xf20, PACA_EXGEN)
  1036. #ifdef CONFIG_ALTIVEC
  1037. BEGIN_FTR_SECTION
  1038. beq 1f
  1039. #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
  1040. BEGIN_FTR_SECTION_NESTED(69)
  1041. /* Test if 2 TM state bits are zero. If non-zero (ie. userspace was in
  1042. * transaction), go do TM stuff
  1043. */
  1044. rldicl. r0, r12, (64-MSR_TS_LG), (64-2)
  1045. bne- 2f
  1046. END_FTR_SECTION_NESTED(CPU_FTR_TM, CPU_FTR_TM, 69)
  1047. #endif
  1048. bl .load_up_altivec
  1049. b fast_exception_return
  1050. #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
  1051. 2: /* User process was in a transaction */
  1052. bl .save_nvgprs
  1053. DISABLE_INTS
  1054. addi r3,r1,STACK_FRAME_OVERHEAD
  1055. bl .altivec_unavailable_tm
  1056. b .ret_from_except
  1057. #endif
  1058. 1:
  1059. END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
  1060. #endif
  1061. bl .save_nvgprs
  1062. DISABLE_INTS
  1063. addi r3,r1,STACK_FRAME_OVERHEAD
  1064. bl .altivec_unavailable_exception
  1065. b .ret_from_except
  1066. .align 7
  1067. .globl vsx_unavailable_common
  1068. vsx_unavailable_common:
  1069. EXCEPTION_PROLOG_COMMON(0xf40, PACA_EXGEN)
  1070. #ifdef CONFIG_VSX
  1071. BEGIN_FTR_SECTION
  1072. beq 1f
  1073. #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
  1074. BEGIN_FTR_SECTION_NESTED(69)
  1075. /* Test if 2 TM state bits are zero. If non-zero (ie. userspace was in
  1076. * transaction), go do TM stuff
  1077. */
  1078. rldicl. r0, r12, (64-MSR_TS_LG), (64-2)
  1079. bne- 2f
  1080. END_FTR_SECTION_NESTED(CPU_FTR_TM, CPU_FTR_TM, 69)
  1081. #endif
  1082. b .load_up_vsx
  1083. #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
  1084. 2: /* User process was in a transaction */
  1085. bl .save_nvgprs
  1086. DISABLE_INTS
  1087. addi r3,r1,STACK_FRAME_OVERHEAD
  1088. bl .vsx_unavailable_tm
  1089. b .ret_from_except
  1090. #endif
  1091. 1:
  1092. END_FTR_SECTION_IFSET(CPU_FTR_VSX)
  1093. #endif
  1094. bl .save_nvgprs
  1095. DISABLE_INTS
  1096. addi r3,r1,STACK_FRAME_OVERHEAD
  1097. bl .vsx_unavailable_exception
  1098. b .ret_from_except
  1099. STD_EXCEPTION_COMMON(0xf60, facility_unavailable, .facility_unavailable_exception)
  1100. STD_EXCEPTION_COMMON(0xf80, hv_facility_unavailable, .facility_unavailable_exception)
  1101. .align 7
  1102. .globl __end_handlers
  1103. __end_handlers:
  1104. /* Equivalents to the above handlers for relocation-on interrupt vectors */
  1105. STD_RELON_EXCEPTION_HV_OOL(0xe40, emulation_assist)
  1106. MASKABLE_RELON_EXCEPTION_HV_OOL(0xe80, h_doorbell)
  1107. STD_RELON_EXCEPTION_PSERIES_OOL(0xf00, performance_monitor)
  1108. STD_RELON_EXCEPTION_PSERIES_OOL(0xf20, altivec_unavailable)
  1109. STD_RELON_EXCEPTION_PSERIES_OOL(0xf40, vsx_unavailable)
  1110. STD_RELON_EXCEPTION_PSERIES_OOL(0xf60, facility_unavailable)
  1111. STD_RELON_EXCEPTION_HV_OOL(0xf80, hv_facility_unavailable)
  1112. #if defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV)
  1113. /*
  1114. * Data area reserved for FWNMI option.
  1115. * This address (0x7000) is fixed by the RPA.
  1116. */
  1117. .= 0x7000
  1118. .globl fwnmi_data_area
  1119. fwnmi_data_area:
  1120. /* pseries and powernv need to keep the whole page from
  1121. * 0x7000 to 0x8000 free for use by the firmware
  1122. */
  1123. . = 0x8000
  1124. #endif /* defined(CONFIG_PPC_PSERIES) || defined(CONFIG_PPC_POWERNV) */
  1125. /* Space for CPU0's segment table */
  1126. .balign 4096
  1127. .globl initial_stab
  1128. initial_stab:
  1129. .space 4096
  1130. #ifdef CONFIG_PPC_POWERNV
  1131. _GLOBAL(opal_mc_secondary_handler)
  1132. HMT_MEDIUM_PPR_DISCARD
  1133. SET_SCRATCH0(r13)
  1134. GET_PACA(r13)
  1135. clrldi r3,r3,2
  1136. tovirt(r3,r3)
  1137. std r3,PACA_OPAL_MC_EVT(r13)
  1138. ld r13,OPAL_MC_SRR0(r3)
  1139. mtspr SPRN_SRR0,r13
  1140. ld r13,OPAL_MC_SRR1(r3)
  1141. mtspr SPRN_SRR1,r13
  1142. ld r3,OPAL_MC_GPR3(r3)
  1143. GET_SCRATCH0(r13)
  1144. b machine_check_pSeries
  1145. #endif /* CONFIG_PPC_POWERNV */
  1146. /*
  1147. * r13 points to the PACA, r9 contains the saved CR,
  1148. * r12 contain the saved SRR1, SRR0 is still ready for return
  1149. * r3 has the faulting address
  1150. * r9 - r13 are saved in paca->exslb.
  1151. * r3 is saved in paca->slb_r3
  1152. * We assume we aren't going to take any exceptions during this procedure.
  1153. */
  1154. _GLOBAL(slb_miss_realmode)
  1155. mflr r10
  1156. #ifdef CONFIG_RELOCATABLE
  1157. mtctr r11
  1158. #endif
  1159. stw r9,PACA_EXSLB+EX_CCR(r13) /* save CR in exc. frame */
  1160. std r10,PACA_EXSLB+EX_LR(r13) /* save LR */
  1161. bl .slb_allocate_realmode
  1162. /* All done -- return from exception. */
  1163. ld r10,PACA_EXSLB+EX_LR(r13)
  1164. ld r3,PACA_EXSLB+EX_R3(r13)
  1165. lwz r9,PACA_EXSLB+EX_CCR(r13) /* get saved CR */
  1166. mtlr r10
  1167. andi. r10,r12,MSR_RI /* check for unrecoverable exception */
  1168. beq- 2f
  1169. .machine push
  1170. .machine "power4"
  1171. mtcrf 0x80,r9
  1172. mtcrf 0x01,r9 /* slb_allocate uses cr0 and cr7 */
  1173. .machine pop
  1174. RESTORE_PPR_PACA(PACA_EXSLB, r9)
  1175. ld r9,PACA_EXSLB+EX_R9(r13)
  1176. ld r10,PACA_EXSLB+EX_R10(r13)
  1177. ld r11,PACA_EXSLB+EX_R11(r13)
  1178. ld r12,PACA_EXSLB+EX_R12(r13)
  1179. ld r13,PACA_EXSLB+EX_R13(r13)
  1180. rfid
  1181. b . /* prevent speculative execution */
  1182. 2: mfspr r11,SPRN_SRR0
  1183. ld r10,PACAKBASE(r13)
  1184. LOAD_HANDLER(r10,unrecov_slb)
  1185. mtspr SPRN_SRR0,r10
  1186. ld r10,PACAKMSR(r13)
  1187. mtspr SPRN_SRR1,r10
  1188. rfid
  1189. b .
  1190. unrecov_slb:
  1191. EXCEPTION_PROLOG_COMMON(0x4100, PACA_EXSLB)
  1192. DISABLE_INTS
  1193. bl .save_nvgprs
  1194. 1: addi r3,r1,STACK_FRAME_OVERHEAD
  1195. bl .unrecoverable_exception
  1196. b 1b
  1197. #ifdef CONFIG_PPC_970_NAP
  1198. power4_fixup_nap:
  1199. andc r9,r9,r10
  1200. std r9,TI_LOCAL_FLAGS(r11)
  1201. ld r10,_LINK(r1) /* make idle task do the */
  1202. std r10,_NIP(r1) /* equivalent of a blr */
  1203. blr
  1204. #endif
  1205. /*
  1206. * Hash table stuff
  1207. */
  1208. .align 7
  1209. _STATIC(do_hash_page)
  1210. std r3,_DAR(r1)
  1211. std r4,_DSISR(r1)
  1212. andis. r0,r4,0xa410 /* weird error? */
  1213. bne- handle_page_fault /* if not, try to insert a HPTE */
  1214. andis. r0,r4,DSISR_DABRMATCH@h
  1215. bne- handle_dabr_fault
  1216. BEGIN_FTR_SECTION
  1217. andis. r0,r4,0x0020 /* Is it a segment table fault? */
  1218. bne- do_ste_alloc /* If so handle it */
  1219. END_MMU_FTR_SECTION_IFCLR(MMU_FTR_SLB)
  1220. CURRENT_THREAD_INFO(r11, r1)
  1221. lwz r0,TI_PREEMPT(r11) /* If we're in an "NMI" */
  1222. andis. r0,r0,NMI_MASK@h /* (i.e. an irq when soft-disabled) */
  1223. bne 77f /* then don't call hash_page now */
  1224. /*
  1225. * We need to set the _PAGE_USER bit if MSR_PR is set or if we are
  1226. * accessing a userspace segment (even from the kernel). We assume
  1227. * kernel addresses always have the high bit set.
  1228. */
  1229. rlwinm r4,r4,32-25+9,31-9,31-9 /* DSISR_STORE -> _PAGE_RW */
  1230. rotldi r0,r3,15 /* Move high bit into MSR_PR posn */
  1231. orc r0,r12,r0 /* MSR_PR | ~high_bit */
  1232. rlwimi r4,r0,32-13,30,30 /* becomes _PAGE_USER access bit */
  1233. ori r4,r4,1 /* add _PAGE_PRESENT */
  1234. rlwimi r4,r5,22+2,31-2,31-2 /* Set _PAGE_EXEC if trap is 0x400 */
  1235. /*
  1236. * r3 contains the faulting address
  1237. * r4 contains the required access permissions
  1238. * r5 contains the trap number
  1239. *
  1240. * at return r3 = 0 for success, 1 for page fault, negative for error
  1241. */
  1242. bl .hash_page /* build HPTE if possible */
  1243. cmpdi r3,0 /* see if hash_page succeeded */
  1244. /* Success */
  1245. beq fast_exc_return_irq /* Return from exception on success */
  1246. /* Error */
  1247. blt- 13f
  1248. /* Here we have a page fault that hash_page can't handle. */
  1249. handle_page_fault:
  1250. 11: ld r4,_DAR(r1)
  1251. ld r5,_DSISR(r1)
  1252. addi r3,r1,STACK_FRAME_OVERHEAD
  1253. bl .do_page_fault
  1254. cmpdi r3,0
  1255. beq+ 12f
  1256. bl .save_nvgprs
  1257. mr r5,r3
  1258. addi r3,r1,STACK_FRAME_OVERHEAD
  1259. lwz r4,_DAR(r1)
  1260. bl .bad_page_fault
  1261. b .ret_from_except
  1262. /* We have a data breakpoint exception - handle it */
  1263. handle_dabr_fault:
  1264. bl .save_nvgprs
  1265. ld r4,_DAR(r1)
  1266. ld r5,_DSISR(r1)
  1267. addi r3,r1,STACK_FRAME_OVERHEAD
  1268. bl .do_break
  1269. 12: b .ret_from_except_lite
  1270. /* We have a page fault that hash_page could handle but HV refused
  1271. * the PTE insertion
  1272. */
  1273. 13: bl .save_nvgprs
  1274. mr r5,r3
  1275. addi r3,r1,STACK_FRAME_OVERHEAD
  1276. ld r4,_DAR(r1)
  1277. bl .low_hash_fault
  1278. b .ret_from_except
  1279. /*
  1280. * We come here as a result of a DSI at a point where we don't want
  1281. * to call hash_page, such as when we are accessing memory (possibly
  1282. * user memory) inside a PMU interrupt that occurred while interrupts
  1283. * were soft-disabled. We want to invoke the exception handler for
  1284. * the access, or panic if there isn't a handler.
  1285. */
  1286. 77: bl .save_nvgprs
  1287. mr r4,r3
  1288. addi r3,r1,STACK_FRAME_OVERHEAD
  1289. li r5,SIGSEGV
  1290. bl .bad_page_fault
  1291. b .ret_from_except
  1292. /* here we have a segment miss */
  1293. do_ste_alloc:
  1294. bl .ste_allocate /* try to insert stab entry */
  1295. cmpdi r3,0
  1296. bne- handle_page_fault
  1297. b fast_exception_return
  1298. /*
  1299. * r13 points to the PACA, r9 contains the saved CR,
  1300. * r11 and r12 contain the saved SRR0 and SRR1.
  1301. * r9 - r13 are saved in paca->exslb.
  1302. * We assume we aren't going to take any exceptions during this procedure.
  1303. * We assume (DAR >> 60) == 0xc.
  1304. */
  1305. .align 7
  1306. _GLOBAL(do_stab_bolted)
  1307. stw r9,PACA_EXSLB+EX_CCR(r13) /* save CR in exc. frame */
  1308. std r11,PACA_EXSLB+EX_SRR0(r13) /* save SRR0 in exc. frame */
  1309. mfspr r11,SPRN_DAR /* ea */
  1310. /*
  1311. * check for bad kernel/user address
  1312. * (ea & ~REGION_MASK) >= PGTABLE_RANGE
  1313. */
  1314. rldicr. r9,r11,4,(63 - 46 - 4)
  1315. li r9,0 /* VSID = 0 for bad address */
  1316. bne- 0f
  1317. /*
  1318. * Calculate VSID:
  1319. * This is the kernel vsid, we take the top for context from
  1320. * the range. context = (MAX_USER_CONTEXT) + ((ea >> 60) - 0xc) + 1
  1321. * Here we know that (ea >> 60) == 0xc
  1322. */
  1323. lis r9,(MAX_USER_CONTEXT + 1)@ha
  1324. addi r9,r9,(MAX_USER_CONTEXT + 1)@l
  1325. srdi r10,r11,SID_SHIFT
  1326. rldimi r10,r9,ESID_BITS,0 /* proto vsid */
  1327. ASM_VSID_SCRAMBLE(r10, r9, 256M)
  1328. rldic r9,r10,12,16 /* r9 = vsid << 12 */
  1329. 0:
  1330. /* Hash to the primary group */
  1331. ld r10,PACASTABVIRT(r13)
  1332. srdi r11,r11,SID_SHIFT
  1333. rldimi r10,r11,7,52 /* r10 = first ste of the group */
  1334. /* Search the primary group for a free entry */
  1335. 1: ld r11,0(r10) /* Test valid bit of the current ste */
  1336. andi. r11,r11,0x80
  1337. beq 2f
  1338. addi r10,r10,16
  1339. andi. r11,r10,0x70
  1340. bne 1b
  1341. /* Stick for only searching the primary group for now. */
  1342. /* At least for now, we use a very simple random castout scheme */
  1343. /* Use the TB as a random number ; OR in 1 to avoid entry 0 */
  1344. mftb r11
  1345. rldic r11,r11,4,57 /* r11 = (r11 << 4) & 0x70 */
  1346. ori r11,r11,0x10
  1347. /* r10 currently points to an ste one past the group of interest */
  1348. /* make it point to the randomly selected entry */
  1349. subi r10,r10,128
  1350. or r10,r10,r11 /* r10 is the entry to invalidate */
  1351. isync /* mark the entry invalid */
  1352. ld r11,0(r10)
  1353. rldicl r11,r11,56,1 /* clear the valid bit */
  1354. rotldi r11,r11,8
  1355. std r11,0(r10)
  1356. sync
  1357. clrrdi r11,r11,28 /* Get the esid part of the ste */
  1358. slbie r11
  1359. 2: std r9,8(r10) /* Store the vsid part of the ste */
  1360. eieio
  1361. mfspr r11,SPRN_DAR /* Get the new esid */
  1362. clrrdi r11,r11,28 /* Permits a full 32b of ESID */
  1363. ori r11,r11,0x90 /* Turn on valid and kp */
  1364. std r11,0(r10) /* Put new entry back into the stab */
  1365. sync
  1366. /* All done -- return from exception. */
  1367. lwz r9,PACA_EXSLB+EX_CCR(r13) /* get saved CR */
  1368. ld r11,PACA_EXSLB+EX_SRR0(r13) /* get saved SRR0 */
  1369. andi. r10,r12,MSR_RI
  1370. beq- unrecov_slb
  1371. mtcrf 0x80,r9 /* restore CR */
  1372. mfmsr r10
  1373. clrrdi r10,r10,2
  1374. mtmsrd r10,1
  1375. mtspr SPRN_SRR0,r11
  1376. mtspr SPRN_SRR1,r12
  1377. ld r9,PACA_EXSLB+EX_R9(r13)
  1378. ld r10,PACA_EXSLB+EX_R10(r13)
  1379. ld r11,PACA_EXSLB+EX_R11(r13)
  1380. ld r12,PACA_EXSLB+EX_R12(r13)
  1381. ld r13,PACA_EXSLB+EX_R13(r13)
  1382. rfid
  1383. b . /* prevent speculative execution */