/
usr
/
src
/
linux-headers-5.15.0-181
/
arch
/
xtensa
/
include
/
asm
/
/usr/src/linux-headers-5.15.0-181/arch/xtensa/include/asm
mkdir
upload
Name
Size
Mode
Actions
asm-offsets.h
35
0644
edit
dl
rm
asm-uaccess.h
4180
0644
edit
dl
rm
asmmacro.h
4763
0644
edit
dl
rm
atomic.h
7301
0644
edit
dl
rm
barrier.h
594
0644
edit
dl
rm
bitops.h
5398
0644
edit
dl
rm
bootparam.h
1402
0644
edit
dl
rm
cache.h
1114
0644
edit
dl
rm
cacheasm.h
3856
0644
edit
dl
rm
cacheflush.h
5968
0644
edit
dl
rm
checksum.h
5893
0644
edit
dl
rm
cmpxchg.h
5684
0644
edit
dl
rm
coprocessor.h
4623
0644
edit
dl
rm
core.h
830
0644
edit
dl
rm
current.h
679
0644
edit
dl
rm
delay.h
1668
0644
edit
dl
rm
dma.h
1830
0644
edit
dl
rm
elf.h
5115
0644
edit
dl
rm
fixmap.h
1106
0644
edit
dl
rm
flat.h
440
0644
edit
dl
rm
ftrace.h
979
0644
edit
dl
rm
futex.h
3889
0644
edit
dl
rm
highmem.h
2167
0644
edit
dl
rm
hw_breakpoint.h
1597
0644
edit
dl
rm
initialize_mmu.h
5196
0644
edit
dl
rm
io.h
1959
0644
edit
dl
rm
irq.h
1127
0644
edit
dl
rm
irqflags.h
2069
0644
edit
dl
rm
jump_label.h
1655
0644
edit
dl
rm
kasan.h
859
0644
edit
dl
rm
Kbuild
230
0644
edit
dl
rm
kmem_layout.h
2790
0644
edit
dl
rm
linkage.h
154
0644
edit
dl
rm
mmu.h
462
0644
edit
dl
rm
mmu_context.h
3624
0644
edit
dl
rm
mxregs.h
1330
0644
edit
dl
rm
nommu_context.h
156
0644
edit
dl
rm
page.h
5793
0644
edit
dl
rm
pci-bridge.h
2170
0644
edit
dl
rm
pci.h
1302
0644
edit
dl
rm
perf_event.h
108
0644
edit
dl
rm
pgalloc.h
1405
0644
edit
dl
rm
pgtable.h
14470
0644
edit
dl
rm
platform.h
1528
0644
edit
dl
rm
processor.h
7705
0644
edit
dl
rm
ptrace.h
3321
0644
edit
dl
rm
regs.h
4017
0644
edit
dl
rm
seccomp.h
287
0644
edit
dl
rm
serial.h
443
0644
edit
dl
rm
shmparam.h
561
0644
edit
dl
rm
signal.h
502
0644
edit
dl
rm
smp.h
967
0644
edit
dl
rm
spinlock.h
472
0644
edit
dl
rm
spinlock_types.h
317
0644
edit
dl
rm
stackprotector.h
1140
0644
edit
dl
rm
stacktrace.h
1158
0644
edit
dl
rm
string.h
3385
0644
edit
dl
rm
switch_to.h
601
0644
edit
dl
rm
syscall.h
2140
0644
edit
dl
rm
sysmem.h
426
0644
edit
dl
rm
thread_info.h
3965
0644
edit
dl
rm
timex.h
1440
0644
edit
dl
rm
tlb.h
475
0644
edit
dl
rm
tlbflush.h
5620
0644
edit
dl
rm
traps.h
2779
0644
edit
dl
rm
uaccess.h
9375
0644
edit
dl
rm
ucontext.h
540
0644
edit
dl
rm
unistd.h
370
0644
edit
dl
rm
vectors.h
3276
0644
edit
dl
rm
vermagic.h
433
0644
edit
dl
rm
vmalloc.h
96
0644
edit
dl
rm
Edit:
/usr/src/linux-headers-5.15.0-181/arch/xtensa/include/asm/atomic.h
(7301B)
/* * include/asm-xtensa/atomic.h * * Atomic operations that C can't guarantee us. Useful for resource counting.. * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. * * Copyright (C) 2001 - 2008 Tensilica Inc. */ #ifndef _XTENSA_ATOMIC_H #define _XTENSA_ATOMIC_H #include <linux/stringify.h> #include <linux/types.h> #include <asm/processor.h> #include <asm/cmpxchg.h> #include <asm/barrier.h> /* * This Xtensa implementation assumes that the right mechanism * for exclusion is for locking interrupts to level EXCM_LEVEL. * * Locking interrupts looks like this: * * rsil a15, TOPLEVEL * <code> * wsr a15, PS * rsync * * Note that a15 is used here because the register allocation * done by the compiler is not guaranteed and a window overflow * may not occur between the rsil and wsr instructions. By using * a15 in the rsil, the machine is guaranteed to be in a state * where no register reference will cause an overflow. */ /** * atomic_read - read atomic variable * @v: pointer of type atomic_t * * Atomically reads the value of @v. */ #define arch_atomic_read(v) READ_ONCE((v)->counter) /** * atomic_set - set atomic variable * @v: pointer of type atomic_t * @i: required value * * Atomically sets the value of @v to @i. */ #define arch_atomic_set(v,i) WRITE_ONCE((v)->counter, (i)) #if XCHAL_HAVE_EXCLUSIVE #define ATOMIC_OP(op) \ static inline void arch_atomic_##op(int i, atomic_t *v) \ { \ unsigned long tmp; \ int result; \ \ __asm__ __volatile__( \ "1: l32ex %[tmp], %[addr]\n" \ " " #op " %[result], %[tmp], %[i]\n" \ " s32ex %[result], %[addr]\n" \ " getex %[result]\n" \ " beqz %[result], 1b\n" \ : [result] "=&a" (result), [tmp] "=&a" (tmp) \ : [i] "a" (i), [addr] "a" (v) \ : "memory" \ ); \ } \ #define ATOMIC_OP_RETURN(op) \ static inline int arch_atomic_##op##_return(int i, atomic_t *v) \ { \ unsigned long tmp; \ int result; \ \ __asm__ __volatile__( \ "1: l32ex %[tmp], %[addr]\n" \ " " #op " %[result], %[tmp], %[i]\n" \ " s32ex %[result], %[addr]\n" \ " getex %[result]\n" \ " beqz %[result], 1b\n" \ " " #op " %[result], %[tmp], %[i]\n" \ : [result] "=&a" (result), [tmp] "=&a" (tmp) \ : [i] "a" (i), [addr] "a" (v) \ : "memory" \ ); \ \ return result; \ } #define ATOMIC_FETCH_OP(op) \ static inline int arch_atomic_fetch_##op(int i, atomic_t *v) \ { \ unsigned long tmp; \ int result; \ \ __asm__ __volatile__( \ "1: l32ex %[tmp], %[addr]\n" \ " " #op " %[result], %[tmp], %[i]\n" \ " s32ex %[result], %[addr]\n" \ " getex %[result]\n" \ " beqz %[result], 1b\n" \ : [result] "=&a" (result), [tmp] "=&a" (tmp) \ : [i] "a" (i), [addr] "a" (v) \ : "memory" \ ); \ \ return tmp; \ } #elif XCHAL_HAVE_S32C1I #define ATOMIC_OP(op) \ static inline void arch_atomic_##op(int i, atomic_t * v) \ { \ unsigned long tmp; \ int result; \ \ __asm__ __volatile__( \ "1: l32i %[tmp], %[mem]\n" \ " wsr %[tmp], scompare1\n" \ " " #op " %[result], %[tmp], %[i]\n" \ " s32c1i %[result], %[mem]\n" \ " bne %[result], %[tmp], 1b\n" \ : [result] "=&a" (result), [tmp] "=&a" (tmp), \ [mem] "+m" (*v) \ : [i] "a" (i) \ : "memory" \ ); \ } \ #define ATOMIC_OP_RETURN(op) \ static inline int arch_atomic_##op##_return(int i, atomic_t * v) \ { \ unsigned long tmp; \ int result; \ \ __asm__ __volatile__( \ "1: l32i %[tmp], %[mem]\n" \ " wsr %[tmp], scompare1\n" \ " " #op " %[result], %[tmp], %[i]\n" \ " s32c1i %[result], %[mem]\n" \ " bne %[result], %[tmp], 1b\n" \ " " #op " %[result], %[result], %[i]\n" \ : [result] "=&a" (result), [tmp] "=&a" (tmp), \ [mem] "+m" (*v) \ : [i] "a" (i) \ : "memory" \ ); \ \ return result; \ } #define ATOMIC_FETCH_OP(op) \ static inline int arch_atomic_fetch_##op(int i, atomic_t * v) \ { \ unsigned long tmp; \ int result; \ \ __asm__ __volatile__( \ "1: l32i %[tmp], %[mem]\n" \ " wsr %[tmp], scompare1\n" \ " " #op " %[result], %[tmp], %[i]\n" \ " s32c1i %[result], %[mem]\n" \ " bne %[result], %[tmp], 1b\n" \ : [result] "=&a" (result), [tmp] "=&a" (tmp), \ [mem] "+m" (*v) \ : [i] "a" (i) \ : "memory" \ ); \ \ return result; \ } #else /* XCHAL_HAVE_S32C1I */ #define ATOMIC_OP(op) \ static inline void arch_atomic_##op(int i, atomic_t * v) \ { \ unsigned int vval; \ \ __asm__ __volatile__( \ " rsil a15, "__stringify(TOPLEVEL)"\n" \ " l32i %[result], %[mem]\n" \ " " #op " %[result], %[result], %[i]\n" \ " s32i %[result], %[mem]\n" \ " wsr a15, ps\n" \ " rsync\n" \ : [result] "=&a" (vval), [mem] "+m" (*v) \ : [i] "a" (i) \ : "a15", "memory" \ ); \ } \ #define ATOMIC_OP_RETURN(op) \ static inline int arch_atomic_##op##_return(int i, atomic_t * v) \ { \ unsigned int vval; \ \ __asm__ __volatile__( \ " rsil a15,"__stringify(TOPLEVEL)"\n" \ " l32i %[result], %[mem]\n" \ " " #op " %[result], %[result], %[i]\n" \ " s32i %[result], %[mem]\n" \ " wsr a15, ps\n" \ " rsync\n" \ : [result] "=&a" (vval), [mem] "+m" (*v) \ : [i] "a" (i) \ : "a15", "memory" \ ); \ \ return vval; \ } #define ATOMIC_FETCH_OP(op) \ static inline int arch_atomic_fetch_##op(int i, atomic_t * v) \ { \ unsigned int tmp, vval; \ \ __asm__ __volatile__( \ " rsil a15,"__stringify(TOPLEVEL)"\n" \ " l32i %[result], %[mem]\n" \ " " #op " %[tmp], %[result], %[i]\n" \ " s32i %[tmp], %[mem]\n" \ " wsr a15, ps\n" \ " rsync\n" \ : [result] "=&a" (vval), [tmp] "=&a" (tmp), \ [mem] "+m" (*v) \ : [i] "a" (i) \ : "a15", "memory" \ ); \ \ return vval; \ } #endif /* XCHAL_HAVE_S32C1I */ #define ATOMIC_OPS(op) ATOMIC_OP(op) ATOMIC_FETCH_OP(op) ATOMIC_OP_RETURN(op) ATOMIC_OPS(add) ATOMIC_OPS(sub) #undef ATOMIC_OPS #define ATOMIC_OPS(op) ATOMIC_OP(op) ATOMIC_FETCH_OP(op) ATOMIC_OPS(and) ATOMIC_OPS(or) ATOMIC_OPS(xor) #undef ATOMIC_OPS #undef ATOMIC_FETCH_OP #undef ATOMIC_OP_RETURN #undef ATOMIC_OP #define arch_atomic_cmpxchg(v, o, n) ((int)arch_cmpxchg(&((v)->counter), (o), (n))) #define arch_atomic_xchg(v, new) (arch_xchg(&((v)->counter), new)) #endif /* _XTENSA_ATOMIC_H */
Save
cmd:
run