entry.S (812489ac4dd91144a74ce65ecf232252a2e406fb) entry.S (63d7f9f11e5e81de2ce8f1c7a8aaed5b0288eddf)
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * OpenRISC entry.S
4 *
5 * Linux architectural port borrowing liberally from similar works of
6 * others. All original copyrights apply as per the original source
7 * declaration.
8 *

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

101 */
102
103#define RESTORE_ALL \
104 DISABLE_INTERRUPTS(r3,r4) ;\
105 l.lwz r3,PT_PC(r1) ;\
106 l.mtspr r0,r3,SPR_EPCR_BASE ;\
107 l.lwz r3,PT_SR(r1) ;\
108 l.mtspr r0,r3,SPR_ESR_BASE ;\
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * OpenRISC entry.S
4 *
5 * Linux architectural port borrowing liberally from similar works of
6 * others. All original copyrights apply as per the original source
7 * declaration.
8 *

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

101 */
102
103#define RESTORE_ALL \
104 DISABLE_INTERRUPTS(r3,r4) ;\
105 l.lwz r3,PT_PC(r1) ;\
106 l.mtspr r0,r3,SPR_EPCR_BASE ;\
107 l.lwz r3,PT_SR(r1) ;\
108 l.mtspr r0,r3,SPR_ESR_BASE ;\
109 l.lwz r3,PT_FPCSR(r1) ;\
110 l.mtspr r0,r3,SPR_FPCSR ;\
109 l.lwz r2,PT_GPR2(r1) ;\
110 l.lwz r3,PT_GPR3(r1) ;\
111 l.lwz r4,PT_GPR4(r1) ;\
112 l.lwz r5,PT_GPR5(r1) ;\
113 l.lwz r6,PT_GPR6(r1) ;\
114 l.lwz r7,PT_GPR7(r1) ;\
115 l.lwz r8,PT_GPR8(r1) ;\
116 l.lwz r9,PT_GPR9(r1) ;\

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

170 l.sw PT_GPR25(r1),r25 ;\
171 l.sw PT_GPR26(r1),r26 ;\
172 l.sw PT_GPR27(r1),r27 ;\
173 l.sw PT_GPR28(r1),r28 ;\
174 l.sw PT_GPR29(r1),r29 ;\
175 /* r30 already save */ ;\
176 l.sw PT_GPR31(r1),r31 ;\
177 TRACE_IRQS_OFF_ENTRY ;\
111 l.lwz r2,PT_GPR2(r1) ;\
112 l.lwz r3,PT_GPR3(r1) ;\
113 l.lwz r4,PT_GPR4(r1) ;\
114 l.lwz r5,PT_GPR5(r1) ;\
115 l.lwz r6,PT_GPR6(r1) ;\
116 l.lwz r7,PT_GPR7(r1) ;\
117 l.lwz r8,PT_GPR8(r1) ;\
118 l.lwz r9,PT_GPR9(r1) ;\

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

172 l.sw PT_GPR25(r1),r25 ;\
173 l.sw PT_GPR26(r1),r26 ;\
174 l.sw PT_GPR27(r1),r27 ;\
175 l.sw PT_GPR28(r1),r28 ;\
176 l.sw PT_GPR29(r1),r29 ;\
177 /* r30 already save */ ;\
178 l.sw PT_GPR31(r1),r31 ;\
179 TRACE_IRQS_OFF_ENTRY ;\
180 l.mfspr r30,r0,SPR_FPCSR ;\
181 l.sw PT_FPCSR(r1),r30 ;\
178 /* Store -1 in orig_gpr11 for non-syscall exceptions */ ;\
179 l.addi r30,r0,-1 ;\
180 l.sw PT_ORIG_GPR11(r1),r30
181
182#define UNHANDLED_EXCEPTION(handler,vector) \
183 .global handler ;\
184handler: ;\
185 /* r1, EPCR, ESR already saved */ ;\

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

210 l.sw PT_GPR27(r1),r27 ;\
211 l.sw PT_GPR28(r1),r28 ;\
212 l.sw PT_GPR29(r1),r29 ;\
213 /* r30 already saved */ ;\
214 l.sw PT_GPR31(r1),r31 ;\
215 /* Store -1 in orig_gpr11 for non-syscall exceptions */ ;\
216 l.addi r30,r0,-1 ;\
217 l.sw PT_ORIG_GPR11(r1),r30 ;\
182 /* Store -1 in orig_gpr11 for non-syscall exceptions */ ;\
183 l.addi r30,r0,-1 ;\
184 l.sw PT_ORIG_GPR11(r1),r30
185
186#define UNHANDLED_EXCEPTION(handler,vector) \
187 .global handler ;\
188handler: ;\
189 /* r1, EPCR, ESR already saved */ ;\

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

