exceptions-64s.S (f89e0dd9d1a72fdf6b8958bcadfa6abf84f3cae0) exceptions-64s.S (b1576fec7f4dd4657694fefc97fda4cf28ec68e9)
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.

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

127 lbz r0,HSTATE_HWTHREAD_REQ(r13)
128 cmpwi r0,0
129 beq 1f
130 b kvm_start_guest
1311:
132#endif
133
134 beq cr1,2f
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.

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

127 lbz r0,HSTATE_HWTHREAD_REQ(r13)
128 cmpwi r0,0
129 beq 1f
130 b kvm_start_guest
1311:
132#endif
133
134 beq cr1,2f
135 b .power7_wakeup_noloss
1362: b .power7_wakeup_loss
135 b power7_wakeup_noloss
1362: b power7_wakeup_loss
137
138 /* Fast Sleep wakeup on PowerNV */
1398: GET_PACA(r13)
137
138 /* Fast Sleep wakeup on PowerNV */
1398: GET_PACA(r13)
140 b .power7_wakeup_tb_loss
140 b power7_wakeup_tb_loss
141
1429:
143END_FTR_SECTION_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206)
144#endif /* CONFIG_PPC_P7_NAP */
145 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common, EXC_STD,
146 NOTEST, 0x100)
147
148 . = 0x200

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

206 mfspr r3,SPRN_DAR
207#ifdef __DISABLED__
208 /* Keep that around for when we re-implement dynamic VSIDs */
209 cmpdi r3,0
210 bge slb_miss_user_pseries
211#endif /* __DISABLED__ */
212 mfspr r12,SPRN_SRR1
213#ifndef CONFIG_RELOCATABLE
141
1429:
143END_FTR_SECTION_IFSET(CPU_FTR_HVMODE | CPU_FTR_ARCH_206)
144#endif /* CONFIG_PPC_P7_NAP */
145 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common, EXC_STD,
146 NOTEST, 0x100)
147
148 . = 0x200

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

206 mfspr r3,SPRN_DAR
207#ifdef __DISABLED__
208 /* Keep that around for when we re-implement dynamic VSIDs */
209 cmpdi r3,0
210 bge slb_miss_user_pseries
211#endif /* __DISABLED__ */
212 mfspr r12,SPRN_SRR1
213#ifndef CONFIG_RELOCATABLE
214 b .slb_miss_realmode
214 b slb_miss_realmode
215#else
216 /*
217 * We can't just use a direct branch to .slb_miss_realmode
218 * because the distance from here to there depends on where
219 * the kernel ends up being put.
220 */
221 mfctr r11
222 ld r10,PACAKBASE(r13)

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

238 mfspr r3,SPRN_SRR0 /* SRR0 is faulting address */
239#ifdef __DISABLED__
240 /* Keep that around for when we re-implement dynamic VSIDs */
241 cmpdi r3,0
242 bge slb_miss_user_pseries
243#endif /* __DISABLED__ */
244 mfspr r12,SPRN_SRR1
245#ifndef CONFIG_RELOCATABLE
215#else
216 /*
217 * We can't just use a direct branch to .slb_miss_realmode
218 * because the distance from here to there depends on where
219 * the kernel ends up being put.
220 */
221 mfctr r11
222 ld r10,PACAKBASE(r13)

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

238 mfspr r3,SPRN_SRR0 /* SRR0 is faulting address */
239#ifdef __DISABLED__
240 /* Keep that around for when we re-implement dynamic VSIDs */
241 cmpdi r3,0
242 bge slb_miss_user_pseries
243#endif /* __DISABLED__ */
244 mfspr r12,SPRN_SRR1
245#ifndef CONFIG_RELOCATABLE
246 b .slb_miss_realmode
246 b slb_miss_realmode
247#else
248 mfctr r11
249 ld r10,PACAKBASE(r13)
250 LOAD_HANDLER(r10, .slb_miss_realmode)
251 mtctr r10
252 bctr
253#endif
254

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

824data_access_slb_relon_pSeries:
825 SET_SCRATCH0(r13)
826 EXCEPTION_PROLOG_0(PACA_EXSLB)
827 EXCEPTION_PROLOG_1(PACA_EXSLB, NOTEST, 0x380)
828 std r3,PACA_EXSLB+EX_R3(r13)
829 mfspr r3,SPRN_DAR
830 mfspr r12,SPRN_SRR1
831#ifndef CONFIG_RELOCATABLE
247#else
248 mfctr r11
249 ld r10,PACAKBASE(r13)
250 LOAD_HANDLER(r10, .slb_miss_realmode)
251 mtctr r10
252 bctr
253#endif
254

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

824data_access_slb_relon_pSeries:
825 SET_SCRATCH0(r13)
826 EXCEPTION_PROLOG_0(PACA_EXSLB)
827 EXCEPTION_PROLOG_1(PACA_EXSLB, NOTEST, 0x380)
828 std r3,PACA_EXSLB+EX_R3(r13)
829 mfspr r3,SPRN_DAR
830 mfspr r12,SPRN_SRR1
831#ifndef CONFIG_RELOCATABLE
832 b .slb_miss_realmode
832 b slb_miss_realmode
833#else
834 /*
835 * We can't just use a direct branch to .slb_miss_realmode
836 * because the distance from here to there depends on where
837 * the kernel ends up being put.
838 */
839 mfctr r11
840 ld r10,PACAKBASE(r13)

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

