support for read/write-lock and read/write-trylock

Change-Id: I609071c0f6234d0d413c8b312d8a8379abf6846e
Refs: #1323
This commit is contained in:
Tomoki Shirasawa
2019-07-29 14:11:13 +09:00
committed by Masamichi Takagi
parent 8efced7bf7
commit 258156b57e
9 changed files with 570 additions and 0 deletions

View File

@@ -126,6 +126,22 @@ static inline void ihk_atomic64_inc(ihk_atomic64_t *v)
asm volatile ("lock incq %0" : "+m"(v->counter64));
}
static inline long ihk_atomic64_add_return(long i, ihk_atomic64_t *v)
{
long __i;
__i = i;
asm volatile("lock xaddq %0, %1"
: "+r" (i), "+m" (v->counter64)
: : "memory");
return i + __i;
}
static inline long ihk_atomic64_sub_return(long i, ihk_atomic64_t *v)
{
return ihk_atomic64_add_return(-i, v);
}
/***********************************************************************
* others
*/