__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ALPHA_CMPXCHG_H
#define _ALPHA_CMPXCHG_H
/*
* Atomic exchange.
* Since it can be used to implement critical sections
* it must clobber "memory" (also for interrupts in UP).
*/
static inline unsigned long
____xchg_u8(volatile char *m, unsigned long val)
{
unsigned long ret, tmp, addr64;
__asm__ __volatile__(
" andnot %4,7,%3\n"
" insbl %1,%4,%1\n"
"1: ldq_l %2,0(%3)\n"
" extbl %2,%4,%0\n"
" mskbl %2,%4,%2\n"
" or %1,%2,%2\n"
" stq_c %2,0(%3)\n"
" beq %2,2f\n"
".subsection 2\n"
"2: br 1b\n"
".previous"
: "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64)
: "r" ((long)m), "1" (val) : "memory");
return ret;
}
static inline unsigned long
____xchg_u16(volatile short *m, unsigned long val)
{
unsigned long ret, tmp, addr64;
__asm__ __volatile__(
" andnot %4,7,%3\n"
" inswl %1,%4,%1\n"
"1: ldq_l %2,0(%3)\n"
" extwl %2,%4,%0\n"
" mskwl %2,%4,%2\n"
" or %1,%2,%2\n"
" stq_c %2,0(%3)\n"
" beq %2,2f\n"
".subsection 2\n"
"2: br 1b\n"
".previous"
: "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64)
: "r" ((long)m), "1" (val) : "memory");
return ret;
}
static inline unsigned long
____xchg_u32(volatile int *m, unsigned long val)
{
unsigned long dummy;
__asm__ __volatile__(
"1: ldl_l %0,%4\n"
" bis $31,%3,%1\n"
" stl_c %1,%2\n"
" beq %1,2f\n"
".subsection 2\n"
"2: br 1b\n"
".previous"
: "=&r" (val), "=&r" (dummy), "=m" (*m)
: "rI" (val), "m" (*m) : "memory");
return val;
}
static inline unsigned long
____xchg_u64(volatile long *m, unsigned long val)
{
unsigned long dummy;
__asm__ __volatile__(
"1: ldq_l %0,%4\n"
" bis $31,%3,%1\n"
" stq_c %1,%2\n"
" beq %1,2f\n"
".subsection 2\n"
"2: br 1b\n"
".previous"
: "=&r" (val), "=&r" (dummy), "=m" (*m)
: "rI" (val), "m" (*m) : "memory");
return val;
}
/* This function doesn't exist, so you'll get a linker error
if something tries to do an invalid xchg(). */
extern void __xchg_called_with_bad_pointer(void);
static __always_inline unsigned long
____xchg(volatile void *ptr, unsigned long x, int size)
{
return
size == 1 ? ____xchg_u8(ptr, x) :
size == 2 ? ____xchg_u16(ptr, x) :
size == 4 ? ____xchg_u32(ptr, x) :
size == 8 ? ____xchg_u64(ptr, x) :
(__xchg_called_with_bad_pointer(), x);
}
/*
* Atomic compare and exchange. Compare OLD with MEM, if identical,
* store NEW in MEM. Return the initial value in MEM. Success is
* indicated by comparing RETURN with OLD.
*/
static inline unsigned long
____cmpxchg_u8(volatile char *m, unsigned char old, unsigned char new)
{
unsigned long prev, tmp, cmp, addr64;
__asm__ __volatile__(
" andnot %5,7,%4\n"
" insbl %1,%5,%1\n"
"1: ldq_l %2,0(%4)\n"
" extbl %2,%5,%0\n"
" cmpeq %0,%6,%3\n"
" beq %3,2f\n"
" mskbl %2,%5,%2\n"
" or %1,%2,%2\n"
" stq_c %2,0(%4)\n"
" beq %2,3f\n"
"2:\n"
".subsection 2\n"
"3: br 1b\n"
".previous"
: "=&r" (prev), "=&r" (new), "=&r" (tmp), "=&r" (cmp), "=&r" (addr64)
: "r" ((long)m), "Ir" (old), "1" (new) : "memory");
return prev;
}
static inline unsigned long
____cmpxchg_u16(volatile short *m, unsigned short old, unsigned short new)
{
unsigned long prev, tmp, cmp, addr64;
__asm__ __volatile__(
" andnot %5,7,%4\n"
" inswl %1,%5,%1\n"
"1: ldq_l %2,0(%4)\n"
" extwl %2,%5,%0\n"
" cmpeq %0,%6,%3\n"
" beq %3,2f\n"
" mskwl %2,%5,%2\n"
" or %1,%2,%2\n"
" stq_c %2,0(%4)\n"
" beq %2,3f\n"
"2:\n"
".subsection 2\n"
"3: br 1b\n"
".previous"
: "=&r" (prev), "=&r" (new), "=&r" (tmp), "=&r" (cmp), "=&r" (addr64)
: "r" ((long)m), "Ir" (old), "1" (new) : "memory");
return prev;
}
static inline unsigned long
____cmpxchg_u32(volatile int *m, int old, int new)
{
unsigned long prev, cmp;
__asm__ __volatile__(
"1: ldl_l %0,%5\n"
" cmpeq %0,%3,%1\n"
" beq %1,2f\n"
" mov %4,%1\n"
" stl_c %1,%2\n"
" beq %1,3f\n"
"2:\n"
".subsection 2\n"
"3: br 1b\n"
".previous"
: "=&r"(prev), "=&r"(cmp), "=m"(*m)
: "r"((long) old), "r"(new), "m"(*m) : "memory");
return prev;
}
static inline unsigned long
____cmpxchg_u64(volatile long *m, unsigned long old, unsigned long new)
{
unsigned long prev, cmp;
__asm__ __volatile__(
"1: ldq_l %0,%5\n"
" cmpeq %0,%3,%1\n"
" beq %1,2f\n"
" mov %4,%1\n"
" stq_c %1,%2\n"
" beq %1,3f\n"
"2:\n"
".subsection 2\n"
"3: br 1b\n"
".previous"
: "=&r"(prev), "=&r"(cmp), "=m"(*m)
: "r"((long) old), "r"(new), "m"(*m) : "memory");
return prev;
}
/* This function doesn't exist, so you'll get a linker error
if something tries to do an invalid cmpxchg(). */
extern void __cmpxchg_called_with_bad_pointer(void);
static __always_inline unsigned long
____cmpxchg(volatile void *ptr, unsigned long old, unsigned long new,
int size)
{
return
size == 1 ? ____cmpxchg_u8(ptr, old, new) :
size == 2 ? ____cmpxchg_u16(ptr, old, new) :
size == 4 ? ____cmpxchg_u32(ptr, old, new) :
size == 8 ? ____cmpxchg_u64(ptr, old, new) :
(__cmpxchg_called_with_bad_pointer(), old);
}
#define xchg_local(ptr, x) \
({ \
__typeof__(*(ptr)) _x_ = (x); \
(__typeof__(*(ptr))) ____xchg((ptr), (unsigned long)_x_, \
sizeof(*(ptr))); \
})
#define arch_cmpxchg_local(ptr, o, n) \
({ \
__typeof__(*(ptr)) _o_ = (o); \
__typeof__(*(ptr)) _n_ = (n); \
(__typeof__(*(ptr))) ____cmpxchg((ptr), (unsigned long)_o_, \
(unsigned long)_n_, \
sizeof(*(ptr))); \
})
#define arch_cmpxchg64_local(ptr, o, n) \
({ \
BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
cmpxchg_local((ptr), (o), (n)); \
})
/*
* The leading and the trailing memory barriers guarantee that these
* operations are fully ordered.
*/
#define arch_xchg(ptr, x) \
({ \
__typeof__(*(ptr)) __ret; \
__typeof__(*(ptr)) _x_ = (x); \
smp_mb(); \
__ret = (__typeof__(*(ptr))) \
____xchg((ptr), (unsigned long)_x_, sizeof(*(ptr))); \
smp_mb(); \
__ret; \
})
#define arch_cmpxchg(ptr, o, n) \
({ \
__typeof__(*(ptr)) __ret; \
__typeof__(*(ptr)) _o_ = (o); \
__typeof__(*(ptr)) _n_ = (n); \
smp_mb(); \
__ret = (__typeof__(*(ptr))) ____cmpxchg((ptr), \
(unsigned long)_o_, (unsigned long)_n_, sizeof(*(ptr)));\
smp_mb(); \
__ret; \
})
#define arch_cmpxchg64(ptr, o, n) \
({ \
BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
arch_cmpxchg((ptr), (o), (n)); \
})
#endif /* _ALPHA_CMPXCHG_H */
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Kbuild | File | 194 B | 0644 |
|
| agp_backend.h | File | 948 B | 0644 |
|
| asm-prototypes.h | File | 505 B | 0644 |
|
| atomic.h | File | 7.48 KB | 0644 |
|
| barrier.h | File | 507 B | 0644 |
|
| bitops.h | File | 9.31 KB | 0644 |
|
| bug.h | File | 571 B | 0644 |
|
| cache.h | File | 507 B | 0644 |
|
| cacheflush.h | File | 2.17 KB | 0644 |
|
| checksum.h | File | 1.96 KB | 0644 |
|
| cmpxchg.h | File | 6.26 KB | 0644 |
|
| compiler.h | File | 158 B | 0644 |
|
| console.h | File | 1.06 KB | 0644 |
|
| core_cia.h | File | 15.82 KB | 0644 |
|
| core_irongate.h | File | 6.63 KB | 0644 |
|
| core_marvel.h | File | 9.14 KB | 0644 |
|
| core_mcpcia.h | File | 11.94 KB | 0644 |
|
| core_polaris.h | File | 2.92 KB | 0644 |
|
| core_t2.h | File | 19.18 KB | 0644 |
|
| core_titan.h | File | 11.2 KB | 0644 |
|
| core_tsunami.h | File | 8.29 KB | 0644 |
|
| core_wildfire.h | File | 8.45 KB | 0644 |
|
| delay.h | File | 264 B | 0644 |
|
| device.h | File | 129 B | 0644 |
|
| dma-mapping.h | File | 272 B | 0644 |
|
| dma.h | File | 12.01 KB | 0644 |
|
| elf.h | File | 5.38 KB | 0644 |
|
| emergency-restart.h | File | 149 B | 0644 |
|
| err_common.h | File | 3.24 KB | 0644 |
|
| err_ev6.h | File | 116 B | 0644 |
|
| err_ev7.h | File | 4.37 KB | 0644 |
|
| extable.h | File | 1.42 KB | 0644 |
|
| floppy.h | File | 3.11 KB | 0644 |
|
| fpu.h | File | 2.13 KB | 0644 |
|
| ftrace.h | File | 12 B | 0644 |
|
| futex.h | File | 1.97 KB | 0644 |
|
| gct.h | File | 1.02 KB | 0644 |
|
| hardirq.h | File | 223 B | 0644 |
|
| hw_irq.h | File | 302 B | 0644 |
|
| hwrpb.h | File | 6.9 KB | 0644 |
|
| io.h | File | 15.34 KB | 0644 |
|
| io_trivial.h | File | 3.34 KB | 0644 |
|
| irq.h | File | 2.06 KB | 0644 |
|
| irqflags.h | File | 1.17 KB | 0644 |
|
| linkage.h | File | 256 B | 0644 |
|
| local.h | File | 2.67 KB | 0644 |
|
| machvec.h | File | 3.27 KB | 0644 |
|
| mc146818rtc.h | File | 680 B | 0644 |
|
| mce.h | File | 4.04 KB | 0644 |
|
| mmu.h | File | 203 B | 0644 |
|
| mmu_context.h | File | 5.92 KB | 0644 |
|
| module.h | File | 329 B | 0644 |
|
| page.h | File | 2.08 KB | 0644 |
|
| pal.h | File | 5.01 KB | 0644 |
|
| param.h | File | 284 B | 0644 |
|
| parport.h | File | 536 B | 0644 |
|
| pci.h | File | 2.39 KB | 0644 |
|
| percpu.h | File | 527 B | 0644 |
|
| perf_event.h | File | 105 B | 0644 |
|
| pgalloc.h | File | 761 B | 0644 |
|
| pgtable.h | File | 12.76 KB | 0644 |
|
| processor.h | File | 1.28 KB | 0644 |
|
| ptrace.h | File | 715 B | 0644 |
|
| rwonce.h | File | 812 B | 0644 |
|
| serial.h | File | 1.01 KB | 0644 |
|
| setup.h | File | 1.43 KB | 0644 |
|
| sfp-machine.h | File | 2.86 KB | 0644 |
|
| shmparam.h | File | 191 B | 0644 |
|
| signal.h | File | 627 B | 0644 |
|
| smp.h | File | 1.34 KB | 0644 |
|
| socket.h | File | 310 B | 0644 |
|
| sparsemem.h | File | 410 B | 0644 |
|
| special_insns.h | File | 865 B | 0644 |
|
| spinlock.h | File | 2.85 KB | 0644 |
|
| spinlock_types.h | File | 419 B | 0644 |
|
| string.h | File | 2.42 KB | 0644 |
|
| switch_to.h | File | 406 B | 0644 |
|
| syscall.h | File | 379 B | 0644 |
|
| thread_info.h | File | 3.82 KB | 0644 |
|
| timex.h | File | 827 B | 0644 |
|
| tlb.h | File | 257 B | 0644 |
|
| tlbflush.h | File | 2.57 KB | 0644 |
|
| topology.h | File | 271 B | 0644 |
|
| types.h | File | 143 B | 0644 |
|
| uaccess.h | File | 5.99 KB | 0644 |
|
| ucontext.h | File | 348 B | 0644 |
|
| unistd.h | File | 561 B | 0644 |
|
| user.h | File | 1.95 KB | 0644 |
|
| vga.h | File | 2.1 KB | 0644 |
|
| vmalloc.h | File | 93 B | 0644 |
|
| word-at-a-time.h | File | 1.34 KB | 0644 |
|
| wrperfmon.h | File | 2.56 KB | 0644 |
|
| xor.h | File | 21.93 KB | 0644 |
|