849instruction_access_slb_relon_pSeries:
850 SET_SCRATCH0(r13)
851 EXCEPTION_PROLOG_0(PACA_EXSLB)
852 EXCEPTION_PROLOG_1(PACA_EXSLB, NOTEST, 0x480)
853 std r3,PACA_EXSLB+EX_R3(r13)
854 mfspr r3,SPRN_SRR0 /* SRR0 is faulting address */
855 mfspr r12,SPRN_SRR1
856#ifndef CONFIG_RELOCATABLE
833#else
834 /*
835 * We can't just use a direct branch to .slb_miss_realmode
836 * because the distance from here to there depends on where
837 * the kernel ends up being put.
838 */
839 mfctr r11
840 ld r10,PACAKBASE(r13)

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

849instruction_access_slb_relon_pSeries:
850 SET_SCRATCH0(r13)
851 EXCEPTION_PROLOG_0(PACA_EXSLB)
852 EXCEPTION_PROLOG_1(PACA_EXSLB, NOTEST, 0x480)
853 std r3,PACA_EXSLB+EX_R3(r13)
854 mfspr r3,SPRN_SRR0 /* SRR0 is faulting address */
855 mfspr r12,SPRN_SRR1
856#ifndef CONFIG_RELOCATABLE
857 b .slb_miss_realmode
857 b slb_miss_realmode
858#else
859 mfctr r11
860 ld r10,PACAKBASE(r13)
861 LOAD_HANDLER(r10, .slb_miss_realmode)
862 mtctr r10
863 bctr
864#endif
865

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

961 * orig in r10. To save hacking/ifdeffing common code, restore here.
962 */
963 mtlr r10
964#endif
965system_call_entry:
966 b system_call_common
967
968ppc64_runlatch_on_trampoline:
858#else
859 mfctr r11
860 ld r10,PACAKBASE(r13)
861 LOAD_HANDLER(r10, .slb_miss_realmode)
862 mtctr r10
863 bctr
864#endif
865

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

961 * orig in r10. To save hacking/ifdeffing common code, restore here.
962 */
963 mtlr r10
964#endif
965system_call_entry:
966 b system_call_common
967
968ppc64_runlatch_on_trampoline:
969 b .__ppc64_runlatch_on
969 b __ppc64_runlatch_on
970
971/*
972 * Here we have detected that the kernel stack pointer is bad.
973 * R9 contains the saved CR, r13 points to the paca,
974 * r10 contains the (bad) kernel stack pointer,
975 * r11 and r12 contain the saved SRR0 and SRR1.
976 * We switch to using an emergency stack, save the registers there,
977 * and call kernel_bad_stack(), which panics.

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

1020 std r11,0(r1)
1021 li r12,0
1022 std r12,0(r11)
1023 ld r2,PACATOC(r13)
1024 ld r11,exception_marker@toc(r2)
1025 std r12,RESULT(r1)
1026 std r11,STACK_FRAME_OVERHEAD-16(r1)
10271: addi r3,r1,STACK_FRAME_OVERHEAD
970
971/*
972 * Here we have detected that the kernel stack pointer is bad.
973 * R9 contains the saved CR, r13 points to the paca,
974 * r10 contains the (bad) kernel stack pointer,
975 * r11 and r12 contain the saved SRR0 and SRR1.
976 * We switch to using an emergency stack, save the registers there,
977 * and call kernel_bad_stack(), which panics.

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

1020 std r11,0(r1)
1021 li r12,0
1022 std r12,0(r11)
1023 ld r2,PACATOC(r13)
1024 ld r11,exception_marker@toc(r2)
1025 std r12,RESULT(r1)
1026 std r11,STACK_FRAME_OVERHEAD-16(r1)
10271: addi r3,r1,STACK_FRAME_OVERHEAD
1028 bl .kernel_bad_stack
1028 bl kernel_bad_stack
1029 b 1b
1030
1031/*
1032 * Here r13 points to the paca, r9 contains the saved CR,
1033 * SRR0 and SRR1 are saved in r11 and r12,
1034 * r9 - r13 are saved in paca->exgen.
1035 */
1036 .align 7

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

1041 mfspr r10,SPRN_DSISR
1042 stw r10,PACA_EXGEN+EX_DSISR(r13)
1043 EXCEPTION_PROLOG_COMMON(0x300, PACA_EXGEN)
1044 DISABLE_INTS
1045 ld r12,_MSR(r1)
1046 ld r3,PACA_EXGEN+EX_DAR(r13)
1047 lwz r4,PACA_EXGEN+EX_DSISR(r13)
1048 li r5,0x300
1029 b 1b
1030
1031/*
1032 * Here r13 points to the paca, r9 contains the saved CR,
1033 * SRR0 and SRR1 are saved in r11 and r12,
1034 * r9 - r13 are saved in paca->exgen.
1035 */
1036 .align 7

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

