• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2021 the V8 project 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 // CPU specific code for arm independent of OS goes here.
6 
7 #include <sys/syscall.h>
8 #include <unistd.h>
9 
10 #if V8_TARGET_ARCH_RISCV64
11 
12 #include "src/codegen/cpu-features.h"
13 
14 namespace v8 {
15 namespace internal {
16 
FlushICache(void * start,size_t size)17 void CpuFeatures::FlushICache(void* start, size_t size) {
18 #if !defined(USE_SIMULATOR)
19   char* end = reinterpret_cast<char*>(start) + size;
20   // The definition of this syscall is
21   // SYSCALL_DEFINE3(riscv_flush_icache, uintptr_t, start,
22   //                 uintptr_t, end, uintptr_t, flags)
23   // The flag here is set to be SYS_RISCV_FLUSH_ICACHE_LOCAL, which is
24   // defined as 1 in the Linux kernel.
25   syscall(SYS_riscv_flush_icache, start, end, 1);
26 #endif  // !USE_SIMULATOR.
27 }
28 
29 }  // namespace internal
30 }  // namespace v8
31 
32 #endif  // V8_TARGET_ARCH_RISCV64
33