Lines Matching +full:sw +full:- +full:exception
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
12 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
25 #include <asm/asm-offsets.h>
46 l.sw -8(r1),r2 /* store frame pointer */ ;\
47 l.sw -4(r1),r9 /* store return address */ ;\
50 l.addi r1,r1,-8 ;\
52 l.lwz r9,-4(r1) /* restore return address */ ;\
53 l.lwz r2,-8(r1) /* restore fp */ ;\
59 l.sw -12(r1),t1 /* save extra reg */ ;\
60 l.sw -8(r1),r2 /* store frame pointer */ ;\
61 l.sw -4(r1),r9 /* store return address */ ;\
64 l.addi r1,r1,-12 ;\
66 l.lwz r9,-4(r1) /* restore return address */ ;\
67 l.lwz r2,-8(r1) /* restore fp */ ;\
68 l.lwz t1,-12(r1) /* restore extra reg */
147 l.sw PT_GPR2(r1),r2 ;\
148 l.sw PT_GPR3(r1),r3 ;\
150 l.sw PT_GPR5(r1),r5 ;\
151 l.sw PT_GPR6(r1),r6 ;\
152 l.sw PT_GPR7(r1),r7 ;\
153 l.sw PT_GPR8(r1),r8 ;\
154 l.sw PT_GPR9(r1),r9 ;\
156 l.sw PT_GPR11(r1),r11 ;\
158 l.sw PT_GPR13(r1),r13 ;\
159 l.sw PT_GPR14(r1),r14 ;\
160 l.sw PT_GPR15(r1),r15 ;\
161 l.sw PT_GPR16(r1),r16 ;\
162 l.sw PT_GPR17(r1),r17 ;\
163 l.sw PT_GPR18(r1),r18 ;\
164 l.sw PT_GPR19(r1),r19 ;\
165 l.sw PT_GPR20(r1),r20 ;\
166 l.sw PT_GPR21(r1),r21 ;\
167 l.sw PT_GPR22(r1),r22 ;\
168 l.sw PT_GPR23(r1),r23 ;\
169 l.sw PT_GPR24(r1),r24 ;\
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 ;\
176 l.sw PT_GPR31(r1),r31 ;\
178 /* Store -1 in orig_gpr11 for non-syscall exceptions */ ;\
179 l.addi r30,r0,-1 ;\
180 l.sw PT_ORIG_GPR11(r1),r30
186 l.sw PT_GPR2(r1),r2 ;\
187 l.sw PT_GPR3(r1),r3 ;\
188 l.sw PT_GPR5(r1),r5 ;\
189 l.sw PT_GPR6(r1),r6 ;\
190 l.sw PT_GPR7(r1),r7 ;\
191 l.sw PT_GPR8(r1),r8 ;\
192 l.sw PT_GPR9(r1),r9 ;\
194 l.sw PT_GPR11(r1),r11 ;\
196 l.sw PT_GPR13(r1),r13 ;\
197 l.sw PT_GPR14(r1),r14 ;\
198 l.sw PT_GPR15(r1),r15 ;\
199 l.sw PT_GPR16(r1),r16 ;\
200 l.sw PT_GPR17(r1),r17 ;\
201 l.sw PT_GPR18(r1),r18 ;\
202 l.sw PT_GPR19(r1),r19 ;\
203 l.sw PT_GPR20(r1),r20 ;\
204 l.sw PT_GPR21(r1),r21 ;\
205 l.sw PT_GPR22(r1),r22 ;\
206 l.sw PT_GPR23(r1),r23 ;\
207 l.sw PT_GPR24(r1),r24 ;\
208 l.sw PT_GPR25(r1),r25 ;\
209 l.sw PT_GPR26(r1),r26 ;\
210 l.sw PT_GPR27(r1),r27 ;\
211 l.sw PT_GPR28(r1),r28 ;\
212 l.sw PT_GPR29(r1),r29 ;\
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 ;\
219 /* r4 is exception EA */ ;\
230 l.sw 0(reg),r0
233 * contain the same values as when exception we're handling
244 /* ---[ 0x100: RESET exception ]----------------------------------------- */
250 /* ---[ 0x200: BUS exception ]------------------------------------------- */
261 /* ---[ 0x300: Data Page Fault exception ]------------------------------- */
271 l.ori r5,r0,0x300 // exception vector
308 l.andi r6,r6,SPR_SR_DSX // check for delay slot exception
309 l.sfne r6,r0 // exception happened in delay slot
335 /* ---[ 0x400: Insn Page Fault exception ]------------------------------- */
345 l.ori r5,r0,0x400 // exception vector
358 /* ---[ 0x500: Timer exception ]----------------------------------------- */
368 /* ---[ 0x600: Alignment exception ]-------------------------------------- */
430 l.sw PT_PC(r1),r5
443 l.bf sw
457 l.sw 0(r4),r5
467 l.sw 0(r4),r5
483 l.sw 0(r4),r5
499 l.sw 0(r4),r5
511 sw:
530 /* ---[ 0x700: Illegal insn exception ]---------------------------------- */
540 /* ---[ 0x800: External interrupt exception ]---------------------------- */
551 l.addi r1,r1,-0x8
554 l.sw 0x0(r1),r3
556 l.sw 0x4(r1),r4
567 // l.sw PT_SR(r1),r4
579 /* ---[ 0x900: DTLB miss exception ]------------------------------------- */
582 /* ---[ 0xa00: ITLB miss exception ]------------------------------------- */
585 /* ---[ 0xb00: Range exception ]----------------------------------------- */
589 /* ---[ 0xc00: Syscall exception ]--------------------------------------- */
592 * Syscalls are a special type of exception in that they are
599 /* Upon syscall entry we just save the callee-saved registers
600 * and not the call-clobbered ones.
604 .string "syscall r9:0x%08x -> syscall(%ld) return %ld\0"
609 l.sw PT_GPR2(r1),r2
610 /* r3-r8 must be saved because syscall restart relies
614 l.sw PT_GPR3(r1),r3
622 l.sw PT_GPR5(r1),r5
623 l.sw PT_GPR6(r1),r6
624 l.sw PT_GPR7(r1),r7
625 l.sw PT_GPR8(r1),r8
626 l.sw PT_GPR9(r1),r9
628 l.sw PT_GPR11(r1),r11
630 l.sw PT_ORIG_GPR11(r1),r11
633 /* r14-r28 (even) aren't touched by the syscall fast path below
642 /* l.sw PT_GPR30(r1),r30 */
674 * which does it in a round-about way.
676 l.sw PT_GPR11(r1),r11 // save return value
683 l.sw -4(r1),r27
684 l.sw -8(r1),r11
686 l.sw -12(r1),r29
688 l.sw -16(r1),r29
692 l.addi r1,r1,-16
704 /* r30 is a callee-saved register so this should still hold the
706 * _syscall_trace_leave expects syscall result to be in pt_regs->r11.
712 /* This is where the exception-return code begins... interrupts need to be
732 * make sure that all the call-saved registers get into pt_regs
735 l.sw PT_GPR14(r1),r14
736 l.sw PT_GPR16(r1),r16
737 l.sw PT_GPR18(r1),r18
738 l.sw PT_GPR20(r1),r20
739 l.sw PT_GPR22(r1),r22
740 l.sw PT_GPR24(r1),r24
741 l.sw PT_GPR26(r1),r26
742 l.sw PT_GPR28(r1),r28
754 * return to userspace will be done via the normal exception return path...
756 * registers with whatever garbage is in pt_regs -- that's OK because those
763 /* The assumption here is that the registers r14-r28 (even) are untouched and
775 /* r3-r8 are technically clobbered, but syscall restart needs these
792 /* Here we use r13-r19 (odd) as scratch regs */
842 * syscall that returns -ENOSYS and then return to the regular
847 l.addi r11,r0,-ENOSYS
851 /* ---[ 0xd00: Floating Point exception ]-------------------------------- */
863 /* ---[ 0xe00: Trap exception ]------------------------------------------ */
874 /* ---[ 0xf00: Reserved exception ]-------------------------------------- */
878 /* ---[ 0x1000: Reserved exception ]------------------------------------- */
882 /* ---[ 0x1100: Reserved exception ]------------------------------------- */
886 /* ---[ 0x1200: Reserved exception ]------------------------------------- */
890 /* ---[ 0x1300: Reserved exception ]------------------------------------- */
894 /* ---[ 0x1400: Reserved exception ]------------------------------------- */
898 /* ---[ 0x1500: Reserved exception ]------------------------------------- */
902 /* ---[ 0x1600: Reserved exception ]------------------------------------- */
906 /* ---[ 0x1700: Reserved exception ]------------------------------------- */
910 /* ---[ 0x1800: Reserved exception ]------------------------------------- */
914 /* ---[ 0x1900: Reserved exception ]------------------------------------- */
918 /* ---[ 0x1a00: Reserved exception ]------------------------------------- */
922 /* ---[ 0x1b00: Reserved exception ]------------------------------------- */
926 /* ---[ 0x1c00: Reserved exception ]------------------------------------- */
930 /* ---[ 0x1d00: Reserved exception ]------------------------------------- */
934 /* ---[ 0x1e00: Reserved exception ]------------------------------------- */
938 /* ---[ 0x1f00: Reserved exception ]------------------------------------- */
1025 /* The syscall fast path return expects call-saved registers
1026 * r14-r28 to be untouched, so we restore them here as they
1076 * way, we are a function call and only need to preserve the callee-saved
1087 l.addi r1,r1,-(INT_FRAME_SIZE)
1090 l.sw PT_GPR2(r1),r2
1091 l.sw PT_GPR9(r1),r9
1093 /* Save callee-saved registers to the new pt_regs */
1094 l.sw PT_GPR14(r1),r14
1095 l.sw PT_GPR16(r1),r16
1096 l.sw PT_GPR18(r1),r18
1097 l.sw PT_GPR20(r1),r20
1098 l.sw PT_GPR22(r1),r22
1099 l.sw PT_GPR24(r1),r24
1100 l.sw PT_GPR26(r1),r26
1101 l.sw PT_GPR28(r1),r28
1102 l.sw PT_GPR30(r1),r30
1106 /* We use thread_info->ksp for storing the address of the above
1108 * to lose the value of thread_info->ksp, though, so store it as
1109 * pt_regs->sp so that we can easily restore it when we are made
1113 /* Save the old value of thread_info->ksp as pt_regs->sp */
1115 l.sw PT_SP(r1),r29
1118 l.sw TI_KSP(r10),r1 /* Save old stack pointer */
1122 /* Restore the old value of thread_info->ksp */
1124 l.sw TI_KSP(r10),r29
1134 /* Restore callee-saved registers */
1145 /* Unwind stack to pre-switch state */
1148 /* Return via the link-register back to where we 'came from', where
1163 * These are all just wrappers that don't touch the link-register r9, so the
1168 /* fork requires that we save all the callee-saved registers because they
1175 l.sw PT_GPR14(r1),r14
1176 l.sw PT_GPR16(r1),r16
1177 l.sw PT_GPR18(r1),r18
1178 l.sw PT_GPR20(r1),r20
1179 l.sw PT_GPR22(r1),r22
1180 l.sw PT_GPR24(r1),r24
1181 l.sw PT_GPR26(r1),r26
1183 l.sw PT_GPR28(r1),r28
1212 /* This is a catch-all syscall for atomic instructions for the OpenRISC 1000.
1231 l.sw 0(r4),r27
1232 l.sw 0(r5),r29