1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #if defined(__arm__) // nacl_irt_icache is supported only on ARM. 6 7 #include <errno.h> 8 #include <sys/syscall.h> 9 #include <stddef.h> 10 11 #include "components/nacl/loader/nonsfi/irt_interfaces.h" 12 13 namespace nacl { 14 namespace nonsfi { 15 16 namespace { 17 18 // TODO(mazda): Revisit the implementation to consider inlining the syscall 19 // with assembly when Non-SFI mode's IRT implementations get moved to the 20 // NaCl repository. 21 int IrtClearCache(void* addr, size_t size) { 22 // The third argument of cacheflush is just ignored for now and should 23 // always be zero. 24 int result = syscall(__ARM_NR_cacheflush, 25 addr, reinterpret_cast<intptr_t>(addr) + size, 0); 26 if (result < 0) 27 return errno; 28 return 0; 29 } 30 31 } // namespace 32 33 const nacl_irt_icache kIrtIcache = { 34 IrtClearCache 35 }; 36 37 } // namespace nonsfi 38 } // namespace nacl 39 40 #endif 41