head_64.S 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737
  1. /*
  2. * PowerPC version
  3. * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
  4. *
  5. * Rewritten by Cort Dougan (cort@cs.nmt.edu) for PReP
  6. * Copyright (C) 1996 Cort Dougan <cort@cs.nmt.edu>
  7. * Adapted for Power Macintosh by Paul Mackerras.
  8. * Low-level exception handlers and MMU support
  9. * rewritten by Paul Mackerras.
  10. * Copyright (C) 1996 Paul Mackerras.
  11. *
  12. * Adapted for 64bit PowerPC by Dave Engebretsen, Peter Bergner, and
  13. * Mike Corrigan {engebret|bergner|mikejc}@us.ibm.com
  14. *
  15. * This file contains the low-level support and setup for the
  16. * PowerPC-64 platform, including trap and interrupt dispatch.
  17. *
  18. * This program is free software; you can redistribute it and/or
  19. * modify it under the terms of the GNU General Public License
  20. * as published by the Free Software Foundation; either version
  21. * 2 of the License, or (at your option) any later version.
  22. */
  23. #include <linux/threads.h>
  24. #include <asm/reg.h>
  25. #include <asm/page.h>
  26. #include <asm/mmu.h>
  27. #include <asm/ppc_asm.h>
  28. #include <asm/asm-offsets.h>
  29. #include <asm/bug.h>
  30. #include <asm/cputable.h>
  31. #include <asm/setup.h>
  32. #include <asm/hvcall.h>
  33. #include <asm/iseries/lpar_map.h>
  34. #include <asm/thread_info.h>
  35. #include <asm/firmware.h>
  36. #include <asm/page_64.h>
  37. #include <asm/exception.h>
  38. #include <asm/irqflags.h>
  39. /*
  40. * We layout physical memory as follows:
  41. * 0x0000 - 0x00ff : Secondary processor spin code
  42. * 0x0100 - 0x2fff : pSeries Interrupt prologs
  43. * 0x3000 - 0x5fff : interrupt support, iSeries and common interrupt prologs
  44. * 0x6000 - 0x6fff : Initial (CPU0) segment table
  45. * 0x7000 - 0x7fff : FWNMI data area
  46. * 0x8000 - : Early init and support code
  47. */
  48. /*
  49. * SPRG Usage
  50. *
  51. * Register Definition
  52. *
  53. * SPRG0 reserved for hypervisor
  54. * SPRG1 temp - used to save gpr
  55. * SPRG2 temp - used to save gpr
  56. * SPRG3 virt addr of paca
  57. */
  58. /*
  59. * Entering into this code we make the following assumptions:
  60. * For pSeries:
  61. * 1. The MMU is off & open firmware is running in real mode.
  62. * 2. The kernel is entered at __start
  63. *
  64. * For iSeries:
  65. * 1. The MMU is on (as it always is for iSeries)
  66. * 2. The kernel is entered at system_reset_iSeries
  67. */
  68. .text
  69. .globl _stext
  70. _stext:
  71. _GLOBAL(__start)
  72. /* NOP this out unconditionally */
  73. BEGIN_FTR_SECTION
  74. b .__start_initialization_multiplatform
  75. END_FTR_SECTION(0, 1)
  76. /* Catch branch to 0 in real mode */
  77. trap
  78. /* Secondary processors spin on this value until it becomes nonzero.
  79. * When it does it contains the real address of the descriptor
  80. * of the function that the cpu should jump to to continue
  81. * initialization.
  82. */
  83. .globl __secondary_hold_spinloop
  84. __secondary_hold_spinloop:
  85. .llong 0x0
  86. /* Secondary processors write this value with their cpu # */
  87. /* after they enter the spin loop immediately below. */
  88. .globl __secondary_hold_acknowledge
  89. __secondary_hold_acknowledge:
  90. .llong 0x0
  91. /* This flag is set by purgatory if we should be a kdump kernel. */
  92. /* Do not move this variable as purgatory knows about it. */
  93. .globl __kdump_flag
  94. __kdump_flag:
  95. .llong 0x0
  96. #ifdef CONFIG_PPC_ISERIES
  97. /*
  98. * At offset 0x20, there is a pointer to iSeries LPAR data.
  99. * This is required by the hypervisor
  100. */
  101. . = 0x20
  102. .llong hvReleaseData-KERNELBASE
  103. #endif /* CONFIG_PPC_ISERIES */
  104. . = 0x60
  105. /*
  106. * The following code is used to hold secondary processors
  107. * in a spin loop after they have entered the kernel, but
  108. * before the bulk of the kernel has been relocated. This code
  109. * is relocated to physical address 0x60 before prom_init is run.
  110. * All of it must fit below the first exception vector at 0x100.
  111. * Use .globl here not _GLOBAL because we want __secondary_hold
  112. * to be the actual text address, not a descriptor.
  113. */
  114. .globl __secondary_hold
  115. __secondary_hold:
  116. mfmsr r24
  117. ori r24,r24,MSR_RI
  118. mtmsrd r24 /* RI on */
  119. /* Grab our physical cpu number */
  120. mr r24,r3
  121. /* Tell the master cpu we're here */
  122. /* Relocation is off & we are located at an address less */
  123. /* than 0x100, so only need to grab low order offset. */
  124. std r24,__secondary_hold_acknowledge-_stext(0)
  125. sync
  126. /* All secondary cpus wait here until told to start. */
  127. 100: ld r4,__secondary_hold_spinloop-_stext(0)
  128. cmpdi 0,r4,0
  129. beq 100b
  130. #if defined(CONFIG_SMP) || defined(CONFIG_KEXEC)
  131. ld r4,0(r4) /* deref function descriptor */
  132. mtctr r4
  133. mr r3,r24
  134. bctr
  135. #else
  136. BUG_OPCODE
  137. #endif
  138. /* This value is used to mark exception frames on the stack. */
  139. .section ".toc","aw"
  140. exception_marker:
  141. .tc ID_72656773_68657265[TC],0x7265677368657265
  142. .text
  143. /*
  144. * This is the start of the interrupt handlers for pSeries
  145. * This code runs with relocation off.
  146. * Code from here to __end_interrupts gets copied down to real
  147. * address 0x100 when we are running a relocatable kernel.
  148. * Therefore any relative branches in this section must only
  149. * branch to labels in this section.
  150. */
  151. . = 0x100
  152. .globl __start_interrupts
  153. __start_interrupts:
  154. STD_EXCEPTION_PSERIES(0x100, system_reset)
  155. . = 0x200
  156. _machine_check_pSeries:
  157. HMT_MEDIUM
  158. mtspr SPRN_SPRG1,r13 /* save r13 */
  159. EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common)
  160. . = 0x300
  161. .globl data_access_pSeries
  162. data_access_pSeries:
  163. HMT_MEDIUM
  164. mtspr SPRN_SPRG1,r13
  165. BEGIN_FTR_SECTION
  166. mtspr SPRN_SPRG2,r12
  167. mfspr r13,SPRN_DAR
  168. mfspr r12,SPRN_DSISR
  169. srdi r13,r13,60
  170. rlwimi r13,r12,16,0x20
  171. mfcr r12
  172. cmpwi r13,0x2c
  173. beq do_stab_bolted_pSeries
  174. mtcrf 0x80,r12
  175. mfspr r12,SPRN_SPRG2
  176. END_FTR_SECTION_IFCLR(CPU_FTR_SLB)
  177. EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, data_access_common)
  178. . = 0x380
  179. .globl data_access_slb_pSeries
  180. data_access_slb_pSeries:
  181. HMT_MEDIUM
  182. mtspr SPRN_SPRG1,r13
  183. mfspr r13,SPRN_SPRG3 /* get paca address into r13 */
  184. std r3,PACA_EXSLB+EX_R3(r13)
  185. mfspr r3,SPRN_DAR
  186. std r9,PACA_EXSLB+EX_R9(r13) /* save r9 - r12 */
  187. mfcr r9
  188. #ifdef __DISABLED__
  189. /* Keep that around for when we re-implement dynamic VSIDs */
  190. cmpdi r3,0
  191. bge slb_miss_user_pseries
  192. #endif /* __DISABLED__ */
  193. std r10,PACA_EXSLB+EX_R10(r13)
  194. std r11,PACA_EXSLB+EX_R11(r13)
  195. std r12,PACA_EXSLB+EX_R12(r13)
  196. mfspr r10,SPRN_SPRG1
  197. std r10,PACA_EXSLB+EX_R13(r13)
  198. mfspr r12,SPRN_SRR1 /* and SRR1 */
  199. #ifndef CONFIG_RELOCATABLE
  200. b .slb_miss_realmode
  201. #else
  202. /*
  203. * We can't just use a direct branch to .slb_miss_realmode
  204. * because the distance from here to there depends on where
  205. * the kernel ends up being put.
  206. */
  207. mfctr r11
  208. ld r10,PACAKBASE(r13)
  209. LOAD_HANDLER(r10, .slb_miss_realmode)
  210. mtctr r10
  211. bctr
  212. #endif
  213. STD_EXCEPTION_PSERIES(0x400, instruction_access)
  214. . = 0x480
  215. .globl instruction_access_slb_pSeries
  216. instruction_access_slb_pSeries:
  217. HMT_MEDIUM
  218. mtspr SPRN_SPRG1,r13
  219. mfspr r13,SPRN_SPRG3 /* get paca address into r13 */
  220. std r3,PACA_EXSLB+EX_R3(r13)
  221. mfspr r3,SPRN_SRR0 /* SRR0 is faulting address */
  222. std r9,PACA_EXSLB+EX_R9(r13) /* save r9 - r12 */
  223. mfcr r9
  224. #ifdef __DISABLED__
  225. /* Keep that around for when we re-implement dynamic VSIDs */
  226. cmpdi r3,0
  227. bge slb_miss_user_pseries
  228. #endif /* __DISABLED__ */
  229. std r10,PACA_EXSLB+EX_R10(r13)
  230. std r11,PACA_EXSLB+EX_R11(r13)
  231. std r12,PACA_EXSLB+EX_R12(r13)
  232. mfspr r10,SPRN_SPRG1
  233. std r10,PACA_EXSLB+EX_R13(r13)
  234. mfspr r12,SPRN_SRR1 /* and SRR1 */
  235. #ifndef CONFIG_RELOCATABLE
  236. b .slb_miss_realmode
  237. #else
  238. mfctr r11
  239. ld r10,PACAKBASE(r13)
  240. LOAD_HANDLER(r10, .slb_miss_realmode)
  241. mtctr r10
  242. bctr
  243. #endif
  244. MASKABLE_EXCEPTION_PSERIES(0x500, hardware_interrupt)
  245. STD_EXCEPTION_PSERIES(0x600, alignment)
  246. STD_EXCEPTION_PSERIES(0x700, program_check)
  247. STD_EXCEPTION_PSERIES(0x800, fp_unavailable)
  248. MASKABLE_EXCEPTION_PSERIES(0x900, decrementer)
  249. STD_EXCEPTION_PSERIES(0xa00, trap_0a)
  250. STD_EXCEPTION_PSERIES(0xb00, trap_0b)
  251. . = 0xc00
  252. .globl system_call_pSeries
  253. system_call_pSeries:
  254. HMT_MEDIUM
  255. BEGIN_FTR_SECTION
  256. cmpdi r0,0x1ebe
  257. beq- 1f
  258. END_FTR_SECTION_IFSET(CPU_FTR_REAL_LE)
  259. mr r9,r13
  260. mfspr r13,SPRN_SPRG3
  261. mfspr r11,SPRN_SRR0
  262. ld r12,PACAKBASE(r13)
  263. ld r10,PACAKMSR(r13)
  264. LOAD_HANDLER(r12, system_call_entry)
  265. mtspr SPRN_SRR0,r12
  266. mfspr r12,SPRN_SRR1
  267. mtspr SPRN_SRR1,r10
  268. rfid
  269. b . /* prevent speculative execution */
  270. /* Fast LE/BE switch system call */
  271. 1: mfspr r12,SPRN_SRR1
  272. xori r12,r12,MSR_LE
  273. mtspr SPRN_SRR1,r12
  274. rfid /* return to userspace */
  275. b .
  276. STD_EXCEPTION_PSERIES(0xd00, single_step)
  277. STD_EXCEPTION_PSERIES(0xe00, trap_0e)
  278. /* We need to deal with the Altivec unavailable exception
  279. * here which is at 0xf20, thus in the middle of the
  280. * prolog code of the PerformanceMonitor one. A little
  281. * trickery is thus necessary
  282. */
  283. . = 0xf00
  284. b performance_monitor_pSeries
  285. . = 0xf20
  286. b altivec_unavailable_pSeries
  287. . = 0xf40
  288. b vsx_unavailable_pSeries
  289. #ifdef CONFIG_CBE_RAS
  290. HSTD_EXCEPTION_PSERIES(0x1200, cbe_system_error)
  291. #endif /* CONFIG_CBE_RAS */
  292. STD_EXCEPTION_PSERIES(0x1300, instruction_breakpoint)
  293. #ifdef CONFIG_CBE_RAS
  294. HSTD_EXCEPTION_PSERIES(0x1600, cbe_maintenance)
  295. #endif /* CONFIG_CBE_RAS */
  296. STD_EXCEPTION_PSERIES(0x1700, altivec_assist)
  297. #ifdef CONFIG_CBE_RAS
  298. HSTD_EXCEPTION_PSERIES(0x1800, cbe_thermal)
  299. #endif /* CONFIG_CBE_RAS */
  300. . = 0x3000
  301. /*** pSeries interrupt support ***/
  302. /* moved from 0xf00 */
  303. STD_EXCEPTION_PSERIES(., performance_monitor)
  304. STD_EXCEPTION_PSERIES(., altivec_unavailable)
  305. STD_EXCEPTION_PSERIES(., vsx_unavailable)
  306. /*
  307. * An interrupt came in while soft-disabled; clear EE in SRR1,
  308. * clear paca->hard_enabled and return.
  309. */
  310. masked_interrupt:
  311. stb r10,PACAHARDIRQEN(r13)
  312. mtcrf 0x80,r9
  313. ld r9,PACA_EXGEN+EX_R9(r13)
  314. mfspr r10,SPRN_SRR1
  315. rldicl r10,r10,48,1 /* clear MSR_EE */
  316. rotldi r10,r10,16
  317. mtspr SPRN_SRR1,r10
  318. ld r10,PACA_EXGEN+EX_R10(r13)
  319. mfspr r13,SPRN_SPRG1
  320. rfid
  321. b .
  322. .align 7
  323. do_stab_bolted_pSeries:
  324. mtcrf 0x80,r12
  325. mfspr r12,SPRN_SPRG2
  326. EXCEPTION_PROLOG_PSERIES(PACA_EXSLB, .do_stab_bolted)
  327. #ifdef CONFIG_PPC_PSERIES
  328. /*
  329. * Vectors for the FWNMI option. Share common code.
  330. */
  331. .globl system_reset_fwnmi
  332. .align 7
  333. system_reset_fwnmi:
  334. HMT_MEDIUM
  335. mtspr SPRN_SPRG1,r13 /* save r13 */
  336. EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common)
  337. .globl machine_check_fwnmi
  338. .align 7
  339. machine_check_fwnmi:
  340. HMT_MEDIUM
  341. mtspr SPRN_SPRG1,r13 /* save r13 */
  342. EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common)
  343. #endif /* CONFIG_PPC_PSERIES */
  344. #ifdef __DISABLED__
  345. /*
  346. * This is used for when the SLB miss handler has to go virtual,
  347. * which doesn't happen for now anymore but will once we re-implement
  348. * dynamic VSIDs for shared page tables
  349. */
  350. slb_miss_user_pseries:
  351. std r10,PACA_EXGEN+EX_R10(r13)
  352. std r11,PACA_EXGEN+EX_R11(r13)
  353. std r12,PACA_EXGEN+EX_R12(r13)
  354. mfspr r10,SPRG1
  355. ld r11,PACA_EXSLB+EX_R9(r13)
  356. ld r12,PACA_EXSLB+EX_R3(r13)
  357. std r10,PACA_EXGEN+EX_R13(r13)
  358. std r11,PACA_EXGEN+EX_R9(r13)
  359. std r12,PACA_EXGEN+EX_R3(r13)
  360. clrrdi r12,r13,32
  361. mfmsr r10
  362. mfspr r11,SRR0 /* save SRR0 */
  363. ori r12,r12,slb_miss_user_common@l /* virt addr of handler */
  364. ori r10,r10,MSR_IR|MSR_DR|MSR_RI
  365. mtspr SRR0,r12
  366. mfspr r12,SRR1 /* and SRR1 */
  367. mtspr SRR1,r10
  368. rfid
  369. b . /* prevent spec. execution */
  370. #endif /* __DISABLED__ */
  371. .align 7
  372. .globl __end_interrupts
  373. __end_interrupts:
  374. /*
  375. * Code from here down to __end_handlers is invoked from the
  376. * exception prologs above. Because the prologs assemble the
  377. * addresses of these handlers using the LOAD_HANDLER macro,
  378. * which uses an addi instruction, these handlers must be in
  379. * the first 32k of the kernel image.
  380. */
  381. /*** Common interrupt handlers ***/
  382. STD_EXCEPTION_COMMON(0x100, system_reset, .system_reset_exception)
  383. /*
  384. * Machine check is different because we use a different
  385. * save area: PACA_EXMC instead of PACA_EXGEN.
  386. */
  387. .align 7
  388. .globl machine_check_common
  389. machine_check_common:
  390. EXCEPTION_PROLOG_COMMON(0x200, PACA_EXMC)
  391. FINISH_NAP
  392. DISABLE_INTS
  393. bl .save_nvgprs
  394. addi r3,r1,STACK_FRAME_OVERHEAD
  395. bl .machine_check_exception
  396. b .ret_from_except
  397. STD_EXCEPTION_COMMON_LITE(0x900, decrementer, .timer_interrupt)
  398. STD_EXCEPTION_COMMON(0xa00, trap_0a, .unknown_exception)
  399. STD_EXCEPTION_COMMON(0xb00, trap_0b, .unknown_exception)
  400. STD_EXCEPTION_COMMON(0xd00, single_step, .single_step_exception)
  401. STD_EXCEPTION_COMMON(0xe00, trap_0e, .unknown_exception)
  402. STD_EXCEPTION_COMMON_IDLE(0xf00, performance_monitor, .performance_monitor_exception)
  403. STD_EXCEPTION_COMMON(0x1300, instruction_breakpoint, .instruction_breakpoint_exception)
  404. #ifdef CONFIG_ALTIVEC
  405. STD_EXCEPTION_COMMON(0x1700, altivec_assist, .altivec_assist_exception)
  406. #else
  407. STD_EXCEPTION_COMMON(0x1700, altivec_assist, .unknown_exception)
  408. #endif
  409. #ifdef CONFIG_CBE_RAS
  410. STD_EXCEPTION_COMMON(0x1200, cbe_system_error, .cbe_system_error_exception)
  411. STD_EXCEPTION_COMMON(0x1600, cbe_maintenance, .cbe_maintenance_exception)
  412. STD_EXCEPTION_COMMON(0x1800, cbe_thermal, .cbe_thermal_exception)
  413. #endif /* CONFIG_CBE_RAS */
  414. .align 7
  415. system_call_entry:
  416. b system_call_common
  417. /*
  418. * Here we have detected that the kernel stack pointer is bad.
  419. * R9 contains the saved CR, r13 points to the paca,
  420. * r10 contains the (bad) kernel stack pointer,
  421. * r11 and r12 contain the saved SRR0 and SRR1.
  422. * We switch to using an emergency stack, save the registers there,
  423. * and call kernel_bad_stack(), which panics.
  424. */
  425. bad_stack:
  426. ld r1,PACAEMERGSP(r13)
  427. subi r1,r1,64+INT_FRAME_SIZE
  428. std r9,_CCR(r1)
  429. std r10,GPR1(r1)
  430. std r11,_NIP(r1)
  431. std r12,_MSR(r1)
  432. mfspr r11,SPRN_DAR
  433. mfspr r12,SPRN_DSISR
  434. std r11,_DAR(r1)
  435. std r12,_DSISR(r1)
  436. mflr r10
  437. mfctr r11
  438. mfxer r12
  439. std r10,_LINK(r1)
  440. std r11,_CTR(r1)
  441. std r12,_XER(r1)
  442. SAVE_GPR(0,r1)
  443. SAVE_GPR(2,r1)
  444. SAVE_4GPRS(3,r1)
  445. SAVE_2GPRS(7,r1)
  446. SAVE_10GPRS(12,r1)
  447. SAVE_10GPRS(22,r1)
  448. lhz r12,PACA_TRAP_SAVE(r13)
  449. std r12,_TRAP(r1)
  450. addi r11,r1,INT_FRAME_SIZE
  451. std r11,0(r1)
  452. li r12,0
  453. std r12,0(r11)
  454. ld r2,PACATOC(r13)
  455. 1: addi r3,r1,STACK_FRAME_OVERHEAD
  456. bl .kernel_bad_stack
  457. b 1b
  458. /*
  459. * Here r13 points to the paca, r9 contains the saved CR,
  460. * SRR0 and SRR1 are saved in r11 and r12,
  461. * r9 - r13 are saved in paca->exgen.
  462. */
  463. .align 7
  464. .globl data_access_common
  465. data_access_common:
  466. mfspr r10,SPRN_DAR
  467. std r10,PACA_EXGEN+EX_DAR(r13)
  468. mfspr r10,SPRN_DSISR
  469. stw r10,PACA_EXGEN+EX_DSISR(r13)
  470. EXCEPTION_PROLOG_COMMON(0x300, PACA_EXGEN)
  471. ld r3,PACA_EXGEN+EX_DAR(r13)
  472. lwz r4,PACA_EXGEN+EX_DSISR(r13)
  473. li r5,0x300
  474. b .do_hash_page /* Try to handle as hpte fault */
  475. .align 7
  476. .globl instruction_access_common
  477. instruction_access_common:
  478. EXCEPTION_PROLOG_COMMON(0x400, PACA_EXGEN)
  479. ld r3,_NIP(r1)
  480. andis. r4,r12,0x5820
  481. li r5,0x400
  482. b .do_hash_page /* Try to handle as hpte fault */
  483. /*
  484. * Here is the common SLB miss user that is used when going to virtual
  485. * mode for SLB misses, that is currently not used
  486. */
  487. #ifdef __DISABLED__
  488. .align 7
  489. .globl slb_miss_user_common
  490. slb_miss_user_common:
  491. mflr r10
  492. std r3,PACA_EXGEN+EX_DAR(r13)
  493. stw r9,PACA_EXGEN+EX_CCR(r13)
  494. std r10,PACA_EXGEN+EX_LR(r13)
  495. std r11,PACA_EXGEN+EX_SRR0(r13)
  496. bl .slb_allocate_user
  497. ld r10,PACA_EXGEN+EX_LR(r13)
  498. ld r3,PACA_EXGEN+EX_R3(r13)
  499. lwz r9,PACA_EXGEN+EX_CCR(r13)
  500. ld r11,PACA_EXGEN+EX_SRR0(r13)
  501. mtlr r10
  502. beq- slb_miss_fault
  503. andi. r10,r12,MSR_RI /* check for unrecoverable exception */
  504. beq- unrecov_user_slb
  505. mfmsr r10
  506. .machine push
  507. .machine "power4"
  508. mtcrf 0x80,r9
  509. .machine pop
  510. clrrdi r10,r10,2 /* clear RI before setting SRR0/1 */
  511. mtmsrd r10,1
  512. mtspr SRR0,r11
  513. mtspr SRR1,r12
  514. ld r9,PACA_EXGEN+EX_R9(r13)
  515. ld r10,PACA_EXGEN+EX_R10(r13)
  516. ld r11,PACA_EXGEN+EX_R11(r13)
  517. ld r12,PACA_EXGEN+EX_R12(r13)
  518. ld r13,PACA_EXGEN+EX_R13(r13)
  519. rfid
  520. b .
  521. slb_miss_fault:
  522. EXCEPTION_PROLOG_COMMON(0x380, PACA_EXGEN)
  523. ld r4,PACA_EXGEN+EX_DAR(r13)
  524. li r5,0
  525. std r4,_DAR(r1)
  526. std r5,_DSISR(r1)
  527. b handle_page_fault
  528. unrecov_user_slb:
  529. EXCEPTION_PROLOG_COMMON(0x4200, PACA_EXGEN)
  530. DISABLE_INTS
  531. bl .save_nvgprs
  532. 1: addi r3,r1,STACK_FRAME_OVERHEAD
  533. bl .unrecoverable_exception
  534. b 1b
  535. #endif /* __DISABLED__ */
  536. /*
  537. * r13 points to the PACA, r9 contains the saved CR,
  538. * r12 contain the saved SRR1, SRR0 is still ready for return
  539. * r3 has the faulting address
  540. * r9 - r13 are saved in paca->exslb.
  541. * r3 is saved in paca->slb_r3
  542. * We assume we aren't going to take any exceptions during this procedure.
  543. */
  544. _GLOBAL(slb_miss_realmode)
  545. mflr r10
  546. #ifdef CONFIG_RELOCATABLE
  547. mtctr r11
  548. #endif
  549. stw r9,PACA_EXSLB+EX_CCR(r13) /* save CR in exc. frame */
  550. std r10,PACA_EXSLB+EX_LR(r13) /* save LR */
  551. bl .slb_allocate_realmode
  552. /* All done -- return from exception. */
  553. ld r10,PACA_EXSLB+EX_LR(r13)
  554. ld r3,PACA_EXSLB+EX_R3(r13)
  555. lwz r9,PACA_EXSLB+EX_CCR(r13) /* get saved CR */
  556. #ifdef CONFIG_PPC_ISERIES
  557. BEGIN_FW_FTR_SECTION
  558. ld r11,PACALPPACAPTR(r13)
  559. ld r11,LPPACASRR0(r11) /* get SRR0 value */
  560. END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
  561. #endif /* CONFIG_PPC_ISERIES */
  562. mtlr r10
  563. andi. r10,r12,MSR_RI /* check for unrecoverable exception */
  564. beq- 2f
  565. .machine push
  566. .machine "power4"
  567. mtcrf 0x80,r9
  568. mtcrf 0x01,r9 /* slb_allocate uses cr0 and cr7 */
  569. .machine pop
  570. #ifdef CONFIG_PPC_ISERIES
  571. BEGIN_FW_FTR_SECTION
  572. mtspr SPRN_SRR0,r11
  573. mtspr SPRN_SRR1,r12
  574. END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
  575. #endif /* CONFIG_PPC_ISERIES */
  576. ld r9,PACA_EXSLB+EX_R9(r13)
  577. ld r10,PACA_EXSLB+EX_R10(r13)
  578. ld r11,PACA_EXSLB+EX_R11(r13)
  579. ld r12,PACA_EXSLB+EX_R12(r13)
  580. ld r13,PACA_EXSLB+EX_R13(r13)
  581. rfid
  582. b . /* prevent speculative execution */
  583. 2:
  584. #ifdef CONFIG_PPC_ISERIES
  585. BEGIN_FW_FTR_SECTION
  586. b unrecov_slb
  587. END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
  588. #endif /* CONFIG_PPC_ISERIES */
  589. mfspr r11,SPRN_SRR0
  590. ld r10,PACAKBASE(r13)
  591. LOAD_HANDLER(r10,unrecov_slb)
  592. mtspr SPRN_SRR0,r10
  593. ld r10,PACAKMSR(r13)
  594. mtspr SPRN_SRR1,r10
  595. rfid
  596. b .
  597. unrecov_slb:
  598. EXCEPTION_PROLOG_COMMON(0x4100, PACA_EXSLB)
  599. DISABLE_INTS
  600. bl .save_nvgprs
  601. 1: addi r3,r1,STACK_FRAME_OVERHEAD
  602. bl .unrecoverable_exception
  603. b 1b
  604. .align 7
  605. .globl hardware_interrupt_common
  606. .globl hardware_interrupt_entry
  607. hardware_interrupt_common:
  608. EXCEPTION_PROLOG_COMMON(0x500, PACA_EXGEN)
  609. FINISH_NAP
  610. hardware_interrupt_entry:
  611. DISABLE_INTS
  612. BEGIN_FTR_SECTION
  613. bl .ppc64_runlatch_on
  614. END_FTR_SECTION_IFSET(CPU_FTR_CTRL)
  615. addi r3,r1,STACK_FRAME_OVERHEAD
  616. bl .do_IRQ
  617. b .ret_from_except_lite
  618. #ifdef CONFIG_PPC_970_NAP
  619. power4_fixup_nap:
  620. andc r9,r9,r10
  621. std r9,TI_LOCAL_FLAGS(r11)
  622. ld r10,_LINK(r1) /* make idle task do the */
  623. std r10,_NIP(r1) /* equivalent of a blr */
  624. blr
  625. #endif
  626. .align 7
  627. .globl alignment_common
  628. alignment_common:
  629. mfspr r10,SPRN_DAR
  630. std r10,PACA_EXGEN+EX_DAR(r13)
  631. mfspr r10,SPRN_DSISR
  632. stw r10,PACA_EXGEN+EX_DSISR(r13)
  633. EXCEPTION_PROLOG_COMMON(0x600, PACA_EXGEN)
  634. ld r3,PACA_EXGEN+EX_DAR(r13)
  635. lwz r4,PACA_EXGEN+EX_DSISR(r13)
  636. std r3,_DAR(r1)
  637. std r4,_DSISR(r1)
  638. bl .save_nvgprs
  639. addi r3,r1,STACK_FRAME_OVERHEAD
  640. ENABLE_INTS
  641. bl .alignment_exception
  642. b .ret_from_except
  643. .align 7
  644. .globl program_check_common
  645. program_check_common:
  646. EXCEPTION_PROLOG_COMMON(0x700, PACA_EXGEN)
  647. bl .save_nvgprs
  648. addi r3,r1,STACK_FRAME_OVERHEAD
  649. ENABLE_INTS
  650. bl .program_check_exception
  651. b .ret_from_except
  652. .align 7
  653. .globl fp_unavailable_common
  654. fp_unavailable_common:
  655. EXCEPTION_PROLOG_COMMON(0x800, PACA_EXGEN)
  656. bne 1f /* if from user, just load it up */
  657. bl .save_nvgprs
  658. addi r3,r1,STACK_FRAME_OVERHEAD
  659. ENABLE_INTS
  660. bl .kernel_fp_unavailable_exception
  661. BUG_OPCODE
  662. 1: bl .load_up_fpu
  663. b fast_exception_return
  664. .align 7
  665. .globl altivec_unavailable_common
  666. altivec_unavailable_common:
  667. EXCEPTION_PROLOG_COMMON(0xf20, PACA_EXGEN)
  668. #ifdef CONFIG_ALTIVEC
  669. BEGIN_FTR_SECTION
  670. beq 1f
  671. bl .load_up_altivec
  672. b fast_exception_return
  673. 1:
  674. END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
  675. #endif
  676. bl .save_nvgprs
  677. addi r3,r1,STACK_FRAME_OVERHEAD
  678. ENABLE_INTS
  679. bl .altivec_unavailable_exception
  680. b .ret_from_except
  681. .align 7
  682. .globl vsx_unavailable_common
  683. vsx_unavailable_common:
  684. EXCEPTION_PROLOG_COMMON(0xf40, PACA_EXGEN)
  685. #ifdef CONFIG_VSX
  686. BEGIN_FTR_SECTION
  687. bne .load_up_vsx
  688. 1:
  689. END_FTR_SECTION_IFSET(CPU_FTR_VSX)
  690. #endif
  691. bl .save_nvgprs
  692. addi r3,r1,STACK_FRAME_OVERHEAD
  693. ENABLE_INTS
  694. bl .vsx_unavailable_exception
  695. b .ret_from_except
  696. .align 7
  697. .globl __end_handlers
  698. __end_handlers:
  699. /*
  700. * Return from an exception with minimal checks.
  701. * The caller is assumed to have done EXCEPTION_PROLOG_COMMON.
  702. * If interrupts have been enabled, or anything has been
  703. * done that might have changed the scheduling status of
  704. * any task or sent any task a signal, you should use
  705. * ret_from_except or ret_from_except_lite instead of this.
  706. */
  707. fast_exc_return_irq: /* restores irq state too */
  708. ld r3,SOFTE(r1)
  709. TRACE_AND_RESTORE_IRQ(r3);
  710. ld r12,_MSR(r1)
  711. rldicl r4,r12,49,63 /* get MSR_EE to LSB */
  712. stb r4,PACAHARDIRQEN(r13) /* restore paca->hard_enabled */
  713. b 1f
  714. .globl fast_exception_return
  715. fast_exception_return:
  716. ld r12,_MSR(r1)
  717. 1: ld r11,_NIP(r1)
  718. andi. r3,r12,MSR_RI /* check if RI is set */
  719. beq- unrecov_fer
  720. #ifdef CONFIG_VIRT_CPU_ACCOUNTING
  721. andi. r3,r12,MSR_PR
  722. beq 2f
  723. ACCOUNT_CPU_USER_EXIT(r3, r4)
  724. 2:
  725. #endif
  726. ld r3,_CCR(r1)
  727. ld r4,_LINK(r1)
  728. ld r5,_CTR(r1)
  729. ld r6,_XER(r1)
  730. mtcr r3
  731. mtlr r4
  732. mtctr r5
  733. mtxer r6
  734. REST_GPR(0, r1)
  735. REST_8GPRS(2, r1)
  736. mfmsr r10
  737. rldicl r10,r10,48,1 /* clear EE */
  738. rldicr r10,r10,16,61 /* clear RI (LE is 0 already) */
  739. mtmsrd r10,1
  740. mtspr SPRN_SRR1,r12
  741. mtspr SPRN_SRR0,r11
  742. REST_4GPRS(10, r1)
  743. ld r1,GPR1(r1)
  744. rfid
  745. b . /* prevent speculative execution */
  746. unrecov_fer:
  747. bl .save_nvgprs
  748. 1: addi r3,r1,STACK_FRAME_OVERHEAD
  749. bl .unrecoverable_exception
  750. b 1b
  751. #ifdef CONFIG_ALTIVEC
  752. /*
  753. * load_up_altivec(unused, unused, tsk)
  754. * Disable VMX for the task which had it previously,
  755. * and save its vector registers in its thread_struct.
  756. * Enables the VMX for use in the kernel on return.
  757. * On SMP we know the VMX is free, since we give it up every
  758. * switch (ie, no lazy save of the vector registers).
  759. * On entry: r13 == 'current' && last_task_used_altivec != 'current'
  760. */
  761. _STATIC(load_up_altivec)
  762. mfmsr r5 /* grab the current MSR */
  763. oris r5,r5,MSR_VEC@h
  764. mtmsrd r5 /* enable use of VMX now */
  765. isync
  766. /*
  767. * For SMP, we don't do lazy VMX switching because it just gets too
  768. * horrendously complex, especially when a task switches from one CPU
  769. * to another. Instead we call giveup_altvec in switch_to.
  770. * VRSAVE isn't dealt with here, that is done in the normal context
  771. * switch code. Note that we could rely on vrsave value to eventually
  772. * avoid saving all of the VREGs here...
  773. */
  774. #ifndef CONFIG_SMP
  775. ld r3,last_task_used_altivec@got(r2)
  776. ld r4,0(r3)
  777. cmpdi 0,r4,0
  778. beq 1f
  779. /* Save VMX state to last_task_used_altivec's THREAD struct */
  780. addi r4,r4,THREAD
  781. SAVE_32VRS(0,r5,r4)
  782. mfvscr vr0
  783. li r10,THREAD_VSCR
  784. stvx vr0,r10,r4
  785. /* Disable VMX for last_task_used_altivec */
  786. ld r5,PT_REGS(r4)
  787. ld r4,_MSR-STACK_FRAME_OVERHEAD(r5)
  788. lis r6,MSR_VEC@h
  789. andc r4,r4,r6
  790. std r4,_MSR-STACK_FRAME_OVERHEAD(r5)
  791. 1:
  792. #endif /* CONFIG_SMP */
  793. /* Hack: if we get an altivec unavailable trap with VRSAVE
  794. * set to all zeros, we assume this is a broken application
  795. * that fails to set it properly, and thus we switch it to
  796. * all 1's
  797. */
  798. mfspr r4,SPRN_VRSAVE
  799. cmpdi 0,r4,0
  800. bne+ 1f
  801. li r4,-1
  802. mtspr SPRN_VRSAVE,r4
  803. 1:
  804. /* enable use of VMX after return */
  805. ld r4,PACACURRENT(r13)
  806. addi r5,r4,THREAD /* Get THREAD */
  807. oris r12,r12,MSR_VEC@h
  808. std r12,_MSR(r1)
  809. li r4,1
  810. li r10,THREAD_VSCR
  811. stw r4,THREAD_USED_VR(r5)
  812. lvx vr0,r10,r5
  813. mtvscr vr0
  814. REST_32VRS(0,r4,r5)
  815. #ifndef CONFIG_SMP
  816. /* Update last_task_used_math to 'current' */
  817. subi r4,r5,THREAD /* Back to 'current' */
  818. std r4,0(r3)
  819. #endif /* CONFIG_SMP */
  820. /* restore registers and return */
  821. blr
  822. #endif /* CONFIG_ALTIVEC */
  823. #ifdef CONFIG_VSX
  824. /*
  825. * load_up_vsx(unused, unused, tsk)
  826. * Disable VSX for the task which had it previously,
  827. * and save its vector registers in its thread_struct.
  828. * Reuse the fp and vsx saves, but first check to see if they have
  829. * been saved already.
  830. * On entry: r13 == 'current' && last_task_used_vsx != 'current'
  831. */
  832. _STATIC(load_up_vsx)
  833. /* Load FP and VSX registers if they haven't been done yet */
  834. andi. r5,r12,MSR_FP
  835. beql+ load_up_fpu /* skip if already loaded */
  836. andis. r5,r12,MSR_VEC@h
  837. beql+ load_up_altivec /* skip if already loaded */
  838. #ifndef CONFIG_SMP
  839. ld r3,last_task_used_vsx@got(r2)
  840. ld r4,0(r3)
  841. cmpdi 0,r4,0
  842. beq 1f
  843. /* Disable VSX for last_task_used_vsx */
  844. addi r4,r4,THREAD
  845. ld r5,PT_REGS(r4)
  846. ld r4,_MSR-STACK_FRAME_OVERHEAD(r5)
  847. lis r6,MSR_VSX@h
  848. andc r6,r4,r6
  849. std r6,_MSR-STACK_FRAME_OVERHEAD(r5)
  850. 1:
  851. #endif /* CONFIG_SMP */
  852. ld r4,PACACURRENT(r13)
  853. addi r4,r4,THREAD /* Get THREAD */
  854. li r6,1
  855. stw r6,THREAD_USED_VSR(r4) /* ... also set thread used vsr */
  856. /* enable use of VSX after return */
  857. oris r12,r12,MSR_VSX@h
  858. std r12,_MSR(r1)
  859. #ifndef CONFIG_SMP
  860. /* Update last_task_used_math to 'current' */
  861. ld r4,PACACURRENT(r13)
  862. std r4,0(r3)
  863. #endif /* CONFIG_SMP */
  864. b fast_exception_return
  865. #endif /* CONFIG_VSX */
  866. /*
  867. * Hash table stuff
  868. */
  869. .align 7
  870. _STATIC(do_hash_page)
  871. std r3,_DAR(r1)
  872. std r4,_DSISR(r1)
  873. andis. r0,r4,0xa450 /* weird error? */
  874. bne- handle_page_fault /* if not, try to insert a HPTE */
  875. BEGIN_FTR_SECTION
  876. andis. r0,r4,0x0020 /* Is it a segment table fault? */
  877. bne- do_ste_alloc /* If so handle it */
  878. END_FTR_SECTION_IFCLR(CPU_FTR_SLB)
  879. /*
  880. * On iSeries, we soft-disable interrupts here, then
  881. * hard-enable interrupts so that the hash_page code can spin on
  882. * the hash_table_lock without problems on a shared processor.
  883. */
  884. DISABLE_INTS
  885. /*
  886. * Currently, trace_hardirqs_off() will be called by DISABLE_INTS
  887. * and will clobber volatile registers when irq tracing is enabled
  888. * so we need to reload them. It may be possible to be smarter here
  889. * and move the irq tracing elsewhere but let's keep it simple for
  890. * now
  891. */
  892. #ifdef CONFIG_TRACE_IRQFLAGS
  893. ld r3,_DAR(r1)
  894. ld r4,_DSISR(r1)
  895. ld r5,_TRAP(r1)
  896. ld r12,_MSR(r1)
  897. clrrdi r5,r5,4
  898. #endif /* CONFIG_TRACE_IRQFLAGS */
  899. /*
  900. * We need to set the _PAGE_USER bit if MSR_PR is set or if we are
  901. * accessing a userspace segment (even from the kernel). We assume
  902. * kernel addresses always have the high bit set.
  903. */
  904. rlwinm r4,r4,32-25+9,31-9,31-9 /* DSISR_STORE -> _PAGE_RW */
  905. rotldi r0,r3,15 /* Move high bit into MSR_PR posn */
  906. orc r0,r12,r0 /* MSR_PR | ~high_bit */
  907. rlwimi r4,r0,32-13,30,30 /* becomes _PAGE_USER access bit */
  908. ori r4,r4,1 /* add _PAGE_PRESENT */
  909. rlwimi r4,r5,22+2,31-2,31-2 /* Set _PAGE_EXEC if trap is 0x400 */
  910. /*
  911. * r3 contains the faulting address
  912. * r4 contains the required access permissions
  913. * r5 contains the trap number
  914. *
  915. * at return r3 = 0 for success
  916. */
  917. bl .hash_page /* build HPTE if possible */
  918. cmpdi r3,0 /* see if hash_page succeeded */
  919. BEGIN_FW_FTR_SECTION
  920. /*
  921. * If we had interrupts soft-enabled at the point where the
  922. * DSI/ISI occurred, and an interrupt came in during hash_page,
  923. * handle it now.
  924. * We jump to ret_from_except_lite rather than fast_exception_return
  925. * because ret_from_except_lite will check for and handle pending
  926. * interrupts if necessary.
  927. */
  928. beq 13f
  929. END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
  930. BEGIN_FW_FTR_SECTION
  931. /*
  932. * Here we have interrupts hard-disabled, so it is sufficient
  933. * to restore paca->{soft,hard}_enable and get out.
  934. */
  935. beq fast_exc_return_irq /* Return from exception on success */
  936. END_FW_FTR_SECTION_IFCLR(FW_FEATURE_ISERIES)
  937. /* For a hash failure, we don't bother re-enabling interrupts */
  938. ble- 12f
  939. /*
  940. * hash_page couldn't handle it, set soft interrupt enable back
  941. * to what it was before the trap. Note that .raw_local_irq_restore
  942. * handles any interrupts pending at this point.
  943. */
  944. ld r3,SOFTE(r1)
  945. TRACE_AND_RESTORE_IRQ_PARTIAL(r3, 11f)
  946. bl .raw_local_irq_restore
  947. b 11f
  948. /* Here we have a page fault that hash_page can't handle. */
  949. handle_page_fault:
  950. ENABLE_INTS
  951. 11: ld r4,_DAR(r1)
  952. ld r5,_DSISR(r1)
  953. addi r3,r1,STACK_FRAME_OVERHEAD
  954. bl .do_page_fault
  955. cmpdi r3,0
  956. beq+ 13f
  957. bl .save_nvgprs
  958. mr r5,r3
  959. addi r3,r1,STACK_FRAME_OVERHEAD
  960. lwz r4,_DAR(r1)
  961. bl .bad_page_fault
  962. b .ret_from_except
  963. 13: b .ret_from_except_lite
  964. /* We have a page fault that hash_page could handle but HV refused
  965. * the PTE insertion
  966. */
  967. 12: bl .save_nvgprs
  968. mr r5,r3
  969. addi r3,r1,STACK_FRAME_OVERHEAD
  970. ld r4,_DAR(r1)
  971. bl .low_hash_fault
  972. b .ret_from_except
  973. /* here we have a segment miss */
  974. do_ste_alloc:
  975. bl .ste_allocate /* try to insert stab entry */
  976. cmpdi r3,0
  977. bne- handle_page_fault
  978. b fast_exception_return
  979. /*
  980. * r13 points to the PACA, r9 contains the saved CR,
  981. * r11 and r12 contain the saved SRR0 and SRR1.
  982. * r9 - r13 are saved in paca->exslb.
  983. * We assume we aren't going to take any exceptions during this procedure.
  984. * We assume (DAR >> 60) == 0xc.
  985. */
  986. .align 7
  987. _GLOBAL(do_stab_bolted)
  988. stw r9,PACA_EXSLB+EX_CCR(r13) /* save CR in exc. frame */
  989. std r11,PACA_EXSLB+EX_SRR0(r13) /* save SRR0 in exc. frame */
  990. /* Hash to the primary group */
  991. ld r10,PACASTABVIRT(r13)
  992. mfspr r11,SPRN_DAR
  993. srdi r11,r11,28
  994. rldimi r10,r11,7,52 /* r10 = first ste of the group */
  995. /* Calculate VSID */
  996. /* This is a kernel address, so protovsid = ESID */
  997. ASM_VSID_SCRAMBLE(r11, r9, 256M)
  998. rldic r9,r11,12,16 /* r9 = vsid << 12 */
  999. /* Search the primary group for a free entry */
  1000. 1: ld r11,0(r10) /* Test valid bit of the current ste */
  1001. andi. r11,r11,0x80
  1002. beq 2f
  1003. addi r10,r10,16
  1004. andi. r11,r10,0x70
  1005. bne 1b
  1006. /* Stick for only searching the primary group for now. */
  1007. /* At least for now, we use a very simple random castout scheme */
  1008. /* Use the TB as a random number ; OR in 1 to avoid entry 0 */
  1009. mftb r11
  1010. rldic r11,r11,4,57 /* r11 = (r11 << 4) & 0x70 */
  1011. ori r11,r11,0x10
  1012. /* r10 currently points to an ste one past the group of interest */
  1013. /* make it point to the randomly selected entry */
  1014. subi r10,r10,128
  1015. or r10,r10,r11 /* r10 is the entry to invalidate */
  1016. isync /* mark the entry invalid */
  1017. ld r11,0(r10)
  1018. rldicl r11,r11,56,1 /* clear the valid bit */
  1019. rotldi r11,r11,8
  1020. std r11,0(r10)
  1021. sync
  1022. clrrdi r11,r11,28 /* Get the esid part of the ste */
  1023. slbie r11
  1024. 2: std r9,8(r10) /* Store the vsid part of the ste */
  1025. eieio
  1026. mfspr r11,SPRN_DAR /* Get the new esid */
  1027. clrrdi r11,r11,28 /* Permits a full 32b of ESID */
  1028. ori r11,r11,0x90 /* Turn on valid and kp */
  1029. std r11,0(r10) /* Put new entry back into the stab */
  1030. sync
  1031. /* All done -- return from exception. */
  1032. lwz r9,PACA_EXSLB+EX_CCR(r13) /* get saved CR */
  1033. ld r11,PACA_EXSLB+EX_SRR0(r13) /* get saved SRR0 */
  1034. andi. r10,r12,MSR_RI
  1035. beq- unrecov_slb
  1036. mtcrf 0x80,r9 /* restore CR */
  1037. mfmsr r10
  1038. clrrdi r10,r10,2
  1039. mtmsrd r10,1
  1040. mtspr SPRN_SRR0,r11
  1041. mtspr SPRN_SRR1,r12
  1042. ld r9,PACA_EXSLB+EX_R9(r13)
  1043. ld r10,PACA_EXSLB+EX_R10(r13)
  1044. ld r11,PACA_EXSLB+EX_R11(r13)
  1045. ld r12,PACA_EXSLB+EX_R12(r13)
  1046. ld r13,PACA_EXSLB+EX_R13(r13)
  1047. rfid
  1048. b . /* prevent speculative execution */
  1049. /*
  1050. * Space for CPU0's segment table.
  1051. *
  1052. * On iSeries, the hypervisor must fill in at least one entry before
  1053. * we get control (with relocate on). The address is given to the hv
  1054. * as a page number (see xLparMap below), so this must be at a
  1055. * fixed address (the linker can't compute (u64)&initial_stab >>
  1056. * PAGE_SHIFT).
  1057. */
  1058. . = STAB0_OFFSET /* 0x6000 */
  1059. .globl initial_stab
  1060. initial_stab:
  1061. .space 4096
  1062. #ifdef CONFIG_PPC_PSERIES
  1063. /*
  1064. * Data area reserved for FWNMI option.
  1065. * This address (0x7000) is fixed by the RPA.
  1066. */
  1067. .= 0x7000
  1068. .globl fwnmi_data_area
  1069. fwnmi_data_area:
  1070. #endif /* CONFIG_PPC_PSERIES */
  1071. /* iSeries does not use the FWNMI stuff, so it is safe to put
  1072. * this here, even if we later allow kernels that will boot on
  1073. * both pSeries and iSeries */
  1074. #ifdef CONFIG_PPC_ISERIES
  1075. . = LPARMAP_PHYS
  1076. .globl xLparMap
  1077. xLparMap:
  1078. .quad HvEsidsToMap /* xNumberEsids */
  1079. .quad HvRangesToMap /* xNumberRanges */
  1080. .quad STAB0_PAGE /* xSegmentTableOffs */
  1081. .zero 40 /* xRsvd */
  1082. /* xEsids (HvEsidsToMap entries of 2 quads) */
  1083. .quad PAGE_OFFSET_ESID /* xKernelEsid */
  1084. .quad PAGE_OFFSET_VSID /* xKernelVsid */
  1085. .quad VMALLOC_START_ESID /* xKernelEsid */
  1086. .quad VMALLOC_START_VSID /* xKernelVsid */
  1087. /* xRanges (HvRangesToMap entries of 3 quads) */
  1088. .quad HvPagesToMap /* xPages */
  1089. .quad 0 /* xOffset */
  1090. .quad PAGE_OFFSET_VSID << (SID_SHIFT - HW_PAGE_SHIFT) /* xVPN */
  1091. #endif /* CONFIG_PPC_ISERIES */
  1092. #ifdef CONFIG_PPC_PSERIES
  1093. . = 0x8000
  1094. #endif /* CONFIG_PPC_PSERIES */
  1095. /*
  1096. * On pSeries and most other platforms, secondary processors spin
  1097. * in the following code.
  1098. * At entry, r3 = this processor's number (physical cpu id)
  1099. */
  1100. _GLOBAL(generic_secondary_smp_init)
  1101. mr r24,r3
  1102. /* turn on 64-bit mode */
  1103. bl .enable_64b_mode
  1104. /* get the TOC pointer (real address) */
  1105. bl .relative_toc
  1106. /* Set up a paca value for this processor. Since we have the
  1107. * physical cpu id in r24, we need to search the pacas to find
  1108. * which logical id maps to our physical one.
  1109. */
  1110. LOAD_REG_ADDR(r13, paca) /* Get base vaddr of paca array */
  1111. li r5,0 /* logical cpu id */
  1112. 1: lhz r6,PACAHWCPUID(r13) /* Load HW procid from paca */
  1113. cmpw r6,r24 /* Compare to our id */
  1114. beq 2f
  1115. addi r13,r13,PACA_SIZE /* Loop to next PACA on miss */
  1116. addi r5,r5,1
  1117. cmpwi r5,NR_CPUS
  1118. blt 1b
  1119. mr r3,r24 /* not found, copy phys to r3 */
  1120. b .kexec_wait /* next kernel might do better */
  1121. 2: mtspr SPRN_SPRG3,r13 /* Save vaddr of paca in SPRG3 */
  1122. /* From now on, r24 is expected to be logical cpuid */
  1123. mr r24,r5
  1124. 3: HMT_LOW
  1125. lbz r23,PACAPROCSTART(r13) /* Test if this processor should */
  1126. /* start. */
  1127. #ifndef CONFIG_SMP
  1128. b 3b /* Never go on non-SMP */
  1129. #else
  1130. cmpwi 0,r23,0
  1131. beq 3b /* Loop until told to go */
  1132. sync /* order paca.run and cur_cpu_spec */
  1133. /* See if we need to call a cpu state restore handler */
  1134. LOAD_REG_ADDR(r23, cur_cpu_spec)
  1135. ld r23,0(r23)
  1136. ld r23,CPU_SPEC_RESTORE(r23)
  1137. cmpdi 0,r23,0
  1138. beq 4f
  1139. ld r23,0(r23)
  1140. mtctr r23
  1141. bctrl
  1142. 4: /* Create a temp kernel stack for use before relocation is on. */
  1143. ld r1,PACAEMERGSP(r13)
  1144. subi r1,r1,STACK_FRAME_OVERHEAD
  1145. b __secondary_start
  1146. #endif
  1147. /*
  1148. * Turn the MMU off.
  1149. * Assumes we're mapped EA == RA if the MMU is on.
  1150. */
  1151. _STATIC(__mmu_off)
  1152. mfmsr r3
  1153. andi. r0,r3,MSR_IR|MSR_DR
  1154. beqlr
  1155. mflr r4
  1156. andc r3,r3,r0
  1157. mtspr SPRN_SRR0,r4
  1158. mtspr SPRN_SRR1,r3
  1159. sync
  1160. rfid
  1161. b . /* prevent speculative execution */
  1162. /*
  1163. * Here is our main kernel entry point. We support currently 2 kind of entries
  1164. * depending on the value of r5.
  1165. *
  1166. * r5 != NULL -> OF entry, we go to prom_init, "legacy" parameter content
  1167. * in r3...r7
  1168. *
  1169. * r5 == NULL -> kexec style entry. r3 is a physical pointer to the
  1170. * DT block, r4 is a physical pointer to the kernel itself
  1171. *
  1172. */
  1173. _GLOBAL(__start_initialization_multiplatform)
  1174. /* Make sure we are running in 64 bits mode */
  1175. bl .enable_64b_mode
  1176. /* Get TOC pointer (current runtime address) */
  1177. bl .relative_toc
  1178. /* find out where we are now */
  1179. bcl 20,31,$+4
  1180. 0: mflr r26 /* r26 = runtime addr here */
  1181. addis r26,r26,(_stext - 0b)@ha
  1182. addi r26,r26,(_stext - 0b)@l /* current runtime base addr */
  1183. /*
  1184. * Are we booted from a PROM Of-type client-interface ?
  1185. */
  1186. cmpldi cr0,r5,0
  1187. beq 1f
  1188. b .__boot_from_prom /* yes -> prom */
  1189. 1:
  1190. /* Save parameters */
  1191. mr r31,r3
  1192. mr r30,r4
  1193. /* Setup some critical 970 SPRs before switching MMU off */
  1194. mfspr r0,SPRN_PVR
  1195. srwi r0,r0,16
  1196. cmpwi r0,0x39 /* 970 */
  1197. beq 1f
  1198. cmpwi r0,0x3c /* 970FX */
  1199. beq 1f
  1200. cmpwi r0,0x44 /* 970MP */
  1201. beq 1f
  1202. cmpwi r0,0x45 /* 970GX */
  1203. bne 2f
  1204. 1: bl .__cpu_preinit_ppc970
  1205. 2:
  1206. /* Switch off MMU if not already off */
  1207. bl .__mmu_off
  1208. b .__after_prom_start
  1209. _INIT_STATIC(__boot_from_prom)
  1210. /* Save parameters */
  1211. mr r31,r3
  1212. mr r30,r4
  1213. mr r29,r5
  1214. mr r28,r6
  1215. mr r27,r7
  1216. /*
  1217. * Align the stack to 16-byte boundary
  1218. * Depending on the size and layout of the ELF sections in the initial
  1219. * boot binary, the stack pointer may be unaligned on PowerMac
  1220. */
  1221. rldicr r1,r1,0,59
  1222. #ifdef CONFIG_RELOCATABLE
  1223. /* Relocate code for where we are now */
  1224. mr r3,r26
  1225. bl .relocate
  1226. #endif
  1227. /* Restore parameters */
  1228. mr r3,r31
  1229. mr r4,r30
  1230. mr r5,r29
  1231. mr r6,r28
  1232. mr r7,r27
  1233. /* Do all of the interaction with OF client interface */
  1234. mr r8,r26
  1235. bl .prom_init
  1236. /* We never return */
  1237. trap
  1238. _STATIC(__after_prom_start)
  1239. #ifdef CONFIG_RELOCATABLE
  1240. /* process relocations for the final address of the kernel */
  1241. lis r25,PAGE_OFFSET@highest /* compute virtual base of kernel */
  1242. sldi r25,r25,32
  1243. #ifdef CONFIG_CRASH_DUMP
  1244. ld r7,__kdump_flag-_stext(r26)
  1245. cmpldi cr0,r7,1 /* kdump kernel ? - stay where we are */
  1246. bne 1f
  1247. add r25,r25,r26
  1248. #endif
  1249. 1: mr r3,r25
  1250. bl .relocate
  1251. #endif
  1252. /*
  1253. * We need to run with _stext at physical address PHYSICAL_START.
  1254. * This will leave some code in the first 256B of
  1255. * real memory, which are reserved for software use.
  1256. *
  1257. * Note: This process overwrites the OF exception vectors.
  1258. */
  1259. li r3,0 /* target addr */
  1260. mr. r4,r26 /* In some cases the loader may */
  1261. beq 9f /* have already put us at zero */
  1262. li r6,0x100 /* Start offset, the first 0x100 */
  1263. /* bytes were copied earlier. */
  1264. #ifdef CONFIG_CRASH_DUMP
  1265. /*
  1266. * Check if the kernel has to be running as relocatable kernel based on the
  1267. * variable __kdump_flag, if it is set the kernel is treated as relocatable
  1268. * kernel, otherwise it will be moved to PHYSICAL_START
  1269. */
  1270. ld r7,__kdump_flag-_stext(r26)
  1271. cmpldi cr0,r7,1
  1272. bne 3f
  1273. li r5,__end_interrupts - _stext /* just copy interrupts */
  1274. b 5f
  1275. 3:
  1276. #endif
  1277. lis r5,(copy_to_here - _stext)@ha
  1278. addi r5,r5,(copy_to_here - _stext)@l /* # bytes of memory to copy */
  1279. bl .copy_and_flush /* copy the first n bytes */
  1280. /* this includes the code being */
  1281. /* executed here. */
  1282. addis r8,r3,(4f - _stext)@ha /* Jump to the copy of this code */
  1283. addi r8,r8,(4f - _stext)@l /* that we just made */
  1284. mtctr r8
  1285. bctr
  1286. p_end: .llong _end - _stext
  1287. 4: /* Now copy the rest of the kernel up to _end */
  1288. addis r5,r26,(p_end - _stext)@ha
  1289. ld r5,(p_end - _stext)@l(r5) /* get _end */
  1290. 5: bl .copy_and_flush /* copy the rest */
  1291. 9: b .start_here_multiplatform
  1292. /*
  1293. * Copy routine used to copy the kernel to start at physical address 0
  1294. * and flush and invalidate the caches as needed.
  1295. * r3 = dest addr, r4 = source addr, r5 = copy limit, r6 = start offset
  1296. * on exit, r3, r4, r5 are unchanged, r6 is updated to be >= r5.
  1297. *
  1298. * Note: this routine *only* clobbers r0, r6 and lr
  1299. */
  1300. _GLOBAL(copy_and_flush)
  1301. addi r5,r5,-8
  1302. addi r6,r6,-8
  1303. 4: li r0,8 /* Use the smallest common */
  1304. /* denominator cache line */
  1305. /* size. This results in */
  1306. /* extra cache line flushes */
  1307. /* but operation is correct. */
  1308. /* Can't get cache line size */
  1309. /* from NACA as it is being */
  1310. /* moved too. */
  1311. mtctr r0 /* put # words/line in ctr */
  1312. 3: addi r6,r6,8 /* copy a cache line */
  1313. ldx r0,r6,r4
  1314. stdx r0,r6,r3
  1315. bdnz 3b
  1316. dcbst r6,r3 /* write it to memory */
  1317. sync
  1318. icbi r6,r3 /* flush the icache line */
  1319. cmpld 0,r6,r5
  1320. blt 4b
  1321. sync
  1322. addi r5,r5,8
  1323. addi r6,r6,8
  1324. blr
  1325. .align 8
  1326. copy_to_here:
  1327. #ifdef CONFIG_SMP
  1328. #ifdef CONFIG_PPC_PMAC
  1329. /*
  1330. * On PowerMac, secondary processors starts from the reset vector, which
  1331. * is temporarily turned into a call to one of the functions below.
  1332. */
  1333. .section ".text";
  1334. .align 2 ;
  1335. .globl __secondary_start_pmac_0
  1336. __secondary_start_pmac_0:
  1337. /* NB the entries for cpus 0, 1, 2 must each occupy 8 bytes. */
  1338. li r24,0
  1339. b 1f
  1340. li r24,1
  1341. b 1f
  1342. li r24,2
  1343. b 1f
  1344. li r24,3
  1345. 1:
  1346. _GLOBAL(pmac_secondary_start)
  1347. /* turn on 64-bit mode */
  1348. bl .enable_64b_mode
  1349. /* get TOC pointer (real address) */
  1350. bl .relative_toc
  1351. /* Copy some CPU settings from CPU 0 */
  1352. bl .__restore_cpu_ppc970
  1353. /* pSeries do that early though I don't think we really need it */
  1354. mfmsr r3
  1355. ori r3,r3,MSR_RI
  1356. mtmsrd r3 /* RI on */
  1357. /* Set up a paca value for this processor. */
  1358. LOAD_REG_ADDR(r4,paca) /* Get base vaddr of paca array */
  1359. mulli r13,r24,PACA_SIZE /* Calculate vaddr of right paca */
  1360. add r13,r13,r4 /* for this processor. */
  1361. mtspr SPRN_SPRG3,r13 /* Save vaddr of paca in SPRG3 */
  1362. /* Create a temp kernel stack for use before relocation is on. */
  1363. ld r1,PACAEMERGSP(r13)
  1364. subi r1,r1,STACK_FRAME_OVERHEAD
  1365. b __secondary_start
  1366. #endif /* CONFIG_PPC_PMAC */
  1367. /*
  1368. * This function is called after the master CPU has released the
  1369. * secondary processors. The execution environment is relocation off.
  1370. * The paca for this processor has the following fields initialized at
  1371. * this point:
  1372. * 1. Processor number
  1373. * 2. Segment table pointer (virtual address)
  1374. * On entry the following are set:
  1375. * r1 = stack pointer. vaddr for iSeries, raddr (temp stack) for pSeries
  1376. * r24 = cpu# (in Linux terms)
  1377. * r13 = paca virtual address
  1378. * SPRG3 = paca virtual address
  1379. */
  1380. .globl __secondary_start
  1381. __secondary_start:
  1382. /* Set thread priority to MEDIUM */
  1383. HMT_MEDIUM
  1384. /* Do early setup for that CPU (stab, slb, hash table pointer) */
  1385. bl .early_setup_secondary
  1386. /* Initialize the kernel stack. Just a repeat for iSeries. */
  1387. LOAD_REG_ADDR(r3, current_set)
  1388. sldi r28,r24,3 /* get current_set[cpu#] */
  1389. ldx r1,r3,r28
  1390. addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
  1391. std r1,PACAKSAVE(r13)
  1392. /* Clear backchain so we get nice backtraces */
  1393. li r7,0
  1394. mtlr r7
  1395. /* enable MMU and jump to start_secondary */
  1396. LOAD_REG_ADDR(r3, .start_secondary_prolog)
  1397. LOAD_REG_IMMEDIATE(r4, MSR_KERNEL)
  1398. #ifdef CONFIG_PPC_ISERIES
  1399. BEGIN_FW_FTR_SECTION
  1400. ori r4,r4,MSR_EE
  1401. li r8,1
  1402. stb r8,PACAHARDIRQEN(r13)
  1403. END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
  1404. #endif
  1405. BEGIN_FW_FTR_SECTION
  1406. stb r7,PACAHARDIRQEN(r13)
  1407. END_FW_FTR_SECTION_IFCLR(FW_FEATURE_ISERIES)
  1408. stb r7,PACASOFTIRQEN(r13)
  1409. mtspr SPRN_SRR0,r3
  1410. mtspr SPRN_SRR1,r4
  1411. rfid
  1412. b . /* prevent speculative execution */
  1413. /*
  1414. * Running with relocation on at this point. All we want to do is
  1415. * zero the stack back-chain pointer and get the TOC virtual address
  1416. * before going into C code.
  1417. */
  1418. _GLOBAL(start_secondary_prolog)
  1419. ld r2,PACATOC(r13)
  1420. li r3,0
  1421. std r3,0(r1) /* Zero the stack frame pointer */
  1422. bl .start_secondary
  1423. b .
  1424. #endif
  1425. /*
  1426. * This subroutine clobbers r11 and r12
  1427. */
  1428. _GLOBAL(enable_64b_mode)
  1429. mfmsr r11 /* grab the current MSR */
  1430. li r12,(MSR_SF | MSR_ISF)@highest
  1431. sldi r12,r12,48
  1432. or r11,r11,r12
  1433. mtmsrd r11
  1434. isync
  1435. blr
  1436. /*
  1437. * This puts the TOC pointer into r2, offset by 0x8000 (as expected
  1438. * by the toolchain). It computes the correct value for wherever we
  1439. * are running at the moment, using position-independent code.
  1440. */
  1441. _GLOBAL(relative_toc)
  1442. mflr r0
  1443. bcl 20,31,$+4
  1444. 0: mflr r9
  1445. ld r2,(p_toc - 0b)(r9)
  1446. add r2,r2,r9
  1447. mtlr r0
  1448. blr
  1449. p_toc: .llong __toc_start + 0x8000 - 0b
  1450. /*
  1451. * This is where the main kernel code starts.
  1452. */
  1453. _INIT_STATIC(start_here_multiplatform)
  1454. /* set up the TOC (real address) */
  1455. bl .relative_toc
  1456. /* Clear out the BSS. It may have been done in prom_init,
  1457. * already but that's irrelevant since prom_init will soon
  1458. * be detached from the kernel completely. Besides, we need
  1459. * to clear it now for kexec-style entry.
  1460. */
  1461. LOAD_REG_ADDR(r11,__bss_stop)
  1462. LOAD_REG_ADDR(r8,__bss_start)
  1463. sub r11,r11,r8 /* bss size */
  1464. addi r11,r11,7 /* round up to an even double word */
  1465. srdi. r11,r11,3 /* shift right by 3 */
  1466. beq 4f
  1467. addi r8,r8,-8
  1468. li r0,0
  1469. mtctr r11 /* zero this many doublewords */
  1470. 3: stdu r0,8(r8)
  1471. bdnz 3b
  1472. 4:
  1473. mfmsr r6
  1474. ori r6,r6,MSR_RI
  1475. mtmsrd r6 /* RI on */
  1476. #ifdef CONFIG_RELOCATABLE
  1477. /* Save the physical address we're running at in kernstart_addr */
  1478. LOAD_REG_ADDR(r4, kernstart_addr)
  1479. clrldi r0,r25,2
  1480. std r0,0(r4)
  1481. #endif
  1482. /* The following gets the stack set up with the regs */
  1483. /* pointing to the real addr of the kernel stack. This is */
  1484. /* all done to support the C function call below which sets */
  1485. /* up the htab. This is done because we have relocated the */
  1486. /* kernel but are still running in real mode. */
  1487. LOAD_REG_ADDR(r3,init_thread_union)
  1488. /* set up a stack pointer */
  1489. addi r1,r3,THREAD_SIZE
  1490. li r0,0
  1491. stdu r0,-STACK_FRAME_OVERHEAD(r1)
  1492. /* Do very early kernel initializations, including initial hash table,
  1493. * stab and slb setup before we turn on relocation. */
  1494. /* Restore parameters passed from prom_init/kexec */
  1495. mr r3,r31
  1496. bl .early_setup /* also sets r13 and SPRG3 */
  1497. LOAD_REG_ADDR(r3, .start_here_common)
  1498. ld r4,PACAKMSR(r13)
  1499. mtspr SPRN_SRR0,r3
  1500. mtspr SPRN_SRR1,r4
  1501. rfid
  1502. b . /* prevent speculative execution */
  1503. /* This is where all platforms converge execution */
  1504. _INIT_GLOBAL(start_here_common)
  1505. /* relocation is on at this point */
  1506. std r1,PACAKSAVE(r13)
  1507. /* Load the TOC (virtual address) */
  1508. ld r2,PACATOC(r13)
  1509. bl .setup_system
  1510. /* Load up the kernel context */
  1511. 5:
  1512. li r5,0
  1513. stb r5,PACASOFTIRQEN(r13) /* Soft Disabled */
  1514. #ifdef CONFIG_PPC_ISERIES
  1515. BEGIN_FW_FTR_SECTION
  1516. mfmsr r5
  1517. ori r5,r5,MSR_EE /* Hard Enabled on iSeries*/
  1518. mtmsrd r5
  1519. li r5,1
  1520. END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
  1521. #endif
  1522. stb r5,PACAHARDIRQEN(r13) /* Hard Disabled on others */
  1523. bl .start_kernel
  1524. /* Not reached */
  1525. BUG_OPCODE
  1526. /*
  1527. * We put a few things here that have to be page-aligned.
  1528. * This stuff goes at the beginning of the bss, which is page-aligned.
  1529. */
  1530. .section ".bss"
  1531. .align PAGE_SHIFT
  1532. .globl empty_zero_page
  1533. empty_zero_page:
  1534. .space PAGE_SIZE
  1535. .globl swapper_pg_dir
  1536. swapper_pg_dir:
  1537. .space PGD_TABLE_SIZE