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/3f594631bb72
branches:  trunk
changeset: 458009:3f594631bb72
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 03e4f9c670fa -r 3f594631bb72 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