Source-Changes-HG archive

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

[src/trunk]: src/sys/external/bsd/drm2/include/asm Implement hokey slow clear...



details:   https://anonhg.NetBSD.org/src/rev/7918a4a1b130
branches:  trunk
changeset: 1027833:7918a4a1b130
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sun Dec 19 00:55:01 2021 +0000

description:
Implement hokey slow clear_user.

diffstat:

 sys/external/bsd/drm2/include/asm/uaccess.h |  21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diffs (35 lines):

diff -r 22ca7abc9a53 -r 7918a4a1b130 sys/external/bsd/drm2/include/asm/uaccess.h
--- a/sys/external/bsd/drm2/include/asm/uaccess.h       Sun Dec 19 00:54:54 2021 +0000
+++ b/sys/external/bsd/drm2/include/asm/uaccess.h       Sun Dec 19 00:55:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uaccess.h,v 1.4 2021/12/19 00:50:11 riastradh Exp $    */
+/*     $NetBSD: uaccess.h,v 1.5 2021/12/19 00:55:01 riastradh Exp $    */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -72,6 +72,25 @@
        copy_to_user((USER_PTR), &__put_user_tmp, sizeof(__put_user_tmp));    \
 })
 
+static inline size_t
+clear_user(void __user *user_ptr, size_t size)
+{
+       char __user *p = user_ptr;
+       size_t n = size;
+
+       /*
+        * This loop which sets up a fault handler on every iteration
+        * is not going to win any speed records, but it'll do to copy
+        * out an int.
+        */
+       while (n --> 0) {
+               if (subyte(p, 0) != 0)
+                       return ++n;
+       }
+
+       return 0;
+}
+
 #if 0
 /*
  * XXX These `inatomic' versions are a cop out, but they should do for



Home | Main Index | Thread Index | Old Index