Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/vax Use copyin(), not fusword().



details:   https://anonhg.NetBSD.org/src/rev/aa2cdc28a204
branches:  trunk
changeset: 449654:aa2cdc28a204
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Thu Mar 14 23:49:38 2019 +0000

description:
Use copyin(), not fusword().

diffstat:

 sys/arch/vax/uba/qv.c  |  26 ++++++++++++++------------
 sys/arch/vax/vsa/smg.c |  26 ++++++++++++++------------
 2 files changed, 28 insertions(+), 24 deletions(-)

diffs (94 lines):

diff -r f52419737855 -r aa2cdc28a204 sys/arch/vax/uba/qv.c
--- a/sys/arch/vax/uba/qv.c     Thu Mar 14 21:49:32 2019 +0000
+++ b/sys/arch/vax/uba/qv.c     Thu Mar 14 23:49:38 2019 +0000
@@ -1,4 +1,4 @@
-/*$Header: /cvsroot/src/sys/arch/vax/uba/qv.c,v 1.33 2017/05/22 17:15:45 ragge Exp $*/
+/*$Header: /cvsroot/src/sys/arch/vax/uba/qv.c,v 1.34 2019/03/14 23:49:38 thorpej Exp $*/
 /*
  * Copyright (c) 2015 Charles H. Dickman. All rights reserved.
  * Derived from smg.c
@@ -31,7 +31,7 @@
 /*3456789012345678901234567890123456789012345678901234567890123456789012345678*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$Header: /cvsroot/src/sys/arch/vax/uba/qv.c,v 1.33 2017/05/22 17:15:45 ragge Exp $");
+__KERNEL_RCSID(0, "$Header: /cvsroot/src/sys/arch/vax/uba/qv.c,v 1.34 2019/03/14 23:49:38 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -785,16 +785,18 @@
        }
        if (v->which & WSDISPLAY_CURSOR_DOCMAP) {
                /* First background */
-               red = fusword(v->cmap.red);
-               green = fusword(v->cmap.green);
-               blue = fusword(v->cmap.blue);
-               bgmask = (((30L * red + 59L * green + 11L * blue) >> 8) >=
-                   (((1<<8)-1)*50)) ? ~0 : 0;
-               red = fusword(v->cmap.red+2);
-               green = fusword(v->cmap.green+2);
-               blue = fusword(v->cmap.blue+2);
-               fgmask = (((30L * red + 59L * green + 11L * blue) >> 8) >=
-                   (((1<<8)-1)*50)) ? ~0 : 0;
+               if (copyin(v->cmap.red, &red, sizeof(red)) == 0 &&
+                   copyin(v->cmap.green, &green, sizeof(green)) == 0 &&
+                   copyin(v->cmap.blue, &blue, sizeof(blue)) == 0) {
+                       bgmask = (((30L * red + 59L * green + 11L * blue) >> 8)
+                           >= (((1<<8)-1)*50)) ? ~0 : 0;
+               }
+               if (copyin(v->cmap.red + 2, &red, sizeof(red)) == 0 &&
+                   copyin(v->cmap.green + 2, &green, sizeof(green)) == 0 &&
+                   copyin(v->cmap.blue + 2, &blue, sizeof(blue)) == 0) {
+                       fgmask = (((30L * red + 59L * green + 11L * blue) >> 8)
+                           >= (((1<<8)-1)*50)) ? ~0 : 0;
+               }
        }
        if (v->which & WSDISPLAY_CURSOR_DOSHAPE) {
                copyin(v->image, curfg, sizeof(curfg));
diff -r f52419737855 -r aa2cdc28a204 sys/arch/vax/vsa/smg.c
--- a/sys/arch/vax/vsa/smg.c    Thu Mar 14 21:49:32 2019 +0000
+++ b/sys/arch/vax/vsa/smg.c    Thu Mar 14 23:49:38 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: smg.c,v 1.57 2017/05/22 17:17:25 ragge Exp $ */
+/*     $NetBSD: smg.c,v 1.58 2019/03/14 23:49:38 thorpej Exp $ */
 /*
  * Copyright (c) 1998 Ludd, University of Lule}, Sweden.
  * All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smg.c,v 1.57 2017/05/22 17:17:25 ragge Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smg.c,v 1.58 2019/03/14 23:49:38 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -430,16 +430,18 @@
        }
        if (v->which & WSDISPLAY_CURSOR_DOCMAP) {
                /* First background */
-               red = fusword(v->cmap.red);
-               green = fusword(v->cmap.green);
-               blue = fusword(v->cmap.blue);
-               bgmask = (((30L * red + 59L * green + 11L * blue) >> 8) >=
-                   (((1<<8)-1)*50)) ? ~0 : 0;
-               red = fusword(v->cmap.red+2);
-               green = fusword(v->cmap.green+2);
-               blue = fusword(v->cmap.blue+2);
-               fgmask = (((30L * red + 59L * green + 11L * blue) >> 8) >=
-                   (((1<<8)-1)*50)) ? ~0 : 0;
+               if (copyin(v->cmap.red, &red, sizeof(red)) == 0 &&
+                   copyin(v->cmap.green, &green, sizeof(green)) == 0 &&
+                   copyin(v->cmap.blue, &blue, sizeof(blue)) == 0) {
+                       bgmask = (((30L * red + 59L * green + 11L * blue) >> 8)
+                           >= (((1<<8)-1)*50)) ? ~0 : 0;
+               }
+               if (copyin(v->cmap.red + 2, &red, sizeof(red)) == 0 &&
+                   copyin(v->cmap.green + 2, &green, sizeof(green)) == 0 &&
+                   copyin(v->cmap.blue + 2, &blue, sizeof(blue)) == 0) {
+                       fgmask = (((30L * red + 59L * green + 11L * blue) >> 8)
+                           >= (((1<<8)-1)*50)) ? ~0 : 0;
+               }
        }
        if (v->which & WSDISPLAY_CURSOR_DOSHAPE) {
                WRITECUR(CUR_CMD, curcmd | CUR_CMD_LODSA);



Home | Main Index | Thread Index | Old Index