|
From: <sv...@va...> - 2013-09-15 22:17:03
|
Author: petarj
Date: Sun Sep 15 22:16:38 2013
New Revision: 13550
Log:
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.
Modified:
trunk/perf/bigcode.c
Modified: trunk/perf/bigcode.c
==============================================================================
--- trunk/perf/bigcode.c (original)
+++ trunk/perf/bigcode.c Sun Sep 15 22:16:38 2013
@@ -10,6 +10,10 @@
#include <stdio.h>
#include <string.h>
#include <assert.h>
+#if defined(__mips__)
+#include <asm/cachectl.h>
+#include <sys/syscall.h>
+#endif
#include "tests/sys_mman.h"
#define FN_SIZE 996 // Must be big enough to hold the compiled f()
@@ -58,7 +62,11 @@
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)];
|
|
From: Petar J. <mip...@gm...> - 2013-09-15 22:50:42
|
ARM version likely needs something similar.
Regards,
Petar
On Mon, Sep 16, 2013 at 12:16 AM, <sv...@va...> wrote:
> Author: petarj
> Date: Sun Sep 15 22:16:38 2013
> New Revision: 13550
>
> Log:
> 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.
>
> Modified:
> trunk/perf/bigcode.c
>
> Modified: trunk/perf/bigcode.c
>
> ==============================================================================
> --- trunk/perf/bigcode.c (original)
> +++ trunk/perf/bigcode.c Sun Sep 15 22:16:38 2013
> @@ -10,6 +10,10 @@
> #include <stdio.h>
> #include <string.h>
> #include <assert.h>
> +#if defined(__mips__)
> +#include <asm/cachectl.h>
> +#include <sys/syscall.h>
> +#endif
> #include "tests/sys_mman.h"
>
> #define FN_SIZE 996 // Must be big enough to hold the compiled f()
> @@ -58,7 +62,11 @@
> 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)];
>
>
>
> ------------------------------------------------------------------------------
> LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
> 1,500+ hours of tutorials including VisualStudio 2012, Windows 8,
> SharePoint
> 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack
> includes
> Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/22/13.
> http://pubads.g.doubleclick.net/gampad/clk?id=64545871&iu=/4140/ostg.clktrk
> _______________________________________________
> Valgrind-developers mailing list
> Val...@li...
> https://lists.sourceforge.net/lists/listinfo/valgrind-developers
>
|