1041 mfspr r10,SPRN_DSISR
1042 stw r10,PACA_EXGEN+EX_DSISR(r13)
1043 EXCEPTION_PROLOG_COMMON(0x300, PACA_EXGEN)
1044 DISABLE_INTS
1045 ld r12,_MSR(r1)
1046 ld r3,PACA_EXGEN+EX_DAR(r13)
1047 lwz r4,PACA_EXGEN+EX_DSISR(r13)
1048 li r5,0x300
1049 b .do_hash_page /* Try to handle as hpte fault */
1049 b do_hash_page /* Try to handle as hpte fault */
1050
1051 .align 7
1052 .globl h_data_storage_common
1053h_data_storage_common:
1054 mfspr r10,SPRN_HDAR
1055 std r10,PACA_EXGEN+EX_DAR(r13)
1056 mfspr r10,SPRN_HDSISR
1057 stw r10,PACA_EXGEN+EX_DSISR(r13)
1058 EXCEPTION_PROLOG_COMMON(0xe00, PACA_EXGEN)
1050
1051 .align 7
1052 .globl h_data_storage_common
1053h_data_storage_common:
1054 mfspr r10,SPRN_HDAR
1055 std r10,PACA_EXGEN+EX_DAR(r13)
1056 mfspr r10,SPRN_HDSISR
1057 stw r10,PACA_EXGEN+EX_DSISR(r13)
1058 EXCEPTION_PROLOG_COMMON(0xe00, PACA_EXGEN)
1059 bl .save_nvgprs
1059 bl save_nvgprs
1060 DISABLE_INTS
1061 addi r3,r1,STACK_FRAME_OVERHEAD
1060 DISABLE_INTS
1061 addi r3,r1,STACK_FRAME_OVERHEAD
1062 bl .unknown_exception
1063 b .ret_from_except
1062 bl unknown_exception
1063 b ret_from_except
1064
1065 .align 7
1066 .globl instruction_access_common
1067instruction_access_common:
1068 EXCEPTION_PROLOG_COMMON(0x400, PACA_EXGEN)
1069 DISABLE_INTS
1070 ld r12,_MSR(r1)
1071 ld r3,_NIP(r1)
1072 andis. r4,r12,0x5820
1073 li r5,0x400
1064
1065 .align 7
1066 .globl instruction_access_common
1067instruction_access_common:
1068 EXCEPTION_PROLOG_COMMON(0x400, PACA_EXGEN)
1069 DISABLE_INTS
1070 ld r12,_MSR(r1)
1071 ld r3,_NIP(r1)
1072 andis. r4,r12,0x5820
1073 li r5,0x400
1074 b .do_hash_page /* Try to handle as hpte fault */
1074 b do_hash_page /* Try to handle as hpte fault */
1075
1076 STD_EXCEPTION_COMMON(0xe20, h_instr_storage, .unknown_exception)
1077
1078/*
1079 * Here is the common SLB miss user that is used when going to virtual
1080 * mode for SLB misses, that is currently not used
1081 */
1082#ifdef __DISABLED__
1083 .align 7
1084 .globl slb_miss_user_common
1085slb_miss_user_common:
1086 mflr r10
1087 std r3,PACA_EXGEN+EX_DAR(r13)
1088 stw r9,PACA_EXGEN+EX_CCR(r13)
1089 std r10,PACA_EXGEN+EX_LR(r13)
1090 std r11,PACA_EXGEN+EX_SRR0(r13)
1075
1076 STD_EXCEPTION_COMMON(0xe20, h_instr_storage, .unknown_exception)
1077
1078/*
1079 * Here is the common SLB miss user that is used when going to virtual
1080 * mode for SLB misses, that is currently not used
1081 */
1082#ifdef __DISABLED__
1083 .align 7
1084 .globl slb_miss_user_common
1085slb_miss_user_common:
1086 mflr r10
1087 std r3,PACA_EXGEN+EX_DAR(r13)
1088 stw r9,PACA_EXGEN+EX_CCR(r13)
1089 std r10,PACA_EXGEN+EX_LR(r13)
1090 std r11,PACA_EXGEN+EX_SRR0(r13)
1091 bl .slb_allocate_user
1091 bl slb_allocate_user
1092
1093 ld r10,PACA_EXGEN+EX_LR(r13)
1094 ld r3,PACA_EXGEN+EX_R3(r13)
1095 lwz r9,PACA_EXGEN+EX_CCR(r13)
1096 ld r11,PACA_EXGEN+EX_SRR0(r13)
1097 mtlr r10
1098 beq- slb_miss_fault
1099

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

1126 li r5,0
1127 std r4,_DAR(r1)
1128 std r5,_DSISR(r1)
1129 b handle_page_fault
1130
1131unrecov_user_slb:
1132 EXCEPTION_PROLOG_COMMON(0x4200, PACA_EXGEN)
1133 DISABLE_INTS
1092
1093 ld r10,PACA_EXGEN+EX_LR(r13)
1094 ld r3,PACA_EXGEN+EX_R3(r13)
1095 lwz r9,PACA_EXGEN+EX_CCR(r13)
1096 ld r11,PACA_EXGEN+EX_SRR0(r13)
1097 mtlr r10
1098 beq- slb_miss_fault
1099

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

