2 * ppc64 MMU hashtable management routines
4 * (c) Copyright IBM Corp. 2003, 2005
6 * Maintained by: Benjamin Herrenschmidt
7 * <benh@kernel.crashing.org>
9 * This file is covered by the GNU Public Licence v2 as
10 * described in the kernel's COPYING file.
13 #include <linux/config.h>
15 #include <asm/pgtable.h>
18 #include <asm/types.h>
19 #include <asm/ppc_asm.h>
20 #include <asm/asm-offsets.h>
21 #include <asm/cputable.h>
28 * +-> Back chain (SP + 256)
29 * | General register save area (SP + 112)
30 * | Parameter save area (SP + 48)
31 * | TOC save area (SP + 40)
32 * | link editor doubleword (SP + 32)
33 * | compiler doubleword (SP + 24)
34 * | LR save area (SP + 16)
35 * | CR save area (SP + 8)
36 * SP ---> +-- Back chain (SP + 0)
38 #define STACKFRAMESIZE 256
40 /* Save parameters offsets */
41 #define STK_PARM(i) (STACKFRAMESIZE + 48 + ((i)-3)*8)
43 /* Save non-volatile offsets */
44 #define STK_REG(i) (112 + ((i)-14)*8)
47 #ifndef CONFIG_PPC_64K_PAGES
49 /*****************************************************************************
51 * 4K SW & 4K HW pages implementation *
53 *****************************************************************************/
57 * _hash_page_4K(unsigned long ea, unsigned long access, unsigned long vsid,
58 * pte_t *ptep, unsigned long trap, int local)
60 * Adds a 4K page to the hash table in a segment of 4K pages only
63 _GLOBAL(__hash_page_4K)
66 stdu r1,-STACKFRAMESIZE(r1)
67 /* Save all params that we need after a function call */
68 std r6,STK_PARM(r6)(r1)
69 std r8,STK_PARM(r8)(r1)
71 /* Add _PAGE_PRESENT to access */
72 ori r4,r4,_PAGE_PRESENT
74 /* Save non-volatile registers.
75 * r31 will hold "old PTE"
79 * r27 is hashtab mask (maybe dynamic patched instead ?)
81 std r27,STK_REG(r27)(r1)
82 std r28,STK_REG(r28)(r1)
83 std r29,STK_REG(r29)(r1)
84 std r30,STK_REG(r30)(r1)
85 std r31,STK_REG(r31)(r1)
89 * Check permissions, atomically mark the linux PTE busy
94 /* Check access rights (access & ~(pte_val(*ptep))) */
96 bne- htab_wrong_access
97 /* Check if PTE is busy */
98 andi. r0,r31,_PAGE_BUSY
99 /* If so, just bail out and refault if needed. Someone else
100 * is changing this PTE anyway and might hash it.
104 /* Prepare new PTE value (turn access RW into DIRTY, then
105 * add BUSY,HASHPTE and ACCESSED)
107 rlwinm r30,r4,32-9+7,31-7,31-7 /* _PAGE_RW -> _PAGE_DIRTY */
109 ori r30,r30,_PAGE_BUSY | _PAGE_ACCESSED | _PAGE_HASHPTE
110 /* Write the linux PTE atomically (setting busy) */
117 * Insert/Update the HPTE in the hash table. At this point,
118 * r4 (access) is re-useable, we use it for the new HPTE flags
121 /* Calc va and put it in r29 */
122 rldicr r29,r5,28,63-28
126 /* Calculate hash value for primary slot and store it in r28 */
127 rldicl r5,r5,0,25 /* vsid & 0x0000007fffffffff */
128 rldicl r0,r3,64-12,48 /* (ea >> 12) & 0xffff */
131 /* Convert linux PTE bits into HW equivalents */
132 andi. r3,r30,0x1fe /* Get basic set of flags */
133 xori r3,r3,HPTE_R_N /* _PAGE_EXEC -> NOEXEC */
134 rlwinm r0,r30,32-9+1,30,30 /* _PAGE_RW -> _PAGE_USER (r0) */
135 rlwinm r4,r30,32-7+1,30,30 /* _PAGE_DIRTY -> _PAGE_USER (r4) */
136 and r0,r0,r4 /* _PAGE_RW & _PAGE_DIRTY ->r0 bit 30*/
137 andc r0,r30,r0 /* r0 = pte & ~r0 */
138 rlwimi r3,r0,32-1,31,31 /* Insert result into PP lsb */
139 ori r3,r3,HPTE_R_C /* Always add "C" bit for perf. */
141 /* We eventually do the icache sync here (maybe inline that
142 * code rather than call a C function...)
147 bl .hash_page_do_lazy_icache
148 END_FTR_SECTION(CPU_FTR_NOEXECUTE|CPU_FTR_COHERENT_ICACHE, CPU_FTR_NOEXECUTE)
150 /* At this point, r3 contains new PP bits, save them in
151 * place of "access" in the param area (sic)
153 std r3,STK_PARM(r4)(r1)
155 /* Get htab_hash_mask */
156 ld r4,htab_hash_mask@got(2)
157 ld r27,0(r4) /* htab_hash_mask -> r27 */
159 /* Check if we may already be in the hashtable, in this case, we
160 * go to out-of-line code to try to modify the HPTE
162 andi. r0,r31,_PAGE_HASHPTE
166 /* Clear hpte bits in new pte (we also clear BUSY btw) and
169 lis r0,_PAGE_HPTEFLAGS@h
170 ori r0,r0,_PAGE_HPTEFLAGS@l
172 ori r30,r30,_PAGE_HASHPTE
174 /* physical address r5 */
175 rldicl r5,r31,64-PTE_RPN_SHIFT,PTE_RPN_SHIFT
176 sldi r5,r5,PAGE_SHIFT
178 /* Calculate primary group hash */
180 rldicr r3,r0,3,63-3 /* r3 = (hash & mask) << 3 */
182 /* Call ppc_md.hpte_insert */
183 ld r6,STK_PARM(r4)(r1) /* Retreive new pp bits */
184 mr r4,r29 /* Retreive va */
185 li r7,0 /* !bolted, !secondary */
186 li r8,MMU_PAGE_4K /* page size */
187 _GLOBAL(htab_call_hpte_insert1)
188 bl . /* Patched by htab_finish_init() */
190 bge htab_pte_insert_ok /* Insertion successful */
191 cmpdi 0,r3,-2 /* Critical failure */
192 beq- htab_pte_insert_failure
194 /* Now try secondary slot */
196 /* physical address r5 */
197 rldicl r5,r31,64-PTE_RPN_SHIFT,PTE_RPN_SHIFT
198 sldi r5,r5,PAGE_SHIFT
200 /* Calculate secondary group hash */
202 rldicr r3,r0,3,63-3 /* r0 = (~hash & mask) << 3 */
204 /* Call ppc_md.hpte_insert */
205 ld r6,STK_PARM(r4)(r1) /* Retreive new pp bits */
206 mr r4,r29 /* Retreive va */
207 li r7,HPTE_V_SECONDARY /* !bolted, secondary */
208 li r8,MMU_PAGE_4K /* page size */
209 _GLOBAL(htab_call_hpte_insert2)
210 bl . /* Patched by htab_finish_init() */
212 bge+ htab_pte_insert_ok /* Insertion successful */
213 cmpdi 0,r3,-2 /* Critical failure */
214 beq- htab_pte_insert_failure
216 /* Both are full, we need to evict something */
218 /* Pick a random group based on TB */
224 rldicr r3,r0,3,63-3 /* r0 = (hash & mask) << 3 */
225 /* Call ppc_md.hpte_remove */
226 _GLOBAL(htab_call_hpte_remove)
227 bl . /* Patched by htab_finish_init() */
237 /* Insert slot number & secondary bit in PTE */
238 rldimi r30,r3,12,63-15
240 /* Write out the PTE with a normal write
241 * (maybe add eieio may be good still ?)
244 ld r6,STK_PARM(r6)(r1)
248 ld r27,STK_REG(r27)(r1)
249 ld r28,STK_REG(r28)(r1)
250 ld r29,STK_REG(r29)(r1)
251 ld r30,STK_REG(r30)(r1)
252 ld r31,STK_REG(r31)(r1)
253 addi r1,r1,STACKFRAMESIZE
259 /* Keep PP bits in r4 and slot idx from the PTE around in r3 */
261 rlwinm r3,r31,32-12,29,31
263 /* Secondary group ? if yes, get a inverted hash value */
265 andi. r0,r31,_PAGE_SECONDARY
269 /* Calculate proper slot value for ppc_md.hpte_updatepp */
271 rldicr r0,r0,3,63-3 /* r0 = (hash & mask) << 3 */
272 add r3,r0,r3 /* add slot idx */
274 /* Call ppc_md.hpte_updatepp */
276 li r6,MMU_PAGE_4K /* page size */
277 ld r7,STK_PARM(r8)(r1) /* get "local" param */
278 _GLOBAL(htab_call_hpte_updatepp)
279 bl . /* Patched by htab_finish_init() */
281 /* if we failed because typically the HPTE wasn't really here
282 * we try an insertion.
287 /* Clear the BUSY bit and Write out the PTE */
293 /* Bail out clearing reservation */
298 htab_pte_insert_failure:
299 /* Bail out restoring old PTE */
300 ld r6,STK_PARM(r6)(r1)
306 #else /* CONFIG_PPC_64K_PAGES */
309 /*****************************************************************************
311 * 64K SW & 4K or 64K HW in a 4K segment pages implementation *
313 *****************************************************************************/
315 /* _hash_page_4K(unsigned long ea, unsigned long access, unsigned long vsid,
316 * pte_t *ptep, unsigned long trap, int local)
320 * For now, we do NOT implement Admixed pages
322 _GLOBAL(__hash_page_4K)
325 stdu r1,-STACKFRAMESIZE(r1)
326 /* Save all params that we need after a function call */
327 std r6,STK_PARM(r6)(r1)
328 std r8,STK_PARM(r8)(r1)
330 /* Add _PAGE_PRESENT to access */
331 ori r4,r4,_PAGE_PRESENT
333 /* Save non-volatile registers.
334 * r31 will hold "old PTE"
337 * r28 is a hash value
338 * r27 is hashtab mask (maybe dynamic patched instead ?)
339 * r26 is the hidx mask
340 * r25 is the index in combo page
342 std r25,STK_REG(r25)(r1)
343 std r26,STK_REG(r26)(r1)
344 std r27,STK_REG(r27)(r1)
345 std r28,STK_REG(r28)(r1)
346 std r29,STK_REG(r29)(r1)
347 std r30,STK_REG(r30)(r1)
348 std r31,STK_REG(r31)(r1)
352 * Check permissions, atomically mark the linux PTE busy
357 /* Check access rights (access & ~(pte_val(*ptep))) */
359 bne- htab_wrong_access
360 /* Check if PTE is busy */
361 andi. r0,r31,_PAGE_BUSY
362 /* If so, just bail out and refault if needed. Someone else
363 * is changing this PTE anyway and might hash it.
366 /* Prepare new PTE value (turn access RW into DIRTY, then
367 * add BUSY and ACCESSED)
369 rlwinm r30,r4,32-9+7,31-7,31-7 /* _PAGE_RW -> _PAGE_DIRTY */
371 ori r30,r30,_PAGE_BUSY | _PAGE_ACCESSED | _PAGE_HASHPTE
372 /* Write the linux PTE atomically (setting busy) */
379 * Insert/Update the HPTE in the hash table. At this point,
380 * r4 (access) is re-useable, we use it for the new HPTE flags
383 /* Load the hidx index */
384 rldicl r25,r3,64-12,60
386 /* Calc va and put it in r29 */
387 rldicr r29,r5,28,63-28 /* r29 = (vsid << 28) */
388 rldicl r3,r3,0,36 /* r3 = (ea & 0x0fffffff) */
389 or r29,r3,r29 /* r29 = va
391 /* Calculate hash value for primary slot and store it in r28 */
392 rldicl r5,r5,0,25 /* vsid & 0x0000007fffffffff */
393 rldicl r0,r3,64-12,48 /* (ea >> 12) & 0xffff */
396 /* Convert linux PTE bits into HW equivalents */
397 andi. r3,r30,0x1fe /* Get basic set of flags */
398 xori r3,r3,HPTE_R_N /* _PAGE_EXEC -> NOEXEC */
399 rlwinm r0,r30,32-9+1,30,30 /* _PAGE_RW -> _PAGE_USER (r0) */
400 rlwinm r4,r30,32-7+1,30,30 /* _PAGE_DIRTY -> _PAGE_USER (r4) */
401 and r0,r0,r4 /* _PAGE_RW & _PAGE_DIRTY ->r0 bit 30*/
402 andc r0,r30,r0 /* r0 = pte & ~r0 */
403 rlwimi r3,r0,32-1,31,31 /* Insert result into PP lsb */
404 ori r3,r3,HPTE_R_C /* Always add "C" bit for perf. */
406 /* We eventually do the icache sync here (maybe inline that
407 * code rather than call a C function...)
412 bl .hash_page_do_lazy_icache
413 END_FTR_SECTION(CPU_FTR_NOEXECUTE|CPU_FTR_COHERENT_ICACHE, CPU_FTR_NOEXECUTE)
415 /* At this point, r3 contains new PP bits, save them in
416 * place of "access" in the param area (sic)
418 std r3,STK_PARM(r4)(r1)
420 /* Get htab_hash_mask */
421 ld r4,htab_hash_mask@got(2)
422 ld r27,0(r4) /* htab_hash_mask -> r27 */
424 /* Check if we may already be in the hashtable, in this case, we
425 * go to out-of-line code to try to modify the HPTE. We look for
426 * the bit at (1 >> (index + 32))
428 andi. r0,r31,_PAGE_HASHPTE
429 li r26,0 /* Default hidx */
431 ld r6,STK_PARM(r6)(r1)
432 ori r26,r6,0x8000 /* Load the hidx mask */
434 addi r5,r25,36 /* Check actual HPTE_SUB bit, this */
435 rldcr. r0,r31,r5,0 /* must match pgtable.h definition */
439 /* real page number in r5, PTE RPN value + index */
440 rldicl r5,r31,64-PTE_RPN_SHIFT,PTE_RPN_SHIFT
441 sldi r5,r5,PAGE_SHIFT-HW_PAGE_SHIFT
443 sldi r5,r5,HW_PAGE_SHIFT
445 /* Calculate primary group hash */
447 rldicr r3,r0,3,63-3 /* r0 = (hash & mask) << 3 */
449 /* Call ppc_md.hpte_insert */
450 ld r6,STK_PARM(r4)(r1) /* Retreive new pp bits */
451 mr r4,r29 /* Retreive va */
452 li r7,0 /* !bolted, !secondary */
453 li r8,MMU_PAGE_4K /* page size */
454 _GLOBAL(htab_call_hpte_insert1)
455 bl . /* patched by htab_finish_init() */
457 bge htab_pte_insert_ok /* Insertion successful */
458 cmpdi 0,r3,-2 /* Critical failure */
459 beq- htab_pte_insert_failure
461 /* Now try secondary slot */
463 /* real page number in r5, PTE RPN value + index */
464 rldicl r5,r31,64-PTE_RPN_SHIFT,PTE_RPN_SHIFT
465 sldi r5,r5,PAGE_SHIFT-HW_PAGE_SHIFT
467 sldi r5,r5,HW_PAGE_SHIFT
469 /* Calculate secondary group hash */
471 rldicr r3,r0,3,63-3 /* r0 = (~hash & mask) << 3 */
473 /* Call ppc_md.hpte_insert */
474 ld r6,STK_PARM(r4)(r1) /* Retreive new pp bits */
475 mr r4,r29 /* Retreive va */
476 li r7,HPTE_V_SECONDARY /* !bolted, secondary */
477 li r8,MMU_PAGE_4K /* page size */
478 _GLOBAL(htab_call_hpte_insert2)
479 bl . /* patched by htab_finish_init() */
481 bge+ htab_pte_insert_ok /* Insertion successful */
482 cmpdi 0,r3,-2 /* Critical failure */
483 beq- htab_pte_insert_failure
485 /* Both are full, we need to evict something */
487 /* Pick a random group based on TB */
493 rldicr r3,r0,3,63-3 /* r0 = (hash & mask) << 3 */
494 /* Call ppc_md.hpte_remove */
495 _GLOBAL(htab_call_hpte_remove)
496 bl . /* patched by htab_finish_init() */
506 /* Insert slot number & secondary bit in PTE second half,
507 * clear _PAGE_BUSY and set approriate HPTE slot bit
509 ld r6,STK_PARM(r6)(r1)
514 subfic r5,r25,27 /* Must match bit position in */
515 sld r0,r0,r5 /* pgtable.h */
530 ld r25,STK_REG(r25)(r1)
531 ld r26,STK_REG(r26)(r1)
532 ld r27,STK_REG(r27)(r1)
533 ld r28,STK_REG(r28)(r1)
534 ld r29,STK_REG(r29)(r1)
535 ld r30,STK_REG(r30)(r1)
536 ld r31,STK_REG(r31)(r1)
537 addi r1,r1,STACKFRAMESIZE
543 /* Keep PP bits in r4 and slot idx from the PTE around in r3 */
548 /* Secondary group ? if yes, get a inverted hash value */
550 andi. r0,r3,0x8 /* page secondary ? */
553 1: andi. r3,r3,0x7 /* extract idx alone */
555 /* Calculate proper slot value for ppc_md.hpte_updatepp */
557 rldicr r0,r0,3,63-3 /* r0 = (hash & mask) << 3 */
558 add r3,r0,r3 /* add slot idx */
560 /* Call ppc_md.hpte_updatepp */
562 li r6,MMU_PAGE_4K /* page size */
563 ld r7,STK_PARM(r8)(r1) /* get "local" param */
564 _GLOBAL(htab_call_hpte_updatepp)
565 bl . /* patched by htab_finish_init() */
567 /* if we failed because typically the HPTE wasn't really here
568 * we try an insertion.
573 /* Clear the BUSY bit and Write out the PTE */
576 ld r6,STK_PARM(r6)(r1)
582 /* Bail out clearing reservation */
587 htab_pte_insert_failure:
588 /* Bail out restoring old PTE */
589 ld r6,STK_PARM(r6)(r1)
595 /*****************************************************************************
597 * 64K SW & 64K HW in a 64K segment pages implementation *
599 *****************************************************************************/
601 _GLOBAL(__hash_page_64K)
604 stdu r1,-STACKFRAMESIZE(r1)
605 /* Save all params that we need after a function call */
606 std r6,STK_PARM(r6)(r1)
607 std r8,STK_PARM(r8)(r1)
609 /* Add _PAGE_PRESENT to access */
610 ori r4,r4,_PAGE_PRESENT
612 /* Save non-volatile registers.
613 * r31 will hold "old PTE"
616 * r28 is a hash value
617 * r27 is hashtab mask (maybe dynamic patched instead ?)
619 std r27,STK_REG(r27)(r1)
620 std r28,STK_REG(r28)(r1)
621 std r29,STK_REG(r29)(r1)
622 std r30,STK_REG(r30)(r1)
623 std r31,STK_REG(r31)(r1)
627 * Check permissions, atomically mark the linux PTE busy
632 /* Check access rights (access & ~(pte_val(*ptep))) */
634 bne- ht64_wrong_access
635 /* Check if PTE is busy */
636 andi. r0,r31,_PAGE_BUSY
637 /* If so, just bail out and refault if needed. Someone else
638 * is changing this PTE anyway and might hash it.
641 /* Prepare new PTE value (turn access RW into DIRTY, then
642 * add BUSY,HASHPTE and ACCESSED)
644 rlwinm r30,r4,32-9+7,31-7,31-7 /* _PAGE_RW -> _PAGE_DIRTY */
646 ori r30,r30,_PAGE_BUSY | _PAGE_ACCESSED | _PAGE_HASHPTE
647 /* Write the linux PTE atomically (setting busy) */
654 * Insert/Update the HPTE in the hash table. At this point,
655 * r4 (access) is re-useable, we use it for the new HPTE flags
658 /* Calc va and put it in r29 */
659 rldicr r29,r5,28,63-28
663 /* Calculate hash value for primary slot and store it in r28 */
664 rldicl r5,r5,0,25 /* vsid & 0x0000007fffffffff */
665 rldicl r0,r3,64-16,52 /* (ea >> 16) & 0xfff */
668 /* Convert linux PTE bits into HW equivalents */
669 andi. r3,r30,0x1fe /* Get basic set of flags */
670 xori r3,r3,HPTE_R_N /* _PAGE_EXEC -> NOEXEC */
671 rlwinm r0,r30,32-9+1,30,30 /* _PAGE_RW -> _PAGE_USER (r0) */
672 rlwinm r4,r30,32-7+1,30,30 /* _PAGE_DIRTY -> _PAGE_USER (r4) */
673 and r0,r0,r4 /* _PAGE_RW & _PAGE_DIRTY ->r0 bit 30*/
674 andc r0,r30,r0 /* r0 = pte & ~r0 */
675 rlwimi r3,r0,32-1,31,31 /* Insert result into PP lsb */
676 ori r3,r3,HPTE_R_C /* Always add "C" bit for perf. */
678 /* We eventually do the icache sync here (maybe inline that
679 * code rather than call a C function...)
684 bl .hash_page_do_lazy_icache
685 END_FTR_SECTION(CPU_FTR_NOEXECUTE|CPU_FTR_COHERENT_ICACHE, CPU_FTR_NOEXECUTE)
687 /* At this point, r3 contains new PP bits, save them in
688 * place of "access" in the param area (sic)
690 std r3,STK_PARM(r4)(r1)
692 /* Get htab_hash_mask */
693 ld r4,htab_hash_mask@got(2)
694 ld r27,0(r4) /* htab_hash_mask -> r27 */
696 /* Check if we may already be in the hashtable, in this case, we
697 * go to out-of-line code to try to modify the HPTE
699 andi. r0,r31,_PAGE_HASHPTE
703 /* Clear hpte bits in new pte (we also clear BUSY btw) and
706 lis r0,_PAGE_HPTEFLAGS@h
707 ori r0,r0,_PAGE_HPTEFLAGS@l
709 ori r30,r30,_PAGE_HASHPTE
711 /* Phyical address in r5 */
712 rldicl r5,r31,64-PTE_RPN_SHIFT,PTE_RPN_SHIFT
713 sldi r5,r5,PAGE_SHIFT
715 /* Calculate primary group hash */
717 rldicr r3,r0,3,63-3 /* r0 = (hash & mask) << 3 */
719 /* Call ppc_md.hpte_insert */
720 ld r6,STK_PARM(r4)(r1) /* Retreive new pp bits */
721 mr r4,r29 /* Retreive va */
722 li r7,0 /* !bolted, !secondary */
724 _GLOBAL(ht64_call_hpte_insert1)
725 bl . /* patched by htab_finish_init() */
727 bge ht64_pte_insert_ok /* Insertion successful */
728 cmpdi 0,r3,-2 /* Critical failure */
729 beq- ht64_pte_insert_failure
731 /* Now try secondary slot */
733 /* Phyical address in r5 */
734 rldicl r5,r31,64-PTE_RPN_SHIFT,PTE_RPN_SHIFT
735 sldi r5,r5,PAGE_SHIFT
737 /* Calculate secondary group hash */
739 rldicr r3,r0,3,63-3 /* r0 = (~hash & mask) << 3 */
741 /* Call ppc_md.hpte_insert */
742 ld r6,STK_PARM(r4)(r1) /* Retreive new pp bits */
743 mr r4,r29 /* Retreive va */
744 li r7,HPTE_V_SECONDARY /* !bolted, secondary */
746 _GLOBAL(ht64_call_hpte_insert2)
747 bl . /* patched by htab_finish_init() */
749 bge+ ht64_pte_insert_ok /* Insertion successful */
750 cmpdi 0,r3,-2 /* Critical failure */
751 beq- ht64_pte_insert_failure
753 /* Both are full, we need to evict something */
755 /* Pick a random group based on TB */
761 rldicr r3,r0,3,63-3 /* r0 = (hash & mask) << 3 */
762 /* Call ppc_md.hpte_remove */
763 _GLOBAL(ht64_call_hpte_remove)
764 bl . /* patched by htab_finish_init() */
774 /* Insert slot number & secondary bit in PTE */
775 rldimi r30,r3,12,63-15
777 /* Write out the PTE with a normal write
778 * (maybe add eieio may be good still ?)
781 ld r6,STK_PARM(r6)(r1)
785 ld r27,STK_REG(r27)(r1)
786 ld r28,STK_REG(r28)(r1)
787 ld r29,STK_REG(r29)(r1)
788 ld r30,STK_REG(r30)(r1)
789 ld r31,STK_REG(r31)(r1)
790 addi r1,r1,STACKFRAMESIZE
796 /* Keep PP bits in r4 and slot idx from the PTE around in r3 */
798 rlwinm r3,r31,32-12,29,31
800 /* Secondary group ? if yes, get a inverted hash value */
802 andi. r0,r31,_PAGE_F_SECOND
806 /* Calculate proper slot value for ppc_md.hpte_updatepp */
808 rldicr r0,r0,3,63-3 /* r0 = (hash & mask) << 3 */
809 add r3,r0,r3 /* add slot idx */
811 /* Call ppc_md.hpte_updatepp */
814 ld r7,STK_PARM(r8)(r1) /* get "local" param */
815 _GLOBAL(ht64_call_hpte_updatepp)
816 bl . /* patched by htab_finish_init() */
818 /* if we failed because typically the HPTE wasn't really here
819 * we try an insertion.
824 /* Clear the BUSY bit and Write out the PTE */
830 /* Bail out clearing reservation */
835 ht64_pte_insert_failure:
836 /* Bail out restoring old PTE */
837 ld r6,STK_PARM(r6)(r1)
843 #endif /* CONFIG_PPC_64K_PAGES */
846 /*****************************************************************************
848 * Huge pages implementation is in hugetlbpage.c *
850 *****************************************************************************/