162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (C) 2018 David Abdurachmanov <david.abdurachmanov@gmail.com> 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * This program is free software; you can redistribute it and/or modify 662306a36Sopenharmony_ci * it under the terms of the GNU General Public License version 2 as 762306a36Sopenharmony_ci * published by the Free Software Foundation. 862306a36Sopenharmony_ci * 962306a36Sopenharmony_ci * This program is distributed in the hope that it will be useful, 1062306a36Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of 1162306a36Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 1262306a36Sopenharmony_ci * GNU General Public License for more details. 1362306a36Sopenharmony_ci * 1462306a36Sopenharmony_ci * You should have received a copy of the GNU General Public License 1562306a36Sopenharmony_ci * along with this program. If not, see <https://www.gnu.org/licenses/>. 1662306a36Sopenharmony_ci */ 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci#ifdef __LP64__ 1962306a36Sopenharmony_ci#define __ARCH_WANT_NEW_STAT 2062306a36Sopenharmony_ci#define __ARCH_WANT_SET_GET_RLIMIT 2162306a36Sopenharmony_ci#endif /* __LP64__ */ 2262306a36Sopenharmony_ci 2362306a36Sopenharmony_ci#include <asm-generic/unistd.h> 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci/* 2662306a36Sopenharmony_ci * Allows the instruction cache to be flushed from userspace. Despite RISC-V 2762306a36Sopenharmony_ci * having a direct 'fence.i' instruction available to userspace (which we 2862306a36Sopenharmony_ci * can't trap!), that's not actually viable when running on Linux because the 2962306a36Sopenharmony_ci * kernel might schedule a process on another hart. There is no way for 3062306a36Sopenharmony_ci * userspace to handle this without invoking the kernel (as it doesn't know the 3162306a36Sopenharmony_ci * thread->hart mappings), so we've defined a RISC-V specific system call to 3262306a36Sopenharmony_ci * flush the instruction cache. 3362306a36Sopenharmony_ci * 3462306a36Sopenharmony_ci * __NR_riscv_flush_icache is defined to flush the instruction cache over an 3562306a36Sopenharmony_ci * address range, with the flush applying to either all threads or just the 3662306a36Sopenharmony_ci * caller. We don't currently do anything with the address range, that's just 3762306a36Sopenharmony_ci * in there for forwards compatibility. 3862306a36Sopenharmony_ci */ 3962306a36Sopenharmony_ci#ifndef __NR_riscv_flush_icache 4062306a36Sopenharmony_ci#define __NR_riscv_flush_icache (__NR_arch_specific_syscall + 15) 4162306a36Sopenharmony_ci#endif 4262306a36Sopenharmony_ci__SYSCALL(__NR_riscv_flush_icache, sys_riscv_flush_icache) 43