Implement RtlAtomicBitTestAndSet() and RtlAtomicBitTestAndSet64() intrinsic routines

このコミットが含まれているのは:
2024-02-04 22:34:13 +01:00
コミット abdb9b25db
2個のファイルの変更52行の追加0行の削除

ファイルの表示

@@ -33,6 +33,16 @@ LONG_PTR
RtlAtomicAnd64(IN VOLATILE PLONG_PTR Address,
IN LONG_PTR Mask);
XTFASTCALL
UCHAR
RtlAtomicBitTestAndSet(IN VOLATILE PLONG Base,
IN LONG Offset);
XTFASTCALL
UCHAR
RtlAtomicBitTestAndSet64(IN VOLATILE PLONGLONG Base,
IN LONGLONG Offset);
XTFASTCALL
CHAR
RtlAtomicCompareExchange8(IN VOLATILE PCHAR Address,

ファイルの表示

@@ -93,6 +93,48 @@ RtlAtomicAnd64(IN VOLATILE PLONG_PTR Address,
return __sync_fetch_and_and(Address, Mask);
}
/**
* Performs an atomic test of the specified bit of the specified long value and sets it to 1.
*
* @param Base
* Specifies a pointer to the variable.
*
* @param Offset
* Specifies the bit position to be tested.
*
* @return Returns a value of the specified bit.
*
* @since XT 1.0
*/
XTFASTCALL
UCHAR
RtlAtomicBitTestAndSet(IN VOLATILE PLONG Base,
IN LONG Offset)
{
return (__atomic_fetch_or(Base, 1l << Offset, __ATOMIC_SEQ_CST) >> Offset) & 1;
}
/**
* Performs an atomic test of the specified bit of the specified 64-bit long value and sets it to 1.
*
* @param Base
* Specifies a pointer to the variable.
*
* @param Offset
* Specifies the bit position to be tested.
*
* @return Returns a value of the specified bit.
*
* @since XT 1.0
*/
XTFASTCALL
UCHAR
RtlAtomicBitTestAndSet64(IN VOLATILE PLONGLONG Base,
IN LONGLONG Offset)
{
return (__atomic_fetch_or(Base, 1ll << Offset, __ATOMIC_SEQ_CST) >> Offset) & 1;
}
/**
* Performs atomically compare exchange operation on the 8-bit value.
*