diff options
Diffstat (limited to 'arch/powerpc/kernel/head_fsl_booke.S')
-rw-r--r-- | arch/powerpc/kernel/head_fsl_booke.S | 100 |
1 files changed, 57 insertions, 43 deletions
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S index 5bdcc06d294..975788ca05d 100644 --- a/arch/powerpc/kernel/head_fsl_booke.S +++ b/arch/powerpc/kernel/head_fsl_booke.S | |||
@@ -361,7 +361,7 @@ skpinv: addi r6,r6,1 /* Increment */ | |||
361 | 361 | ||
362 | /* ptr to current thread */ | 362 | /* ptr to current thread */ |
363 | addi r4,r2,THREAD /* init task's THREAD */ | 363 | addi r4,r2,THREAD /* init task's THREAD */ |
364 | mtspr SPRN_SPRG3,r4 | 364 | mtspr SPRN_SPRG_THREAD,r4 |
365 | 365 | ||
366 | /* stack */ | 366 | /* stack */ |
367 | lis r1,init_thread_union@h | 367 | lis r1,init_thread_union@h |
@@ -532,12 +532,12 @@ interrupt_base: | |||
532 | 532 | ||
533 | /* Data TLB Error Interrupt */ | 533 | /* Data TLB Error Interrupt */ |
534 | START_EXCEPTION(DataTLBError) | 534 | START_EXCEPTION(DataTLBError) |
535 | mtspr SPRN_SPRG0, r10 /* Save some working registers */ | 535 | mtspr SPRN_SPRG_WSCRATCH0, r10 /* Save some working registers */ |
536 | mtspr SPRN_SPRG1, r11 | 536 | mtspr SPRN_SPRG_WSCRATCH1, r11 |
537 | mtspr SPRN_SPRG4W, r12 | 537 | mtspr SPRN_SPRG_WSCRATCH2, r12 |
538 | mtspr SPRN_SPRG5W, r13 | 538 | mtspr SPRN_SPRG_WSCRATCH3, r13 |
539 | mfcr r11 | 539 | mfcr r11 |
540 | mtspr SPRN_SPRG7W, r11 | 540 | mtspr SPRN_SPRG_WSCRATCH4, r11 |
541 | mfspr r10, SPRN_DEAR /* Get faulting address */ | 541 | mfspr r10, SPRN_DEAR /* Get faulting address */ |
542 | 542 | ||
543 | /* If we are faulting a kernel address, we have to use the | 543 | /* If we are faulting a kernel address, we have to use the |
@@ -557,7 +557,7 @@ interrupt_base: | |||
557 | 557 | ||
558 | /* Get the PGD for the current thread */ | 558 | /* Get the PGD for the current thread */ |
559 | 3: | 559 | 3: |
560 | mfspr r11,SPRN_SPRG3 | 560 | mfspr r11,SPRN_SPRG_THREAD |
561 | lwz r11,PGDIR(r11) | 561 | lwz r11,PGDIR(r11) |
562 | 562 | ||
563 | 4: | 563 | 4: |
@@ -575,7 +575,12 @@ interrupt_base: | |||
575 | * place or can we save a couple of instructions here ? | 575 | * place or can we save a couple of instructions here ? |
576 | */ | 576 | */ |
577 | mfspr r12,SPRN_ESR | 577 | mfspr r12,SPRN_ESR |
578 | #ifdef CONFIG_PTE_64BIT | ||
579 | li r13,_PAGE_PRESENT | ||
580 | oris r13,r13,_PAGE_ACCESSED@h | ||
581 | #else | ||
578 | li r13,_PAGE_PRESENT|_PAGE_ACCESSED | 582 | li r13,_PAGE_PRESENT|_PAGE_ACCESSED |
583 | #endif | ||
579 | rlwimi r13,r12,11,29,29 | 584 | rlwimi r13,r12,11,29,29 |
580 | 585 | ||
581 | FIND_PTE | 586 | FIND_PTE |
@@ -598,12 +603,12 @@ interrupt_base: | |||
598 | /* The bailout. Restore registers to pre-exception conditions | 603 | /* The bailout. Restore registers to pre-exception conditions |
599 | * and call the heavyweights to help us out. | 604 | * and call the heavyweights to help us out. |
600 | */ | 605 | */ |
601 | mfspr r11, SPRN_SPRG7R | 606 | mfspr r11, SPRN_SPRG_RSCRATCH4 |
602 | mtcr r11 | 607 | mtcr r11 |
603 | mfspr r13, SPRN_SPRG5R | 608 | mfspr r13, SPRN_SPRG_RSCRATCH3 |
604 | mfspr r12, SPRN_SPRG4R | 609 | mfspr r12, SPRN_SPRG_RSCRATCH2 |
605 | mfspr r11, SPRN_SPRG1 | 610 | mfspr r11, SPRN_SPRG_RSCRATCH1 |
606 | mfspr r10, SPRN_SPRG0 | 611 | mfspr r10, SPRN_SPRG_RSCRATCH0 |
607 | b DataStorage | 612 | b DataStorage |
608 | 613 | ||
609 | /* Instruction TLB Error Interrupt */ | 614 | /* Instruction TLB Error Interrupt */ |
@@ -613,12 +618,12 @@ interrupt_base: | |||
613 | * to a different point. | 618 | * to a different point. |
614 | */ | 619 | */ |
615 | START_EXCEPTION(InstructionTLBError) | 620 | START_EXCEPTION(InstructionTLBError) |
616 | mtspr SPRN_SPRG0, r10 /* Save some working registers */ | 621 | mtspr SPRN_SPRG_WSCRATCH0, r10 /* Save some working registers */ |
617 | mtspr SPRN_SPRG1, r11 | 622 | mtspr SPRN_SPRG_WSCRATCH1, r11 |
618 | mtspr SPRN_SPRG4W, r12 | 623 | mtspr SPRN_SPRG_WSCRATCH2, r12 |
619 | mtspr SPRN_SPRG5W, r13 | 624 | mtspr SPRN_SPRG_WSCRATCH3, r13 |
620 | mfcr r11 | 625 | mfcr r11 |
621 | mtspr SPRN_SPRG7W, r11 | 626 | mtspr SPRN_SPRG_WSCRATCH4, r11 |
622 | mfspr r10, SPRN_SRR0 /* Get faulting address */ | 627 | mfspr r10, SPRN_SRR0 /* Get faulting address */ |
623 | 628 | ||
624 | /* If we are faulting a kernel address, we have to use the | 629 | /* If we are faulting a kernel address, we have to use the |
@@ -638,12 +643,17 @@ interrupt_base: | |||
638 | 643 | ||
639 | /* Get the PGD for the current thread */ | 644 | /* Get the PGD for the current thread */ |
640 | 3: | 645 | 3: |
641 | mfspr r11,SPRN_SPRG3 | 646 | mfspr r11,SPRN_SPRG_THREAD |
642 | lwz r11,PGDIR(r11) | 647 | lwz r11,PGDIR(r11) |
643 | 648 | ||
644 | 4: | 649 | 4: |
645 | /* Make up the required permissions */ | 650 | /* Make up the required permissions */ |
646 | li r13,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_HWEXEC | 651 | #ifdef CONFIG_PTE_64BIT |
652 | li r13,_PAGE_PRESENT | _PAGE_EXEC | ||
653 | oris r13,r13,_PAGE_ACCESSED@h | ||
654 | #else | ||
655 | li r13,_PAGE_PRESENT | _PAGE_ACCESSED | _PAGE_EXEC | ||
656 | #endif | ||
647 | 657 | ||
648 | FIND_PTE | 658 | FIND_PTE |
649 | andc. r13,r13,r11 /* Check permission */ | 659 | andc. r13,r13,r11 /* Check permission */ |
@@ -666,12 +676,12 @@ interrupt_base: | |||
666 | /* The bailout. Restore registers to pre-exception conditions | 676 | /* The bailout. Restore registers to pre-exception conditions |
667 | * and call the heavyweights to help us out. | 677 | * and call the heavyweights to help us out. |
668 | */ | 678 | */ |
669 | mfspr r11, SPRN_SPRG7R | 679 | mfspr r11, SPRN_SPRG_RSCRATCH4 |
670 | mtcr r11 | 680 | mtcr r11 |
671 | mfspr r13, SPRN_SPRG5R | 681 | mfspr r13, SPRN_SPRG_RSCRATCH3 |
672 | mfspr r12, SPRN_SPRG4R | 682 | mfspr r12, SPRN_SPRG_RSCRATCH2 |
673 | mfspr r11, SPRN_SPRG1 | 683 | mfspr r11, SPRN_SPRG_RSCRATCH1 |
674 | mfspr r10, SPRN_SPRG0 | 684 | mfspr r10, SPRN_SPRG_RSCRATCH0 |
675 | b InstructionStorage | 685 | b InstructionStorage |
676 | 686 | ||
677 | #ifdef CONFIG_SPE | 687 | #ifdef CONFIG_SPE |
@@ -733,7 +743,7 @@ finish_tlb_load: | |||
733 | 743 | ||
734 | mfspr r12, SPRN_MAS2 | 744 | mfspr r12, SPRN_MAS2 |
735 | #ifdef CONFIG_PTE_64BIT | 745 | #ifdef CONFIG_PTE_64BIT |
736 | rlwimi r12, r11, 26, 24, 31 /* extract ...WIMGE from pte */ | 746 | rlwimi r12, r11, 32-19, 27, 31 /* extract WIMGE from pte */ |
737 | #else | 747 | #else |
738 | rlwimi r12, r11, 26, 27, 31 /* extract WIMGE from pte */ | 748 | rlwimi r12, r11, 26, 27, 31 /* extract WIMGE from pte */ |
739 | #endif | 749 | #endif |
@@ -742,23 +752,27 @@ finish_tlb_load: | |||
742 | #endif | 752 | #endif |
743 | mtspr SPRN_MAS2, r12 | 753 | mtspr SPRN_MAS2, r12 |
744 | 754 | ||
745 | li r10, (_PAGE_HWEXEC | _PAGE_PRESENT) | ||
746 | rlwimi r10, r11, 31, 29, 29 /* extract _PAGE_DIRTY into SW */ | ||
747 | and r12, r11, r10 | ||
748 | andi. r10, r11, _PAGE_USER /* Test for _PAGE_USER */ | ||
749 | slwi r10, r12, 1 | ||
750 | or r10, r10, r12 | ||
751 | iseleq r12, r12, r10 | ||
752 | |||
753 | #ifdef CONFIG_PTE_64BIT | 755 | #ifdef CONFIG_PTE_64BIT |
754 | rlwimi r12, r13, 24, 0, 7 /* grab RPN[32:39] */ | 756 | rlwinm r12, r11, 32-2, 26, 31 /* Move in perm bits */ |
755 | rlwimi r12, r11, 24, 8, 19 /* grab RPN[40:51] */ | 757 | andi. r10, r11, _PAGE_DIRTY |
758 | bne 1f | ||
759 | li r10, MAS3_SW | MAS3_UW | ||
760 | andc r12, r12, r10 | ||
761 | 1: rlwimi r12, r13, 20, 0, 11 /* grab RPN[32:43] */ | ||
762 | rlwimi r12, r11, 20, 12, 19 /* grab RPN[44:51] */ | ||
756 | mtspr SPRN_MAS3, r12 | 763 | mtspr SPRN_MAS3, r12 |
757 | BEGIN_MMU_FTR_SECTION | 764 | BEGIN_MMU_FTR_SECTION |
758 | srwi r10, r13, 8 /* grab RPN[8:31] */ | 765 | srwi r10, r13, 12 /* grab RPN[12:31] */ |
759 | mtspr SPRN_MAS7, r10 | 766 | mtspr SPRN_MAS7, r10 |
760 | END_MMU_FTR_SECTION_IFSET(MMU_FTR_BIG_PHYS) | 767 | END_MMU_FTR_SECTION_IFSET(MMU_FTR_BIG_PHYS) |
761 | #else | 768 | #else |
769 | li r10, (_PAGE_EXEC | _PAGE_PRESENT) | ||
770 | rlwimi r10, r11, 31, 29, 29 /* extract _PAGE_DIRTY into SW */ | ||
771 | and r12, r11, r10 | ||
772 | andi. r10, r11, _PAGE_USER /* Test for _PAGE_USER */ | ||
773 | slwi r10, r12, 1 | ||
774 | or r10, r10, r12 | ||
775 | iseleq r12, r12, r10 | ||
762 | rlwimi r11, r12, 0, 20, 31 /* Extract RPN from PTE and merge with perms */ | 776 | rlwimi r11, r12, 0, 20, 31 /* Extract RPN from PTE and merge with perms */ |
763 | mtspr SPRN_MAS3, r11 | 777 | mtspr SPRN_MAS3, r11 |
764 | #endif | 778 | #endif |
@@ -790,12 +804,12 @@ END_MMU_FTR_SECTION_IFSET(MMU_FTR_BIG_PHYS) | |||
790 | tlbwe | 804 | tlbwe |
791 | 805 | ||
792 | /* Done...restore registers and get out of here. */ | 806 | /* Done...restore registers and get out of here. */ |
793 | mfspr r11, SPRN_SPRG7R | 807 | mfspr r11, SPRN_SPRG_RSCRATCH4 |
794 | mtcr r11 | 808 | mtcr r11 |
795 | mfspr r13, SPRN_SPRG5R | 809 | mfspr r13, SPRN_SPRG_RSCRATCH3 |
796 | mfspr r12, SPRN_SPRG4R | 810 | mfspr r12, SPRN_SPRG_RSCRATCH2 |
797 | mfspr r11, SPRN_SPRG1 | 811 | mfspr r11, SPRN_SPRG_RSCRATCH1 |
798 | mfspr r10, SPRN_SPRG0 | 812 | mfspr r10, SPRN_SPRG_RSCRATCH0 |
799 | rfi /* Force context change */ | 813 | rfi /* Force context change */ |
800 | 814 | ||
801 | #ifdef CONFIG_SPE | 815 | #ifdef CONFIG_SPE |
@@ -839,7 +853,7 @@ load_up_spe: | |||
839 | #endif /* !CONFIG_SMP */ | 853 | #endif /* !CONFIG_SMP */ |
840 | /* enable use of SPE after return */ | 854 | /* enable use of SPE after return */ |
841 | oris r9,r9,MSR_SPE@h | 855 | oris r9,r9,MSR_SPE@h |
842 | mfspr r5,SPRN_SPRG3 /* current task's THREAD (phys) */ | 856 | mfspr r5,SPRN_SPRG_THREAD /* current task's THREAD (phys) */ |
843 | li r4,1 | 857 | li r4,1 |
844 | li r10,THREAD_ACC | 858 | li r10,THREAD_ACC |
845 | stw r4,THREAD_USED_SPE(r5) | 859 | stw r4,THREAD_USED_SPE(r5) |
@@ -1118,7 +1132,7 @@ __secondary_start: | |||
1118 | 1132 | ||
1119 | /* ptr to current thread */ | 1133 | /* ptr to current thread */ |
1120 | addi r4,r2,THREAD /* address of our thread_struct */ | 1134 | addi r4,r2,THREAD /* address of our thread_struct */ |
1121 | mtspr SPRN_SPRG3,r4 | 1135 | mtspr SPRN_SPRG_THREAD,r4 |
1122 | 1136 | ||
1123 | /* Setup the defaults for TLB entries */ | 1137 | /* Setup the defaults for TLB entries */ |
1124 | li r4,(MAS4_TSIZED(BOOK3E_PAGESZ_4K))@l | 1138 | li r4,(MAS4_TSIZED(BOOK3E_PAGESZ_4K))@l |