/usr/src/linux-headers-5.15.0-190/arch/riscv/include/asm
NameSizeModeActions
vdso/-0755rm
alternative-macros.h46580644editdlrm
alternative.h9300644editdlrm
asm-offsets.h350644editdlrm
asm-prototypes.h10400644editdlrm
asm.h15580644editdlrm
atomic.h110280644editdlrm
barrier.h24580644editdlrm
bitops.h58090644editdlrm
bug.h21860644editdlrm
cache.h5160644editdlrm
cacheflush.h13990644editdlrm
cacheinfo.h5110644editdlrm
clint.h7970644editdlrm
clocksource.h1360644editdlrm
cmpxchg.h95370644editdlrm
cpu_ops.h14940644editdlrm
csr.h60620644editdlrm
current.h9400644editdlrm
delay.h4710644editdlrm
efi.h11500644editdlrm
elf.h27260644editdlrm
errata_list.h10740644editdlrm
fence.h2790644editdlrm
fixmap.h18060644editdlrm
ftrace.h30860644editdlrm
futex.h29060644editdlrm
gdb_xml.h56010644editdlrm
hugetlb.h3600644editdlrm
hwcap.h12450644editdlrm
image.h16730644editdlrm
io.h53220644editdlrm
irq.h3470644editdlrm
irqflags.h11750644editdlrm
irq_work.h2250644editdlrm
jump_label.h14400644editdlrm
kasan.h13900644editdlrm
Kbuild1780644editdlrm
kdebug.h1580644editdlrm
kexec.h13490644editdlrm
kfence.h13120644editdlrm
kgdb.h24940644editdlrm
kprobes.h11360644editdlrm
linkage.h2670644editdlrm
mmio.h53470644editdlrm
mmiowb.h3980644editdlrm
mmu.h6100644editdlrm
mmu_context.h8980644editdlrm
mmzone.h2660644editdlrm
module.h29840644editdlrm
module.lds.h2070644editdlrm
numa.h1650644editdlrm
page.h52640644editdlrm
parse_asm.h72650644editdlrm
patch.h3140644editdlrm
pci.h10620644editdlrm
perf_event.h22040644editdlrm
pgalloc.h18010644editdlrm
pgtable-32.h4980644editdlrm
pgtable-64.h18980644editdlrm
pgtable-bits.h15520644editdlrm
pgtable.h180860644editdlrm
probes.h5630644editdlrm
processor.h21380644editdlrm
ptdump.h3380644editdlrm
ptrace.h43040644editdlrm
sbi.h42230644editdlrm
seccomp.h5040644editdlrm
sections.h8830644editdlrm
set_memory.h18690644editdlrm
smp.h24270644editdlrm
soc.h6270644editdlrm
sparsemem.h2630644editdlrm
spinlock.h25080644editdlrm
spinlock_types.h5300644editdlrm
stackprotector.h7680644editdlrm
stacktrace.h4960644editdlrm
string.h10780644editdlrm
switch_to.h21070644editdlrm
syscall.h21630644editdlrm
thread_info.h39550644editdlrm
timex.h18590644editdlrm
tlb.h4030644editdlrm
tlbflush.h18030644editdlrm
uaccess.h139550644editdlrm
unistd.h3280644editdlrm
uprobes.h8280644editdlrm
vdso.h8680644editdlrm
vendorid_list.h1720644editdlrm
vermagic.h2130644editdlrm
vmalloc.h930644editdlrm
word-at-a-time.h11040644editdlrm
Edit: /usr/src/linux-headers-5.15.0-190/arch/riscv/include/asm/futex.h (2906B)
/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (c) 2006 Ralf Baechle (ralf@linux-mips.org) * Copyright (c) 2018 Jim Wilson (jimw@sifive.com) */ #ifndef _ASM_RISCV_FUTEX_H #define _ASM_RISCV_FUTEX_H #include #include #include #include /* We don't even really need the extable code, but for now keep it simple */ #ifndef CONFIG_MMU #define __enable_user_access() do { } while (0) #define __disable_user_access() do { } while (0) #endif #define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ { \ uintptr_t tmp; \ __enable_user_access(); \ __asm__ __volatile__ ( \ "1: " insn " \n" \ "2: \n" \ " .section .fixup,\"ax\" \n" \ " .balign 4 \n" \ "3: li %[r],%[e] \n" \ " jump 2b,%[t] \n" \ " .previous \n" \ " .section __ex_table,\"a\" \n" \ " .balign " RISCV_SZPTR " \n" \ " " RISCV_PTR " 1b, 3b \n" \ " .previous \n" \ : [r] "+r" (ret), [ov] "=&r" (oldval), \ [u] "+m" (*uaddr), [t] "=&r" (tmp) \ : [op] "Jr" (oparg), [e] "i" (-EFAULT) \ : "memory"); \ __disable_user_access(); \ } static inline int arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *uaddr) { int oldval = 0, ret = 0; if (!access_ok(uaddr, sizeof(u32))) return -EFAULT; switch (op) { case FUTEX_OP_SET: __futex_atomic_op("amoswap.w.aqrl %[ov],%z[op],%[u]", ret, oldval, uaddr, oparg); break; case FUTEX_OP_ADD: __futex_atomic_op("amoadd.w.aqrl %[ov],%z[op],%[u]", ret, oldval, uaddr, oparg); break; case FUTEX_OP_OR: __futex_atomic_op("amoor.w.aqrl %[ov],%z[op],%[u]", ret, oldval, uaddr, oparg); break; case FUTEX_OP_ANDN: __futex_atomic_op("amoand.w.aqrl %[ov],%z[op],%[u]", ret, oldval, uaddr, ~oparg); break; case FUTEX_OP_XOR: __futex_atomic_op("amoxor.w.aqrl %[ov],%z[op],%[u]", ret, oldval, uaddr, oparg); break; default: ret = -ENOSYS; } if (!ret) *oval = oldval; return ret; } static inline int futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, u32 oldval, u32 newval) { int ret = 0; u32 val; uintptr_t tmp; if (!access_ok(uaddr, sizeof(u32))) return -EFAULT; __enable_user_access(); __asm__ __volatile__ ( "1: lr.w.aqrl %[v],%[u] \n" " bne %[v],%z[ov],3f \n" "2: sc.w.aqrl %[t],%z[nv],%[u] \n" " bnez %[t],1b \n" "3: \n" " .section .fixup,\"ax\" \n" " .balign 4 \n" "4: li %[r],%[e] \n" " jump 3b,%[t] \n" " .previous \n" " .section __ex_table,\"a\" \n" " .balign " RISCV_SZPTR " \n" " " RISCV_PTR " 1b, 4b \n" " " RISCV_PTR " 2b, 4b \n" " .previous \n" : [r] "+r" (ret), [v] "=&r" (val), [u] "+m" (*uaddr), [t] "=&r" (tmp) : [ov] "Jr" (oldval), [nv] "Jr" (newval), [e] "i" (-EFAULT) : "memory"); __disable_user_access(); *uval = val; return ret; } #endif /* _ASM_RISCV_FUTEX_H */