Adding upstream version 0.6.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-09 07:35:45 +01:00
parent c49a9029dc
commit 7f70a05c55
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
465 changed files with 60158 additions and 0 deletions

View file

@ -0,0 +1,39 @@
#include <ck_cc.h>
CK_CC_INLINE static void
spin_lock(volatile unsigned int *lock)
{
#ifdef __x86_64__
__asm__ __volatile__(
"\n1:\t"
"lock ; decl %0\n\t"
"jns 2f\n"
"3:\n"
"rep;nop\n\t"
"cmpl $0,%0\n\t"
"jle 3b\n\t"
"jmp 1b\n"
"2:\t" : "=m" (*lock) : : "memory");
#else
*lock = 1;
#endif
return;
}
CK_CC_INLINE static void
spin_unlock(volatile unsigned int *lock)
{
#ifdef __x86_64__
__asm__ __volatile__("movl $1,%0" :"=m" (*lock) :: "memory");
#else
*lock = 0;
return;
#endif
}
#define LOCK_NAME "linux_spinlock"
#define LOCK_DEFINE volatile unsigned int lock = 1
#define LOCK spin_lock(&lock)
#define UNLOCK spin_unlock(&lock)