Module Name:    src
Committed By:   mrg
Date:           Sat Jun 15 19:48:13 UTC 2024

Modified Files:
        src/sys/arch/powerpc/oea: altivec.c

Log Message:
don't do anything in vec_restore_from_mcontext() if no altivec.

fixes a crash seen on netbsd-10 in PR#58283.

XXX: pullup-10.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/powerpc/oea/altivec.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/powerpc/oea/altivec.c
diff -u src/sys/arch/powerpc/oea/altivec.c:1.34 src/sys/arch/powerpc/oea/altivec.c:1.35
--- src/sys/arch/powerpc/oea/altivec.c:1.34	Sat Oct 30 19:44:56 2021
+++ src/sys/arch/powerpc/oea/altivec.c	Sat Jun 15 19:48:13 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: altivec.c,v 1.34 2021/10/30 19:44:56 thorpej Exp $	*/
+/*	$NetBSD: altivec.c,v 1.35 2024/06/15 19:48:13 mrg Exp $	*/
 
 /*
  * Copyright (C) 1996 Wolfgang Solfrank.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: altivec.c,v 1.34 2021/10/30 19:44:56 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: altivec.c,v 1.35 2024/06/15 19:48:13 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -163,6 +163,10 @@ vec_restore_from_mcontext(struct lwp *l,
 
 	KASSERT(l == curlwp);
 
+	/* Nothing to do here. */
+	if (!vec_used_p(l))
+		return;
+
 	/* we don't need to save the state, just drop it */
 	pcu_discard(&vec_ops, l, true);
 

Reply via email to