From 18f28fb2c0950772f9db5679b13e71ab4f9f9b98 Mon Sep 17 00:00:00 2001 From: "danno@chromium.org" Date: Thu, 26 Jan 2012 16:54:44 +0000 Subject: [PATCH] MIPS: Added Android-specific version of cacheflush call. BUG= TEST= Review URL: https://chromiumcodereview.appspot.com/9234059 Patch from Daniel Kalmar . git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10518 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/mips/cpu-mips.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/mips/cpu-mips.cc b/src/mips/cpu-mips.cc index a1e062c803..93ebeda800 100644 --- a/src/mips/cpu-mips.cc +++ b/src/mips/cpu-mips.cc @@ -1,4 +1,4 @@ -// Copyright 2011 the V8 project authors. All rights reserved. +// Copyright 2012 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: @@ -64,15 +64,19 @@ 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(start) + size; + cacheflush( + reinterpret_cast(start), reinterpret_cast(end), 0); +#else // ANDROID 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"); } - +#endif // ANDROID #else // USE_SIMULATOR. // Not generating mips instructions for C-code. This means that we are // building a mips emulator based target. We should notify the simulator