1126 li r5,0
1127 std r4,_DAR(r1)
1128 std r5,_DSISR(r1)
1129 b handle_page_fault
1130
1131unrecov_user_slb:
1132 EXCEPTION_PROLOG_COMMON(0x4200, PACA_EXGEN)
1133 DISABLE_INTS
1134 bl .save_nvgprs
1134 bl save_nvgprs
11351: addi r3,r1,STACK_FRAME_OVERHEAD
11351: addi r3,r1,STACK_FRAME_OVERHEAD
1136 bl .unrecoverable_exception
1136 bl unrecoverable_exception
1137 b 1b
1138
1139#endif /* __DISABLED__ */
1140
1141
1142 /*
1143 * Machine check is different because we use a different
1144 * save area: PACA_EXMC instead of PACA_EXGEN.

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

1153 stw r10,PACA_EXGEN+EX_DSISR(r13)
1154 EXCEPTION_PROLOG_COMMON(0x200, PACA_EXMC)
1155 FINISH_NAP
1156 DISABLE_INTS
1157 ld r3,PACA_EXGEN+EX_DAR(r13)
1158 lwz r4,PACA_EXGEN+EX_DSISR(r13)
1159 std r3,_DAR(r1)
1160 std r4,_DSISR(r1)
1137 b 1b
1138
1139#endif /* __DISABLED__ */
1140
1141
1142 /*
1143 * Machine check is different because we use a different
1144 * save area: PACA_EXMC instead of PACA_EXGEN.

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

1153 stw r10,PACA_EXGEN+EX_DSISR(r13)
1154 EXCEPTION_PROLOG_COMMON(0x200, PACA_EXMC)
1155 FINISH_NAP
1156 DISABLE_INTS
1157 ld r3,PACA_EXGEN+EX_DAR(r13)
1158 lwz r4,PACA_EXGEN+EX_DSISR(r13)
1159 std r3,_DAR(r1)
1160 std r4,_DSISR(r1)
1161 bl .save_nvgprs
1161 bl save_nvgprs
1162 addi r3,r1,STACK_FRAME_OVERHEAD
1162 addi r3,r1,STACK_FRAME_OVERHEAD
1163 bl .machine_check_exception
1164 b .ret_from_except
1163 bl machine_check_exception
1164 b ret_from_except
1165
1166 .align 7
1167 .globl alignment_common
1168alignment_common:
1169 mfspr r10,SPRN_DAR
1170 std r10,PACA_EXGEN+EX_DAR(r13)
1171 mfspr r10,SPRN_DSISR
1172 stw r10,PACA_EXGEN+EX_DSISR(r13)
1173 EXCEPTION_PROLOG_COMMON(0x600, PACA_EXGEN)
1174 ld r3,PACA_EXGEN+EX_DAR(r13)
1175 lwz r4,PACA_EXGEN+EX_DSISR(r13)
1176 std r3,_DAR(r1)
1177 std r4,_DSISR(r1)
1165
1166 .align 7
1167 .globl alignment_common
1168alignment_common:
1169 mfspr r10,SPRN_DAR
1170 std r10,PACA_EXGEN+EX_DAR(r13)
1171 mfspr r10,SPRN_DSISR
1172 stw r10,PACA_EXGEN+EX_DSISR(r13)
1173 EXCEPTION_PROLOG_COMMON(0x600, PACA_EXGEN)
1174 ld r3,PACA_EXGEN+EX_DAR(r13)
1175 lwz r4,PACA_EXGEN+EX_DSISR(r13)
1176 std r3,_DAR(r1)
1177 std r4,_DSISR(r1)
1178 bl .save_nvgprs
1178 bl save_nvgprs
1179 DISABLE_INTS
1180 addi r3,r1,STACK_FRAME_OVERHEAD
1179 DISABLE_INTS
1180 addi r3,r1,STACK_FRAME_OVERHEAD
1181 bl .alignment_exception
1182 b .ret_from_except
1181 bl alignment_exception
1182 b ret_from_except
1183
1184 .align 7
1185 .globl program_check_common
1186program_check_common:
1187 EXCEPTION_PROLOG_COMMON(0x700, PACA_EXGEN)
1183
1184 .align 7
1185 .globl program_check_common
1186program_check_common:
1187 EXCEPTION_PROLOG_COMMON(0x700, PACA_EXGEN)
1188 bl .save_nvgprs
1188 bl save_nvgprs
1189 DISABLE_INTS
1190 addi r3,r1,STACK_FRAME_OVERHEAD
1189 DISABLE_INTS
1190 addi r3,r1,STACK_FRAME_OVERHEAD
1191 bl .program_check_exception
1192 b .ret_from_except
1191 bl program_check_exception
1192 b ret_from_except
1193
1194 .align 7
1195 .globl fp_unavailable_common
1196fp_unavailable_common:
1197 EXCEPTION_PROLOG_COMMON(0x800, PACA_EXGEN)
1198 bne 1f /* if from user, just load it up */
1193
1194 .align 7
1195 .globl fp_unavailable_common
1196fp_unavailable_common:
1197 EXCEPTION_PROLOG_COMMON(0x800, PACA_EXGEN)
1198 bne 1f /* if from user, just load it up */
1199 bl .save_nvgprs
1199 bl save_nvgprs
1200 DISABLE_INTS
1201 addi r3,r1,STACK_FRAME_OVERHEAD
1200 DISABLE_INTS
1201 addi r3,r1,STACK_FRAME_OVERHEAD
1202 bl .kernel_fp_unavailable_exception
1202 bl kernel_fp_unavailable_exception
1203 BUG_OPCODE
12041:
1205#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1206BEGIN_FTR_SECTION
1207 /* Test if 2 TM state bits are zero. If non-zero (ie. userspace was in
1208 * transaction), go do TM stuff
1209 */
1210 rldicl. r0, r12, (64-MSR_TS_LG), (64-2)
1211 bne- 2f
1212END_FTR_SECTION_IFSET(CPU_FTR_TM)
1213#endif
1203 BUG_OPCODE
12041:
1205#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1206BEGIN_FTR_SECTION
1207 /* Test if 2 TM state bits are zero. If non-zero (ie. userspace was in
1208 * transaction), go do TM stuff
1209 */
1210 rldicl. r0, r12, (64-MSR_TS_LG), (64-2)
1211 bne- 2f
1212END_FTR_SECTION_IFSET(CPU_FTR_TM)
1213#endif
1214 bl .load_up_fpu
1214 bl load_up_fpu
1215 b fast_exception_return
1216#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
12172: /* User process was in a transaction */
1215 b fast_exception_return
1216#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
12172: /* User process was in a transaction */
1218 bl .save_nvgprs
1218 bl save_nvgprs
1219 DISABLE_INTS
1220 addi r3,r1,STACK_FRAME_OVERHEAD
1219 DISABLE_INTS
1220 addi r3,r1,STACK_FRAME_OVERHEAD
1221 bl .fp_unavailable_tm
1222 b .ret_from_except
1221 bl fp_unavailable_tm
1222 b ret_from_except
1223#endif
1224 .align 7
1225 .globl altivec_unavailable_common
1226altivec_unavailable_common:
1227 EXCEPTION_PROLOG_COMMON(0xf20, PACA_EXGEN)
1228#ifdef CONFIG_ALTIVEC
1229BEGIN_FTR_SECTION
1230 beq 1f
1231#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1232 BEGIN_FTR_SECTION_NESTED(69)
1233 /* Test if 2 TM state bits are zero. If non-zero (ie. userspace was in
1234 * transaction), go do TM stuff
1235 */
1236 rldicl. r0, r12, (64-MSR_TS_LG), (64-2)
1237 bne- 2f
1238 END_FTR_SECTION_NESTED(CPU_FTR_TM, CPU_FTR_TM, 69)
1239#endif
1223#endif
1224 .align 7
1225 .globl altivec_unavailable_common
1226altivec_unavailable_common:
1227 EXCEPTION_PROLOG_COMMON(0xf20, PACA_EXGEN)
1228#ifdef CONFIG_ALTIVEC
1229BEGIN_FTR_SECTION
1230 beq 1f
1231#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1232 BEGIN_FTR_SECTION_NESTED(69)
1233 /* Test if 2 TM state bits are zero. If non-zero (ie. userspace was in
1234 * transaction), go do TM stuff
1235 */
1236 rldicl. r0, r12, (64-MSR_TS_LG), (64-2)
1237 bne- 2f
1238 END_FTR_SECTION_NESTED(CPU_FTR_TM, CPU_FTR_TM, 69)
1239#endif
1240 bl .load_up_altivec
1240 bl load_up_altivec
1241 b fast_exception_return
1242#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
12432: /* User process was in a transaction */
1241 b fast_exception_return
1242#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
12432: /* User process was in a transaction */
1244 bl .save_nvgprs
1244 bl save_nvgprs
1245 DISABLE_INTS
1246 addi r3,r1,STACK_FRAME_OVERHEAD
1245 DISABLE_INTS
1246 addi r3,r1,STACK_FRAME_OVERHEAD
1247 bl .altivec_unavailable_tm
1248 b .ret_from_except
1247 bl altivec_unavailable_tm
1248 b ret_from_except
1249#endif
12501:
1251END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
1252#endif
1249#endif
12501:
1251END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
1252#endif
1253 bl .save_nvgprs
1253 bl save_nvgprs
1254 DISABLE_INTS
1255 addi r3,r1,STACK_FRAME_OVERHEAD
1254 DISABLE_INTS
1255 addi r3,r1,STACK_FRAME_OVERHEAD
1256 bl .altivec_unavailable_exception
1257 b .ret_from_except
1256 bl altivec_unavailable_exception
1257 b ret_from_except
1258
1259 .align 7
1260 .globl vsx_unavailable_common
1261vsx_unavailable_common:
1262 EXCEPTION_PROLOG_COMMON(0xf40, PACA_EXGEN)
1263#ifdef CONFIG_VSX
1264BEGIN_FTR_SECTION
1265 beq 1f
1266#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1267 BEGIN_FTR_SECTION_NESTED(69)
1268 /* Test if 2 TM state bits are zero. If non-zero (ie. userspace was in
1269 * transaction), go do TM stuff
1270 */
1271 rldicl. r0, r12, (64-MSR_TS_LG), (64-2)
1272 bne- 2f
1273 END_FTR_SECTION_NESTED(CPU_FTR_TM, CPU_FTR_TM, 69)
1274#endif
1258
1259 .align 7
1260 .globl vsx_unavailable_common
1261vsx_unavailable_common:
1262 EXCEPTION_PROLOG_COMMON(0xf40, PACA_EXGEN)
1263#ifdef CONFIG_VSX
1264BEGIN_FTR_SECTION
1265 beq 1f
1266#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1267 BEGIN_FTR_SECTION_NESTED(69)
1268 /* Test if 2 TM state bits are zero. If non-zero (ie. userspace was in
1269 * transaction), go do TM stuff
1270 */
1271 rldicl. r0, r12, (64-MSR_TS_LG), (64-2)
1272 bne- 2f
1273 END_FTR_SECTION_NESTED(CPU_FTR_TM, CPU_FTR_TM, 69)
1274#endif
1275 b .load_up_vsx
1275 b load_up_vsx
1276#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
12772: /* User process was in a transaction */
1276#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
12772: /* User process was in a transaction */
1278 bl .save_nvgprs
1278 bl save_nvgprs
1279 DISABLE_INTS
1280 addi r3,r1,STACK_FRAME_OVERHEAD
1279 DISABLE_INTS
1280 addi r3,r1,STACK_FRAME_OVERHEAD
1281 bl .vsx_unavailable_tm
1282 b .ret_from_except
1281 bl vsx_unavailable_tm
1282 b ret_from_except
1283#endif
12841:
1285END_FTR_SECTION_IFSET(CPU_FTR_VSX)
1286#endif
1283#endif
12841:
1285END_FTR_SECTION_IFSET(CPU_FTR_VSX)
1286#endif
1287 bl .save_nvgprs
1287 bl save_nvgprs
1288 DISABLE_INTS
1289 addi r3,r1,STACK_FRAME_OVERHEAD
1288 DISABLE_INTS
1289 addi r3,r1,STACK_FRAME_OVERHEAD
1290 bl .vsx_unavailable_exception
1291 b .ret_from_except
1290 bl vsx_unavailable_exception
1291 b ret_from_except
1292
1293 STD_EXCEPTION_COMMON(0xf60, facility_unavailable, .facility_unavailable_exception)
1294 STD_EXCEPTION_COMMON(0xf80, hv_facility_unavailable, .facility_unavailable_exception)
1295
1296 .align 7
1297 .globl __end_handlers
1298__end_handlers:
1299

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