214 l.sw PT_GPR27(r1),r27 ;\
215 l.sw PT_GPR28(r1),r28 ;\
216 l.sw PT_GPR29(r1),r29 ;\
217 /* r30 already saved */ ;\
218 l.sw PT_GPR31(r1),r31 ;\
219 /* Store -1 in orig_gpr11 for non-syscall exceptions */ ;\
220 l.addi r30,r0,-1 ;\
221 l.sw PT_ORIG_GPR11(r1),r30 ;\
222 l.mfspr r30,r0,SPR_FPCSR ;\
223 l.sw PT_FPCSR(r1),r30 ;\
218 l.addi r3,r1,0 ;\
219 /* r4 is exception EA */ ;\
220 l.addi r5,r0,vector ;\
221 l.jal unhandled_exception ;\
222 l.nop ;\
223 l.j _ret_from_exception ;\
224 l.nop
225

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

1082 l.sw PT_GPR18(r1),r18
1083 l.sw PT_GPR20(r1),r20
1084 l.sw PT_GPR22(r1),r22
1085 l.sw PT_GPR24(r1),r24
1086 l.sw PT_GPR26(r1),r26
1087 l.sw PT_GPR28(r1),r28
1088 l.sw PT_GPR30(r1),r30
1089
224 l.addi r3,r1,0 ;\
225 /* r4 is exception EA */ ;\
226 l.addi r5,r0,vector ;\
227 l.jal unhandled_exception ;\
228 l.nop ;\
229 l.j _ret_from_exception ;\
230 l.nop
231

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

1088 l.sw PT_GPR18(r1),r18
1089 l.sw PT_GPR20(r1),r20
1090 l.sw PT_GPR22(r1),r22
1091 l.sw PT_GPR24(r1),r24
1092 l.sw PT_GPR26(r1),r26
1093 l.sw PT_GPR28(r1),r28
1094 l.sw PT_GPR30(r1),r30
1095
1096 /* Store the old FPU state to new pt_regs */
1097 l.mfspr r29,r0,SPR_FPCSR
1098 l.sw PT_FPCSR(r1),r29
1099
1090 l.addi r11,r10,0 /* Save old 'current' to 'last' return value*/
1091
1092 /* We use thread_info->ksp for storing the address of the above
1093 * structure so that we can get back to it later... we don't want
1094 * to lose the value of thread_info->ksp, though, so store it as
1095 * pt_regs->sp so that we can easily restore it when we are made
1096 * live again...
1097 */

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

1104 l.sw TI_KSP(r10),r1 /* Save old stack pointer */
1105 l.or r10,r4,r0 /* Set up new current_thread_info */
1106 l.lwz r1,TI_KSP(r10) /* Load new stack pointer */
1107
1108 /* Restore the old value of thread_info->ksp */
1109 l.lwz r29,PT_SP(r1)
1110 l.sw TI_KSP(r10),r29
1111
1100 l.addi r11,r10,0 /* Save old 'current' to 'last' return value*/
1101
1102 /* We use thread_info->ksp for storing the address of the above
1103 * structure so that we can get back to it later... we don't want
1104 * to lose the value of thread_info->ksp, though, so store it as
1105 * pt_regs->sp so that we can easily restore it when we are made
1106 * live again...
1107 */

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

1114 l.sw TI_KSP(r10),r1 /* Save old stack pointer */
1115 l.or r10,r4,r0 /* Set up new current_thread_info */
1116 l.lwz r1,TI_KSP(r10) /* Load new stack pointer */
1117
1118 /* Restore the old value of thread_info->ksp */
1119 l.lwz r29,PT_SP(r1)
1120 l.sw TI_KSP(r10),r29
1121
1122 /* Restore the old value of FPCSR */
1123 l.lwz r29,PT_FPCSR(r1)
1124 l.mtspr r0,r29,SPR_FPCSR
1125
1112 /* ...and restore the registers, except r11 because the return value
1113 * has already been set above.
1114 */
1115 l.lwz r2,PT_GPR2(r1)
1116 l.lwz r9,PT_GPR9(r1)
1117 /* No need to restore r10 */
1118 /* ...and do not restore r11 */
1119

--- 104 unchanged lines hidden ---
1126 /* ...and restore the registers, except r11 because the return value
1127 * has already been set above.
1128 */
1129 l.lwz r2,PT_GPR2(r1)
1130 l.lwz r9,PT_GPR9(r1)
1131 /* No need to restore r10 */
1132 /* ...and do not restore r11 */
1133

--- 104 unchanged lines hidden ---