exceptions-64s.S (e4ed2b5370a2df2b1feeb970904d2f7761c241c9) exceptions-64s.S (ba41e1e1ccb9771ce41a3b8e2121f95486e76ac9)
1/*
2 * This file contains the 64-bit "server" PowerPC variant
3 * of the low level exception handling including exception
4 * vectors, exception return, part of the slb and stab
5 * handling and other fixed offset specific things.
6 *
7 * This file is meant to be #included from head_64.S due to
8 * position dependent assembly.

--- 218 unchanged lines hidden (view full) ---

227 cmpwi r10,0 /* Are we in nested machine check */
228 bne 0f /* Yes, we are. */
229 /* First machine check entry */
230 ld r1,PACAMCEMERGSP(r13) /* Use MC emergency stack */
2310: subi r1,r1,INT_FRAME_SIZE /* alloc stack frame */
232 addi r10,r10,1 /* increment paca->in_mce */
233 sth r10,PACA_IN_MCE(r13)
234 /* Limit nested MCE to level 4 to avoid stack overflow */
1/*
2 * This file contains the 64-bit "server" PowerPC variant
3 * of the low level exception handling including exception
4 * vectors, exception return, part of the slb and stab
5 * handling and other fixed offset specific things.
6 *
7 * This file is meant to be #included from head_64.S due to
8 * position dependent assembly.

--- 218 unchanged lines hidden (view full) ---

227 cmpwi r10,0 /* Are we in nested machine check */
228 bne 0f /* Yes, we are. */
229 /* First machine check entry */
230 ld r1,PACAMCEMERGSP(r13) /* Use MC emergency stack */
2310: subi r1,r1,INT_FRAME_SIZE /* alloc stack frame */
232 addi r10,r10,1 /* increment paca->in_mce */
233 sth r10,PACA_IN_MCE(r13)
234 /* Limit nested MCE to level 4 to avoid stack overflow */
235 cmpwi r10,4
235 cmpwi r10,MAX_MCE_DEPTH
236 bgt 2f /* Check if we hit limit of 4 */
237 std r11,GPR1(r1) /* Save r1 on the stack. */
238 std r11,0(r1) /* make stack chain pointer */
239 mfspr r11,SPRN_SRR0 /* Save SRR0 */
240 std r11,_NIP(r1)
241 mfspr r11,SPRN_SRR1 /* Save SRR1 */
242 std r11,_MSR(r1)
243 mfspr r11,SPRN_DAR /* Save DAR */

--- 485 unchanged lines hidden (view full) ---

729 bl alignment_exception
730 b ret_from_except
731
732
733EXC_REAL(program_check, 0x700, 0x100)
734EXC_VIRT(program_check, 0x4700, 0x100, 0x700)
735TRAMP_KVM(PACA_EXGEN, 0x700)
736EXC_COMMON_BEGIN(program_check_common)
236 bgt 2f /* Check if we hit limit of 4 */
237 std r11,GPR1(r1) /* Save r1 on the stack. */
238 std r11,0(r1) /* make stack chain pointer */
239 mfspr r11,SPRN_SRR0 /* Save SRR0 */
240 std r11,_NIP(r1)
241 mfspr r11,SPRN_SRR1 /* Save SRR1 */
242 std r11,_MSR(r1)
243 mfspr r11,SPRN_DAR /* Save DAR */

--- 485 unchanged lines hidden (view full) ---

