Update of /cvsroot/blob/blob/src/blob
In directory usw-pr-cvs1:/tmp/cvs-serv12855
Modified Files:
chkmem.c
Log Message:
- removed silly "test all mem regions" loop. This tested also
the region blob lives in --- KABOOM
- Provide 2 args (start-end) instead.
Index: chkmem.c
===================================================================
RCS file: /cvsroot/blob/blob/src/blob/chkmem.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- chkmem.c 11 Feb 2002 16:55:26 -0000 1.8
+++ chkmem.c 2 Oct 2002 12:02:56 -0000 1.9
@@ -138,14 +138,13 @@
int ChkMem( int argc, char *argv[] )
{
memtestfunc_t method;
- int area;
- u32 start = 0L;
- u32 end = 0L;
- u32 badaddr = 0L;
- u32 repcount = 0L;
+ u32 start = 0L;
+ u32 end = 0L;
+ u32 badaddr = 0L;
+ u32 repcount= 0L;
/* check args */
- if ( argc < 2 ) {
+ if ( argc < 4 ) {
SerialOutputString("*** not enough arguments\n");
return CHKMEM_ERR;
}
@@ -153,11 +152,21 @@
/* reset error counter */
chkmem_errs = 0;
+ if(strtou32(argv[1], &start) < 0) {
+ SerialOutputString("*** not a value (start)\n");
+ return CHKMEM_ERR;
+ }
+
+ if(strtou32(argv[2], &end) < 0) {
+ SerialOutputString("*** not a value (start)\n");
+ return CHKMEM_ERR;
+ }
+
/* get verbosity level */
showevery = CHKMEM_SHOWEVERY;
- if ( argc > 2 ) {
- if(strtou32(argv[2], &showevery) < 0) {
- SerialOutputString("*** not a value\n");
+ if ( argc > 4 ) {
+ if(strtou32(argv[4], &showevery) < 0) {
+ SerialOutputString("*** not a value (showevry)\n");
return CHKMEM_ERR;
}
@@ -171,20 +180,18 @@
/* get repeat count */
repcount = 1;
- if ( argc > 3 ) {
- if ( strtou32(argv[3], &repcount ) < 0 ) {
+ if ( argc > 5 ) {
+ if ( strtou32(argv[5], &repcount ) < 0 ) {
SerialOutputString("*** not a value\n");
return CHKMEM_ERR;
}
}
- SerialOutputString(argv[0]);
- SerialOutputString(": display every 0x");
- SerialOutputHex(showevery);
- SerialOutputString(" bytes\n");
+ printf( "%s: display every 0x%08x bytes\n", argv[0], showevery );
+ printf( "%s: start: 0x%08x end: 0x%08x\n", argv[0], start, end );
/* set memory test method */
- switch ( *argv[1] ) {
+ switch ( *argv[3] ) {
case '0':
method = ChkMemMovInv;
break;
@@ -201,16 +208,8 @@
}
while ( repcount-- ) {
- /* test all known memory areas */
- for (area = 0; area < NUM_MEM_AREAS; area++) {
- if(memory_map[area].used) {
- start = memory_map[area].start;
- end = start + memory_map[area].len;
-
- if ( method(start, end, 0x5555aaaa, &badaddr) != CHKMEM_OK ) {
- CHKMEM_PUSHERR( badaddr );
- }
- }
+ if ( method(start, end, 0x5555aaaa, &badaddr) != CHKMEM_OK ) {
+ CHKMEM_PUSHERR( badaddr );
}
}
@@ -222,7 +221,9 @@
return CHKMEM_OK;
}
-static char chkmemhelp[] = "chkmem [method] {verbosity:1..F} {repeat-count}\n"
+static char chkmemhelp[] = "chkmem start end method {verbosity:1..F} {repeat-count}\n"
+"start: startadr\n"
+"end: endadr\n"
"method=0: move-inverse test\n"
"method=1: address test\n"
"method=2: hardcore test\n"
@@ -288,10 +289,7 @@
SerialOutputString("\n*** memory errors:\n");
for ( i=0; i< chkmem_errs % CHKMEM_MAXERR; i++ ) {
- SerialOutputHex( i );
- SerialOutputString(": 0x");
- SerialOutputHex(chkmem_errlist[i]);
- SerialOutputString("\n");
+ printf( "%02d: adr 0x%08x\n", i, chkmem_errlist[i] );
}
return CHKMEM_OK;
@@ -333,11 +331,7 @@
SKIPBLOBMEM( start );
#if CHKMEM_DEBUG
- SerialOutputString("ChkMem: start(0x");
- SerialOutputHex(start);
- SerialOutputString(") - end(0x");
- SerialOutputHex(end);
- SerialOutputString(")\n");
+ printf( "chkmem: 0x%08x -> 0x%08x\n", start, end );
#endif
#if CHKMEM_DEBUG
@@ -422,11 +416,7 @@
SKIPBLOBMEM( start );
#if CHKMEM_DEBUG
- SerialOutputString("ChkMem: start(0x");
- SerialOutputHex(start);
- SerialOutputString(") - end(0x");
- SerialOutputHex(end);
- SerialOutputString(")\n");
+ printf( "chkmem: 0x%08x -> 0x%08x\n", start, end );
#endif
#if CHKMEM_DEBUG
@@ -489,11 +479,7 @@
SKIPBLOBMEM( start );
#if CHKMEM_DEBUG
- SerialOutputString("ChkMem: start(0x");
- SerialOutputHex(start);
- SerialOutputString(") - end(0x");
- SerialOutputHex(end);
- SerialOutputString(")\n");
+ printf( "chkmem: 0x%08x -> 0x%08x\n", start, end );
#endif
count = end - start;
|