/usr/src/linux-headers-5.15.0-181/arch/arm/include/asm
NameSizeModeActions
hardware/-0755rm
mach/-0755rm
vdso/-0755rm
xen/-0755rm
archrandom.h1920644editdlrm
arch_gicv3.h63270644editdlrm
arch_timer.h31240644editdlrm
arm-cci.h5350644editdlrm
asm-offsets.h350644editdlrm
assembler.h131060644editdlrm
atomic.h125360644editdlrm
auxvec.h290644editdlrm
barrier.h29100644editdlrm
bitops.h76270644editdlrm
bitrev.h4510644editdlrm
bL_switcher.h21860644editdlrm
bug.h26200644editdlrm
bugs.h2970644editdlrm
cache.h7940644editdlrm
cacheflush.h157940644editdlrm
cachetype.h27790644editdlrm
checksum.h40260644editdlrm
clocksource.h1610644editdlrm
cmpxchg.h63280644editdlrm
compiler.h9780644editdlrm
cp15.h33020644editdlrm
cpu.h3870644editdlrm
cpufeature.h12910644editdlrm
cpuidle.h16280644editdlrm
cputype.h87660644editdlrm
cti.h37030644editdlrm
dcc.h6230644editdlrm
delay.h29030644editdlrm
device.h6360644editdlrm
div64.h26400644editdlrm
dma-direct.h13410644editdlrm
dma-iommu.h9080644editdlrm
dma-mapping.h47140644editdlrm
dma.h42870644editdlrm
dmi.h3780644editdlrm
domain.h37510644editdlrm
ecard.h61190644editdlrm
edac.h9950644editdlrm
efi.h25010644editdlrm
elf.h46360644editdlrm
entry-macro-multi.S3360644editdlrm
exception.h4160644editdlrm
fb.h3750644editdlrm
fiq.h13910644editdlrm
firmware.h17280644editdlrm
fixmap.h18810644editdlrm
floppy.h23180644editdlrm
fncpy.h25520644editdlrm
fpstate.h14780644editdlrm
ftrace.h18210644editdlrm
futex.h43570644editdlrm
glue-cache.h35150644editdlrm
glue-df.h21100644editdlrm
glue-pf.h10050644editdlrm
glue-proc.h44240644editdlrm
glue.h6130644editdlrm
gpio.h6150644editdlrm
hardirq.h2460644editdlrm
highmem.h23790644editdlrm
hugetlb-3level.h6900644editdlrm
hugetlb.h5130644editdlrm
hwcap.h3780644editdlrm
hw_breakpoint.h38110644editdlrm
hw_irq.h3490644editdlrm
hypervisor.h2240644editdlrm
ide.h5660644editdlrm
idmap.h3590644editdlrm
insn.h6360644editdlrm
io.h150270644editdlrm
irq.h8870644editdlrm
irqflags.h39690644editdlrm
irq_work.h2340644editdlrm
jump_label.h10090644editdlrm
kasan.h7080644editdlrm
kasan_def.h27260644editdlrm
Kbuild1860644editdlrm
kexec-internal.h2720644editdlrm
kexec.h22550644editdlrm
kgdb.h27830644editdlrm
kprobes.h22480644editdlrm
krait-l2-accessors.h2310644editdlrm
linkage.h2160644editdlrm
mc146818rtc.h7200644editdlrm
mcpm.h120610644editdlrm
mcs_spinlock.h5700644editdlrm
memblock.h2480644editdlrm
memory.h109450644editdlrm
mmu.h9530644editdlrm
mmu_context.h34610644editdlrm
module.h12160644editdlrm
module.lds.h1340644editdlrm
mpu.h33000644editdlrm
mtd-xip.h5200644editdlrm
neon.h10410644editdlrm
nwflash.h1950644editdlrm
opcodes-sec.h3500644editdlrm
opcodes-virt.h6840644editdlrm
opcodes.h81180644editdlrm
outercache.h32680644editdlrm
page-nommu.h8110644editdlrm
page.h34480644editdlrm
paravirt.h4770644editdlrm
patch.h4380644editdlrm
pci.h7940644editdlrm
percpu.h10690644editdlrm
perf_event.h7080644editdlrm
pgalloc.h33730644editdlrm
pgtable-2level-hwdef.h33850644editdlrm
pgtable-2level-types.h12780644editdlrm
pgtable-2level.h86450644editdlrm
pgtable-3level-hwdef.h34350644editdlrm
pgtable-3level-types.h13310644editdlrm
pgtable-3level.h81480644editdlrm
pgtable-hwdef.h3210644editdlrm
pgtable-nommu.h19790644editdlrm
pgtable.h104920644editdlrm
probes.h13320644editdlrm
proc-fns.h47540644editdlrm
processor.h31660644editdlrm
procinfo.h11520644editdlrm
prom.h5520644editdlrm
psci.h3790644editdlrm
ptdump.h9230644editdlrm
ptrace.h48410644editdlrm
seccomp.h2810644editdlrm
sections.h6220644editdlrm
secure_cntvoff.h1520644editdlrm
setup.h7730644editdlrm
set_memory.h7200644editdlrm
shmparam.h4190644editdlrm
signal.h5590644editdlrm
smp.h28390644editdlrm
smp_plat.h25350644editdlrm
smp_scu.h13520644editdlrm
smp_twd.h5900644editdlrm
sparsemem.h7160644editdlrm
spectre.h9060644editdlrm
spinlock.h56450644editdlrm
spinlock_types.h5410644editdlrm
stackprotector.h13570644editdlrm
stacktrace.h7420644editdlrm
string.h21650644editdlrm
suspend.h3690644editdlrm
swab.h10050644editdlrm
switch_to.h10580644editdlrm
sync_bitops.h15140644editdlrm
syscall.h23470644editdlrm
system_info.h7630644editdlrm
system_misc.h10050644editdlrm
tcm.h9250644editdlrm
therm.h6550644editdlrm
thread_info.h49740644editdlrm
thread_notify.h10860644editdlrm
timex.h4310644editdlrm
tlb.h14420644editdlrm
tlbflush.h179090644editdlrm
tls.h31660644editdlrm
topology.h11390644editdlrm
traps.h9110644editdlrm
uaccess-asm.h27030644editdlrm
uaccess.h174310644editdlrm
ucontext.h27450644editdlrm
unified.h9790644editdlrm
unistd.h15780644editdlrm
unwind.h11730644editdlrm
uprobes.h9480644editdlrm
user.h43020644editdlrm
v7m.h32330644editdlrm
vdso.h5070644editdlrm
vdso_datapage.h4440644editdlrm
vermagic.h8000644editdlrm
vfp.h29690644editdlrm
vfpmacros.h20740644editdlrm
vga.h3050644editdlrm
virt.h18550644editdlrm
vmalloc.h870644editdlrm
vmlinux.lds.h44900644editdlrm
word-at-a-time.h21280644editdlrm
xor.h52040644editdlrm
Edit: /usr/src/linux-headers-5.15.0-181/arch/arm/include/asm/cmpxchg.h (6328B)
/* SPDX-License-Identifier: GPL-2.0 */ #ifndef __ASM_ARM_CMPXCHG_H #define __ASM_ARM_CMPXCHG_H #include #include #include #if defined(CONFIG_CPU_SA1100) || defined(CONFIG_CPU_SA110) /* * On the StrongARM, "swp" is terminally broken since it bypasses the * cache totally. This means that the cache becomes inconsistent, and, * since we use normal loads/stores as well, this is really bad. * Typically, this causes oopsen in filp_close, but could have other, * more disastrous effects. There are two work-arounds: * 1. Disable interrupts and emulate the atomic swap * 2. Clean the cache, perform atomic swap, flush the cache * * We choose (1) since its the "easiest" to achieve here and is not * dependent on the processor type. * * NOTE that this solution won't work on an SMP system, so explcitly * forbid it here. */ #define swp_is_buggy #endif static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size) { extern void __bad_xchg(volatile void *, int); unsigned long ret; #ifdef swp_is_buggy unsigned long flags; #endif #if __LINUX_ARM_ARCH__ >= 6 unsigned int tmp; #endif prefetchw((const void *)ptr); switch (size) { #if __LINUX_ARM_ARCH__ >= 6 #ifndef CONFIG_CPU_V6 /* MIN ARCH >= V6K */ case 1: asm volatile("@ __xchg1\n" "1: ldrexb %0, [%3]\n" " strexb %1, %2, [%3]\n" " teq %1, #0\n" " bne 1b" : "=&r" (ret), "=&r" (tmp) : "r" (x), "r" (ptr) : "memory", "cc"); break; case 2: asm volatile("@ __xchg2\n" "1: ldrexh %0, [%3]\n" " strexh %1, %2, [%3]\n" " teq %1, #0\n" " bne 1b" : "=&r" (ret), "=&r" (tmp) : "r" (x), "r" (ptr) : "memory", "cc"); break; #endif case 4: asm volatile("@ __xchg4\n" "1: ldrex %0, [%3]\n" " strex %1, %2, [%3]\n" " teq %1, #0\n" " bne 1b" : "=&r" (ret), "=&r" (tmp) : "r" (x), "r" (ptr) : "memory", "cc"); break; #elif defined(swp_is_buggy) #ifdef CONFIG_SMP #error SMP is not supported on this platform #endif case 1: raw_local_irq_save(flags); ret = *(volatile unsigned char *)ptr; *(volatile unsigned char *)ptr = x; raw_local_irq_restore(flags); break; case 4: raw_local_irq_save(flags); ret = *(volatile unsigned long *)ptr; *(volatile unsigned long *)ptr = x; raw_local_irq_restore(flags); break; #else case 1: asm volatile("@ __xchg1\n" " swpb %0, %1, [%2]" : "=&r" (ret) : "r" (x), "r" (ptr) : "memory", "cc"); break; case 4: asm volatile("@ __xchg4\n" " swp %0, %1, [%2]" : "=&r" (ret) : "r" (x), "r" (ptr) : "memory", "cc"); break; #endif default: /* Cause a link-time error, the xchg() size is not supported */ __bad_xchg(ptr, size), ret = 0; break; } return ret; } #define arch_xchg_relaxed(ptr, x) ({ \ (__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), \ sizeof(*(ptr))); \ }) #include #if __LINUX_ARM_ARCH__ < 6 /* min ARCH < ARMv6 */ #ifdef CONFIG_SMP #error "SMP is not supported on this platform" #endif #define arch_xchg arch_xchg_relaxed /* * cmpxchg_local and cmpxchg64_local are atomic wrt current CPU. Always make * them available. */ #define arch_cmpxchg_local(ptr, o, n) ({ \ (__typeof(*ptr))__generic_cmpxchg_local((ptr), \ (unsigned long)(o), \ (unsigned long)(n), \ sizeof(*(ptr))); \ }) #define arch_cmpxchg64_local(ptr, o, n) __generic_cmpxchg64_local((ptr), (o), (n)) #include #else /* min ARCH >= ARMv6 */ extern void __bad_cmpxchg(volatile void *ptr, int size); /* * cmpxchg only support 32-bits operands on ARMv6. */ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new, int size) { unsigned long oldval, res; prefetchw((const void *)ptr); switch (size) { #ifndef CONFIG_CPU_V6 /* min ARCH >= ARMv6K */ case 1: do { asm volatile("@ __cmpxchg1\n" " ldrexb %1, [%2]\n" " mov %0, #0\n" " teq %1, %3\n" " strexbeq %0, %4, [%2]\n" : "=&r" (res), "=&r" (oldval) : "r" (ptr), "Ir" (old), "r" (new) : "memory", "cc"); } while (res); break; case 2: do { asm volatile("@ __cmpxchg1\n" " ldrexh %1, [%2]\n" " mov %0, #0\n" " teq %1, %3\n" " strexheq %0, %4, [%2]\n" : "=&r" (res), "=&r" (oldval) : "r" (ptr), "Ir" (old), "r" (new) : "memory", "cc"); } while (res); break; #endif case 4: do { asm volatile("@ __cmpxchg4\n" " ldrex %1, [%2]\n" " mov %0, #0\n" " teq %1, %3\n" " strexeq %0, %4, [%2]\n" : "=&r" (res), "=&r" (oldval) : "r" (ptr), "Ir" (old), "r" (new) : "memory", "cc"); } while (res); break; default: __bad_cmpxchg(ptr, size); oldval = 0; } return oldval; } #define arch_cmpxchg_relaxed(ptr,o,n) ({ \ (__typeof__(*(ptr)))__cmpxchg((ptr), \ (unsigned long)(o), \ (unsigned long)(n), \ sizeof(*(ptr))); \ }) static inline unsigned long __cmpxchg_local(volatile void *ptr, unsigned long old, unsigned long new, int size) { unsigned long ret; switch (size) { #ifdef CONFIG_CPU_V6 /* min ARCH == ARMv6 */ case 1: case 2: ret = __generic_cmpxchg_local(ptr, old, new, size); break; #endif default: ret = __cmpxchg(ptr, old, new, size); } return ret; } #define arch_cmpxchg_local(ptr, o, n) ({ \ (__typeof(*ptr))__cmpxchg_local((ptr), \ (unsigned long)(o), \ (unsigned long)(n), \ sizeof(*(ptr))); \ }) static inline unsigned long long __cmpxchg64(unsigned long long *ptr, unsigned long long old, unsigned long long new) { unsigned long long oldval; unsigned long res; prefetchw(ptr); __asm__ __volatile__( "1: ldrexd %1, %H1, [%3]\n" " teq %1, %4\n" " teqeq %H1, %H4\n" " bne 2f\n" " strexd %0, %5, %H5, [%3]\n" " teq %0, #0\n" " bne 1b\n" "2:" : "=&r" (res), "=&r" (oldval), "+Qo" (*ptr) : "r" (ptr), "r" (old), "r" (new) : "cc"); return oldval; } #define arch_cmpxchg64_relaxed(ptr, o, n) ({ \ (__typeof__(*(ptr)))__cmpxchg64((ptr), \ (unsigned long long)(o), \ (unsigned long long)(n)); \ }) #define arch_cmpxchg64_local(ptr, o, n) arch_cmpxchg64_relaxed((ptr), (o), (n)) #endif /* __LINUX_ARM_ARCH__ >= 6 */ #endif /* __ASM_ARM_CMPXCHG_H */