729 bl alignment_exception
730 b ret_from_except
731
732
733EXC_REAL(program_check, 0x700, 0x100)
734EXC_VIRT(program_check, 0x4700, 0x100, 0x700)
735TRAMP_KVM(PACA_EXGEN, 0x700)
736EXC_COMMON_BEGIN(program_check_common)
737 /*
738 * It's possible to receive a TM Bad Thing type program check with
739 * userspace register values (in particular r1), but with SRR1 reporting
740 * that we came from the kernel. Normally that would confuse the bad
741 * stack logic, and we would report a bad kernel stack pointer. Instead
742 * we switch to the emergency stack if we're taking a TM Bad Thing from
743 * the kernel.
744 */
745 li r10,MSR_PR /* Build a mask of MSR_PR .. */
746 oris r10,r10,0x200000@h /* .. and SRR1_PROGTM */
747 and r10,r10,r12 /* Mask SRR1 with that. */
748 srdi r10,r10,8 /* Shift it so we can compare */
749 cmpldi r10,(0x200000 >> 8) /* .. with an immediate. */
750 bne 1f /* If != go to normal path. */
751
752 /* SRR1 had PR=0 and SRR1_PROGTM=1, so use the emergency stack */
753 andi. r10,r12,MSR_PR; /* Set CR0 correctly for label */
754 /* 3 in EXCEPTION_PROLOG_COMMON */
755 mr r10,r1 /* Save r1 */
756 ld r1,PACAEMERGSP(r13) /* Use emergency stack */
757 subi r1,r1,INT_FRAME_SIZE /* alloc stack frame */
758 b 3f /* Jump into the macro !! */
7591: EXCEPTION_PROLOG_COMMON(0x700, PACA_EXGEN)
737 EXCEPTION_PROLOG_COMMON(0x700, PACA_EXGEN)
760 bl save_nvgprs
761 RECONCILE_IRQ_STATE(r10, r11)
762 addi r3,r1,STACK_FRAME_OVERHEAD
763 bl program_check_exception
764 b ret_from_except
765
766
767EXC_REAL(fp_unavailable, 0x800, 0x100)

--- 259 unchanged lines hidden (view full) ---

1027 subi r1,r1,INT_FRAME_SIZE /* alloc stack frame */
1028 mfspr r11,SPRN_HSRR0 /* Save HSRR0 */
1029 mfspr r12,SPRN_HSRR1 /* Save HSRR1 */
1030 EXCEPTION_PROLOG_COMMON_1()
1031 EXCEPTION_PROLOG_COMMON_2(PACA_EXGEN)
1032 EXCEPTION_PROLOG_COMMON_3(0xe60)
1033 addi r3,r1,STACK_FRAME_OVERHEAD
1034 BRANCH_LINK_TO_FAR(hmi_exception_realmode) /* Function call ABI */
738 bl save_nvgprs
739 RECONCILE_IRQ_STATE(r10, r11)
740 addi r3,r1,STACK_FRAME_OVERHEAD
741 bl program_check_exception
742 b ret_from_except
743
744
745EXC_REAL(fp_unavailable, 0x800, 0x100)

--- 259 unchanged lines hidden (view full) ---

