From: Petar Jovanovic Date: Sun, 15 Sep 2013 22:16:38 +0000 (+0000) Subject: mips: flush the cache in perf/bigcode.c X-Git-Tag: svn/VALGRIND_3_9_0~141 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6303a18f514373c42c2dad12c72647279ff2cb74;p=thirdparty%2Fvalgrind.git mips: flush the cache in perf/bigcode.c MIPS needs to flush the cache after memcpy in perf/bigcode.c. Otherwise, the executed code will likely be wrong. This fixes issues with bigcode test on some MIPS platforms. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13550 --- diff --git a/perf/bigcode.c b/perf/bigcode.c index c36879858b..628cd01dd4 100644 --- a/perf/bigcode.c +++ b/perf/bigcode.c @@ -10,6 +10,10 @@ #include #include #include +#if defined(__mips__) +#include +#include +#endif #include "tests/sys_mman.h" #define FN_SIZE 996 // Must be big enough to hold the compiled f() @@ -58,7 +62,11 @@ int main(int argc, char* argv[]) for (i = 0; i < n_fns; i++) { memcpy(&a[FN_SIZE*i], f, FN_SIZE); } - + +#if defined(__mips__) + syscall(__NR_cacheflush, a, FN_SIZE * n_fns, ICACHE); +#endif + for (h = 0; h < n_reps; h += 1) { for (i = 0; i < n_fns; i += 4) { int(*f1)(int,int) = (void*)&a[FN_SIZE*(i+0)];