summaryrefslogtreecommitdiff
path: root/sys/arch
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2020-06-09 18:57:34 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2020-06-09 18:57:34 +0000
commitb572199aacfe7fe314e968cca47aff429c3d3a8b (patch)
tree6b022ab373db8f431d335478504ce96b9d143fd4 /sys/arch
parent32c9c7aacf12e2407b4aa86fd05cc06bde7f9547 (diff)
Make FRAME_LEAVE a bit more complete and do things in the same order as
FreeBSD for now.
Diffstat (limited to 'sys/arch')
-rw-r--r--sys/arch/powerpc64/powerpc64/trap_subr.S112
1 files changed, 67 insertions, 45 deletions
diff --git a/sys/arch/powerpc64/powerpc64/trap_subr.S b/sys/arch/powerpc64/powerpc64/trap_subr.S
index bd5b47bc98e..be1544fa363 100644
--- a/sys/arch/powerpc64/powerpc64/trap_subr.S
+++ b/sys/arch/powerpc64/powerpc64/trap_subr.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: trap_subr.S,v 1.4 2020/06/07 09:27:06 kettenis Exp $ */
+/* $OpenBSD: trap_subr.S,v 1.5 2020/06/09 18:57:33 kettenis Exp $ */
/* $NetBSD: trap_subr.S,v 1.20 2002/04/22 23:20:08 kleink Exp $ */
/*-
@@ -123,60 +123,82 @@
mfxer %r3; \
mfctr %r4; \
mfsprg3 %r5; \
- std %r3,FRAME_XER+48(%r1); /* save xer/ctr/exc */ \
- std %r4,FRAME_CTR+48(%r1); \
- std %r5,FRAME_EXC+48(%r1); \
+ std %r3, FRAME_XER+48(%r1); /* save xer/ctr/exc */ \
+ std %r4, FRAME_CTR+48(%r1); \
+ std %r5, FRAME_EXC+48(%r1); \
std %r28, FRAME_DAR+48(%r1); \
std %r29, FRAME_DSISR+48(%r1); /* save dsisr/srr0/srr1 */ \
std %r30, FRAME_SRR0+48(%r1); \
std %r31, FRAME_SRR1+48(%r1);
#define FRAME_LEAVE(savearea) \
+/* Disable exceptions: */ \
+ mfmsr %r2; \
+ andi. %r2,%r2,~PSL_EE@l; \
+ mtmsr %r2; \
+ isync; \
/* Now restore regs: */ \
- ld %r3, FRAME_LR+48(%r1); \
- ld %r4, FRAME_CR+48(%r1); \
+ ld %r2, FRAME_SRR0+48(%r1); \
+ ld %r3, FRAME_SRR1+48(%r1); \
+ ld %r4, FRAME_CTR+48(%r1); \
ld %r5, FRAME_XER+48(%r1); \
- ld %r6, FRAME_CTR+48(%r1); \
- ld %r7, FRAME_SRR0+48(%r1); \
- ld %r8, FRAME_SRR1+48(%r1); \
- mtlr %r3; \
- mtcr %r4; \
+ ld %r6, FRAME_LR+48(%r1); \
+ GET_CPUINFO(%r7); \
+ std %r2, (savearea+CPUSAVE_SRR0)(%r7); /* save SRR0 */ \
+ std %r3, (savearea+CPUSAVE_SRR1)(%r7); /* save SRR1 */ \
+ ld %r7, FRAME_CR+48(%r1); \
+ mtctr %r4; \
mtxer %r5; \
- mtctr %r6; \
- mtsrr0 %r7; \
- mtsrr1 %r8; \
- ld %r0, FRAME_0+48(%r1); \
- ld %r2, FRAME_2+48(%r1); \
- ld %r3, FRAME_3+48(%r1); \
- ld %r4, FRAME_4+48(%r1); \
- ld %r5, FRAME_5+48(%r1); \
- ld %r6, FRAME_6+48(%r1); \
- ld %r7, FRAME_7+48(%r1); \
- ld %r8, FRAME_8+48(%r1); \
- ld %r9, FRAME_9+48(%r1); \
- ld %r10, FRAME_10+48(%r1); \
- ld %r11, FRAME_11+48(%r1); \
- ld %r12, FRAME_12+48(%r1); \
- ld %r13, FRAME_13+48(%r1); \
- ld %r14, FRAME_14+48(%r1); \
- ld %r15, FRAME_15+48(%r1); \
- ld %r16, FRAME_16+48(%r1); \
- ld %r17, FRAME_17+48(%r1); \
- ld %r18, FRAME_18+48(%r1); \
- ld %r19, FRAME_19+48(%r1); \
- ld %r20, FRAME_20+48(%r1); \
- ld %r21, FRAME_21+48(%r1); \
- ld %r22, FRAME_22+48(%r1); \
- ld %r23, FRAME_23+48(%r1); \
- ld %r24, FRAME_24+48(%r1); \
- ld %r25, FRAME_25+48(%r1); \
- ld %r26, FRAME_26+48(%r1); \
- ld %r27, FRAME_27+48(%r1); \
- ld %r28, FRAME_28+48(%r1); \
- ld %r29, FRAME_29+48(%r1); \
+ mtlr %r6; \
+ mtsprg2 %r7; \
+ ld %r31, FRAME_31+48(%r1); /* restore r0-31 */ \
ld %r30, FRAME_30+48(%r1); \
- ld %r31, FRAME_31+48(%r1); \
- ld %r1, FRAME_1+48(%r1);
+ ld %r29, FRAME_29+48(%r1); \
+ ld %r28, FRAME_28+48(%r1); \
+ ld %r27, FRAME_27+48(%r1); \
+ ld %r26, FRAME_26+48(%r1); \
+ ld %r25, FRAME_25+48(%r1); \
+ ld %r24, FRAME_24+48(%r1); \
+ ld %r23, FRAME_23+48(%r1); \
+ ld %r22, FRAME_22+48(%r1); \
+ ld %r21, FRAME_21+48(%r1); \
+ ld %r20, FRAME_20+48(%r1); \
+ ld %r19, FRAME_19+48(%r1); \
+ ld %r18, FRAME_18+48(%r1); \
+ ld %r17, FRAME_17+48(%r1); \
+ ld %r16, FRAME_16+48(%r1); \
+ ld %r15, FRAME_15+48(%r1); \
+ ld %r14, FRAME_14+48(%r1); \
+ ld %r13, FRAME_13+48(%r1); \
+ ld %r12, FRAME_12+48(%r1); \
+ ld %r11, FRAME_11+48(%r1); \
+ ld %r10, FRAME_10+48(%r1); \
+ ld %r9, FRAME_9+48(%r1); \
+ ld %r8, FRAME_8+48(%r1); \
+ ld %r7, FRAME_7+48(%r1); \
+ ld %r6, FRAME_6+48(%r1); \
+ ld %r5, FRAME_5+48(%r1); \
+ ld %r4, FRAME_4+48(%r1); \
+ ld %r3, FRAME_3+48(%r1); \
+ ld %r2, FRAME_2+48(%r1); \
+ ld %r0, FRAME_0+48(%r1); \
+ ld %r1, FRAME_1+48(%r1); \
+/* Can't touch %r1 from here on */ \
+ mtsprg3 %r3; /* save r3 */ \
+/* Disable translation, machine check and recoverability: */ \
+ mfmsr %r3; \
+ andi. %r3, %r3, ~(PSL_DR|PSL_IR|PSL_ME|PSL_RI)@l; \
+ mtmsr %r3; \
+ isync; \
+1: mfsprg2 %r3; /* restore cr */ \
+ mtcr %r3; \
+ GET_CPUINFO(%r3); \
+ ld %r3, (savearea+CPUSAVE_SRR0)(%r3); /* restore srr0 */ \
+ mtsrr0 %r3; \
+ GET_CPUINFO(%r3); \
+ ld %r3, (savearea+CPUSAVE_SRR1)(%r3); /* restore srr1 */ \
+ mtsrr1 %r3; \
+ mfsprg3 %r3 /* restore r3 */
.text