Module Name:    src
Committed By:   ad
Date:           Tue Dec  3 12:39:00 UTC 2019

Modified Files:
        src/sys/arch/sh3/sh3: exception.c

Log Message:
tlb_exception: in slow path, check for usermode before calling userret().


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/sh3/sh3/exception.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/sh3/sh3/exception.c
diff -u src/sys/arch/sh3/sh3/exception.c:1.71 src/sys/arch/sh3/sh3/exception.c:1.72
--- src/sys/arch/sh3/sh3/exception.c:1.71	Sun Dec  1 12:19:28 2019
+++ src/sys/arch/sh3/sh3/exception.c	Tue Dec  3 12:39:00 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: exception.c,v 1.71 2019/12/01 12:19:28 ad Exp $	*/
+/*	$NetBSD: exception.c,v 1.72 2019/12/03 12:39:00 ad Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2019 The NetBSD Foundation, Inc. All rights reserved.
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.71 2019/12/01 12:19:28 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.72 2019/12/03 12:39:00 ad Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -233,6 +233,7 @@ general_exception(struct lwp *l, struct 
 	return;
 
  trapsignal:
+	KASSERT(usermode);
 	ksi.ksi_trap = tf->tf_expevt;
 	trapsignal(l, &ksi);
 	userret(l);
@@ -400,7 +401,8 @@ tlb_exception(struct lwp *l, struct trap
 	/* Page in. load PTE to TLB. */
 	if (err == 0) {
 		bool loaded;
-		userret(l);
+		if (usermode)
+			userret(l);
 		loaded = __pmap_pte_load(pmap, va, track);
 #if 0
 		/*

Reply via email to