head_44x.S 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  1. /*
  2. * Kernel execution entry point code.
  3. *
  4. * Copyright (c) 1995-1996 Gary Thomas <gdt@linuxppc.org>
  5. * Initial PowerPC version.
  6. * Copyright (c) 1996 Cort Dougan <cort@cs.nmt.edu>
  7. * Rewritten for PReP
  8. * Copyright (c) 1996 Paul Mackerras <paulus@cs.anu.edu.au>
  9. * Low-level exception handers, MMU support, and rewrite.
  10. * Copyright (c) 1997 Dan Malek <dmalek@jlc.net>
  11. * PowerPC 8xx modifications.
  12. * Copyright (c) 1998-1999 TiVo, Inc.
  13. * PowerPC 403GCX modifications.
  14. * Copyright (c) 1999 Grant Erickson <grant@lcse.umn.edu>
  15. * PowerPC 403GCX/405GP modifications.
  16. * Copyright 2000 MontaVista Software Inc.
  17. * PPC405 modifications
  18. * PowerPC 403GCX/405GP modifications.
  19. * Author: MontaVista Software, Inc.
  20. * frank_rowand@mvista.com or source@mvista.com
  21. * debbie_chu@mvista.com
  22. * Copyright 2002-2005 MontaVista Software, Inc.
  23. * PowerPC 44x support, Matt Porter <mporter@kernel.crashing.org>
  24. *
  25. * This program is free software; you can redistribute it and/or modify it
  26. * under the terms of the GNU General Public License as published by the
  27. * Free Software Foundation; either version 2 of the License, or (at your
  28. * option) any later version.
  29. */
  30. #include <asm/processor.h>
  31. #include <asm/page.h>
  32. #include <asm/mmu.h>
  33. #include <asm/pgtable.h>
  34. #include <asm/cputable.h>
  35. #include <asm/thread_info.h>
  36. #include <asm/ppc_asm.h>
  37. #include <asm/asm-offsets.h>
  38. #include "head_booke.h"
  39. /* As with the other PowerPC ports, it is expected that when code
  40. * execution begins here, the following registers contain valid, yet
  41. * optional, information:
  42. *
  43. * r3 - Board info structure pointer (DRAM, frequency, MAC address, etc.)
  44. * r4 - Starting address of the init RAM disk
  45. * r5 - Ending address of the init RAM disk
  46. * r6 - Start of kernel command line string (e.g. "mem=128")
  47. * r7 - End of kernel command line string
  48. *
  49. */
  50. .section .text.head, "ax"
  51. _ENTRY(_stext);
  52. _ENTRY(_start);
  53. /*
  54. * Reserve a word at a fixed location to store the address
  55. * of abatron_pteptrs
  56. */
  57. nop
  58. /*
  59. * Save parameters we are passed
  60. */
  61. mr r31,r3
  62. mr r30,r4
  63. mr r29,r5
  64. mr r28,r6
  65. mr r27,r7
  66. li r24,0 /* CPU number */
  67. /*
  68. * Set up the initial MMU state
  69. *
  70. * We are still executing code at the virtual address
  71. * mappings set by the firmware for the base of RAM.
  72. *
  73. * We first invalidate all TLB entries but the one
  74. * we are running from. We then load the KERNELBASE
  75. * mappings so we can begin to use kernel addresses
  76. * natively and so the interrupt vector locations are
  77. * permanently pinned (necessary since Book E
  78. * implementations always have translation enabled).
  79. *
  80. * TODO: Use the known TLB entry we are running from to
  81. * determine which physical region we are located
  82. * in. This can be used to determine where in RAM
  83. * (on a shared CPU system) or PCI memory space
  84. * (on a DRAMless system) we are located.
  85. * For now, we assume a perfect world which means
  86. * we are located at the base of DRAM (physical 0).
  87. */
  88. /*
  89. * Search TLB for entry that we are currently using.
  90. * Invalidate all entries but the one we are using.
  91. */
  92. /* Load our current PID->MMUCR TID and MSR IS->MMUCR STS */
  93. mfspr r3,SPRN_PID /* Get PID */
  94. mfmsr r4 /* Get MSR */
  95. andi. r4,r4,MSR_IS@l /* TS=1? */
  96. beq wmmucr /* If not, leave STS=0 */
  97. oris r3,r3,PPC44x_MMUCR_STS@h /* Set STS=1 */
  98. wmmucr: mtspr SPRN_MMUCR,r3 /* Put MMUCR */
  99. sync
  100. bl invstr /* Find our address */
  101. invstr: mflr r5 /* Make it accessible */
  102. tlbsx r23,0,r5 /* Find entry we are in */
  103. li r4,0 /* Start at TLB entry 0 */
  104. li r3,0 /* Set PAGEID inval value */
  105. 1: cmpw r23,r4 /* Is this our entry? */
  106. beq skpinv /* If so, skip the inval */
  107. tlbwe r3,r4,PPC44x_TLB_PAGEID /* If not, inval the entry */
  108. skpinv: addi r4,r4,1 /* Increment */
  109. cmpwi r4,64 /* Are we done? */
  110. bne 1b /* If not, repeat */
  111. isync /* If so, context change */
  112. /*
  113. * Configure and load pinned entry into TLB slot 63.
  114. */
  115. lis r3,PAGE_OFFSET@h
  116. ori r3,r3,PAGE_OFFSET@l
  117. /* Kernel is at the base of RAM */
  118. li r4, 0 /* Load the kernel physical address */
  119. /* Load the kernel PID = 0 */
  120. li r0,0
  121. mtspr SPRN_PID,r0
  122. sync
  123. /* Initialize MMUCR */
  124. li r5,0
  125. mtspr SPRN_MMUCR,r5
  126. sync
  127. /* pageid fields */
  128. clrrwi r3,r3,10 /* Mask off the effective page number */
  129. ori r3,r3,PPC44x_TLB_VALID | PPC44x_TLB_256M
  130. /* xlat fields */
  131. clrrwi r4,r4,10 /* Mask off the real page number */
  132. /* ERPN is 0 for first 4GB page */
  133. /* attrib fields */
  134. /* Added guarded bit to protect against speculative loads/stores */
  135. li r5,0
  136. ori r5,r5,(PPC44x_TLB_SW | PPC44x_TLB_SR | PPC44x_TLB_SX | PPC44x_TLB_G)
  137. li r0,63 /* TLB slot 63 */
  138. tlbwe r3,r0,PPC44x_TLB_PAGEID /* Load the pageid fields */
  139. tlbwe r4,r0,PPC44x_TLB_XLAT /* Load the translation fields */
  140. tlbwe r5,r0,PPC44x_TLB_ATTRIB /* Load the attrib/access fields */
  141. /* Force context change */
  142. mfmsr r0
  143. mtspr SPRN_SRR1, r0
  144. lis r0,3f@h
  145. ori r0,r0,3f@l
  146. mtspr SPRN_SRR0,r0
  147. sync
  148. rfi
  149. /* If necessary, invalidate original entry we used */
  150. 3: cmpwi r23,63
  151. beq 4f
  152. li r6,0
  153. tlbwe r6,r23,PPC44x_TLB_PAGEID
  154. isync
  155. 4:
  156. #ifdef CONFIG_PPC_EARLY_DEBUG_44x
  157. /* Add UART mapping for early debug. */
  158. /* pageid fields */
  159. lis r3,PPC44x_EARLY_DEBUG_VIRTADDR@h
  160. ori r3,r3,PPC44x_TLB_VALID|PPC44x_TLB_TS|PPC44x_TLB_64K
  161. /* xlat fields */
  162. lis r4,CONFIG_PPC_EARLY_DEBUG_44x_PHYSLOW@h
  163. ori r4,r4,CONFIG_PPC_EARLY_DEBUG_44x_PHYSHIGH
  164. /* attrib fields */
  165. li r5,(PPC44x_TLB_SW|PPC44x_TLB_SR|PPC44x_TLB_I|PPC44x_TLB_G)
  166. li r0,62 /* TLB slot 0 */
  167. tlbwe r3,r0,PPC44x_TLB_PAGEID
  168. tlbwe r4,r0,PPC44x_TLB_XLAT
  169. tlbwe r5,r0,PPC44x_TLB_ATTRIB
  170. /* Force context change */
  171. isync
  172. #endif /* CONFIG_PPC_EARLY_DEBUG_44x */
  173. /* Establish the interrupt vector offsets */
  174. SET_IVOR(0, CriticalInput);
  175. SET_IVOR(1, MachineCheck);
  176. SET_IVOR(2, DataStorage);
  177. SET_IVOR(3, InstructionStorage);
  178. SET_IVOR(4, ExternalInput);
  179. SET_IVOR(5, Alignment);
  180. SET_IVOR(6, Program);
  181. SET_IVOR(7, FloatingPointUnavailable);
  182. SET_IVOR(8, SystemCall);
  183. SET_IVOR(9, AuxillaryProcessorUnavailable);
  184. SET_IVOR(10, Decrementer);
  185. SET_IVOR(11, FixedIntervalTimer);
  186. SET_IVOR(12, WatchdogTimer);
  187. SET_IVOR(13, DataTLBError);
  188. SET_IVOR(14, InstructionTLBError);
  189. SET_IVOR(15, DebugCrit);
  190. /* Establish the interrupt vector base */
  191. lis r4,interrupt_base@h /* IVPR only uses the high 16-bits */
  192. mtspr SPRN_IVPR,r4
  193. /*
  194. * This is where the main kernel code starts.
  195. */
  196. /* ptr to current */
  197. lis r2,init_task@h
  198. ori r2,r2,init_task@l
  199. /* ptr to current thread */
  200. addi r4,r2,THREAD /* init task's THREAD */
  201. mtspr SPRN_SPRG3,r4
  202. /* stack */
  203. lis r1,init_thread_union@h
  204. ori r1,r1,init_thread_union@l
  205. li r0,0
  206. stwu r0,THREAD_SIZE-STACK_FRAME_OVERHEAD(r1)
  207. bl early_init
  208. /*
  209. * Decide what sort of machine this is and initialize the MMU.
  210. */
  211. mr r3,r31
  212. mr r4,r30
  213. mr r5,r29
  214. mr r6,r28
  215. mr r7,r27
  216. bl machine_init
  217. bl MMU_init
  218. /* Setup PTE pointers for the Abatron bdiGDB */
  219. lis r6, swapper_pg_dir@h
  220. ori r6, r6, swapper_pg_dir@l
  221. lis r5, abatron_pteptrs@h
  222. ori r5, r5, abatron_pteptrs@l
  223. lis r4, KERNELBASE@h
  224. ori r4, r4, KERNELBASE@l
  225. stw r5, 0(r4) /* Save abatron_pteptrs at a fixed location */
  226. stw r6, 0(r5)
  227. /* Let's move on */
  228. lis r4,start_kernel@h
  229. ori r4,r4,start_kernel@l
  230. lis r3,MSR_KERNEL@h
  231. ori r3,r3,MSR_KERNEL@l
  232. mtspr SPRN_SRR0,r4
  233. mtspr SPRN_SRR1,r3
  234. rfi /* change context and jump to start_kernel */
  235. /*
  236. * Interrupt vector entry code
  237. *
  238. * The Book E MMUs are always on so we don't need to handle
  239. * interrupts in real mode as with previous PPC processors. In
  240. * this case we handle interrupts in the kernel virtual address
  241. * space.
  242. *
  243. * Interrupt vectors are dynamically placed relative to the
  244. * interrupt prefix as determined by the address of interrupt_base.
  245. * The interrupt vectors offsets are programmed using the labels
  246. * for each interrupt vector entry.
  247. *
  248. * Interrupt vectors must be aligned on a 16 byte boundary.
  249. * We align on a 32 byte cache line boundary for good measure.
  250. */
  251. interrupt_base:
  252. /* Critical Input Interrupt */
  253. CRITICAL_EXCEPTION(0x0100, CriticalInput, unknown_exception)
  254. /* Machine Check Interrupt */
  255. CRITICAL_EXCEPTION(0x0200, MachineCheck, machine_check_exception)
  256. MCHECK_EXCEPTION(0x0210, MachineCheckA, machine_check_exception)
  257. /* Data Storage Interrupt */
  258. DATA_STORAGE_EXCEPTION
  259. /* Instruction Storage Interrupt */
  260. INSTRUCTION_STORAGE_EXCEPTION
  261. /* External Input Interrupt */
  262. EXCEPTION(0x0500, ExternalInput, do_IRQ, EXC_XFER_LITE)
  263. /* Alignment Interrupt */
  264. ALIGNMENT_EXCEPTION
  265. /* Program Interrupt */
  266. PROGRAM_EXCEPTION
  267. /* Floating Point Unavailable Interrupt */
  268. #ifdef CONFIG_PPC_FPU
  269. FP_UNAVAILABLE_EXCEPTION
  270. #else
  271. EXCEPTION(0x2010, FloatingPointUnavailable, unknown_exception, EXC_XFER_EE)
  272. #endif
  273. /* System Call Interrupt */
  274. START_EXCEPTION(SystemCall)
  275. NORMAL_EXCEPTION_PROLOG
  276. EXC_XFER_EE_LITE(0x0c00, DoSyscall)
  277. /* Auxillary Processor Unavailable Interrupt */
  278. EXCEPTION(0x2020, AuxillaryProcessorUnavailable, unknown_exception, EXC_XFER_EE)
  279. /* Decrementer Interrupt */
  280. DECREMENTER_EXCEPTION
  281. /* Fixed Internal Timer Interrupt */
  282. /* TODO: Add FIT support */
  283. EXCEPTION(0x1010, FixedIntervalTimer, unknown_exception, EXC_XFER_EE)
  284. /* Watchdog Timer Interrupt */
  285. /* TODO: Add watchdog support */
  286. #ifdef CONFIG_BOOKE_WDT
  287. CRITICAL_EXCEPTION(0x1020, WatchdogTimer, WatchdogException)
  288. #else
  289. CRITICAL_EXCEPTION(0x1020, WatchdogTimer, unknown_exception)
  290. #endif
  291. /* Data TLB Error Interrupt */
  292. START_EXCEPTION(DataTLBError)
  293. mtspr SPRN_SPRG0, r10 /* Save some working registers */
  294. mtspr SPRN_SPRG1, r11
  295. mtspr SPRN_SPRG4W, r12
  296. mtspr SPRN_SPRG5W, r13
  297. mfcr r11
  298. mtspr SPRN_SPRG7W, r11
  299. mfspr r10, SPRN_DEAR /* Get faulting address */
  300. /* If we are faulting a kernel address, we have to use the
  301. * kernel page tables.
  302. */
  303. lis r11, PAGE_OFFSET@h
  304. cmplw r10, r11
  305. blt+ 3f
  306. lis r11, swapper_pg_dir@h
  307. ori r11, r11, swapper_pg_dir@l
  308. mfspr r12,SPRN_MMUCR
  309. rlwinm r12,r12,0,0,23 /* Clear TID */
  310. b 4f
  311. /* Get the PGD for the current thread */
  312. 3:
  313. mfspr r11,SPRN_SPRG3
  314. lwz r11,PGDIR(r11)
  315. /* Load PID into MMUCR TID */
  316. mfspr r12,SPRN_MMUCR
  317. mfspr r13,SPRN_PID /* Get PID */
  318. rlwimi r12,r13,0,24,31 /* Set TID */
  319. 4:
  320. mtspr SPRN_MMUCR,r12
  321. /* Mask of required permission bits. Note that while we
  322. * do copy ESR:ST to _PAGE_RW position as trying to write
  323. * to an RO page is pretty common, we don't do it with
  324. * _PAGE_DIRTY. We could do it, but it's a fairly rare
  325. * event so I'd rather take the overhead when it happens
  326. * rather than adding an instruction here. We should measure
  327. * whether the whole thing is worth it in the first place
  328. * as we could avoid loading SPRN_ESR completely in the first
  329. * place...
  330. *
  331. * TODO: Is it worth doing that mfspr & rlwimi in the first
  332. * place or can we save a couple of instructions here ?
  333. */
  334. mfspr r12,SPRN_ESR
  335. li r13,_PAGE_PRESENT|_PAGE_ACCESSED
  336. rlwimi r13,r12,10,30,30
  337. /* Load the PTE */
  338. rlwinm r12, r10, 13, 19, 29 /* Compute pgdir/pmd offset */
  339. lwzx r11, r12, r11 /* Get pgd/pmd entry */
  340. rlwinm. r12, r11, 0, 0, 20 /* Extract pt base address */
  341. beq 2f /* Bail if no table */
  342. rlwimi r12, r10, 23, 20, 28 /* Compute pte address */
  343. lwz r11, 0(r12) /* Get high word of pte entry */
  344. lwz r12, 4(r12) /* Get low word of pte entry */
  345. lis r10,tlb_44x_index@ha
  346. andc. r13,r13,r12 /* Check permission */
  347. /* Load the next available TLB index */
  348. lwz r13,tlb_44x_index@l(r10)
  349. bne 2f /* Bail if permission mismach */
  350. /* Increment, rollover, and store TLB index */
  351. addi r13,r13,1
  352. /* Compare with watermark (instruction gets patched) */
  353. .globl tlb_44x_patch_hwater_D
  354. tlb_44x_patch_hwater_D:
  355. cmpwi 0,r13,1 /* reserve entries */
  356. ble 5f
  357. li r13,0
  358. 5:
  359. /* Store the next available TLB index */
  360. stw r13,tlb_44x_index@l(r10)
  361. /* Re-load the faulting address */
  362. mfspr r10,SPRN_DEAR
  363. /* Jump to common tlb load */
  364. b finish_tlb_load
  365. 2:
  366. /* The bailout. Restore registers to pre-exception conditions
  367. * and call the heavyweights to help us out.
  368. */
  369. mfspr r11, SPRN_SPRG7R
  370. mtcr r11
  371. mfspr r13, SPRN_SPRG5R
  372. mfspr r12, SPRN_SPRG4R
  373. mfspr r11, SPRN_SPRG1
  374. mfspr r10, SPRN_SPRG0
  375. b DataStorage
  376. /* Instruction TLB Error Interrupt */
  377. /*
  378. * Nearly the same as above, except we get our
  379. * information from different registers and bailout
  380. * to a different point.
  381. */
  382. START_EXCEPTION(InstructionTLBError)
  383. mtspr SPRN_SPRG0, r10 /* Save some working registers */
  384. mtspr SPRN_SPRG1, r11
  385. mtspr SPRN_SPRG4W, r12
  386. mtspr SPRN_SPRG5W, r13
  387. mfcr r11
  388. mtspr SPRN_SPRG7W, r11
  389. mfspr r10, SPRN_SRR0 /* Get faulting address */
  390. /* If we are faulting a kernel address, we have to use the
  391. * kernel page tables.
  392. */
  393. lis r11, PAGE_OFFSET@h
  394. cmplw r10, r11
  395. blt+ 3f
  396. lis r11, swapper_pg_dir@h
  397. ori r11, r11, swapper_pg_dir@l
  398. mfspr r12,SPRN_MMUCR
  399. rlwinm r12,r12,0,0,23 /* Clear TID */
  400. b 4f
  401. /* Get the PGD for the current thread */
  402. 3:
  403. mfspr r11,SPRN_SPRG3
  404. lwz r11,PGDIR(r11)
  405. /* Load PID into MMUCR TID */
  406. mfspr r12,SPRN_MMUCR
  407. mfspr r13,SPRN_PID /* Get PID */
  408. rlwimi r12,r13,0,24,31 /* Set TID */
  409. 4:
  410. mtspr SPRN_MMUCR,r12
  411. /* Make up the required permissions */
  412. li r13,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_HWEXEC
  413. rlwinm r12, r10, 13, 19, 29 /* Compute pgdir/pmd offset */
  414. lwzx r11, r12, r11 /* Get pgd/pmd entry */
  415. rlwinm. r12, r11, 0, 0, 20 /* Extract pt base address */
  416. beq 2f /* Bail if no table */
  417. rlwimi r12, r10, 23, 20, 28 /* Compute pte address */
  418. lwz r11, 0(r12) /* Get high word of pte entry */
  419. lwz r12, 4(r12) /* Get low word of pte entry */
  420. lis r10,tlb_44x_index@ha
  421. andc. r13,r13,r12 /* Check permission */
  422. /* Load the next available TLB index */
  423. lwz r13,tlb_44x_index@l(r10)
  424. bne 2f /* Bail if permission mismach */
  425. /* Increment, rollover, and store TLB index */
  426. addi r13,r13,1
  427. /* Compare with watermark (instruction gets patched) */
  428. .globl tlb_44x_patch_hwater_I
  429. tlb_44x_patch_hwater_I:
  430. cmpwi 0,r13,1 /* reserve entries */
  431. ble 5f
  432. li r13,0
  433. 5:
  434. /* Store the next available TLB index */
  435. stw r13,tlb_44x_index@l(r10)
  436. /* Re-load the faulting address */
  437. mfspr r10,SPRN_SRR0
  438. /* Jump to common TLB load point */
  439. b finish_tlb_load
  440. 2:
  441. /* The bailout. Restore registers to pre-exception conditions
  442. * and call the heavyweights to help us out.
  443. */
  444. mfspr r11, SPRN_SPRG7R
  445. mtcr r11
  446. mfspr r13, SPRN_SPRG5R
  447. mfspr r12, SPRN_SPRG4R
  448. mfspr r11, SPRN_SPRG1
  449. mfspr r10, SPRN_SPRG0
  450. b InstructionStorage
  451. /* Debug Interrupt */
  452. DEBUG_CRIT_EXCEPTION
  453. /*
  454. * Local functions
  455. */
  456. /*
  457. * Both the instruction and data TLB miss get to this
  458. * point to load the TLB.
  459. * r10 - EA of fault
  460. * r11 - PTE high word value
  461. * r12 - PTE low word value
  462. * r13 - TLB index
  463. * MMUCR - loaded with proper value when we get here
  464. * Upon exit, we reload everything and RFI.
  465. */
  466. finish_tlb_load:
  467. /* Combine RPN & ERPN an write WS 0 */
  468. rlwimi r11,r12,0,0,19
  469. tlbwe r11,r13,PPC44x_TLB_XLAT
  470. /*
  471. * Create WS1. This is the faulting address (EPN),
  472. * page size, and valid flag.
  473. */
  474. li r11,PPC44x_TLB_VALID | PPC44x_TLB_4K
  475. rlwimi r10,r11,0,20,31 /* Insert valid and page size*/
  476. tlbwe r10,r13,PPC44x_TLB_PAGEID /* Write PAGEID */
  477. /* And WS 2 */
  478. li r10,0xf85 /* Mask to apply from PTE */
  479. rlwimi r10,r12,29,30,30 /* DIRTY -> SW position */
  480. and r11,r12,r10 /* Mask PTE bits to keep */
  481. andi. r10,r12,_PAGE_USER /* User page ? */
  482. beq 1f /* nope, leave U bits empty */
  483. rlwimi r11,r11,3,26,28 /* yes, copy S bits to U */
  484. 1: tlbwe r11,r13,PPC44x_TLB_ATTRIB /* Write ATTRIB */
  485. /* Done...restore registers and get out of here.
  486. */
  487. mfspr r11, SPRN_SPRG7R
  488. mtcr r11
  489. mfspr r13, SPRN_SPRG5R
  490. mfspr r12, SPRN_SPRG4R
  491. mfspr r11, SPRN_SPRG1
  492. mfspr r10, SPRN_SPRG0
  493. rfi /* Force context change */
  494. /*
  495. * Global functions
  496. */
  497. /*
  498. * Adjust the machine check IVOR on 440A cores
  499. */
  500. _GLOBAL(__fixup_440A_mcheck)
  501. li r3,MachineCheckA@l
  502. mtspr SPRN_IVOR1,r3
  503. sync
  504. blr
  505. /*
  506. * extern void giveup_altivec(struct task_struct *prev)
  507. *
  508. * The 44x core does not have an AltiVec unit.
  509. */
  510. _GLOBAL(giveup_altivec)
  511. blr
  512. /*
  513. * extern void giveup_fpu(struct task_struct *prev)
  514. *
  515. * The 44x core does not have an FPU.
  516. */
  517. #ifndef CONFIG_PPC_FPU
  518. _GLOBAL(giveup_fpu)
  519. blr
  520. #endif
  521. _GLOBAL(set_context)
  522. #ifdef CONFIG_BDI_SWITCH
  523. /* Context switch the PTE pointer for the Abatron BDI2000.
  524. * The PGDIR is the second parameter.
  525. */
  526. lis r5, abatron_pteptrs@h
  527. ori r5, r5, abatron_pteptrs@l
  528. stw r4, 0x4(r5)
  529. #endif
  530. mtspr SPRN_PID,r3
  531. isync /* Force context change */
  532. blr
  533. /*
  534. * We put a few things here that have to be page-aligned. This stuff
  535. * goes at the beginning of the data segment, which is page-aligned.
  536. */
  537. .data
  538. .align 12
  539. .globl sdata
  540. sdata:
  541. .globl empty_zero_page
  542. empty_zero_page:
  543. .space 4096
  544. /*
  545. * To support >32-bit physical addresses, we use an 8KB pgdir.
  546. */
  547. .globl swapper_pg_dir
  548. swapper_pg_dir:
  549. .space PGD_TABLE_SIZE
  550. /*
  551. * Room for two PTE pointers, usually the kernel and current user pointers
  552. * to their respective root page table.
  553. */
  554. abatron_pteptrs:
  555. .space 8