1381 * Handle machine check early in real mode. We come here with
1382 * ME=1, MMU (IR=0 and DR=0) off and using MC emergency stack.
1383 */
1384 .align 7
1385 .globl machine_check_handle_early
1386machine_check_handle_early:
1387 std r0,GPR0(r1) /* Save r0 */
1388 EXCEPTION_PROLOG_COMMON_3(0x200)
1292
1293 STD_EXCEPTION_COMMON(0xf60, facility_unavailable, .facility_unavailable_exception)
1294 STD_EXCEPTION_COMMON(0xf80, hv_facility_unavailable, .facility_unavailable_exception)
1295
1296 .align 7
1297 .globl __end_handlers
1298__end_handlers:
1299

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

1381 * Handle machine check early in real mode. We come here with
1382 * ME=1, MMU (IR=0 and DR=0) off and using MC emergency stack.
1383 */
1384 .align 7
1385 .globl machine_check_handle_early
1386machine_check_handle_early:
1387 std r0,GPR0(r1) /* Save r0 */
1388 EXCEPTION_PROLOG_COMMON_3(0x200)
1389 bl .save_nvgprs
1389 bl save_nvgprs
1390 addi r3,r1,STACK_FRAME_OVERHEAD
1390 addi r3,r1,STACK_FRAME_OVERHEAD
1391 bl .machine_check_early
1391 bl machine_check_early
1392 ld r12,_MSR(r1)
1393#ifdef CONFIG_PPC_P7_NAP
1394 /*
1395 * Check if thread was in power saving mode. We come here when any
1396 * of the following is true:
1397 * a. thread wasn't in power saving mode
1398 * b. thread was in power saving mode with no state loss or
1399 * supervisor state loss
1400 *
1401 * Go back to nap again if (b) is true.
1402 */
1403 rlwinm. r11,r12,47-31,30,31 /* Was it in power saving mode? */
1404 beq 4f /* No, it wasn;t */
1405 /* Thread was in power saving mode. Go back to nap again. */
1406 cmpwi r11,2
1407 bne 3f
1408 /* Supervisor state loss */
1409 li r0,1
1410 stb r0,PACA_NAPSTATELOST(r13)
1392 ld r12,_MSR(r1)
1393#ifdef CONFIG_PPC_P7_NAP
1394 /*
1395 * Check if thread was in power saving mode. We come here when any
1396 * of the following is true:
1397 * a. thread wasn't in power saving mode
1398 * b. thread was in power saving mode with no state loss or
1399 * supervisor state loss
1400 *
1401 * Go back to nap again if (b) is true.
1402 */
1403 rlwinm. r11,r12,47-31,30,31 /* Was it in power saving mode? */
1404 beq 4f /* No, it wasn;t */
1405 /* Thread was in power saving mode. Go back to nap again. */
1406 cmpwi r11,2
1407 bne 3f
1408 /* Supervisor state loss */
1409 li r0,1
1410 stb r0,PACA_NAPSTATELOST(r13)
14113: bl .machine_check_queue_event
14113: bl machine_check_queue_event
1412 MACHINE_CHECK_HANDLER_WINDUP
1413 GET_PACA(r13)
1414 ld r1,PACAR1(r13)
1412 MACHINE_CHECK_HANDLER_WINDUP
1413 GET_PACA(r13)
1414 ld r1,PACAR1(r13)
1415 b .power7_enter_nap_mode
1415 b power7_enter_nap_mode
14164:
1417#endif
1418 /*
1419 * Check if we are coming from hypervisor userspace. If yes then we
1420 * continue in host kernel in V mode to deliver the MC event.
1421 */
1422 rldicl. r11,r12,4,63 /* See if MC hit while in HV mode. */
1423 beq 5f

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

