Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/powerpc/ibm4xx Fix off-by-one error for ctx (ASID).



details:   https://anonhg.NetBSD.org/src/rev/db7000521118
branches:  trunk
changeset: 744980:db7000521118
user:      rin <rin%NetBSD.org@localhost>
date:      Thu Feb 20 05:21:54 2020 +0000

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

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

diffstat:

 sys/arch/powerpc/ibm4xx/pmap.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 1dd2c33a9bed -r db7000521118 sys/arch/powerpc/ibm4xx/pmap.c
--- a/sys/arch/powerpc/ibm4xx/pmap.c    Thu Feb 20 05:13:16 2020 +0000
+++ b/sys/arch/powerpc/ibm4xx/pmap.c    Thu Feb 20 05:21:54 2020 +0000
@@ -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 @@
        /* 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 @@
                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;
        }



Home | Main Index | Thread Index | Old Index