Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/aarch64/aarch64 changed kcopy() to asm to avoid rep...



details:   https://anonhg.NetBSD.org/src/rev/456f05d5c6d1
branches:  trunk
changeset: 835814:456f05d5c6d1
user:      ryo <ryo%NetBSD.org@localhost>
date:      Mon Sep 10 17:25:15 2018 +0000

description:
changed kcopy() to asm to avoid replacement memcpy() to kasan_memcpy() when defined KASAN.

diffstat:

 sys/arch/aarch64/aarch64/copyinout.S |  20 ++++++++++++++++++--
 sys/arch/aarch64/aarch64/trap.c      |  17 ++---------------
 2 files changed, 20 insertions(+), 17 deletions(-)

diffs (76 lines):

diff -r 86c2a780191c -r 456f05d5c6d1 sys/arch/aarch64/aarch64/copyinout.S
--- a/sys/arch/aarch64/aarch64/copyinout.S      Mon Sep 10 16:43:24 2018 +0000
+++ b/sys/arch/aarch64/aarch64/copyinout.S      Mon Sep 10 17:25:15 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: copyinout.S,v 1.7 2018/07/30 09:08:41 ryo Exp $ */
+/* $NetBSD: copyinout.S,v 1.8 2018/09/10 17:25:15 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #include <aarch64/asm.h>
 #include "assym.h"
 
-RCSID("$NetBSD: copyinout.S,v 1.7 2018/07/30 09:08:41 ryo Exp $");
+RCSID("$NetBSD: copyinout.S,v 1.8 2018/09/10 17:25:15 ryo Exp $");
 
        .macro enter_cpu_onfault
        stp     fp, lr, [sp, #-16]!     /* save fp, lr */
@@ -312,3 +312,19 @@
        exit_cpu_onfault
        ret
 END(copyoutstr)
+
+
+/* LINTSTUB: int kcopy(const void *src, void *dst, size_t len); */
+
+ENTRY(kcopy)
+       enter_cpu_onfault
+
+       mov     x3, x0                  /* swap src and dst for memcpy */
+       mov     x0, x1
+       mov     x1, x3
+       bl      _C_LABEL(memcpy)
+       mov     x8, #0                  /* error = 0 */
+
+       exit_cpu_onfault
+       ret
+END(kcopy)
diff -r 86c2a780191c -r 456f05d5c6d1 sys/arch/aarch64/aarch64/trap.c
--- a/sys/arch/aarch64/aarch64/trap.c   Mon Sep 10 16:43:24 2018 +0000
+++ b/sys/arch/aarch64/aarch64/trap.c   Mon Sep 10 17:25:15 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.8 2018/07/28 09:57:59 ryo Exp $ */
+/* $NetBSD: trap.c,v 1.9 2018/09/10 17:25:15 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.8 2018/07/28 09:57:59 ryo Exp $");
+__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.9 2018/09/10 17:25:15 ryo Exp $");
 
 #include "opt_arm_intr_impl.h"
 #include "opt_compat_netbsd32.h"
@@ -421,19 +421,6 @@
 }
 
 int
-kcopy(const void *src, void *dst, size_t len)
-{
-       struct faultbuf fb;
-       int error;
-
-       if ((error = cpu_set_onfault(&fb)) == 0) {
-               memcpy(dst, src, len);
-               cpu_unset_onfault();
-       }
-       return error;
-}
-
-int
 copystr(const void *kfaddr, void *kdaddr, size_t len, size_t *done)
 {
        struct faultbuf fb;



Home | Main Index | Thread Index | Old Index