More routines for performing atomic bitwise AND/OR/XOR operations
所有检测均成功
ci/woodpecker/push/build Pipeline was successful

这个提交包含在:
Rafal Kupiec 2023-02-12 23:11:23 +01:00
父节点 5a86d61b78
当前提交 9e5fb84412
签署人:: belliash
GPG 密钥 ID: 4E829243E0CFE6B4
共有 2 个文件被更改,包括 312 次插入0 次删除

查看文件

@ -14,6 +14,26 @@
#include <xttypes.h>
XTFASTCALL
CHAR
RtlAtomicAnd8(IN VOLATILE PCHAR Address,
IN CHAR Mask);
XTFASTCALL
SHORT
RtlAtomicAnd16(IN VOLATILE PSHORT Address,
IN SHORT Mask);
XTFASTCALL
LONG
RtlAtomicAnd32(IN VOLATILE PLONG Address,
IN LONG Mask);
XTFASTCALL
LONGLONG
RtlAtomicAnd64(IN VOLATILE PLONGLONG Address,
IN LONGLONG Mask);
XTFASTCALL
CHAR
RtlAtomicCompareExchange8(IN VOLATILE PCHAR Address,
@ -121,6 +141,46 @@ XTFASTCALL
LONGLONG
RtlAtomicIncrement64(IN VOLATILE PLONGLONG Address);
XTFASTCALL
CHAR
RtlAtomicOr8(IN VOLATILE PCHAR Address,
IN CHAR Mask);
XTFASTCALL
SHORT
RtlAtomicOr16(IN VOLATILE PSHORT Address,
IN SHORT Mask);
XTFASTCALL
LONG
RtlAtomicOr32(IN VOLATILE PLONG Address,
IN LONG Mask);
XTFASTCALL
LONGLONG
RtlAtomicOr64(IN VOLATILE PLONGLONG Address,
IN LONGLONG Mask);
XTFASTCALL
CHAR
RtlAtomicXor8(IN VOLATILE PCHAR Address,
IN CHAR Mask);
XTFASTCALL
SHORT
RtlAtomicXor16(IN VOLATILE PSHORT Address,
IN SHORT Mask);
XTFASTCALL
LONG
RtlAtomicXor32(IN VOLATILE PLONG Address,
IN LONG Mask);
XTFASTCALL
LONGLONG
RtlAtomicXor64(IN VOLATILE PLONGLONG Address,
IN LONGLONG Mask);
XTAPI
SIZE_T
RtlCompareMemory(IN PCVOID LeftBuffer,

查看文件

@ -9,6 +9,90 @@
#include <xtos.h>
/**
* Performs an atomic bitwise AND operation on the 8-bit value.
*
* @param Address
* Supplies the address of the value on which the bitwise AND operation is to be performed.
*
* @param Mask
* Supplies the mask with which the bitwise AND operation is to be performed
*
* @return This routine returns the initial value at the given address.
*
* @since XT 1.0
*/
XTFASTCALL
CHAR
RtlAtomicAnd8(IN VOLATILE PCHAR Address,
IN CHAR Mask)
{
return __sync_fetch_and_and(Address, Mask);
}
/**
* Performs an atomic bitwise AND operation on the 16-bit value.
*
* @param Address
* Supplies the address of the value on which the bitwise AND operation is to be performed.
*
* @param Mask
* Supplies the mask with which the bitwise AND operation is to be performed
*
* @return This routine returns the initial value at the given address.
*
* @since XT 1.0
*/
XTFASTCALL
SHORT
RtlAtomicAnd16(IN VOLATILE PSHORT Address,
IN SHORT Mask)
{
return __sync_fetch_and_and(Address, Mask);
}
/**
* Performs an atomic bitwise AND operation on the 32-bit value.
*
* @param Address
* Supplies the address of the value on which the bitwise AND operation is to be performed.
*
* @param Mask
* Supplies the mask with which the bitwise AND operation is to be performed
*
* @return This routine returns the initial value at the given address.
*
* @since XT 1.0
*/
XTFASTCALL
LONG
RtlAtomicAnd32(IN VOLATILE PLONG Address,
IN LONG Mask)
{
return __sync_fetch_and_and(Address, Mask);
}
/**
* Performs an atomic bitwise AND operation on the 64-bit value.
*
* @param Address
* Supplies the address of the value on which the bitwise AND operation is to be performed.
*
* @param Mask
* Supplies the mask with which the bitwise AND operation is to be performed
*
* @return This routine returns the initial value at the given address.
*
* @since XT 1.0
*/
XTFASTCALL
LONGLONG
RtlAtomicAnd64(IN VOLATILE PLONGLONG Address,
IN LONGLONG Mask)
{
return __sync_fetch_and_and(Address, Mask);
}
/**
* Performs atomically compare exchange operation on the 8-bit value.
*
@ -458,3 +542,171 @@ RtlAtomicIncrement64(IN VOLATILE PLONGLONG Address)
{
return __sync_add_and_fetch(Address, 1);
}
/**
* Performs an atomic bitwise OR operation on the 8-bit value.
*
* @param Address
* Supplies the address of the value on which the bitwise OR operation is to be performed.
*
* @param Mask
* Supplies the mask with which the bitwise OR operation is to be performed
*
* @return This routine returns the initial value at the given address.
*
* @since XT 1.0
*/
XTFASTCALL
CHAR
RtlAtomicOr8(IN VOLATILE PCHAR Address,
IN CHAR Mask)
{
return __sync_fetch_and_or(Address, Mask);
}
/**
* Performs an atomic bitwise OR operation on the 16-bit value.
*
* @param Address
* Supplies the address of the value on which the bitwise OR operation is to be performed.
*
* @param Mask
* Supplies the mask with which the bitwise OR operation is to be performed
*
* @return This routine returns the initial value at the given address.
*
* @since XT 1.0
*/
XTFASTCALL
SHORT
RtlAtomicOr16(IN VOLATILE PSHORT Address,
IN SHORT Mask)
{
return __sync_fetch_and_or(Address, Mask);
}
/**
* Performs an atomic bitwise OR operation on the 32-bit value.
*
* @param Address
* Supplies the address of the value on which the bitwise OR operation is to be performed.
*
* @param Mask
* Supplies the mask with which the bitwise OR operation is to be performed
*
* @return This routine returns the initial value at the given address.
*
* @since XT 1.0
*/
XTFASTCALL
LONG
RtlAtomicOr32(IN VOLATILE PLONG Address,
IN LONG Mask)
{
return __sync_fetch_and_or(Address, Mask);
}
/**
* Performs an atomic bitwise OR operation on the 64-bit value.
*
* @param Address
* Supplies the address of the value on which the bitwise OR operation is to be performed.
*
* @param Mask
* Supplies the mask with which the bitwise OR operation is to be performed
*
* @return This routine returns the initial value at the given address.
*
* @since XT 1.0
*/
XTFASTCALL
LONGLONG
RtlAtomicOr64(IN VOLATILE PLONGLONG Address,
IN LONGLONG Mask)
{
return __sync_fetch_and_or(Address, Mask);
}
/**
* Performs an atomic bitwise XOR operation on the 8-bit value.
*
* @param Address
* Supplies the address of the value on which the bitwise XOR operation is to be performed.
*
* @param Mask
* Supplies the mask with which the bitwise XOR operation is to be performed
*
* @return This routine returns the initial value at the given address.
*
* @since XT 1.0
*/
XTFASTCALL
CHAR
RtlAtomicXor8(IN VOLATILE PCHAR Address,
IN CHAR Mask)
{
return __sync_fetch_and_xor(Address, Mask);
}
/**
* Performs an atomic bitwise XOR operation on the 16-bit value.
*
* @param Address
* Supplies the address of the value on which the bitwise XOR operation is to be performed.
*
* @param Mask
* Supplies the mask with which the bitwise XOR operation is to be performed
*
* @return This routine returns the initial value at the given address.
*
* @since XT 1.0
*/
XTFASTCALL
SHORT
RtlAtomicXor16(IN VOLATILE PSHORT Address,
IN SHORT Mask)
{
return __sync_fetch_and_xor(Address, Mask);
}
/**
* Performs an atomic bitwise XOR operation on the 32-bit value.
*
* @param Address
* Supplies the address of the value on which the bitwise XOR operation is to be performed.
*
* @param Mask
* Supplies the mask with which the bitwise XOR operation is to be performed
*
* @return This routine returns the initial value at the given address.
*
* @since XT 1.0
*/
XTFASTCALL
LONG
RtlAtomicXor32(IN VOLATILE PLONG Address,
IN LONG Mask)
{
return __sync_fetch_and_xor(Address, Mask);
}
/**
* Performs an atomic bitwise XOR operation on the 64-bit value.
*
* @param Address
* Supplies the address of the value on which the bitwise XOR operation is to be performed.
*
* @param Mask
* Supplies the mask with which the bitwise XOR operation is to be performed
*
* @return This routine returns the initial value at the given address.
*
* @since XT 1.0
*/
XTFASTCALL
LONGLONG
RtlAtomicXor64(IN VOLATILE PLONGLONG Address,
IN LONGLONG Mask)
{
return __sync_fetch_and_xor(Address, Mask);
}