1005 subi r1,r1,INT_FRAME_SIZE /* alloc stack frame */
1006 mfspr r11,SPRN_HSRR0 /* Save HSRR0 */
1007 mfspr r12,SPRN_HSRR1 /* Save HSRR1 */
1008 EXCEPTION_PROLOG_COMMON_1()
1009 EXCEPTION_PROLOG_COMMON_2(PACA_EXGEN)
1010 EXCEPTION_PROLOG_COMMON_3(0xe60)
1011 addi r3,r1,STACK_FRAME_OVERHEAD
1012 BRANCH_LINK_TO_FAR(hmi_exception_realmode) /* Function call ABI */
1013 cmpdi cr0,r3,0
1014
1035 /* Windup the stack. */
1036 /* Move original HSRR0 and HSRR1 into the respective regs */
1037 ld r9,_MSR(r1)
1038 mtspr SPRN_HSRR1,r9
1039 ld r3,_NIP(r1)
1040 mtspr SPRN_HSRR0,r3
1041 ld r9,_CTR(r1)
1042 mtctr r9
1043 ld r9,_XER(r1)
1044 mtxer r9
1045 ld r9,_LINK(r1)
1046 mtlr r9
1047 REST_GPR(0, r1)
1048 REST_8GPRS(2, r1)
1049 REST_GPR(10, r1)
1050 ld r11,_CCR(r1)
1015 /* Windup the stack. */
1016 /* Move original HSRR0 and HSRR1 into the respective regs */
1017 ld r9,_MSR(r1)
1018 mtspr SPRN_HSRR1,r9
1019 ld r3,_NIP(r1)
1020 mtspr SPRN_HSRR0,r3
1021 ld r9,_CTR(r1)
1022 mtctr r9
1023 ld r9,_XER(r1)
1024 mtxer r9
1025 ld r9,_LINK(r1)
1026 mtlr r9
1027 REST_GPR(0, r1)
1028 REST_8GPRS(2, r1)
1029 REST_GPR(10, r1)
1030 ld r11,_CCR(r1)
1031 REST_2GPRS(12, r1)
1032 bne 1f
1051 mtcr r11
1052 REST_GPR(11, r1)
1033 mtcr r11
1034 REST_GPR(11, r1)
1053 REST_2GPRS(12, r1)
1054 /* restore original r1. */
1055 ld r1,GPR1(r1)
1035 ld r1,GPR1(r1)
1036 hrfid
1056
1037
10381: mtcr r11
1039 REST_GPR(11, r1)
1040 ld r1,GPR1(r1)
1041
1057 /*
1058 * Go to virtual mode and pull the HMI event information from
1059 * firmware.
1060 */
1061 .globl hmi_exception_after_realmode
1062hmi_exception_after_realmode:
1063 SET_SCRATCH0(r13)
1064 EXCEPTION_PROLOG_0(PACA_EXGEN)
1065 b tramp_real_hmi_exception
1066
1042 /*
1043 * Go to virtual mode and pull the HMI event information from
1044 * firmware.
1045 */
1046 .globl hmi_exception_after_realmode
1047hmi_exception_after_realmode:
1048 SET_SCRATCH0(r13)
1049 EXCEPTION_PROLOG_0(PACA_EXGEN)
1050 b tramp_real_hmi_exception
1051
1067EXC_COMMON_ASYNC(hmi_exception_common, 0xe60, handle_hmi_exception)
1052EXC_COMMON_BEGIN(hmi_exception_common)
1053EXCEPTION_COMMON(PACA_EXGEN, 0xe60, hmi_exception_common, handle_hmi_exception,
1054 ret_from_except, FINISH_NAP;ADD_NVGPRS;ADD_RECONCILE;RUNLATCH_ON)
1068
1055
1069
1070EXC_REAL_OOL_MASKABLE_HV(h_doorbell, 0xe80, 0x20)
1071EXC_VIRT_OOL_MASKABLE_HV(h_doorbell, 0x4e80, 0x20, 0xe80)
1072TRAMP_KVM_HV(PACA_EXGEN, 0xe80)
1073#ifdef CONFIG_PPC_DOORBELL
1074EXC_COMMON_ASYNC(h_doorbell_common, 0xe80, doorbell_exception)
1075#else
1076EXC_COMMON_ASYNC(h_doorbell_common, 0xe80, unknown_exception)
1077#endif

--- 639 unchanged lines hidden ---
1056EXC_REAL_OOL_MASKABLE_HV(h_doorbell, 0xe80, 0x20)
1057EXC_VIRT_OOL_MASKABLE_HV(h_doorbell, 0x4e80, 0x20, 0xe80)
1058TRAMP_KVM_HV(PACA_EXGEN, 0xe80)
1059#ifdef CONFIG_PPC_DOORBELL
1060EXC_COMMON_ASYNC(h_doorbell_common, 0xe80, doorbell_exception)
1061#else
1062EXC_COMMON_ASYNC(h_doorbell_common, 0xe80, unknown_exception)
1063#endif

--- 639 unchanged lines hidden ---