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 copy{in,out}str: Consistently use tm...



details:   https://anonhg.NetBSD.org/src/rev/41fe7790f32b
branches:  trunk
changeset: 371738:41fe7790f32b
user:      rin <rin%NetBSD.org@localhost>
date:      Tue Oct 04 14:08:30 2022 +0000

description:
copy{in,out}str: Consistently use tmp as scratch register. NFC.

diffstat:

 sys/arch/powerpc/ibm4xx/copyinstr.c  |  22 +++++++++++-----------
 sys/arch/powerpc/ibm4xx/copyoutstr.c |  22 +++++++++++-----------
 2 files changed, 22 insertions(+), 22 deletions(-)

diffs (150 lines):

diff -r 795b4e3ef87b -r 41fe7790f32b sys/arch/powerpc/ibm4xx/copyinstr.c
--- a/sys/arch/powerpc/ibm4xx/copyinstr.c       Tue Oct 04 14:02:46 2022 +0000
+++ b/sys/arch/powerpc/ibm4xx/copyinstr.c       Tue Oct 04 14:08:30 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: copyinstr.c,v 1.21 2022/10/04 14:02:46 rin Exp $       */
+/*     $NetBSD: copyinstr.c,v 1.22 2022/10/04 14:08:30 rin Exp $       */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.21 2022/10/04 14:02:46 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: copyinstr.c,v 1.22 2022/10/04 14:08:30 rin Exp $");
 
 #include <sys/param.h>
 #include <uvm/uvm_extern.h>
@@ -48,7 +48,7 @@
 {
        struct pmap *pm = curproc->p_vmspace->vm_map.pmap;
        size_t resid;
-       int rv, msr, pid, data, ctx;
+       int rv, msr, pid, tmp, ctx;
        struct faultbuf env;
 
        if (__predict_false(len == 0)) {
@@ -74,23 +74,23 @@
        __asm volatile(
                "mtctr  %[resid];"              /* Set up counter */
                "mfmsr  %[msr];"                /* Save MSR */
-               "li     %[pid],0x20;"           /* Disable IMMU */
-               "andc   %[pid],%[msr],%[pid];"
-               "mtmsr  %[pid];"
+               "li     %[tmp],0x20;"           /* Disable IMMU */
+               "andc   %[tmp],%[msr],%[tmp];"
+               "mtmsr  %[tmp];"
                "isync;"
                MFPID(%[pid])                   /* Save old PID */
 
        "1:"    MTPID(%[ctx])                   /* Load user ctx */
                "isync;"
-               "lbz    %[data],0(%[uaddr]);"   /* Load byte */
+               "lbz    %[tmp],0(%[uaddr]);"    /* Load byte */
                "addi   %[uaddr],%[uaddr],1;"
                "sync;"
 
                MTPID(%[pid])
                "isync;"
-               "stb    %[data],0(%[kaddr]);"   /* Store kernel byte */
+               "stb    %[tmp],0(%[kaddr]);"    /* Store kernel byte */
                "addi   %[kaddr],%[kaddr],1;"
-               "or.    %[data],%[data],%[data];"
+               "or.    %[tmp],%[tmp],%[tmp];"
                "sync;"
                "bdnzf  eq,1b;"                 /* while(ctr-- && !zero) */
 
@@ -99,7 +99,7 @@
                "isync;"
                "mfctr  %[resid];"              /* Restore resid */
 
-               : [msr] "=&r" (msr), [pid] "=&r" (pid), [data] "=&r" (data),
+               : [msr] "=&r" (msr), [pid] "=&r" (pid), [tmp] "=&r" (tmp),
                  [resid] "+r" (resid)
                : [ctx] "r" (ctx), [uaddr] "b" (uaddr), [kaddr] "b" (kaddr)
                : "cr0", "ctr");
@@ -107,7 +107,7 @@
        curpcb->pcb_onfault = NULL;
        if (done)
                *done = len - resid;
-       if (resid == 0 && (char)data != '\0')
+       if (resid == 0 && (char)tmp != '\0')
                return ENAMETOOLONG;
        else
                return 0;
diff -r 795b4e3ef87b -r 41fe7790f32b sys/arch/powerpc/ibm4xx/copyoutstr.c
--- a/sys/arch/powerpc/ibm4xx/copyoutstr.c      Tue Oct 04 14:02:46 2022 +0000
+++ b/sys/arch/powerpc/ibm4xx/copyoutstr.c      Tue Oct 04 14:08:30 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: copyoutstr.c,v 1.21 2022/10/04 14:02:46 rin Exp $      */
+/*     $NetBSD: copyoutstr.c,v 1.22 2022/10/04 14:08:30 rin Exp $      */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.21 2022/10/04 14:02:46 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: copyoutstr.c,v 1.22 2022/10/04 14:08:30 rin Exp $");
 
 #include <sys/param.h>
 #include <uvm/uvm_extern.h>
@@ -48,7 +48,7 @@
 {
        struct pmap *pm = curproc->p_vmspace->vm_map.pmap;
        size_t resid;
-       int rv, msr, pid, data, ctx;
+       int rv, msr, pid, tmp, ctx;
        struct faultbuf env;
 
        if (__predict_false(len == 0)) {
@@ -74,23 +74,23 @@
        __asm volatile(
                "mtctr  %[resid];"              /* Set up counter */
                "mfmsr  %[msr];"                /* Save MSR */
-               "li     %[pid],0x20;"           /* Disable IMMU */
-               "andc   %[pid],%[msr],%[pid];"
-               "mtmsr  %[pid];"
+               "li     %[tmp],0x20;"           /* Disable IMMU */
+               "andc   %[tmp],%[msr],%[tmp];"
+               "mtmsr  %[tmp];"
                "isync;"
                MFPID(%[pid])                   /* Save old PID */
 
        "1:"    MTPID(%[pid])
                "isync;"
-               "lbz    %[data],0(%[kaddr]);"   /* Load kernel byte */
+               "lbz    %[tmp],0(%[kaddr]);"    /* Load kernel byte */
                "addi   %[kaddr],%[kaddr],1;"
                "sync;"
 
                MTPID(%[ctx])                   /* Load user ctx */
                "isync;"
-               "stb    %[data],0(%[uaddr]);"   /* Store byte */
+               "stb    %[tmp],0(%[uaddr]);"    /* Store byte */
                "addi   %[uaddr],%[uaddr],1;"
-               "or.    %[data],%[data],%[data];"
+               "or.    %[tmp],%[tmp],%[tmp];"
                "sync;"
                "bdnzf  eq,1b;"                 /* while(ctr-- && !zero) */
 
@@ -99,7 +99,7 @@
                "isync;"
                "mfctr  %[resid];"              /* Restore resid */
 
-               : [msr] "=&r" (msr), [pid] "=&r" (pid), [data] "=&r" (data),
+               : [msr] "=&r" (msr), [pid] "=&r" (pid), [tmp] "=&r" (tmp),
                  [resid] "+r" (resid)
                : [ctx] "r" (ctx), [uaddr] "b" (uaddr), [kaddr] "b" (kaddr)
                : "cr0", "ctr");
@@ -107,7 +107,7 @@
        curpcb->pcb_onfault = NULL;
        if (done)
                *done = len - resid;
-       if (resid == 0 && (char)data != '\0')
+       if (resid == 0 && (char)tmp != '\0')
                return ENAMETOOLONG;
        else
                return 0;



Home | Main Index | Thread Index | Old Index