Put in the version of the gcc4.2+ patch that is being sent upstream

This commit is contained in:
Jarod Wilson 2009-08-18 20:26:25 +00:00
parent ae06925af1
commit d014845287
2 changed files with 239 additions and 137 deletions

View File

@ -1,5 +1,5 @@
--- memtest86+-2.11/test.c.orig 2008-11-15 19:18:14.000000000 -0500
+++ memtest86+-2.11/test.c 2009-08-17 17:21:42.904932613 -0400
+++ memtest86+-2.11/test.c 2009-08-18 16:01:33.845957770 -0400
@@ -13,6 +13,7 @@
#include "config.h"
#include <sys/io.h>
@ -8,7 +8,7 @@
extern int segs, bail;
extern volatile ulong *p;
@@ -150,7 +151,7 @@ void addr_tst2()
@@ -150,16 +151,16 @@ void addr_tst2()
done = 0;
do {
/* Check for overflow */
@ -17,72 +17,70 @@
pe += SPINSZ;
} else {
pe = end;
@@ -194,7 +195,7 @@ 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;
@@ -256,17 +257,19 @@ void addr_tst2()
*/
void movinvr()
{
- int i, j, done, seed1, seed2;
+ int i, seed1, seed2;
+ int j, done;
volatile ulong *pe;
volatile ulong *start,*end;
ulong num;
+ uintptr_t next;
/* Initialize memory with initial sequence of random numbers. */
if (v->rdtsc) {
asm __volatile__ ("rdtsc":"=a" (seed1),"=d" (seed2));
} else {
- seed1 = 521288629 + v->pass;
- seed2 = 362436069 - v->pass;
+ seed1 = (int)(521288629 + v->pass);
+ seed2 = (int)(362436069 - v->pass);
}
/* Display the current seed */
@@ -277,28 +280,20 @@ void movinvr()
end = v->map[j].end;
pe = start;
p = start;
+ next = (uintptr_t)p;
done = 0;
do {
/* Check for overflow */
- if (pe + SPINSZ > pe) {
+ if (((uintptr_t)(pe + SPINSZ) > (uintptr_t)pe) &&
+ ((uintptr_t)(pe + SPINSZ) < (uintptr_t)end)) {
pe += SPINSZ;
} else {
pe = end;
- }
}
- if (pe >= end) {
- pe = end;
+ if ((uintptr_t)pe >= (uintptr_t)end) {
pe = end;
done++;
}
- if (p == pe ) {
+ if (next == (uintptr_t)pe) {
+ if ((uintptr_t)p == (uintptr_t)pe) {
break;
}
-/* Original C code replaced with hand tuned assembly code */
-/*
- for (; p < pe; p++) {
- *p = rand();
- }
- */
-
asm __volatile__ (
"jmp L200\n\t"
".p2align 4,,7\n\t"
@@ -310,7 +305,7 @@ void movinvr()
@@ -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)
@ -91,60 +89,11 @@
);
do_tick();
@@ -324,23 +319,28 @@ void movinvr()
for (i=0; i<2; i++) {
rand_seed(seed1, seed2);
for (j=0; j<segs; j++) {
- start = v->map[j].start;
- end = v->map[j].end;
+ start = (ulong *)(v->map[j].start);
+ end = (ulong *)(v->map[j].end);
@@ -328,19 +331,20 @@ void movinvr()
end = v->map[j].end;
pe = start;
p = start;
done = 0;
do {
/* Check for overflow */
- if (pe + SPINSZ > pe) {
+ next = (uintptr_t)(pe + SPINSZ);
+ if ((next > (uintptr_t)pe) &&
+ (next < (uintptr_t)end)) {
pe += SPINSZ;
} else {
pe = end;
+ done++;
}
+#if 0
if (pe >= end) {
pe = end;
done++;
}
- if (p == pe ) {
+#endif
+ if ((uintptr_t)p == (uintptr_t)pe) {
break;
}
/* Original C code replaced with hand tuned assembly code */
@@ -359,8 +359,9 @@ void movinvr()
if (i) {
num = 0xffffffff;
} else {
- num = 0;
+ num = 0x0;
}
+
asm __volatile__ (
"jmp L26\n\t" \
@@ -427,7 +428,7 @@ 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;
@@ -468,7 +469,7 @@ void movinv1(int iter, ulong p1, ulong p
+ seg_start = (uintptr_t)p;
done = 0;
do {
/* Check for overflow */
@ -153,7 +102,59 @@
pe += SPINSZ;
} else {
pe = end;
@@ -534,7 +535,7 @@ void movinv1(int iter, ulong p1, ulong p
}
- 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 */
@ -162,7 +163,18 @@
pe -= SPINSZ;
} else {
pe = start;
@@ -623,7 +624,7 @@ void movinv32(int iter, ulong p1, ulong
}
- 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 */
@ -171,7 +183,18 @@
pe += SPINSZ;
} else {
pe = end;
@@ -685,7 +686,7 @@ void movinv32(int iter, ulong p1, ulong
}
- 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 */
@ -180,7 +203,18 @@
pe += SPINSZ;
} else {
pe = end;
@@ -798,7 +799,7 @@ void movinv32(int iter, ulong p1, ulong
}
- 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 */
@ -189,7 +223,18 @@
pe -= SPINSZ;
} else {
pe = start;
@@ -906,7 +907,7 @@ void modtst(int offset, int iter, ulong
}
- 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 */
@ -198,7 +243,18 @@
pe += SPINSZ;
} else {
pe = end;
@@ -951,7 +952,7 @@ void modtst(int offset, int iter, ulong
}
- 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 */
@ -207,7 +263,18 @@
pe += SPINSZ;
} else {
pe = end;
@@ -1009,7 +1010,7 @@ void modtst(int offset, int iter, ulong
}
- 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 */
@ -216,39 +283,74 @@
pe += SPINSZ;
} else {
pe = end;
@@ -1098,8 +1099,9 @@ void block_move(int iter)
}
- 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) {
- pe += SPINSZ*4;
+ if ((uintptr_t)(pe + SPINSZ * sizeof(ulong)) >
+ (uintptr_t)pe) {
+ pe += SPINSZ * sizeof(ulong);
+ if ((uintptr_t)(pe + SPINSZ*4) > (uintptr_t)pe) {
pe += SPINSZ*4;
} else {
pe = end;
}
@@ -1167,8 +1169,9 @@ void block_move(int iter)
- 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) {
- pe += SPINSZ*4;
+ if ((uintptr_t)(pe + SPINSZ * sizeof(ulong)) >
+ (uintptr_t)pe) {
+ pe += SPINSZ * sizeof(ulong);
+ if ((uintptr_t)(pe + SPINSZ*4) > (uintptr_t)pe) {
pe += SPINSZ*4;
} else {
pe = end;
}
@@ -1234,8 +1237,9 @@ void block_move(int iter)
- 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) {
- pe += SPINSZ*4;
+ if ((uintptr_t)(pe + SPINSZ * sizeof(ulong)) >
+ (uintptr_t)pe) {
+ pe += SPINSZ * sizeof(ulong);
+ 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__ (

View File

@ -40,7 +40,7 @@ to add the %{name} entry to your GRUB boot menu.
%prep
%setup -q
%patch0 -p1
#patch0 -p1
sed -i -e's,0x10000,0x100000,' memtest.lds
%build