357 lines
8.2 KiB
Diff
357 lines
8.2 KiB
Diff
--- memtest86+-2.11/test.c.orig 2008-11-15 19:18:14.000000000 -0500
|
|
+++ memtest86+-2.11/test.c 2009-08-18 16:01:33.845957770 -0400
|
|
@@ -13,6 +13,7 @@
|
|
#include "config.h"
|
|
#include <sys/io.h>
|
|
#include "dmi.h"
|
|
+#include <inttypes.h>
|
|
|
|
extern int segs, bail;
|
|
extern volatile ulong *p;
|
|
@@ -150,16 +151,16 @@ void addr_tst2()
|
|
done = 0;
|
|
do {
|
|
/* Check for overflow */
|
|
- if (pe + SPINSZ > pe) {
|
|
+ if ((uintptr_t)(pe + SPINSZ) > (uintptr_t)pe) {
|
|
pe += SPINSZ;
|
|
} else {
|
|
pe = end;
|
|
}
|
|
- if (pe >= end) {
|
|
+ if ((uintptr_t)pe >= (uintptr_t)end) {
|
|
pe = end;
|
|
done++;
|
|
}
|
|
- if (p == pe ) {
|
|
+ if ((uintptr_t)p == (uintptr_t)pe) {
|
|
break;
|
|
}
|
|
|
|
@@ -194,16 +195,16 @@ void addr_tst2()
|
|
done = 0;
|
|
do {
|
|
/* Check for overflow */
|
|
- if (pe + SPINSZ > pe) {
|
|
+ if ((uintptr_t)(pe + SPINSZ) > (uintptr_t)pe) {
|
|
pe += SPINSZ;
|
|
} else {
|
|
pe = end;
|
|
}
|
|
- if (pe >= end) {
|
|
+ if ((uintptr_t)pe >= (uintptr_t)end) {
|
|
pe = end;
|
|
done++;
|
|
}
|
|
- if (p == pe ) {
|
|
+ if ((uintptr_t)p == (uintptr_t)pe) {
|
|
break;
|
|
}
|
|
/* Original C code replaced with hand tuned assembly code
|
|
@@ -260,6 +261,7 @@ void movinvr()
|
|
volatile ulong *pe;
|
|
volatile ulong *start,*end;
|
|
ulong num;
|
|
+ uintptr_t seg_start;
|
|
|
|
/* Initialize memory with initial sequence of random numbers. */
|
|
if (v->rdtsc) {
|
|
@@ -277,19 +279,20 @@ void movinvr()
|
|
end = v->map[j].end;
|
|
pe = start;
|
|
p = start;
|
|
+ seg_start = (uintptr_t)p;
|
|
done = 0;
|
|
do {
|
|
/* Check for overflow */
|
|
- if (pe + SPINSZ > pe) {
|
|
+ if ((uintptr_t)(pe + SPINSZ) > (uintptr_t)pe) {
|
|
pe += SPINSZ;
|
|
} else {
|
|
pe = end;
|
|
}
|
|
- if (pe >= end) {
|
|
+ if ((uintptr_t)pe >= (uintptr_t)end) {
|
|
pe = end;
|
|
done++;
|
|
}
|
|
- if (p == pe ) {
|
|
+ if (seg_start == (uintptr_t)pe) {
|
|
break;
|
|
}
|
|
/* Original C code replaced with hand tuned assembly code */
|
|
@@ -310,7 +313,7 @@ void movinvr()
|
|
"jb L200\n\t"
|
|
: "=D" (p)
|
|
: "D" (p), "b" (pe)
|
|
- : "eax"
|
|
+ : "eax", "edx"
|
|
);
|
|
|
|
do_tick();
|
|
@@ -328,19 +331,20 @@ void movinvr()
|
|
end = v->map[j].end;
|
|
pe = start;
|
|
p = start;
|
|
+ seg_start = (uintptr_t)p;
|
|
done = 0;
|
|
do {
|
|
/* Check for overflow */
|
|
- if (pe + SPINSZ > pe) {
|
|
+ if ((uintptr_t)(pe + SPINSZ) > (uintptr_t)pe) {
|
|
pe += SPINSZ;
|
|
} else {
|
|
pe = end;
|
|
}
|
|
- if (pe >= end) {
|
|
+ if ((uintptr_t)pe >= (uintptr_t)end) {
|
|
pe = end;
|
|
done++;
|
|
}
|
|
- if (p == pe ) {
|
|
+ if (seg_start == (uintptr_t)pe) {
|
|
break;
|
|
}
|
|
/* Original C code replaced with hand tuned assembly code */
|
|
@@ -427,17 +431,17 @@ void movinv1(int iter, ulong p1, ulong p
|
|
done = 0;
|
|
do {
|
|
/* Check for overflow */
|
|
- if (pe + SPINSZ > pe) {
|
|
+ if ((uintptr_t)(pe + SPINSZ) > (uintptr_t)pe) {
|
|
pe += SPINSZ;
|
|
} else {
|
|
pe = end;
|
|
}
|
|
- if (pe >= end) {
|
|
+ if ((uintptr_t)pe >= (uintptr_t)end) {
|
|
pe = end;
|
|
done++;
|
|
}
|
|
len = pe - p;
|
|
- if (p == pe ) {
|
|
+ if ((uintptr_t)p == (uintptr_t)pe) {
|
|
break;
|
|
}
|
|
/* Original C code replaced with hand tuned assembly code
|
|
@@ -468,16 +472,16 @@ void movinv1(int iter, ulong p1, ulong p
|
|
done = 0;
|
|
do {
|
|
/* Check for overflow */
|
|
- if (pe + SPINSZ > pe) {
|
|
+ if ((uintptr_t)(pe + SPINSZ) > (uintptr_t)pe) {
|
|
pe += SPINSZ;
|
|
} else {
|
|
pe = end;
|
|
}
|
|
- if (pe >= end) {
|
|
+ if ((uintptr_t)pe >= (uintptr_t)end) {
|
|
pe = end;
|
|
done++;
|
|
}
|
|
- if (p == pe ) {
|
|
+ if ((uintptr_t)p == (uintptr_t)pe) {
|
|
break;
|
|
}
|
|
/* Original C code replaced with hand tuned assembly code
|
|
@@ -534,16 +538,16 @@ void movinv1(int iter, ulong p1, ulong p
|
|
done = 0;
|
|
do {
|
|
/* Check for underflow */
|
|
- if (pe - SPINSZ < pe) {
|
|
+ if ((uintptr_t)(pe - SPINSZ) < (uintptr_t)pe) {
|
|
pe -= SPINSZ;
|
|
} else {
|
|
pe = start;
|
|
}
|
|
- if (pe <= start) {
|
|
+ if ((uintptr_t)pe <= (uintptr_t)start) {
|
|
pe = start;
|
|
done++;
|
|
}
|
|
- if (p == pe ) {
|
|
+ if ((uintptr_t)p == (uintptr_t)pe) {
|
|
break;
|
|
}
|
|
/* Original C code replaced with hand tuned assembly code
|
|
@@ -623,16 +627,16 @@ void movinv32(int iter, ulong p1, ulong
|
|
pat = p1;
|
|
do {
|
|
/* Check for overflow */
|
|
- if (pe + SPINSZ > pe) {
|
|
+ if ((uintptr_t)(pe + SPINSZ) > (uintptr_t)pe) {
|
|
pe += SPINSZ;
|
|
} else {
|
|
pe = end;
|
|
}
|
|
- if (pe >= end) {
|
|
+ if ((uintptr_t)pe >= (uintptr_t)end) {
|
|
pe = end;
|
|
done++;
|
|
}
|
|
- if (p == pe ) {
|
|
+ if ((uintptr_t)p == (uintptr_t)pe) {
|
|
break;
|
|
}
|
|
/* Do a SPINSZ section of memory */
|
|
@@ -685,16 +689,16 @@ void movinv32(int iter, ulong p1, ulong
|
|
pat = p1;
|
|
do {
|
|
/* Check for overflow */
|
|
- if (pe + SPINSZ > pe) {
|
|
+ if ((uintptr_t)(pe + SPINSZ) > (uintptr_t)pe) {
|
|
pe += SPINSZ;
|
|
} else {
|
|
pe = end;
|
|
}
|
|
- if (pe >= end) {
|
|
+ if ((uintptr_t)pe >= (uintptr_t)end) {
|
|
pe = end;
|
|
done++;
|
|
}
|
|
- if (p == pe ) {
|
|
+ if ((uintptr_t)p == (uintptr_t)pe) {
|
|
break;
|
|
}
|
|
/* Original C code replaced with hand tuned assembly code
|
|
@@ -798,16 +802,16 @@ void movinv32(int iter, ulong p1, ulong
|
|
done = 0;
|
|
do {
|
|
/* Check for underflow */
|
|
- if (pe - SPINSZ < pe) {
|
|
+ if ((uintptr_t)(pe - SPINSZ) < (uintptr_t)pe) {
|
|
pe -= SPINSZ;
|
|
} else {
|
|
pe = start;
|
|
}
|
|
- if (pe <= start) {
|
|
+ if ((uintptr_t)pe <= (uintptr_t)start) {
|
|
pe = start;
|
|
done++;
|
|
}
|
|
- if (p == pe ) {
|
|
+ if ((uintptr_t)p == (uintptr_t)pe) {
|
|
break;
|
|
}
|
|
/* Original C code replaced with hand tuned assembly code
|
|
@@ -906,16 +910,16 @@ void modtst(int offset, int iter, ulong
|
|
done = 0;
|
|
do {
|
|
/* Check for overflow */
|
|
- if (pe + SPINSZ > pe) {
|
|
+ if ((uintptr_t)(pe + SPINSZ) > (uintptr_t)pe) {
|
|
pe += SPINSZ;
|
|
} else {
|
|
pe = end;
|
|
}
|
|
- if (pe >= end) {
|
|
+ if ((uintptr_t)pe >= (uintptr_t)end) {
|
|
pe = end;
|
|
done++;
|
|
}
|
|
- if (p == pe ) {
|
|
+ if ((uintptr_t)p == (uintptr_t)pe) {
|
|
break;
|
|
}
|
|
/* Original C code replaced with hand tuned assembly code
|
|
@@ -951,16 +955,16 @@ void modtst(int offset, int iter, ulong
|
|
k = 0;
|
|
do {
|
|
/* Check for overflow */
|
|
- if (pe + SPINSZ > pe) {
|
|
+ if ((uintptr_t)(pe + SPINSZ) > (uintptr_t)pe) {
|
|
pe += SPINSZ;
|
|
} else {
|
|
pe = end;
|
|
}
|
|
- if (pe >= end) {
|
|
+ if ((uintptr_t)pe >= (uintptr_t)end) {
|
|
pe = end;
|
|
done++;
|
|
}
|
|
- if (p == pe ) {
|
|
+ if ((uintptr_t)p == (uintptr_t)pe) {
|
|
break;
|
|
}
|
|
/* Original C code replaced with hand tuned assembly code
|
|
@@ -1009,16 +1013,16 @@ void modtst(int offset, int iter, ulong
|
|
done = 0;
|
|
do {
|
|
/* Check for overflow */
|
|
- if (pe + SPINSZ > pe) {
|
|
+ if ((uintptr_t)(pe + SPINSZ) > (uintptr_t)pe) {
|
|
pe += SPINSZ;
|
|
} else {
|
|
pe = end;
|
|
}
|
|
- if (pe >= end) {
|
|
+ if ((uintptr_t)pe >= (uintptr_t)end) {
|
|
pe = end;
|
|
done++;
|
|
}
|
|
- if (p == pe ) {
|
|
+ if ((uintptr_t)p == (uintptr_t)pe) {
|
|
break;
|
|
}
|
|
/* Original C code replaced with hand tuned assembly code
|
|
@@ -1098,16 +1102,16 @@ void block_move(int iter)
|
|
done = 0;
|
|
do {
|
|
/* Check for overflow */
|
|
- if (pe + SPINSZ*4 > pe) {
|
|
+ if ((uintptr_t)(pe + SPINSZ*4) > (uintptr_t)pe) {
|
|
pe += SPINSZ*4;
|
|
} else {
|
|
pe = end;
|
|
}
|
|
- if (pe >= end) {
|
|
+ if ((uintptr_t)pe >= (uintptr_t)end) {
|
|
pe = end;
|
|
done++;
|
|
}
|
|
- if (p == pe ) {
|
|
+ if ((uintptr_t)p == (uintptr_t)pe) {
|
|
break;
|
|
}
|
|
len = ((ulong)pe - (ulong)p) / 64;
|
|
@@ -1167,16 +1171,16 @@ void block_move(int iter)
|
|
done = 0;
|
|
do {
|
|
/* Check for overflow */
|
|
- if (pe + SPINSZ*4 > pe) {
|
|
+ if ((uintptr_t)(pe + SPINSZ*4) > (uintptr_t)pe) {
|
|
pe += SPINSZ*4;
|
|
} else {
|
|
pe = end;
|
|
}
|
|
- if (pe >= end) {
|
|
+ if ((uintptr_t)pe >= (uintptr_t)end) {
|
|
pe = end;
|
|
done++;
|
|
}
|
|
- if (p == pe ) {
|
|
+ if ((uintptr_t)p == (uintptr_t)pe) {
|
|
break;
|
|
}
|
|
pp = p + ((pe - p) / 2);
|
|
@@ -1234,16 +1238,16 @@ void block_move(int iter)
|
|
done = 0;
|
|
do {
|
|
/* Check for overflow */
|
|
- if (pe + SPINSZ*4 > pe) {
|
|
+ if ((uintptr_t)(pe + SPINSZ*4) > (uintptr_t)pe) {
|
|
pe += SPINSZ*4;
|
|
} else {
|
|
pe = end;
|
|
}
|
|
- if (pe >= end) {
|
|
+ if ((uintptr_t)pe >= (uintptr_t)end) {
|
|
pe = end;
|
|
done++;
|
|
}
|
|
- if (p == pe ) {
|
|
+ if ((uintptr_t)p == (uintptr_t)pe) {
|
|
break;
|
|
}
|
|
asm __volatile__ (
|