Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/rasops Put back byte-wise copy to stop using memcpy, ...



details:   https://anonhg.NetBSD.org/src/rev/a19495311ce3
branches:  trunk
changeset: 842887:a19495311ce3
user:      rin <rin%NetBSD.org@localhost>
date:      Fri Jul 26 11:16:19 2019 +0000

description:
Put back byte-wise copy to stop using memcpy, which
does not work for device memory on some platforms.

Pointed out by Jared, many thanks!

diffstat:

 sys/dev/rasops/rasops.c |  17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diffs (42 lines):

diff -r 7a1d51fe02a9 -r a19495311ce3 sys/dev/rasops/rasops.c
--- a/sys/dev/rasops/rasops.c   Fri Jul 26 11:13:46 2019 +0000
+++ b/sys/dev/rasops/rasops.c   Fri Jul 26 11:16:19 2019 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: rasops.c,v 1.91 2019/07/26 10:48:45 rin Exp $ */
+/*      $NetBSD: rasops.c,v 1.92 2019/07/26 11:16:19 rin Exp $ */
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.91 2019/07/26 10:48:45 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rasops.c,v 1.92 2019/07/26 11:16:19 rin Exp $");
 
 #include "opt_rasops.h"
 #include "rasops_glue.h"
@@ -1186,12 +1186,21 @@
                        }
                } else {
                        while (height--) {
-                               memset(rp, clr, num);
+                               dp = rp;
                                DELTA(rp, ri->ri_stride, uint32_t *);
                                if (ri->ri_hwbits) {
-                                       memset(hrp, clr, num);
+                                       hp = hrp;
                                        DELTA(hrp, ri->ri_stride, uint32_t *);
                                }
+
+                               for (cnt = num; cnt; cnt--) {
+                                       *(uint8_t *)dp = clr;
+                                       DELTA(dp, 1, uint32_t *);
+                                       if (ri->ri_hwbits) {
+                                               *(uint8_t *)hp = clr;
+                                               DELTA(hp, 1, uint32_t *);
+                                       }
+                               }
                        }
                }
 



Home | Main Index | Thread Index | Old Index