Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/powerpc/booke Comment out full function of optimize...



details:   https://anonhg.NetBSD.org/src/rev/302716227203
branches:  trunk
changeset: 849511:302716227203
user:      rin <rin%NetBSD.org@localhost>
date:      Wed Mar 04 13:01:52 2020 +0000

description:
Comment out full function of optimized version of copyoutstr(9),
which has never been enabled so far.

Only for clarity. No binary changes.

diffstat:

 sys/arch/powerpc/booke/copyout.c |  38 ++++++++++++++++++++++++++++++++++----
 1 files changed, 34 insertions(+), 4 deletions(-)

diffs (84 lines):

diff -r 85df46df8865 -r 302716227203 sys/arch/powerpc/booke/copyout.c
--- a/sys/arch/powerpc/booke/copyout.c  Wed Mar 04 11:15:06 2020 +0000
+++ b/sys/arch/powerpc/booke/copyout.c  Wed Mar 04 13:01:52 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: copyout.c,v 1.5 2019/04/07 05:25:55 thorpej Exp $      */
+/*     $NetBSD: copyout.c,v 1.6 2020/03/04 13:01:52 rin Exp $  */
 
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: copyout.c,v 1.5 2019/04/07 05:25:55 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: copyout.c,v 1.6 2020/03/04 13:01:52 rin Exp $");
 
 #define        __UFETCHSTORE_PRIVATE
 
@@ -400,6 +400,7 @@
        return 0;
 }
 
+#if 1
 int
 copyoutstr(const void *ksaddr, void *udaddr, size_t len, size_t *lenp)
 {
@@ -423,7 +424,6 @@
        const uint8_t *ksaddr8 = ksaddr;
        size_t copylen = 0;
 
-#if 1
        uint8_t *udaddr8 = (void *)udaddr;
 
        while (copylen++ < len) {
@@ -432,7 +432,37 @@
                if (data == 0)
                        break;
        }
+
+       pcb->pcb_onfault = NULL;
+       if (lenp)
+               *lenp = copylen;
+       return 0;
+}
 #else
+/* XXX This version of copyoutstr(9) has never beeen enabled so far. */
+int
+copyoutstr(const void *ksaddr, void *udaddr, size_t len, size_t *lenp)
+{
+       struct pcb * const pcb = lwp_getpcb(curlwp);
+       struct faultbuf env;
+
+       if (__predict_false(len == 0)) {
+               if (lenp)
+                       *lenp = 0;
+               return 0;
+       }
+
+       if (setfault(&env)) {
+               pcb->pcb_onfault = NULL;
+               if (lenp)
+                       *lenp = 0;
+               return EFAULT;
+       }
+
+       const register_t ds_msr = mfmsr() | PSL_DS;
+       const uint8_t *ksaddr8 = ksaddr;
+       size_t copylen = 0;
+
        uint32_t *udaddr32 = (void *)((uintptr_t)udaddr & ~3);
 
        size_t boff = (uintptr_t)udaddr & 3;
@@ -523,10 +553,10 @@
                copyout_le32_with_mask(udaddr32, data, mask, ds_msr);
                copylen += wlen;
        }
-#endif
 
        pcb->pcb_onfault = NULL;
        if (lenp)
                *lenp = copylen;
        return 0;
 }
+#endif



Home | Main Index | Thread Index | Old Index