[CI20] Call _flush_cache directly for MIPS
This is a workaround for issues with currently used toolchains:
LLVM toolchain used in Cobalt is missing compiler-rt builtins
and GCC 4.9 does not support __has_builtin nor __clear_cache.
This change adds direct call to _flush_cache().
Change-Id: Ie4dc2e4d4f2183074fe1b3d31ab3285cc74cc53c
diff --git a/src/starboard/shared/posix/memory_flush.cc b/src/starboard/shared/posix/memory_flush.cc
index 46611d5..1b529e9 100644
--- a/src/starboard/shared/posix/memory_flush.cc
+++ b/src/starboard/shared/posix/memory_flush.cc
@@ -18,6 +18,10 @@
#include <iomanip>
+#if SB_IS(ARCH_MIPS)
+#include <sys/cachectl.h>
+#endif
+
#include "starboard/log.h"
#if !SB_CAN(MAP_EXECUTABLE_MEMORY)
@@ -33,6 +37,11 @@
<< std::dec << result << "d)";
#endif
+#if SB_IS(ARCH_MIPS)
+ _flush_cache(reinterpret_cast<char*>(memory), (size_t)size_bytes, BCACHE);
+ return;
+#endif
+
#if !defined(__has_builtin)
#define __has_builtin(a) (0)
#endif