Module Name:    src
Committed By:   rin
Date:           Thu Feb 20 05:21:55 UTC 2020

Modified Files:
        src/sys/arch/powerpc/ibm4xx: pmap.c

Log Message:
Fix off-by-one error for ctx (ASID).

Note that NUM_CTX = 256 = 0 stands for disabling protection by ASID.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/powerpc/ibm4xx/pmap.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/ibm4xx/pmap.c
diff -u src/sys/arch/powerpc/ibm4xx/pmap.c:1.77 src/sys/arch/powerpc/ibm4xx/pmap.c:1.78
--- src/sys/arch/powerpc/ibm4xx/pmap.c:1.77	Thu Feb 20 05:13:16 2020
+++ src/sys/arch/powerpc/ibm4xx/pmap.c	Thu Feb 20 05:21:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.77 2020/02/20 05:13:16 rin Exp $	*/
+/*	$NetBSD: pmap.c,v 1.78 2020/02/20 05:21:54 rin Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.77 2020/02/20 05:13:16 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.78 2020/02/20 05:21:54 rin Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -1563,7 +1563,7 @@ ctx_alloc(struct pmap *pm)
 	/* Find a likely context. */
 	cnum = next;
 	do {
-		if ((++cnum) > NUMCTX)
+		if ((++cnum) >= NUMCTX)
 			cnum = MINCTX;
 	} while (ctxbusy[cnum] != NULL && cnum != next);
 
@@ -1573,7 +1573,7 @@ oops:
 		cnum = MINCTX; /* Never steal ctx 0 or 1 */
 	if (ctx_flush(cnum)) {
 		/* oops -- something's wired. */
-		if ((++cnum) > NUMCTX)
+		if ((++cnum) >= NUMCTX)
 			cnum = MINCTX;
 		goto oops;
 	}

Reply via email to