diff options
author | Keun-young Park <keunyoung@google.com> | 2013-05-07 01:51:16 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2013-05-07 01:51:16 +0000 |
commit | 84336a1fee5050804a9aaa46dc717a9aa9e862f4 (patch) | |
tree | 58c5c0c83fd997ff172dd47fc7d148fc3baa2e1b | |
parent | 7b6942b5f764ef3f146954bef70458db6a71e25d (diff) | |
parent | 3ee90b0f201427268e35d86d7ad95e45aa7491a8 (diff) | |
download | android_external_v8-84336a1fee5050804a9aaa46dc717a9aa9e862f4.tar.gz android_external_v8-84336a1fee5050804a9aaa46dc717a9aa9e862f4.tar.bz2 android_external_v8-84336a1fee5050804a9aaa46dc717a9aa9e862f4.zip |
Merge "Use kernel cacheflush for large sizes on MIPS."
-rw-r--r-- | src/mips/cpu-mips.cc | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/src/mips/cpu-mips.cc b/src/mips/cpu-mips.cc index 93ebeda8..b8200007 100644 --- a/src/mips/cpu-mips.cc +++ b/src/mips/cpu-mips.cc @@ -65,10 +65,23 @@ void CPU::FlushICache(void* start, size_t size) { #if !defined (USE_SIMULATOR) #if defined(ANDROID) - // Bionic cacheflush can typically run in userland, avoiding kernel call. - char *end = reinterpret_cast<char *>(start) + size; - cacheflush( - reinterpret_cast<intptr_t>(start), reinterpret_cast<intptr_t>(end), 0); + // Workaround for a deserializer bug. Bionic usermode cacheflush + // fails in deserializer for a size of Page::kPageSize (1MB), + // because that region contains protected pages. Switch to kernel + // cacheflush in this case. + if (size >= static_cast<size_t>(Page::kPageSize)) { + int res; + // See http://www.linux-mips.org/wiki/Cacheflush_Syscall. + res = syscall(__NR_cacheflush, start, size, ICACHE); + if (res) { + V8_Fatal(__FILE__, __LINE__, "Failed to flush the instruction cache"); + } + } else { + // Bionic cacheflush can typically run in userland, avoiding kernel call. + char *end = reinterpret_cast<char *>(start) + size; + cacheflush( + reinterpret_cast<intptr_t>(start), reinterpret_cast<intptr_t>(end), 0); + } #else // ANDROID int res; // See http://www.linux-mips.org/wiki/Cacheflush_Syscall. |