Module Name: src
Committed By: phx
Date: Sun Jun 1 17:21:50 UTC 2014
Modified Files:
src/sys/arch/bebox/stand/boot: monitor.c
Log Message:
Use int32_t, int16_t, int8_t.
To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/bebox/stand/boot/monitor.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/arch/bebox/stand/boot/monitor.c
diff -u src/sys/arch/bebox/stand/boot/monitor.c:1.9 src/sys/arch/bebox/stand/boot/monitor.c:1.10
--- src/sys/arch/bebox/stand/boot/monitor.c:1.9 Mon May 26 16:28:39 2008
+++ src/sys/arch/bebox/stand/boot/monitor.c Sun Jun 1 17:21:50 2014
@@ -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_mt(int, char **);
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 @@ db_monitor(void)
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 @@ void
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 @@ db_cmd_dump(int argc, char **argv)
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 @@ void
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 @@ db_cmd_get(int argc, char **argv)
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 @@ void
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 @@ db_cmd_put(int argc, char **argv)
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 @@ out:
#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 @@ FUNC(msr)
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 @@ db_cmd_mt(int argc, char **argv)
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;
}