summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2020-06-27 14:34:09 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2020-06-27 14:34:09 +0000
commit241612c0dc227dbf20a09b02b839bf06c228b9bd (patch)
treecf5b5bdbf6b48690a7a4ccaf71bedd9be493dab8
parent686208e0c954c5003b9af8f7edb0ab2c1bf242f5 (diff)
Let traps save and restore VRSAVE.
-rw-r--r--sys/arch/powerpc64/include/signal.h3
-rw-r--r--sys/arch/powerpc64/powerpc64/genassym.cf3
-rw-r--r--sys/arch/powerpc64/powerpc64/trap_subr.S8
3 files changed, 11 insertions, 3 deletions
diff --git a/sys/arch/powerpc64/include/signal.h b/sys/arch/powerpc64/include/signal.h
index 07c2db1e63c..67d8df4f904 100644
--- a/sys/arch/powerpc64/include/signal.h
+++ b/sys/arch/powerpc64/include/signal.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: signal.h,v 1.2 2020/05/22 15:07:47 kettenis Exp $ */
+/* $OpenBSD: signal.h,v 1.3 2020/06/27 14:34:08 kettenis Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -59,6 +59,7 @@ struct trapframe {
__register_t ctr;
__register_t srr0;
__register_t srr1;
+ __register_t vrsave;
__register_t dar; /* dar & dsisr are only filled on a DSI trap */
__register_t dsisr;
__register_t exc;
diff --git a/sys/arch/powerpc64/powerpc64/genassym.cf b/sys/arch/powerpc64/powerpc64/genassym.cf
index d0fb1102669..ec4a048f0e3 100644
--- a/sys/arch/powerpc64/powerpc64/genassym.cf
+++ b/sys/arch/powerpc64/powerpc64/genassym.cf
@@ -1,4 +1,4 @@
-# $OpenBSD: genassym.cf,v 1.9 2020/06/26 22:32:22 kettenis Exp $
+# $OpenBSD: genassym.cf,v 1.10 2020/06/27 14:34:08 kettenis Exp $
#
# Copyright (c) 1982, 1990 The Regents of the University of California.
# All rights reserved.
@@ -92,6 +92,7 @@ member ctr
member xer
member srr0
member srr1
+member vrsave
member dar
member dsisr
member exc
diff --git a/sys/arch/powerpc64/powerpc64/trap_subr.S b/sys/arch/powerpc64/powerpc64/trap_subr.S
index fa75925b4c9..e7e595c5abc 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.13 2020/06/22 18:49:36 kettenis Exp $ */
+/* $OpenBSD: trap_subr.S,v 1.14 2020/06/27 14:34:08 kettenis Exp $ */
/* $NetBSD: trap_subr.S,v 1.20 2002/04/22 23:20:08 kleink Exp $ */
/*-
@@ -38,6 +38,8 @@
#include <machine/psl.h>
#include <machine/trap.h>
+#define SPR_VRSAVE 256
+
.abiversion 2
#define GET_CPUINFO(r) \
@@ -178,9 +180,11 @@ restore_kernsrs:
mfxer %r3; \
mfctr %r4; \
mfsprg3 %r5; \
+ mfspr %r6, SPR_VRSAVE; \
std %r3, FRAME_XER+32(%r1); /* save xer/ctr/exc */ \
std %r4, FRAME_CTR+32(%r1); \
std %r5, FRAME_EXC+32(%r1); \
+ std %r6, FRAME_VRSAVE+32(%r1); \
std %r28, FRAME_DAR+32(%r1); \
std %r29, FRAME_DSISR+32(%r1); /* save dsisr/srr0/srr1 */ \
std %r30, FRAME_SRR0+32(%r1); \
@@ -202,10 +206,12 @@ restore_kernsrs:
std %r2, (savearea+CPUSAVE_SRR0)(%r7); /* save SRR0 */ \
std %r3, (savearea+CPUSAVE_SRR1)(%r7); /* save SRR1 */ \
ld %r7, FRAME_CR+32(%r1); \
+ ld %r8, FRAME_VRSAVE+32(%r1); \
mtctr %r4; \
mtxer %r5; \
mtlr %r6; \
mtsprg2 %r7; \
+ mtspr SPR_VRSAVE, %r8; \
ld %r31, FRAME_31+32(%r1); /* restore r0-31 */ \
ld %r30, FRAME_30+32(%r1); \
ld %r29, FRAME_29+32(%r1); \