1439 * At this point we are not sure about what context we come from.
1440 * Queue up the MCE event and return from the interrupt.
1441 * But before that, check if this is an un-recoverable exception.
1442 * If yes, then stay on emergency stack and panic.
1443 */
1444 andi. r11,r12,MSR_RI
1445 bne 2f
14461: addi r3,r1,STACK_FRAME_OVERHEAD
14164:
1417#endif
1418 /*
1419 * Check if we are coming from hypervisor userspace. If yes then we
1420 * continue in host kernel in V mode to deliver the MC event.
1421 */
1422 rldicl. r11,r12,4,63 /* See if MC hit while in HV mode. */
1423 beq 5f

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

1439 * At this point we are not sure about what context we come from.
1440 * Queue up the MCE event and return from the interrupt.
1441 * But before that, check if this is an un-recoverable exception.
1442 * If yes, then stay on emergency stack and panic.
1443 */
1444 andi. r11,r12,MSR_RI
1445 bne 2f
14461: addi r3,r1,STACK_FRAME_OVERHEAD
1447 bl .unrecoverable_exception
1447 bl unrecoverable_exception
1448 b 1b
14492:
1450 /*
1451 * Return from MC interrupt.
1452 * Queue up the MCE event so that we can log it later, while
1453 * returning from kernel or opal call.
1454 */
1448 b 1b
14492:
1450 /*
1451 * Return from MC interrupt.
1452 * Queue up the MCE event so that we can log it later, while
1453 * returning from kernel or opal call.
1454 */
1455 bl .machine_check_queue_event
1455 bl machine_check_queue_event
1456 MACHINE_CHECK_HANDLER_WINDUP
1457 rfid
14589:
1459 /* Deliver the machine check to host kernel in V mode. */
1460 MACHINE_CHECK_HANDLER_WINDUP
1461 b machine_check_pSeries
1462
1463/*

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

1472 mflr r10
1473#ifdef CONFIG_RELOCATABLE
1474 mtctr r11
1475#endif
1476
1477 stw r9,PACA_EXSLB+EX_CCR(r13) /* save CR in exc. frame */
1478 std r10,PACA_EXSLB+EX_LR(r13) /* save LR */
1479
1456 MACHINE_CHECK_HANDLER_WINDUP
1457 rfid
14589:
1459 /* Deliver the machine check to host kernel in V mode. */
1460 MACHINE_CHECK_HANDLER_WINDUP
1461 b machine_check_pSeries
1462
1463/*

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

1472 mflr r10
1473#ifdef CONFIG_RELOCATABLE
1474 mtctr r11
1475#endif
1476
1477 stw r9,PACA_EXSLB+EX_CCR(r13) /* save CR in exc. frame */
1478 std r10,PACA_EXSLB+EX_LR(r13) /* save LR */
1479
1480 bl .slb_allocate_realmode
1480 bl slb_allocate_realmode
1481
1482 /* All done -- return from exception. */
1483
1484 ld r10,PACA_EXSLB+EX_LR(r13)
1485 ld r3,PACA_EXSLB+EX_R3(r13)
1486 lwz r9,PACA_EXSLB+EX_CCR(r13) /* get saved CR */
1487
1488 mtlr r10

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

