Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/bebox/stand/boot Use int32_t, int16_t, int8_t.



details:   https://anonhg.NetBSD.org/src/rev/04d74e940f0d
branches:  trunk
changeset: 329648:04d74e940f0d
user:      phx <phx%NetBSD.org@localhost>
date:      Sun Jun 01 17:21:50 2014 +0000

description:
Use int32_t, int16_t, int8_t.

diffstat:

 sys/arch/bebox/stand/boot/monitor.c |  52 +++++++++++++++++++-----------------
 1 files changed, 28 insertions(+), 24 deletions(-)

diffs (161 lines):

diff -r 5c9dcb20ac9e -r 04d74e940f0d sys/arch/bebox/stand/boot/monitor.c
--- a/sys/arch/bebox/stand/boot/monitor.c       Sun Jun 01 13:42:12 2014 +0000
+++ b/sys/arch/bebox/stand/boot/monitor.c       Sun Jun 01 17:21:50 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: monitor.c,v 1.9 2008/05/26 16:28:39 kiyohara Exp $     */
+/*     $NetBSD: monitor.c,v 1.10 2014/06/01 17:21:50 phx Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
 void db_cmd_put(int, char **);
 void db_cmd_help(int, char **);
 
-int db_atob(char *);
+uint32_t db_atob(char *);
 
 struct {
        char *name;
@@ -105,10 +105,11 @@
        return 0;
 }
 
-int
+uint32_t
 db_atob(char *p)
 {
-       int b = 0, width, tmp, exp, x = 0;
+       uint32_t b = 0;
+       int width, tmp, exp, x = 0;
 
        if (p[1] == 'x') {
                p += 2;
@@ -134,7 +135,8 @@
 db_cmd_dump(int argc, char **argv)
 {
        char *p, *r, *pp;
-       int mode, add, size, i;
+       int mode, size, i;
+       uint32_t add;
 
        switch (argc) {
        case 4:
@@ -172,21 +174,21 @@
                        printf("\n0x%x:", add);
                switch (mode) {
                case 1:
-                       printf(" %x", *(unsigned char *)add);
+                       printf(" %x", *(uint8_t *)add);
                        add += 1;
                        size -= 1;
                        if (++i == 16)
                                i = 0;
                        break;
                case 2:
-                       printf(" %x", *(unsigned short *)add);
+                       printf(" %x", *(uint16_t *)add);
                        add += 2;
                        size -= 2;
                        if (++i == 8)
                                i = 0;
                        break;
                case 4:
-                       printf(" %x", *(unsigned int *)add);
+                       printf(" %x", *(uint32_t *)add);
                        add += 4;
                        size -= 4;
                        if (++i == 4)
@@ -206,7 +208,8 @@
 db_cmd_get(int argc, char **argv)
 {
        char *p, *r;
-       int mode, add;
+       uint32_t add;
+       int mode;
 
        switch (argc) {
        case 3:
@@ -238,13 +241,13 @@
        printf("0x%x: ", add);
        switch (mode) {
        case 1:
-               printf("0x%x", *(char *)add);
+               printf("0x%x", *(uint8_t *)add);
                break;
        case 2:
-               printf("0x%x", *(short *)add);
+               printf("0x%x", *(uint16_t *)add);
                break;
        case 4:
-               printf("0x%x", *(int *)add);
+               printf("0x%x", *(uint32_t *)add);
                break;
        }
        printf("\n");
@@ -259,7 +262,8 @@
 db_cmd_put(int argc, char **argv)
 {
        char *p, *r, *pp;
-       int mode, add, data;
+       uint32_t add, data;
+       int mode;
 
        switch (argc) {
        case 4:
@@ -294,13 +298,13 @@
        printf("0x%x: 0x%x", add, data);
        switch (mode) {
        case 1:
-               *(char *)add = data;
+               *(uint8_t *)add = data;
                break;
        case 2:
-               *(short *)add = data;
+               *(uint16_t *)add = data;
                break;
        case 4:
-               *(int *)add = data;
+               *(uint32_t *)add = data;
                break;
        }
        printf("\n");
@@ -314,14 +318,14 @@
 #define STR(x) #x
 
 #define        FUNC(x) \
-unsigned int mf ## x(void); \
-void mt ## x(unsigned int); \
-unsigned int mf ## x() { \
-       unsigned int tmp; \
+uint32_t mf ## x(void); \
+void mt ## x(uint32_t); \
+uint32_t mf ## x() { \
+       uint32_t tmp; \
        __asm volatile (STR(mf ## x %0) : STR(=r)(tmp)); \
        return (tmp); \
 } \
-void mt ## x(unsigned int data) \
+void mt ## x(uint32_t data) \
 { \
        __asm volatile (STR(mt ## x %0) :: STR(r)(data)); \
 } \
@@ -333,8 +337,8 @@
 
 struct {
        char *op;
-       unsigned int (*mf)(void);
-       void (*mt)(unsigned int);
+       uint32_t (*mf)(void);
+       void (*mt)(uint32_t);
 } mreg [] = {
        DEF(msr),
        { NULL, NULL, NULL },
@@ -377,7 +381,7 @@
 
        while (mreg[i].op != NULL) {
                if (!strcmp(mreg[i].op, argv[1])) {
-                       (mreg[i].mt)((unsigned int)db_atob(argv[2]));
+                       (mreg[i].mt)(db_atob(argv[2]));
                        printf(" 0x%x\n", db_atob(argv[2]));
                        break;
                }



Home | Main Index | Thread Index | Old Index