Use multiline attribute to check for IA2_STATE_MULTILINE.
[chromium-blink-merge.git] / components / nacl / loader / nonsfi / irt_icache.cc
blob49a70b3e9b5ec0e22bcc25d39e6893f174945e76
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.
5 #if defined(__arm__) // nacl_irt_icache is supported only on ARM.
7 #include <errno.h>
8 #include <sys/syscall.h>
9 #include <stddef.h>
11 #include "components/nacl/loader/nonsfi/irt_interfaces.h"
13 namespace nacl {
14 namespace nonsfi {
16 namespace {
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;
31 } // namespace
33 const nacl_irt_icache kIrtIcache = {
34 IrtClearCache
37 } // namespace nonsfi
38 } // namespace nacl
40 #endif