syscalls.h 1.2 KB

1234567891011121314151617181920212223242526272829
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2017-2018 SiFive
  4. */
  5. /*
  6. * There is explicitly no include guard here because this file is expected to
  7. * be included multiple times in order to define the syscall macros via
  8. * __SYSCALL.
  9. */
  10. /*
  11. * Allows the instruction cache to be flushed from userspace. Despite RISC-V
  12. * having a direct 'fence.i' instruction available to userspace (which we
  13. * can't trap!), that's not actually viable when running on Linux because the
  14. * kernel might schedule a process on another hart. There is no way for
  15. * userspace to handle this without invoking the kernel (as it doesn't know the
  16. * thread->hart mappings), so we've defined a RISC-V specific system call to
  17. * flush the instruction cache.
  18. *
  19. * __NR_riscv_flush_icache is defined to flush the instruction cache over an
  20. * address range, with the flush applying to either all threads or just the
  21. * caller. We don't currently do anything with the address range, that's just
  22. * in there for forwards compatibility.
  23. */
  24. #ifndef __NR_riscv_flush_icache
  25. #define __NR_riscv_flush_icache (__NR_arch_specific_syscall + 15)
  26. #endif
  27. __SYSCALL(__NR_riscv_flush_icache, sys_riscv_flush_icache)