change debug printf method.

This commit is contained in:
uch 2002-02-11 17:01:09 +00:00
parent 24a6d142c3
commit 587d245cb8
3 changed files with 14 additions and 49 deletions

View File

@ -1,4 +1,4 @@
/* -*-C++-*- $NetBSD: arch.cpp,v 1.4 2002/02/04 17:31:34 uch Exp $ */
/* -*-C++-*- $NetBSD: arch.cpp,v 1.5 2002/02/11 17:01:09 uch Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@ -163,44 +163,3 @@ BOOL(*Architecture::_load_UnlockPages(void))(LPVOID, DWORD)
return reinterpret_cast <BOOL(*)(LPVOID, DWORD)>
(_load_func(TEXT("UnlockPages")));
}
//
// Debug support.
//
void
Architecture::_bitdisp(u_int32_t a, int s, int e, int m, int c)
{
u_int32_t j, j1;
int i, n;
n = 31; // 32bit only.
j1 = 1 << n;
e = e ? e : n;
for (j = j1, i = n; j > 0; j >>=1, i--) {
if (i > e || i < s) {
DPRINTF((TEXT("%c"), a & j ? '+' : '-'));
} else {
DPRINTF((TEXT("%c"), a & j ? '|' : '.'));
}
}
if (m) {
DPRINTF((TEXT("[%s]"),(char*)m));
}
if (c) {
for (j = j1, i = n; j > 0; j >>=1, i--) {
if (!(i > e || i < s) &&(a & j)) {
DPRINTF((TEXT(" %d"), i));
}
}
}
DPRINTF((TEXT(" [0x%08x] %d"), a, a));
DPRINTF((TEXT("\n")));
}
void
Architecture::_dbg_bit_print(u_int32_t reg, u_int32_t mask, const char *name)
{
static const char onoff[3] = "_x";
DPRINTF((TEXT("%S[%c] "), name, onoff[reg & mask ? 1 : 0]));
}

View File

@ -1,4 +1,4 @@
/* -*-C++-*- $NetBSD: arch.h,v 1.2 2001/03/15 17:24:47 uch Exp $ */
/* -*-C++-*- $NetBSD: arch.h,v 1.3 2002/02/11 17:01:09 uch Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -56,11 +56,6 @@ protected:
struct BootArgs *_boot_arg;
BOOL _debug;
/* debug utility */
void _bitdisp(u_int32_t, int, int, int, int);
void _dbg_bit_print(u_int32_t, u_int32_t, const char *);
#define bitdisp(a) _bitdisp((a), 0, 0, 0, 1)
public:
Architecture(Console *&, MemoryManager *&);
virtual ~Architecture(void);

View File

@ -1,4 +1,4 @@
/* $NetBSD: hpcboot.h,v 1.2 2002/02/04 17:32:36 uch Exp $ */
/* $NetBSD: hpcboot.h,v 1.3 2002/02/11 17:01:09 uch Exp $ */
/*-
* Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@ -125,6 +125,12 @@ struct BootArgs {
#define VOLATILE_REF(x) (*(volatile u_int32_t *)(x))
#define VOLATILE_REF16(x) (*(volatile u_int16_t *)(x))
#define VOLATILE_REF8(x) (*(volatile u_int8_t *)(x))
#define _reg_read_1(a) (*(volatile u_int8_t *)(a))
#define _reg_read_2(a) (*(volatile u_int16_t *)(a))
#define _reg_read_4(a) (*(volatile u_int32_t *)(a))
#define _reg_write_1(a, v) (*(volatile u_int8_t *)(a) = (v))
#define _reg_write_2(a, v) (*(volatile u_int16_t *)(a) = (v))
#define _reg_write_4(a, v) (*(volatile u_int32_t *)(a) = (v))
#ifdef ARM
#define ptokv(x) (x) /* UNCACHED FLAT */
@ -148,6 +154,11 @@ void CacheSync(int);
/* ExtEscape */
#define GETVFRAMEPHYSICAL 6144
#define GETVFRAMELEN 6145
/* debug utility */
void _bitdisp(u_int32_t, int, int, int, int);
void _dbg_bit_print(u_int32_t, u_int32_t, const char *);
#define bitdisp(a) _bitdisp((a), 0, 0, 0, 1)
__END_DECLS
#endif /* _HPCBOOT_H_ */