From 2baef4409c244c3b5d2515f9f6326ca5268525fb Mon Sep 17 00:00:00 2001 From: Lu Yahan Date: Mon, 9 Dec 2024 19:20:03 +0800 Subject: [PATCH] deps: V8: backport 9ab40592f697 Original commit message: [riscv] Flush icache in both local and remote harts Fix the I-Cache flush flag according to the implementation of flush_icache_mm in Linux kernel. Change-Id: I6e6b1f56c377c2c0a629e170737bfac6c357ce8d Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6080611 Commit-Queue: Yahan Lu (LuYahan) Reviewed-by: Ji Qiu Cr-Commit-Position: refs/heads/main@{#97673} Refs: https://github.com/v8/v8/commit/9ab40592f697795f13e71325a18ecbe8cf5857ed Co-authored-by: kxxt --- common.gypi | 2 +- deps/v8/src/codegen/riscv/cpu-riscv.cc | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/common.gypi b/common.gypi index 04852d81103ef8..d3c17d47bc141b 100644 --- a/common.gypi +++ b/common.gypi @@ -36,7 +36,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.25', + 'v8_embedder_string': '-node.26', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/src/codegen/riscv/cpu-riscv.cc b/deps/v8/src/codegen/riscv/cpu-riscv.cc index 205e13fa988cac..143602dfb663c7 100644 --- a/deps/v8/src/codegen/riscv/cpu-riscv.cc +++ b/deps/v8/src/codegen/riscv/cpu-riscv.cc @@ -15,12 +15,12 @@ namespace internal { void CpuFeatures::FlushICache(void* start, size_t size) { #if !defined(USE_SIMULATOR) char* end = reinterpret_cast(start) + size; - // The definition of this syscall is - // SYSCALL_DEFINE3(riscv_flush_icache, uintptr_t, start, - // uintptr_t, end, uintptr_t, flags) - // The flag here is set to be SYS_RISCV_FLUSH_ICACHE_LOCAL, which is - // defined as 1 in the Linux kernel. - syscall(SYS_riscv_flush_icache, start, end, 1); + // SYS_riscv_flush_icache is a symbolic constant used in user-space code to + // identify the flush_icache system call, while __NR_riscv_flush_icache is the + // corresponding system call number used in the kernel to dispatch the system + // call. + // The flag set to zero will flush all cpu cores. + syscall(__NR_riscv_flush_icache, start, end, 0); #endif // !USE_SIMULATOR. }