Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x86/x86 x86/db_memrw.c: Use uint64_t, not long, for...



details:   https://anonhg.NetBSD.org/src/rev/3d9dc31433b9
branches:  trunk
changeset: 369675:3d9dc31433b9
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Aug 27 20:39:54 2022 +0000

description:
x86/db_memrw.c: Use uint64_t, not long, for 8-byte r/w.

This is shared with amd64 and i386, and while long works on amd64,
not so much on i386.

While here, use uint32_t intead of int and uint16_t instead of short
for clarity.

diffstat:

 sys/arch/x86/x86/db_memrw.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (60 lines):

diff -r eb7e3fcead13 -r 3d9dc31433b9 sys/arch/x86/x86/db_memrw.c
--- a/sys/arch/x86/x86/db_memrw.c       Sat Aug 27 20:37:49 2022 +0000
+++ b/sys/arch/x86/x86/db_memrw.c       Sat Aug 27 20:39:54 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_memrw.c,v 1.14 2022/08/20 23:48:51 riastradh Exp $  */
+/*     $NetBSD: db_memrw.c,v 1.15 2022/08/27 20:39:54 riastradh Exp $  */
 
 /*-
  * Copyright (c) 1996, 2000 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_memrw.c,v 1.14 2022/08/20 23:48:51 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_memrw.c,v 1.15 2022/08/27 20:39:54 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -100,17 +100,17 @@
        }
 
        if (size == 8) {
-               *((long *)data) = *((long *)src);
+               *((uint64_t *)data) = *((uint64_t *)src);
                return;
        }
 
        if (size == 4) {
-               *((int *)data) = *((int *)src);
+               *((uint32_t *)data) = *((uint32_t *)src);
                return;
        }
 
        if (size == 2) {
-               *((short *)data) = *((short *)src);
+               *((uint16_t *)data) = *((uint16_t *)src);
                return;
        }
 
@@ -230,17 +230,17 @@
        dst = (char *)addr;
 
        if (size == 8) {
-               *((long *)dst) = *((const long *)data);
+               *((uint64_t *)dst) = *((const uint64_t *)data);
                return;
        }
 
        if (size == 4) {
-               *((int *)dst) = *((const int *)data);
+               *((uint32_t *)dst) = *((const uint32_t *)data);
                return;
        }
 
        if (size == 2) {
-               *((short *)dst) = *((const short *)data);
+               *((uint16_t *)dst) = *((const uint16_t *)data);
                return;
        }
 



Home | Main Index | Thread Index | Old Index