File use_assembler_routine.patch of Package memtest86+

Use assember code, don't execute the functions twice



Index: memtest86+-4.00/test.c
===================================================================
--- memtest86+-4.00.orig/test.c
+++ memtest86+-4.00/test.c
@@ -444,17 +444,19 @@ void movinv1(int iter, ulong p1, ulong p
 			if ((uintptr_t)p == (uintptr_t)pe) {
 				break;
 			}
-/* Original C code replaced with hand tuned assembly code
- *			for (; p < pe; p++) {
- *				*p = p1;
- *			}
- */
+/* Original C code replaced with hand tuned assembly code */
+#if 0
+  			for (; p < pe; p++) {
+  				*p = p1;
+  			}
+#else
 			asm __volatile__ (
 				"rep\n\t" \
 				"stosl\n\t"
 				: "=D" (p)
 				: "c" (len), "0" (p), "a" (p1)
 			);
+#endif
 			do_tick();
 			BAILR
 		} while (!done);
@@ -484,14 +486,16 @@ void movinv1(int iter, ulong p1, ulong p
 				if ((uintptr_t)p == (uintptr_t)pe) {
 					break;
 				}
-/* Original C code replaced with hand tuned assembly code
- *				for (; p < pe; p++) {
- *					if ((bad=*p) != p1) {
- *						error((ulong*)p, p1, bad);
- *					}
- *					*p = p2;
- *				}
- */
+/* Original C code replaced with hand tuned assembly code */
+#if 0
+  				for (; p < pe; p++) {
+					ulong bad;
+  					if ((bad=*p) != p1) {
+  						error((ulong*)p, p1, bad);
+  					}
+  					*p = p2;
+  				}
+#else
 				asm __volatile__ (
 					"jmp L2\n\t" \
 
@@ -526,10 +530,12 @@ void movinv1(int iter, ulong p1, ulong p
 					: "a" (p1), "0" (p), "d" (pe), "b" (p2)
 					: "ecx"
 				);
+#endif
 				do_tick();
 				BAILR
 			} while (!done);
 		}
+
 		for (j=segs-1; j>=0; j--) {
 			start = v->map[j].start;
 			end = v->map[j].end;
@@ -550,14 +556,16 @@ void movinv1(int iter, ulong p1, ulong p
 				if ((uintptr_t)p == (uintptr_t)pe) {
 					break;
 				}
-/* Original C code replaced with hand tuned assembly code
- *				do {
- *					if ((bad=*p) != p2) {
- *						error((ulong*)p, p2, bad);
- *					}
- *					*p = p1;
- *				} while (p-- > pe);
- */
+/* Original C code replaced with hand tuned assembly code */
+#if 0
+  				do {
+					ulong bad;
+  					if ((bad=*p) != p2) {
+  						error((ulong*)p, p2, bad);
+  					}
+  					*p = p1;
+  				} while (p-- > pe);
+#else
 				asm __volatile__ (
 					"addl $4, %%edi\n\t"
 					"jmp L9\n\t"
@@ -594,6 +602,7 @@ void movinv1(int iter, ulong p1, ulong p
 					: "a" (p1), "0" (p), "d" (pe), "b" (p2)
 					: "ecx"
 				);
+#endif
 				do_tick();
 				BAILR
 			} while (!done);
openSUSE Build Service is sponsored by