1512 ld r10,PACAKMSR(r13)
1513 mtspr SPRN_SRR1,r10
1514 rfid
1515 b .
1516
1517unrecov_slb:
1518 EXCEPTION_PROLOG_COMMON(0x4100, PACA_EXSLB)
1519 DISABLE_INTS
1481
1482 /* All done -- return from exception. */
1483
1484 ld r10,PACA_EXSLB+EX_LR(r13)
1485 ld r3,PACA_EXSLB+EX_R3(r13)
1486 lwz r9,PACA_EXSLB+EX_CCR(r13) /* get saved CR */
1487
1488 mtlr r10

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

1512 ld r10,PACAKMSR(r13)
1513 mtspr SPRN_SRR1,r10
1514 rfid
1515 b .
1516
1517unrecov_slb:
1518 EXCEPTION_PROLOG_COMMON(0x4100, PACA_EXSLB)
1519 DISABLE_INTS
1520 bl .save_nvgprs
1520 bl save_nvgprs
15211: addi r3,r1,STACK_FRAME_OVERHEAD
15211: addi r3,r1,STACK_FRAME_OVERHEAD
1522 bl .unrecoverable_exception
1522 bl unrecoverable_exception
1523 b 1b
1524
1525
1526#ifdef CONFIG_PPC_970_NAP
1527power4_fixup_nap:
1528 andc r9,r9,r10
1529 std r9,TI_LOCAL_FLAGS(r11)
1530 ld r10,_LINK(r1) /* make idle task do the */

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

1568
1569 /*
1570 * r3 contains the faulting address
1571 * r4 contains the required access permissions
1572 * r5 contains the trap number
1573 *
1574 * at return r3 = 0 for success, 1 for page fault, negative for error
1575 */
1523 b 1b
1524
1525
1526#ifdef CONFIG_PPC_970_NAP
1527power4_fixup_nap:
1528 andc r9,r9,r10
1529 std r9,TI_LOCAL_FLAGS(r11)
1530 ld r10,_LINK(r1) /* make idle task do the */

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

