summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2016-11-28 12:05:22 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2016-11-28 12:05:22 +0000
commit4e68ebf9b6e0287f3b4f8ed6db36efdf1c81c09d (patch)
treec8f5260d9b68614f85b2947d81122ffcaf99fdec
parent35b6546b0a4fe423ed6f27d8c5b709d5191e99ef (diff)
parentb18a669259aa6ba08d9ca01b5b32c1aa0417138b (diff)
Merge "Cache flush/invalidate needs RWX permission"
-rw-r--r--runtime/jit/jit_code_cache.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/runtime/jit/jit_code_cache.cc b/runtime/jit/jit_code_cache.cc
index f0ed237fe0..3531852933 100644
--- a/runtime/jit/jit_code_cache.cc
+++ b/runtime/jit/jit_code_cache.cc
@@ -428,10 +428,16 @@ uint8_t* JitCodeCache::CommitCodeInternal(Thread* self,
core_spill_mask,
fp_spill_mask,
code_size);
+ // Flush caches before we remove write permission because on some ARMv8 hardware,
+ // flushing caches require write permissions.
+ //
+ // For reference, here are kernel patches discussing about this issue:
+ // https://android.googlesource.com/kernel/msm/%2B/0e7f7bcc3fc87489cda5aa6aff8ce40eed912279
+ // https://patchwork.kernel.org/patch/9047921/
+ FlushInstructionCache(reinterpret_cast<char*>(code_ptr),
+ reinterpret_cast<char*>(code_ptr + code_size));
}
- FlushInstructionCache(reinterpret_cast<char*>(code_ptr),
- reinterpret_cast<char*>(code_ptr + code_size));
number_of_compilations_++;
}
// We need to update the entry point in the runnable state for the instrumentation.