1568
1569 /*
1570 * r3 contains the faulting address
1571 * r4 contains the required access permissions
1572 * r5 contains the trap number
1573 *
1574 * at return r3 = 0 for success, 1 for page fault, negative for error
1575 */
1576 bl .hash_page /* build HPTE if possible */
1576 bl hash_page /* build HPTE if possible */
1577 cmpdi r3,0 /* see if hash_page succeeded */
1578
1579 /* Success */
1580 beq fast_exc_return_irq /* Return from exception on success */
1581
1582 /* Error */
1583 blt- 13f
1584
1585/* Here we have a page fault that hash_page can't handle. */
1586handle_page_fault:
158711: ld r4,_DAR(r1)
1588 ld r5,_DSISR(r1)
1589 addi r3,r1,STACK_FRAME_OVERHEAD
1577 cmpdi r3,0 /* see if hash_page succeeded */
1578
1579 /* Success */
1580 beq fast_exc_return_irq /* Return from exception on success */
1581
1582 /* Error */
1583 blt- 13f
1584
1585/* Here we have a page fault that hash_page can't handle. */
1586handle_page_fault:
158711: ld r4,_DAR(r1)
1588 ld r5,_DSISR(r1)
1589 addi r3,r1,STACK_FRAME_OVERHEAD
1590 bl .do_page_fault
1590 bl do_page_fault
1591 cmpdi r3,0
1592 beq+ 12f
1591 cmpdi r3,0
1592 beq+ 12f
1593 bl .save_nvgprs
1593 bl save_nvgprs
1594 mr r5,r3
1595 addi r3,r1,STACK_FRAME_OVERHEAD
1596 lwz r4,_DAR(r1)
1594 mr r5,r3
1595 addi r3,r1,STACK_FRAME_OVERHEAD
1596 lwz r4,_DAR(r1)
1597 bl .bad_page_fault
1598 b .ret_from_except
1597 bl bad_page_fault
1598 b ret_from_except
1599
1600/* We have a data breakpoint exception - handle it */
1601handle_dabr_fault:
1599
1600/* We have a data breakpoint exception - handle it */
1601handle_dabr_fault:
1602 bl .save_nvgprs
1602 bl save_nvgprs
1603 ld r4,_DAR(r1)
1604 ld r5,_DSISR(r1)
1605 addi r3,r1,STACK_FRAME_OVERHEAD
1603 ld r4,_DAR(r1)
1604 ld r5,_DSISR(r1)
1605 addi r3,r1,STACK_FRAME_OVERHEAD
1606 bl .do_break
160712: b .ret_from_except_lite
1606 bl do_break
160712: b ret_from_except_lite
1608
1609
1610/* We have a page fault that hash_page could handle but HV refused
1611 * the PTE insertion
1612 */
1608
1609
1610/* We have a page fault that hash_page could handle but HV refused
1611 * the PTE insertion
1612 */
161313: bl .save_nvgprs
161313: bl save_nvgprs
1614 mr r5,r3
1615 addi r3,r1,STACK_FRAME_OVERHEAD
1616 ld r4,_DAR(r1)
1614 mr r5,r3
1615 addi r3,r1,STACK_FRAME_OVERHEAD
1616 ld r4,_DAR(r1)
1617 bl .low_hash_fault
1618 b .ret_from_except
1617 bl low_hash_fault
1618 b ret_from_except
1619
1620/*
1621 * We come here as a result of a DSI at a point where we don't want
1622 * to call hash_page, such as when we are accessing memory (possibly
1623 * user memory) inside a PMU interrupt that occurred while interrupts
1624 * were soft-disabled. We want to invoke the exception handler for
1625 * the access, or panic if there isn't a handler.
1626 */
1619
1620/*
1621 * We come here as a result of a DSI at a point where we don't want
1622 * to call hash_page, such as when we are accessing memory (possibly
1623 * user memory) inside a PMU interrupt that occurred while interrupts
1624 * were soft-disabled. We want to invoke the exception handler for
1625 * the access, or panic if there isn't a handler.
1626 */
162777: bl .save_nvgprs
162777: bl save_nvgprs
1628 mr r4,r3
1629 addi r3,r1,STACK_FRAME_OVERHEAD
1630 li r5,SIGSEGV
1628 mr r4,r3
1629 addi r3,r1,STACK_FRAME_OVERHEAD
1630 li r5,SIGSEGV
1631 bl .bad_page_fault
1632 b .ret_from_except
1631 bl bad_page_fault
1632 b ret_from_except
1633
1634 /* here we have a segment miss */
1635do_ste_alloc:
1633
1634 /* here we have a segment miss */
1635do_ste_alloc:
1636 bl .ste_allocate /* try to insert stab entry */
1636 bl ste_allocate /* try to insert stab entry */
1637 cmpdi r3,0
1638 bne- handle_page_fault
1639 b fast_exception_return
1640
1641/*
1642 * r13 points to the PACA, r9 contains the saved CR,
1643 * r11 and r12 contain the saved SRR0 and SRR1.
1644 * r9 - r13 are saved in paca->exslb.

--- 99 unchanged lines hidden ---
1637 cmpdi r3,0
1638 bne- handle_page_fault
1639 b fast_exception_return
1640
1641/*
1642 * r13 points to the PACA, r9 contains the saved CR,
1643 * r11 and r12 contain the saved SRR0 and SRR1.
1644 * r9 - r13 are saved in paca->exslb.

--- 99 unchanged lines hidden ---