mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 08:55:19 +00:00
[INCLUDE/CRT]
- Move all intrinsic prototypes to intrin.h and remove duplicated declatations from msc/intrin.h and mingw/intrin_x86.h - Fix some intrinsic prototypes for GCC - Fix some SAL annotations for intrinsics svn path=/trunk/; revision=66573
This commit is contained in:
parent
5269230c55
commit
da855e568d
4 changed files with 1050 additions and 654 deletions
File diff suppressed because it is too large
Load diff
|
@ -70,7 +70,6 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
/*** memcopy must be memmove ***/
|
||||
void* memmove(void*, const void*, size_t);
|
||||
__INTRIN_INLINE void* memcpy(void* dest, const void* source, size_t num)
|
||||
{
|
||||
return memmove(dest, source, num);
|
||||
|
@ -89,14 +88,6 @@ __INTRIN_INLINE void* memcpy(void* dest, const void* source, size_t num)
|
|||
|
||||
/*** Memory barriers ***/
|
||||
|
||||
__INTRIN_INLINE void _ReadWriteBarrier(void);
|
||||
__INTRIN_INLINE void _mm_mfence(void);
|
||||
__INTRIN_INLINE void _mm_lfence(void);
|
||||
__INTRIN_INLINE void _mm_sfence(void);
|
||||
#ifdef __x86_64__
|
||||
__INTRIN_INLINE void __faststorefence(void);
|
||||
#endif
|
||||
|
||||
__INTRIN_INLINE void _ReadWriteBarrier(void)
|
||||
{
|
||||
__asm__ __volatile__("" : : : "memory");
|
||||
|
@ -136,49 +127,8 @@ __INTRIN_INLINE void __faststorefence(void)
|
|||
|
||||
/*** Atomic operations ***/
|
||||
|
||||
__INTRIN_INLINE long _InterlockedAddLargeStatistic(volatile long long * const Addend, const long Value);
|
||||
__INTRIN_INLINE unsigned char _interlockedbittestandreset(volatile long * a, const long b);
|
||||
__INTRIN_INLINE unsigned char _interlockedbittestandset(volatile long * a, const long b);
|
||||
#if defined(_M_AMD64)
|
||||
__INTRIN_INLINE unsigned char _interlockedbittestandreset64(volatile long long * a, const long long b);
|
||||
__INTRIN_INLINE unsigned char _interlockedbittestandset64(volatile long long * a, const long long b);
|
||||
#endif
|
||||
|
||||
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100
|
||||
|
||||
__INTRIN_INLINE char _InterlockedCompareExchange8(volatile char * const Destination, const char Exchange, const char Comperand);
|
||||
__INTRIN_INLINE short _InterlockedCompareExchange16(volatile short * const Destination, const short Exchange, const short Comperand);
|
||||
__INTRIN_INLINE long _InterlockedCompareExchange(volatile long * const Destination, const long Exchange, const long Comperand);
|
||||
__INTRIN_INLINE void * _InterlockedCompareExchangePointer(void * volatile * const Destination, void * const Exchange, void * const Comperand);
|
||||
__INTRIN_INLINE char _InterlockedExchange8(volatile char * const Target, const char Value);
|
||||
__INTRIN_INLINE short _InterlockedExchange16(volatile short * const Target, const short Value);
|
||||
__INTRIN_INLINE long _InterlockedExchange(volatile long * const Target, const long Value);
|
||||
__INTRIN_INLINE void * _InterlockedExchangePointer(void * volatile * const Target, void * const Value);
|
||||
__INTRIN_INLINE long _InterlockedExchangeAdd16(volatile short * const Addend, const short Value);
|
||||
__INTRIN_INLINE long _InterlockedExchangeAdd(volatile long * const Addend, const long Value);
|
||||
__INTRIN_INLINE char _InterlockedAnd8(volatile char * const value, const char mask);
|
||||
__INTRIN_INLINE short _InterlockedAnd16(volatile short * const value, const short mask);
|
||||
__INTRIN_INLINE long _InterlockedAnd(volatile long * const value, const long mask);
|
||||
__INTRIN_INLINE char _InterlockedOr8(volatile char * const value, const char mask);
|
||||
__INTRIN_INLINE short _InterlockedOr16(volatile short * const value, const short mask);
|
||||
__INTRIN_INLINE long _InterlockedOr(volatile long * const value, const long mask);
|
||||
__INTRIN_INLINE char _InterlockedXor8(volatile char * const value, const char mask);
|
||||
__INTRIN_INLINE short _InterlockedXor16(volatile short * const value, const short mask);
|
||||
__INTRIN_INLINE long _InterlockedXor(volatile long * const value, const long mask);
|
||||
__INTRIN_INLINE long _InterlockedDecrement(volatile long * const lpAddend);
|
||||
__INTRIN_INLINE long _InterlockedIncrement(volatile long * const lpAddend);
|
||||
__INTRIN_INLINE short _InterlockedDecrement16(volatile short * const lpAddend);
|
||||
__INTRIN_INLINE short _InterlockedIncrement16(volatile short * const lpAddend);
|
||||
#if defined(_M_AMD64)
|
||||
__INTRIN_INLINE long long _InterlockedExchange64(volatile long long * const Target, const long long Value);
|
||||
__INTRIN_INLINE long long _InterlockedExchangeAdd64(volatile long long * const Addend, const long long Value);
|
||||
__INTRIN_INLINE long long _InterlockedAnd64(volatile long long * const value, const long long mask);
|
||||
__INTRIN_INLINE long long _InterlockedOr64(volatile long long * const value, const long long mask);
|
||||
__INTRIN_INLINE long long _InterlockedXor64(volatile long long * const value, const long long mask);
|
||||
__INTRIN_INLINE long long _InterlockedDecrement64(volatile long long * const lpAddend);
|
||||
__INTRIN_INLINE long long _InterlockedIncrement64(volatile long long * const lpAddend);
|
||||
#endif
|
||||
|
||||
__INTRIN_INLINE char _InterlockedCompareExchange8(volatile char * const Destination, const char Exchange, const char Comperand)
|
||||
{
|
||||
return __sync_val_compare_and_swap(Destination, Comperand, Exchange);
|
||||
|
@ -244,7 +194,7 @@ __INTRIN_INLINE long long _InterlockedExchange64(volatile long long * const Targ
|
|||
}
|
||||
#endif
|
||||
|
||||
__INTRIN_INLINE long _InterlockedExchangeAdd16(volatile short * const Addend, const short Value)
|
||||
__INTRIN_INLINE short _InterlockedExchangeAdd16(volatile short * const Addend, const short Value)
|
||||
{
|
||||
return __sync_fetch_and_add(Addend, Value);
|
||||
}
|
||||
|
@ -365,34 +315,6 @@ __INTRIN_INLINE long long _InterlockedIncrement64(volatile long long * const lpA
|
|||
|
||||
#else /* (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100 */
|
||||
|
||||
__INTRIN_INLINE char _InterlockedCompareExchange8(volatile char * const Destination, const char Exchange, const char Comperand);
|
||||
__INTRIN_INLINE short _InterlockedCompareExchange16(volatile short * const Destination, const short Exchange, const short Comperand);
|
||||
__INTRIN_INLINE long _InterlockedCompareExchange(volatile long * const Destination, const long Exchange, const long Comperand);
|
||||
__INTRIN_INLINE void * _InterlockedCompareExchangePointer(void * volatile * const Destination, void * const Exchange, void * const Comperand);
|
||||
__INTRIN_INLINE char _InterlockedExchange8(volatile char * const Target, const char Value);
|
||||
__INTRIN_INLINE short _InterlockedExchange16(volatile short * const Target, const short Value);
|
||||
__INTRIN_INLINE long _InterlockedExchange(volatile long * const Target, const long Value);
|
||||
__INTRIN_INLINE void * _InterlockedExchangePointer(void * volatile * const Target, void * const Value);
|
||||
__INTRIN_INLINE long _InterlockedExchangeAdd16(volatile short * const Addend, const short Value);
|
||||
__INTRIN_INLINE long _InterlockedExchangeAdd(volatile long * const Addend, const long Value);
|
||||
__INTRIN_INLINE char _InterlockedAnd8(volatile char * const value, const char mask);
|
||||
__INTRIN_INLINE short _InterlockedAnd16(volatile short * const value, const short mask);
|
||||
__INTRIN_INLINE long _InterlockedAnd(volatile long * const value, const long mask);
|
||||
__INTRIN_INLINE char _InterlockedOr8(volatile char * const value, const char mask);
|
||||
__INTRIN_INLINE short _InterlockedOr16(volatile short * const value, const short mask);
|
||||
__INTRIN_INLINE long _InterlockedOr(volatile long * const value, const long mask);
|
||||
__INTRIN_INLINE char _InterlockedXor8(volatile char * const value, const char mask);
|
||||
__INTRIN_INLINE short _InterlockedXor16(volatile short * const value, const short mask);
|
||||
__INTRIN_INLINE long _InterlockedXor(volatile long * const value, const long mask);
|
||||
__INTRIN_INLINE long _InterlockedDecrement(volatile long * const lpAddend);
|
||||
__INTRIN_INLINE long _InterlockedIncrement(volatile long * const lpAddend);
|
||||
__INTRIN_INLINE short _InterlockedDecrement16(volatile short * const lpAddend);
|
||||
__INTRIN_INLINE short _InterlockedIncrement16(volatile short * const lpAddend);
|
||||
#if defined(_M_AMD64)
|
||||
__INTRIN_INLINE long long _InterlockedDecrement64(volatile long long * const lpAddend);
|
||||
__INTRIN_INLINE long long _InterlockedIncrement64(volatile long long * const lpAddend);
|
||||
#endif
|
||||
|
||||
__INTRIN_INLINE char _InterlockedCompareExchange8(volatile char * const Destination, const char Exchange, const char Comperand)
|
||||
{
|
||||
char retval = Comperand;
|
||||
|
@ -652,7 +574,6 @@ __INTRIN_INLINE long long _InterlockedIncrement64(volatile long long * const lpA
|
|||
|
||||
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100 && defined(__x86_64__)
|
||||
|
||||
__INTRIN_INLINE long long _InterlockedCompareExchange64(volatile long long * const Destination, const long long Exchange, const long long Comperand);
|
||||
__INTRIN_INLINE long long _InterlockedCompareExchange64(volatile long long * const Destination, const long long Exchange, const long long Comperand)
|
||||
{
|
||||
return __sync_val_compare_and_swap(Destination, Comperand, Exchange);
|
||||
|
@ -660,7 +581,6 @@ __INTRIN_INLINE long long _InterlockedCompareExchange64(volatile long long * con
|
|||
|
||||
#else
|
||||
|
||||
__INTRIN_INLINE long long _InterlockedCompareExchange64(volatile long long * const Destination, const long long Exchange, const long long Comperand);
|
||||
__INTRIN_INLINE long long _InterlockedCompareExchange64(volatile long long * const Destination, const long long Exchange, const long long Comperand)
|
||||
{
|
||||
long long retval = Comperand;
|
||||
|
@ -730,18 +650,6 @@ __INTRIN_INLINE unsigned char _interlockedbittestandset64(volatile long long * a
|
|||
|
||||
/*** String operations ***/
|
||||
|
||||
__INTRIN_INLINE void __stosb(unsigned char * Dest, const unsigned char Data, size_t Count);
|
||||
__INTRIN_INLINE void __stosw(unsigned short * Dest, const unsigned short Data, size_t Count);
|
||||
__INTRIN_INLINE void __stosd(unsigned long * Dest, const unsigned long Data, size_t Count);
|
||||
__INTRIN_INLINE void __movsb(unsigned char * Destination, const unsigned char * Source, size_t Count);
|
||||
__INTRIN_INLINE void __movsw(unsigned short * Destination, const unsigned short * Source, size_t Count);
|
||||
__INTRIN_INLINE void __movsd(unsigned long * Destination, const unsigned long * Source, size_t Count);
|
||||
#ifdef _M_AMD64
|
||||
__INTRIN_INLINE void __stosq(unsigned __int64 * Dest, const unsigned __int64 Data, size_t Count);
|
||||
__INTRIN_INLINE void __movsq(unsigned long * Destination, const unsigned long * Source, size_t Count);
|
||||
#endif
|
||||
|
||||
|
||||
/* NOTE: we don't set a memory clobber in the __stosX functions because Visual C++ doesn't */
|
||||
__INTRIN_INLINE void __stosb(unsigned char * Dest, const unsigned char Data, size_t Count)
|
||||
{
|
||||
|
@ -831,102 +739,85 @@ __INTRIN_INLINE void __movsq(unsigned long * Destination, const unsigned long *
|
|||
|
||||
/*** GS segment addressing ***/
|
||||
|
||||
__INTRIN_INLINE void __writegsbyte(const unsigned long Offset, const unsigned char Data);
|
||||
__INTRIN_INLINE void __writegsword(const unsigned long Offset, const unsigned short Data);
|
||||
__INTRIN_INLINE void __writegsdword(const unsigned long Offset, const unsigned long Data);
|
||||
__INTRIN_INLINE void __writegsqword(const unsigned long Offset, const unsigned __int64 Data);
|
||||
__INTRIN_INLINE unsigned char __readgsbyte(const unsigned long Offset);
|
||||
__INTRIN_INLINE unsigned short __readgsword(const unsigned long Offset);
|
||||
__INTRIN_INLINE unsigned long __readgsdword(const unsigned long Offset);
|
||||
__INTRIN_INLINE unsigned __int64 __readgsqword(const unsigned long Offset);
|
||||
__INTRIN_INLINE void __incgsbyte(const unsigned long Offset);
|
||||
__INTRIN_INLINE void __incgsword(const unsigned long Offset);
|
||||
__INTRIN_INLINE void __incgsdword(const unsigned long Offset);
|
||||
__INTRIN_INLINE void __addgsbyte(const unsigned long Offset, const unsigned char Data);
|
||||
__INTRIN_INLINE void __addgsword(const unsigned long Offset, const unsigned short Data);
|
||||
__INTRIN_INLINE void __addgsdword(const unsigned long Offset, const unsigned int Data);
|
||||
__INTRIN_INLINE void __addgsqword(const unsigned long Offset, const unsigned __int64 Data);
|
||||
|
||||
|
||||
__INTRIN_INLINE void __writegsbyte(const unsigned long Offset, const unsigned char Data)
|
||||
__INTRIN_INLINE void __writegsbyte(unsigned long Offset, unsigned char Data)
|
||||
{
|
||||
__asm__ __volatile__("movb %b[Data], %%gs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "ir" (Data) : "memory");
|
||||
}
|
||||
|
||||
__INTRIN_INLINE void __writegsword(const unsigned long Offset, const unsigned short Data)
|
||||
__INTRIN_INLINE void __writegsword(unsigned long Offset, unsigned short Data)
|
||||
{
|
||||
__asm__ __volatile__("movw %w[Data], %%gs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "ir" (Data) : "memory");
|
||||
}
|
||||
|
||||
__INTRIN_INLINE void __writegsdword(const unsigned long Offset, const unsigned long Data)
|
||||
__INTRIN_INLINE void __writegsdword(unsigned long Offset, unsigned long Data)
|
||||
{
|
||||
__asm__ __volatile__("movl %k[Data], %%gs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "ir" (Data) : "memory");
|
||||
}
|
||||
|
||||
__INTRIN_INLINE void __writegsqword(const unsigned long Offset, const unsigned __int64 Data)
|
||||
__INTRIN_INLINE void __writegsqword(unsigned long Offset, unsigned __int64 Data)
|
||||
{
|
||||
__asm__ __volatile__("movq %q[Data], %%gs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "ir" (Data) : "memory");
|
||||
}
|
||||
|
||||
__INTRIN_INLINE unsigned char __readgsbyte(const unsigned long Offset)
|
||||
__INTRIN_INLINE unsigned char __readgsbyte(unsigned long Offset)
|
||||
{
|
||||
unsigned char value;
|
||||
__asm__ __volatile__("movb %%gs:%a[Offset], %b[value]" : [value] "=r" (value) : [Offset] "ir" (Offset));
|
||||
return value;
|
||||
}
|
||||
|
||||
__INTRIN_INLINE unsigned short __readgsword(const unsigned long Offset)
|
||||
__INTRIN_INLINE unsigned short __readgsword(unsigned long Offset)
|
||||
{
|
||||
unsigned short value;
|
||||
__asm__ __volatile__("movw %%gs:%a[Offset], %w[value]" : [value] "=r" (value) : [Offset] "ir" (Offset));
|
||||
return value;
|
||||
}
|
||||
|
||||
__INTRIN_INLINE unsigned long __readgsdword(const unsigned long Offset)
|
||||
__INTRIN_INLINE unsigned long __readgsdword(unsigned long Offset)
|
||||
{
|
||||
unsigned long value;
|
||||
__asm__ __volatile__("movl %%gs:%a[Offset], %k[value]" : [value] "=r" (value) : [Offset] "ir" (Offset));
|
||||
return value;
|
||||
}
|
||||
|
||||
__INTRIN_INLINE unsigned __int64 __readgsqword(const unsigned long Offset)
|
||||
__INTRIN_INLINE unsigned __int64 __readgsqword(unsigned long Offset)
|
||||
{
|
||||
unsigned __int64 value;
|
||||
__asm__ __volatile__("movq %%gs:%a[Offset], %q[value]" : [value] "=r" (value) : [Offset] "ir" (Offset));
|
||||
return value;
|
||||
}
|
||||
|
||||
__INTRIN_INLINE void __incgsbyte(const unsigned long Offset)
|
||||
__INTRIN_INLINE void __incgsbyte(unsigned long Offset)
|
||||
{
|
||||
__asm__ __volatile__("incb %%gs:%a[Offset]" : : [Offset] "ir" (Offset) : "memory");
|
||||
}
|
||||
|
||||
__INTRIN_INLINE void __incgsword(const unsigned long Offset)
|
||||
__INTRIN_INLINE void __incgsword(unsigned long Offset)
|
||||
{
|
||||
__asm__ __volatile__("incw %%gs:%a[Offset]" : : [Offset] "ir" (Offset) : "memory");
|
||||
}
|
||||
|
||||
__INTRIN_INLINE void __incgsdword(const unsigned long Offset)
|
||||
__INTRIN_INLINE void __incgsdword(unsigned long Offset)
|
||||
{
|
||||
__asm__ __volatile__("incl %%gs:%a[Offset]" : : [Offset] "ir" (Offset) : "memory");
|
||||
}
|
||||
|
||||
__INTRIN_INLINE void __addgsbyte(const unsigned long Offset, const unsigned char Data)
|
||||
__INTRIN_INLINE void __addgsbyte(unsigned long Offset, unsigned char Data)
|
||||
{
|
||||
__asm__ __volatile__("addb %b[Data], %%gs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "ir" (Data) : "memory");
|
||||
}
|
||||
|
||||
__INTRIN_INLINE void __addgsword(const unsigned long Offset, const unsigned short Data)
|
||||
__INTRIN_INLINE void __addgsword(unsigned long Offset, unsigned short Data)
|
||||
{
|
||||
__asm__ __volatile__("addw %w[Data], %%gs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "ir" (Data) : "memory");
|
||||
}
|
||||
|
||||
__INTRIN_INLINE void __addgsdword(const unsigned long Offset, const unsigned int Data)
|
||||
__INTRIN_INLINE void __addgsdword(unsigned long Offset, unsigned int Data)
|
||||
{
|
||||
__asm__ __volatile__("addl %k[Data], %%gs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "ir" (Data) : "memory");
|
||||
}
|
||||
|
||||
__INTRIN_INLINE void __addgsqword(const unsigned long Offset, const unsigned __int64 Data)
|
||||
__INTRIN_INLINE void __addgsqword(unsigned long Offset, unsigned __int64 Data)
|
||||
{
|
||||
__asm__ __volatile__("addq %k[Data], %%gs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "ir" (Data) : "memory");
|
||||
}
|
||||
|
@ -935,73 +826,59 @@ __INTRIN_INLINE void __addgsqword(const unsigned long Offset, const unsigned __i
|
|||
|
||||
/*** FS segment addressing ***/
|
||||
|
||||
__INTRIN_INLINE void __writefsbyte(const unsigned long Offset, const unsigned char Data);
|
||||
__INTRIN_INLINE void __writefsword(const unsigned long Offset, const unsigned short Data);
|
||||
__INTRIN_INLINE void __writefsdword(const unsigned long Offset, const unsigned long Data);
|
||||
__INTRIN_INLINE unsigned char __readfsbyte(const unsigned long Offset);
|
||||
__INTRIN_INLINE unsigned short __readfsword(const unsigned long Offset);
|
||||
__INTRIN_INLINE unsigned long __readfsdword(const unsigned long Offset);
|
||||
__INTRIN_INLINE void __incfsbyte(const unsigned long Offset);
|
||||
__INTRIN_INLINE void __incfsword(const unsigned long Offset);
|
||||
__INTRIN_INLINE void __incfsdword(const unsigned long Offset);
|
||||
__INTRIN_INLINE void __addfsbyte(const unsigned long Offset, const unsigned char Data);
|
||||
__INTRIN_INLINE void __addfsword(const unsigned long Offset, const unsigned short Data);
|
||||
__INTRIN_INLINE void __addfsdword(const unsigned long Offset, const unsigned int Data);
|
||||
|
||||
|
||||
__INTRIN_INLINE void __writefsbyte(const unsigned long Offset, const unsigned char Data)
|
||||
__INTRIN_INLINE void __writefsbyte(unsigned long Offset, unsigned char Data)
|
||||
{
|
||||
__asm__ __volatile__("movb %b[Data], %%fs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "iq" (Data) : "memory");
|
||||
}
|
||||
|
||||
__INTRIN_INLINE void __writefsword(const unsigned long Offset, const unsigned short Data)
|
||||
__INTRIN_INLINE void __writefsword(unsigned long Offset, unsigned short Data)
|
||||
{
|
||||
__asm__ __volatile__("movw %w[Data], %%fs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "ir" (Data) : "memory");
|
||||
}
|
||||
|
||||
__INTRIN_INLINE void __writefsdword(const unsigned long Offset, const unsigned long Data)
|
||||
__INTRIN_INLINE void __writefsdword(unsigned long Offset, unsigned long Data)
|
||||
{
|
||||
__asm__ __volatile__("movl %k[Data], %%fs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "ir" (Data) : "memory");
|
||||
}
|
||||
|
||||
__INTRIN_INLINE unsigned char __readfsbyte(const unsigned long Offset)
|
||||
__INTRIN_INLINE unsigned char __readfsbyte(unsigned long Offset)
|
||||
{
|
||||
unsigned char value;
|
||||
__asm__ __volatile__("movb %%fs:%a[Offset], %b[value]" : [value] "=q" (value) : [Offset] "ir" (Offset));
|
||||
return value;
|
||||
}
|
||||
|
||||
__INTRIN_INLINE unsigned short __readfsword(const unsigned long Offset)
|
||||
__INTRIN_INLINE unsigned short __readfsword(unsigned long Offset)
|
||||
{
|
||||
unsigned short value;
|
||||
__asm__ __volatile__("movw %%fs:%a[Offset], %w[value]" : [value] "=r" (value) : [Offset] "ir" (Offset));
|
||||
return value;
|
||||
}
|
||||
|
||||
__INTRIN_INLINE unsigned long __readfsdword(const unsigned long Offset)
|
||||
__INTRIN_INLINE unsigned long __readfsdword(unsigned long Offset)
|
||||
{
|
||||
unsigned long value;
|
||||
__asm__ __volatile__("movl %%fs:%a[Offset], %k[value]" : [value] "=r" (value) : [Offset] "ir" (Offset));
|
||||
return value;
|
||||
}
|
||||
|
||||
__INTRIN_INLINE void __incfsbyte(const unsigned long Offset)
|
||||
__INTRIN_INLINE void __incfsbyte(unsigned long Offset)
|
||||
{
|
||||
__asm__ __volatile__("incb %%fs:%a[Offset]" : : [Offset] "ir" (Offset) : "memory");
|
||||
}
|
||||
|
||||
__INTRIN_INLINE void __incfsword(const unsigned long Offset)
|
||||
__INTRIN_INLINE void __incfsword(unsigned long Offset)
|
||||
{
|
||||
__asm__ __volatile__("incw %%fs:%a[Offset]" : : [Offset] "ir" (Offset) : "memory");
|
||||
}
|
||||
|
||||
__INTRIN_INLINE void __incfsdword(const unsigned long Offset)
|
||||
__INTRIN_INLINE void __incfsdword(unsigned long Offset)
|
||||
{
|
||||
__asm__ __volatile__("incl %%fs:%a[Offset]" : : [Offset] "ir" (Offset) : "memory");
|
||||
}
|
||||
|
||||
/* NOTE: the bizarre implementation of __addfsxxx mimics the broken Visual C++ behavior */
|
||||
__INTRIN_INLINE void __addfsbyte(const unsigned long Offset, const unsigned char Data)
|
||||
__INTRIN_INLINE void __addfsbyte(unsigned long Offset, unsigned char Data)
|
||||
{
|
||||
if(!__builtin_constant_p(Offset))
|
||||
__asm__ __volatile__("addb %b[Offset], %%fs:%a[Offset]" : : [Offset] "r" (Offset) : "memory");
|
||||
|
@ -1009,7 +886,7 @@ __INTRIN_INLINE void __addfsbyte(const unsigned long Offset, const unsigned char
|
|||
__asm__ __volatile__("addb %b[Data], %%fs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "iq" (Data) : "memory");
|
||||
}
|
||||
|
||||
__INTRIN_INLINE void __addfsword(const unsigned long Offset, const unsigned short Data)
|
||||
__INTRIN_INLINE void __addfsword(unsigned long Offset, unsigned short Data)
|
||||
{
|
||||
if(!__builtin_constant_p(Offset))
|
||||
__asm__ __volatile__("addw %w[Offset], %%fs:%a[Offset]" : : [Offset] "r" (Offset) : "memory");
|
||||
|
@ -1017,7 +894,7 @@ __INTRIN_INLINE void __addfsword(const unsigned long Offset, const unsigned shor
|
|||
__asm__ __volatile__("addw %w[Data], %%fs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "iq" (Data) : "memory");
|
||||
}
|
||||
|
||||
__INTRIN_INLINE void __addfsdword(const unsigned long Offset, const unsigned int Data)
|
||||
__INTRIN_INLINE void __addfsdword(unsigned long Offset, unsigned long Data)
|
||||
{
|
||||
if(!__builtin_constant_p(Offset))
|
||||
__asm__ __volatile__("addl %k[Offset], %%fs:%a[Offset]" : : [Offset] "r" (Offset) : "memory");
|
||||
|
@ -1030,34 +907,6 @@ __INTRIN_INLINE void __addfsdword(const unsigned long Offset, const unsigned int
|
|||
|
||||
/*** Bit manipulation ***/
|
||||
|
||||
__INTRIN_INLINE unsigned char _BitScanForward(unsigned long * const Index, const unsigned long Mask);
|
||||
__INTRIN_INLINE unsigned char _BitScanReverse(unsigned long * const Index, const unsigned long Mask);
|
||||
__INTRIN_INLINE unsigned char _bittest(const long * const a, const long b);
|
||||
#ifdef _M_AMD64
|
||||
__INTRIN_INLINE unsigned char _bittest64(const __int64 * const a, const __int64 b);
|
||||
#endif
|
||||
__INTRIN_INLINE unsigned char _bittestandcomplement(long * const a, const long b);
|
||||
__INTRIN_INLINE unsigned char _bittestandreset(long * const a, const long b);
|
||||
__INTRIN_INLINE unsigned char _bittestandset(long * const a, const long b);
|
||||
__INTRIN_INLINE unsigned char _rotl8(unsigned char value, unsigned char shift);
|
||||
__INTRIN_INLINE unsigned short _rotl16(unsigned short value, unsigned char shift);
|
||||
__INTRIN_INLINE unsigned int _rotl(unsigned int value, int shift);
|
||||
__INTRIN_INLINE unsigned __int64 _rotl64(unsigned __int64 value, int shift);
|
||||
__INTRIN_INLINE unsigned int _rotr(unsigned int value, int shift);
|
||||
__INTRIN_INLINE unsigned char _rotr8(unsigned char value, unsigned char shift);
|
||||
__INTRIN_INLINE unsigned short _rotr16(unsigned short value, unsigned char shift);
|
||||
__INTRIN_INLINE unsigned long long __ll_lshift(const unsigned long long Mask, const int Bit);
|
||||
__INTRIN_INLINE long long __ll_rshift(const long long Mask, const int Bit);
|
||||
__INTRIN_INLINE unsigned long long __ull_rshift(const unsigned long long Mask, int Bit);
|
||||
__INTRIN_INLINE unsigned short _byteswap_ushort(unsigned short value);
|
||||
__INTRIN_INLINE unsigned long _byteswap_ulong(unsigned long value);
|
||||
#ifdef _M_AMD64
|
||||
__INTRIN_INLINE unsigned __int64 _byteswap_uint64(unsigned __int64 value);
|
||||
#else
|
||||
__INTRIN_INLINE unsigned __int64 _byteswap_uint64(unsigned __int64 value);
|
||||
#endif
|
||||
|
||||
|
||||
__INTRIN_INLINE unsigned char _BitScanForward(unsigned long * const Index, const unsigned long Mask)
|
||||
{
|
||||
__asm__("bsfl %[Mask], %[Index]" : [Index] "=r" (*Index) : [Mask] "mr" (Mask));
|
||||
|
@ -1280,14 +1129,6 @@ __INTRIN_INLINE unsigned __int64 _byteswap_uint64(unsigned __int64 value)
|
|||
|
||||
/*** 64-bit math ***/
|
||||
|
||||
__INTRIN_INLINE long long __emul(const int a, const int b);
|
||||
__INTRIN_INLINE unsigned long long __emulu(const unsigned int a, const unsigned int b);
|
||||
#ifdef _M_AMD64
|
||||
__INTRIN_INLINE __int64 __mulh(__int64 a, __int64 b);
|
||||
__INTRIN_INLINE unsigned __int64 __umulh(unsigned __int64 a, unsigned __int64 b);
|
||||
#endif
|
||||
|
||||
|
||||
__INTRIN_INLINE long long __emul(const int a, const int b)
|
||||
{
|
||||
long long retval;
|
||||
|
@ -1322,26 +1163,6 @@ __INTRIN_INLINE unsigned __int64 __umulh(unsigned __int64 a, unsigned __int64 b)
|
|||
|
||||
/*** Port I/O ***/
|
||||
|
||||
__INTRIN_INLINE unsigned char __inbyte(const unsigned short Port);
|
||||
__INTRIN_INLINE unsigned short __inword(const unsigned short Port);
|
||||
__INTRIN_INLINE unsigned long __indword(const unsigned short Port);
|
||||
__INTRIN_INLINE void __inbytestring(unsigned short Port, unsigned char * Buffer, unsigned long Count);
|
||||
__INTRIN_INLINE void __inwordstring(unsigned short Port, unsigned short * Buffer, unsigned long Count);
|
||||
__INTRIN_INLINE void __indwordstring(unsigned short Port, unsigned long * Buffer, unsigned long Count);
|
||||
__INTRIN_INLINE void __outbyte(unsigned short const Port, const unsigned char Data);
|
||||
__INTRIN_INLINE void __outword(unsigned short const Port, const unsigned short Data);
|
||||
__INTRIN_INLINE void __outdword(unsigned short const Port, const unsigned long Data);
|
||||
__INTRIN_INLINE void __outbytestring(unsigned short const Port, const unsigned char * const Buffer, const unsigned long Count);
|
||||
__INTRIN_INLINE void __outwordstring(unsigned short const Port, const unsigned short * const Buffer, const unsigned long Count);
|
||||
__INTRIN_INLINE void __outdwordstring(unsigned short const Port, const unsigned long * const Buffer, const unsigned long Count);
|
||||
__INTRIN_INLINE int _inp(unsigned short Port);
|
||||
__INTRIN_INLINE unsigned short _inpw(unsigned short Port);
|
||||
__INTRIN_INLINE unsigned long _inpd(unsigned short Port);
|
||||
__INTRIN_INLINE int _outp(unsigned short Port, int databyte);
|
||||
__INTRIN_INLINE unsigned short _outpw(unsigned short Port, unsigned short dataword);
|
||||
__INTRIN_INLINE unsigned long _outpd(unsigned short Port, unsigned long dataword);
|
||||
|
||||
|
||||
__INTRIN_INLINE unsigned char __inbyte(const unsigned short Port)
|
||||
{
|
||||
unsigned char byte;
|
||||
|
@ -1411,17 +1232,17 @@ __INTRIN_INLINE void __outdword(unsigned short const Port, const unsigned long D
|
|||
__asm__ __volatile__("outl %k[Data], %w[Port]" : : [Port] "Nd" (Port), [Data] "a" (Data));
|
||||
}
|
||||
|
||||
__INTRIN_INLINE void __outbytestring(unsigned short const Port, const unsigned char * const Buffer, const unsigned long Count)
|
||||
__INTRIN_INLINE void __outbytestring(unsigned short Port, unsigned char * const Buffer, const unsigned long Count)
|
||||
{
|
||||
__asm__ __volatile__("rep; outsb" : : [Port] "d" (Port), [Buffer] "S" (Buffer), "c" (Count));
|
||||
}
|
||||
|
||||
__INTRIN_INLINE void __outwordstring(unsigned short const Port, const unsigned short * const Buffer, const unsigned long Count)
|
||||
__INTRIN_INLINE void __outwordstring(unsigned short Port, unsigned short * const Buffer, const unsigned long Count)
|
||||
{
|
||||
__asm__ __volatile__("rep; outsw" : : [Port] "d" (Port), [Buffer] "S" (Buffer), "c" (Count));
|
||||
}
|
||||
|
||||
__INTRIN_INLINE void __outdwordstring(unsigned short const Port, const unsigned long * const Buffer, const unsigned long Count)
|
||||
__INTRIN_INLINE void __outdwordstring(unsigned short Port, unsigned long * const Buffer, const unsigned long Count)
|
||||
{
|
||||
__asm__ __volatile__("rep; outsl" : : [Port] "d" (Port), [Buffer] "S" (Buffer), "c" (Count));
|
||||
}
|
||||
|
@ -1462,12 +1283,6 @@ __INTRIN_INLINE unsigned long _outpd(unsigned short Port, unsigned long dataword
|
|||
|
||||
/*** System information ***/
|
||||
|
||||
__INTRIN_INLINE void __cpuid(int CPUInfo [], const int InfoType);
|
||||
__INTRIN_INLINE unsigned long long __rdtsc(void);
|
||||
__INTRIN_INLINE void __writeeflags(uintptr_t Value);
|
||||
__INTRIN_INLINE uintptr_t __readeflags(void);
|
||||
|
||||
|
||||
__INTRIN_INLINE void __cpuid(int CPUInfo[], const int InfoType)
|
||||
{
|
||||
__asm__ __volatile__("cpuid" : "=a" (CPUInfo[0]), "=b" (CPUInfo[1]), "=c" (CPUInfo[2]), "=d" (CPUInfo[3]) : "a" (InfoType));
|
||||
|
@ -1500,16 +1315,9 @@ __INTRIN_INLINE uintptr_t __readeflags(void)
|
|||
|
||||
/*** Interrupts ***/
|
||||
|
||||
__INTRIN_INLINE void __int2c(void);
|
||||
__INTRIN_INLINE void _disable(void);
|
||||
__INTRIN_INLINE void _enable(void);
|
||||
__INTRIN_INLINE void __halt(void);
|
||||
__declspec(noreturn) __INTRIN_INLINE void __fastfail(unsigned int Code);
|
||||
|
||||
#ifdef __clang__
|
||||
#define __debugbreak() __asm__("int $3")
|
||||
#else
|
||||
__INTRIN_INLINE void __debugbreak(void);
|
||||
__INTRIN_INLINE void __debugbreak(void)
|
||||
{
|
||||
__asm__("int $3");
|
||||
|
@ -1545,32 +1353,6 @@ __INTRIN_INLINE void __fastfail(unsigned int Code)
|
|||
|
||||
/*** Protected memory management ***/
|
||||
|
||||
__INTRIN_INLINE void __invlpg(void * const Address);
|
||||
#ifdef _M_AMD64
|
||||
__INTRIN_INLINE void __writecr0(const unsigned __int64 Data);
|
||||
__INTRIN_INLINE void __writecr3(const unsigned __int64 Data);
|
||||
__INTRIN_INLINE void __writecr4(const unsigned __int64 Data);
|
||||
__INTRIN_INLINE void __writecr8(const unsigned __int64 Data);
|
||||
__INTRIN_INLINE unsigned __int64 __readcr0(void);
|
||||
__INTRIN_INLINE unsigned __int64 __readcr2(void);
|
||||
__INTRIN_INLINE unsigned __int64 __readcr3(void);
|
||||
__INTRIN_INLINE unsigned __int64 __readcr4(void);
|
||||
__INTRIN_INLINE unsigned __int64 __readcr8(void);
|
||||
__INTRIN_INLINE unsigned __int64 __readdr(unsigned int reg);
|
||||
__INTRIN_INLINE void __writedr(unsigned reg, unsigned __int64 value);
|
||||
#else /* _M_AMD64 */
|
||||
__INTRIN_INLINE void __writecr0(const unsigned int Data);
|
||||
__INTRIN_INLINE void __writecr3(const unsigned int Data);
|
||||
__INTRIN_INLINE void __writecr4(const unsigned int Data);
|
||||
__INTRIN_INLINE unsigned long __readcr0(void);
|
||||
__INTRIN_INLINE unsigned long __readcr2(void);
|
||||
__INTRIN_INLINE unsigned long __readcr3(void);
|
||||
__INTRIN_INLINE unsigned long __readcr4(void);
|
||||
__INTRIN_INLINE unsigned int __readdr(unsigned int reg);
|
||||
__INTRIN_INLINE void __writedr(unsigned reg, unsigned int value);
|
||||
#endif /* _M_AMD64 */
|
||||
|
||||
|
||||
#ifdef _M_AMD64
|
||||
|
||||
__INTRIN_INLINE void __writecr0(const unsigned __int64 Data)
|
||||
|
@ -1817,16 +1599,7 @@ __INTRIN_INLINE void __invlpg(void * const Address)
|
|||
|
||||
/*** System operations ***/
|
||||
|
||||
__INTRIN_INLINE unsigned long long __readmsr(const int reg);
|
||||
__INTRIN_INLINE void __writemsr(const unsigned long Register, const unsigned long long Value);
|
||||
__INTRIN_INLINE unsigned long long __readpmc(const int counter);
|
||||
__INTRIN_INLINE unsigned long __segmentlimit(const unsigned long a);
|
||||
__INTRIN_INLINE void __wbinvd(void);
|
||||
__INTRIN_INLINE void __lidt(void *Source);
|
||||
__INTRIN_INLINE void __sidt(void *Destination);
|
||||
|
||||
|
||||
__INTRIN_INLINE unsigned long long __readmsr(const int reg)
|
||||
__INTRIN_INLINE unsigned long long __readmsr(unsigned long reg)
|
||||
{
|
||||
#ifdef _M_AMD64
|
||||
unsigned long low, high;
|
||||
|
@ -1848,7 +1621,7 @@ __INTRIN_INLINE void __writemsr(const unsigned long Register, const unsigned lon
|
|||
#endif
|
||||
}
|
||||
|
||||
__INTRIN_INLINE unsigned long long __readpmc(const int counter)
|
||||
__INTRIN_INLINE unsigned long long __readpmc(unsigned long counter)
|
||||
{
|
||||
unsigned long long retval;
|
||||
__asm__ __volatile__("rdpmc" : "=A" (retval) : "c" (counter));
|
||||
|
@ -1880,9 +1653,6 @@ __INTRIN_INLINE void __sidt(void *Destination)
|
|||
|
||||
/*** Misc operations ***/
|
||||
|
||||
__INTRIN_INLINE void _mm_pause(void);
|
||||
__INTRIN_INLINE void __nop(void);
|
||||
|
||||
__INTRIN_INLINE void _mm_pause(void)
|
||||
{
|
||||
__asm__ __volatile__("pause" : : : "memory");
|
||||
|
|
|
@ -1,591 +1,275 @@
|
|||
#ifndef KJK_INTRIN_H_
|
||||
#define KJK_INTRIN_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*** Stack frame juggling ***/
|
||||
void * _ReturnAddress(void);
|
||||
#pragma intrinsic(_ReturnAddress)
|
||||
void * _AddressOfReturnAddress(void);
|
||||
#pragma intrinsic(_AddressOfReturnAddress)
|
||||
#if defined(_M_IX86) || defined(_M_AMD64)
|
||||
unsigned int __getcallerseflags(void);
|
||||
#pragma intrinsic(__getcallerseflags)
|
||||
#endif
|
||||
|
||||
/*** Memory barriers ***/
|
||||
void _ReadWriteBarrier(void);
|
||||
#pragma intrinsic(_ReadWriteBarrier)
|
||||
void _ReadBarrier(void);
|
||||
#pragma intrinsic(_ReadBarrier)
|
||||
void _WriteBarrier(void);
|
||||
#pragma intrinsic(_WriteBarrier)
|
||||
#if defined(_M_IX86) || defined(_M_AMD64)
|
||||
void _mm_mfence(void);
|
||||
#pragma intrinsic(_mm_mfence)
|
||||
void _mm_lfence(void);
|
||||
#pragma intrinsic(_mm_lfence)
|
||||
void _mm_sfence(void);
|
||||
#pragma intrinsic(_mm_sfence)
|
||||
void __nvreg_restore_fence(void);
|
||||
void __nvreg_save_fence(void);
|
||||
#endif
|
||||
#if defined(_M_AMD64)
|
||||
void __faststorefence(void);
|
||||
#pragma intrinsic(__faststorefence)
|
||||
#elif defined(_M_ARM)
|
||||
__int16 __iso_volatile_load16(const volatile __int16 *);
|
||||
#pragma intrinsic(__iso_volatile_load16)
|
||||
__int32 __iso_volatile_load32(const volatile __int32 *);
|
||||
#pragma intrinsic(__iso_volatile_load32)
|
||||
__int64 __iso_volatile_load64(const volatile __int64 *);
|
||||
#pragma intrinsic(__iso_volatile_load64)
|
||||
__int8 __iso_volatile_load8(const volatile __int8 *);
|
||||
#pragma intrinsic(__iso_volatile_load8)
|
||||
void __iso_volatile_store16(volatile __int16 *, __int16);
|
||||
#pragma intrinsic(__iso_volatile_store16)
|
||||
void __iso_volatile_store32(volatile __int32 *, __int32);
|
||||
#pragma intrinsic(__iso_volatile_store32)
|
||||
void __iso_volatile_store64(volatile __int64 *, __int64);
|
||||
#pragma intrinsic(__iso_volatile_store64)
|
||||
void __iso_volatile_store8(volatile __int8 *, __int8);
|
||||
#pragma intrinsic(__iso_volatile_store8)
|
||||
#endif
|
||||
|
||||
/*** Atomic operations ***/
|
||||
long _InterlockedCompareExchange(_Interlocked_operand_ volatile long * Destination, long Exchange, long Comperand);
|
||||
#pragma intrinsic(_InterlockedCompareExchange)
|
||||
char _InterlockedCompareExchange8(_Interlocked_operand_ char volatile * Destination, char Exchange, char Comparand);
|
||||
#pragma intrinsic(_InterlockedCompareExchange8)
|
||||
short _InterlockedCompareExchange16(_Interlocked_operand_ short volatile * Destination, short Exchange, short Comparand);
|
||||
#pragma intrinsic(_InterlockedCompareExchange16)
|
||||
__int64 _InterlockedCompareExchange64(_Interlocked_operand_ volatile __int64 * Destination, __int64 Exchange, __int64 Comperand);
|
||||
#pragma intrinsic(_InterlockedCompareExchange64)
|
||||
long _InterlockedExchange(_Interlocked_operand_ volatile long * Target, long Value);
|
||||
#pragma intrinsic(_InterlockedExchange)
|
||||
char _InterlockedExchange8(_Interlocked_operand_ char volatile * Target, char Value);
|
||||
#pragma intrinsic(_InterlockedExchange8)
|
||||
short _InterlockedExchange16(_Interlocked_operand_ short volatile * Target, short Value);
|
||||
#pragma intrinsic(_InterlockedExchange16)
|
||||
long _InterlockedExchangeAdd(_Interlocked_operand_ volatile long * Addend, long Value);
|
||||
#pragma intrinsic(_InterlockedExchangeAdd)
|
||||
char _InterlockedExchangeAdd8(_Interlocked_operand_ char volatile * Addend, char Value);
|
||||
#pragma intrinsic(_InterlockedExchangeAdd8)
|
||||
short _InterlockedExchangeAdd16(_Interlocked_operand_ short volatile * Addend, short Value);
|
||||
#pragma intrinsic(_InterlockedExchangeAdd16)
|
||||
char _InterlockedAnd8(_Interlocked_operand_ volatile char * value, char mask);
|
||||
#pragma intrinsic(_InterlockedAnd8)
|
||||
short _InterlockedAnd16(_Interlocked_operand_ volatile short * value, short mask);
|
||||
#pragma intrinsic(_InterlockedAnd16)
|
||||
long _InterlockedAnd(_Interlocked_operand_ volatile long * value, long mask);
|
||||
#pragma intrinsic(_InterlockedAnd)
|
||||
char _InterlockedOr8(_Interlocked_operand_ volatile char * value, char mask);
|
||||
#pragma intrinsic(_InterlockedOr8)
|
||||
short _InterlockedOr16(_Interlocked_operand_ volatile short * value, short mask);
|
||||
#pragma intrinsic(_InterlockedOr16)
|
||||
long _InterlockedOr(_Interlocked_operand_ volatile long * value, long mask);
|
||||
#pragma intrinsic(_InterlockedOr)
|
||||
char _InterlockedXor8(_Interlocked_operand_ volatile char * value, char mask);
|
||||
#pragma intrinsic(_InterlockedXor8)
|
||||
short _InterlockedXor16(_Interlocked_operand_ volatile short * value, short mask);
|
||||
#pragma intrinsic(_InterlockedXor16)
|
||||
long _InterlockedXor(_Interlocked_operand_ volatile long * value, long mask);
|
||||
#pragma intrinsic(_InterlockedXor)
|
||||
long _InterlockedDecrement(_Interlocked_operand_ volatile long * lpAddend);
|
||||
#pragma intrinsic(_InterlockedDecrement)
|
||||
long _InterlockedIncrement(_Interlocked_operand_ volatile long * lpAddend);
|
||||
#pragma intrinsic(_InterlockedIncrement)
|
||||
short _InterlockedDecrement16(_Interlocked_operand_ volatile short * lpAddend);
|
||||
#pragma intrinsic(_InterlockedDecrement16)
|
||||
short _InterlockedIncrement16(_Interlocked_operand_ volatile short * lpAddend);
|
||||
#pragma intrinsic(_InterlockedIncrement16)
|
||||
unsigned char _interlockedbittestandreset(volatile long * a, long b);
|
||||
#pragma intrinsic(_interlockedbittestandreset)
|
||||
unsigned char _interlockedbittestandset(volatile long * a, long b);
|
||||
#pragma intrinsic(_interlockedbittestandset)
|
||||
#if defined(_M_IX86)
|
||||
long _InterlockedAddLargeStatistic(_Interlocked_operand_ volatile __int64 * Addend, long Value);
|
||||
#pragma intrinsic(_InterlockedAddLargeStatistic)
|
||||
#elif defined(_M_AMD64)
|
||||
__int64 _InterlockedExchange64(volatile __int64 * Target, __int64 Value);
|
||||
#pragma intrinsic(_InterlockedExchange64)
|
||||
__int64 _InterlockedExchangeAdd64(volatile __int64 * Addend, __int64 Value);
|
||||
#pragma intrinsic(_InterlockedExchangeAdd64)
|
||||
void * _InterlockedCompareExchangePointer(void * volatile * Destination, void * Exchange, void * Comperand);
|
||||
#pragma intrinsic(_InterlockedCompareExchangePointer)
|
||||
void * _InterlockedExchangePointer(void * volatile * Target, void * Value);
|
||||
#pragma intrinsic(_InterlockedExchangePointer)
|
||||
unsigned char _InterlockedCompareExchange128(_Interlocked_operand_ volatile __int64 * Destination, __int64 ExchangeHigh, __int64 ExchangeLow, __int64 * ComparandResult);
|
||||
#pragma intrinsic(_InterlockedCompareExchange128)
|
||||
__int64 _InterlockedAnd64(volatile __int64 * value, __int64 mask);
|
||||
#pragma intrinsic(_InterlockedAnd64)
|
||||
__int64 _InterlockedOr64(volatile __int64 * value, __int64 mask);
|
||||
#pragma intrinsic(_InterlockedOr64)
|
||||
__int64 _InterlockedDecrement64(volatile __int64 * lpAddend);
|
||||
#pragma intrinsic(_InterlockedDecrement64)
|
||||
__int64 _InterlockedIncrement64(volatile __int64 * lpAddend);
|
||||
#pragma intrinsic(_InterlockedIncrement64)
|
||||
unsigned char _interlockedbittestandreset64(volatile __int64 * a, __int64 b);
|
||||
#pragma intrinsic(_interlockedbittestandreset64)
|
||||
unsigned char _interlockedbittestandset64(volatile __int64 * a, __int64 b);
|
||||
#pragma intrinsic(_interlockedbittestandset64)
|
||||
long _InterlockedAnd_np(volatile long * Value, long Mask);
|
||||
#pragma intrinsic(_InterlockedAnd_np)
|
||||
char _InterlockedAnd8_np(volatile char * Value, char Mask);
|
||||
#pragma intrinsic(_InterlockedAnd8_np)
|
||||
short _InterlockedAnd16_np(volatile short * Value, short Mask);
|
||||
#pragma intrinsic(_InterlockedAnd16_np)
|
||||
__int64 _InterlockedAnd64_np(volatile __int64 * Value, __int64 Mask);
|
||||
#pragma intrinsic(_InterlockedAnd64_np)
|
||||
short _InterlockedCompareExchange16_np(volatile short * Destination, short Exchange, short Comparand);
|
||||
#pragma intrinsic(_InterlockedCompareExchange16_np)
|
||||
__int64 _InterlockedCompareExchange64_np(volatile __int64 * Destination, __int64 Exchange, __int64 Comparand);
|
||||
#pragma intrinsic(_InterlockedCompareExchange64_np)
|
||||
unsigned char _InterlockedCompareExchange128_np(volatile __int64 * Destination, __int64 ExchangeHigh, __int64 ExchangeLow, __int64 * ComparandResult);
|
||||
#pragma intrinsic(_InterlockedCompareExchange128_np)
|
||||
void * _InterlockedCompareExchangePointer_np(void * volatile * Destination, void * Exchange, void * Comparand);
|
||||
#pragma intrinsic(_InterlockedCompareExchangePointer_np)
|
||||
long _InterlockedCompareExchange_np(volatile long * Destination, long Exchange, long Comparand);
|
||||
#pragma intrinsic(_InterlockedCompareExchange_np)
|
||||
short _InterlockedOr16_np(volatile short * Value, short Mask);
|
||||
#pragma intrinsic(_InterlockedOr16_np)
|
||||
char _InterlockedOr8_np(volatile char * Value, char Mask);
|
||||
#pragma intrinsic(_InterlockedOr8_np)
|
||||
long _InterlockedOr_np(volatile long * Value, long Mask);
|
||||
#pragma intrinsic(_InterlockedOr_np)
|
||||
short _InterlockedXor16_np(volatile short * Value, short Mask);
|
||||
#pragma intrinsic(_InterlockedXor16_np)
|
||||
__int64 _InterlockedXor64_np(volatile __int64 * Value, __int64 Mask);
|
||||
#pragma intrinsic(_InterlockedXor64_np)
|
||||
char _InterlockedXor8_np(volatile char * Value, char Mask);
|
||||
#pragma intrinsic(_InterlockedXor8_np)
|
||||
long _InterlockedXor_np(volatile long * Value, long Mask);
|
||||
#pragma intrinsic(_InterlockedXor_np)
|
||||
__int64 _InterlockedOr64_np(volatile __int64 * Value, __int64 Mask);
|
||||
#pragma intrinsic(_InterlockedOr64_np)
|
||||
#elif defined(_M_ARM)
|
||||
long _InterlockedAdd(_Interlocked_operand_ long volatile * Addend, long Value);
|
||||
__int64 _InterlockedAdd64(_Interlocked_operand_ __int64 volatile * Addend, __int64 Value);
|
||||
__int64 _InterlockedAdd64_acq(__int64 volatile * Addend, __int64 Value);
|
||||
__int64 _InterlockedAdd64_nf(__int64 volatile * Addend, __int64 Value);
|
||||
__int64 _InterlockedAdd64_rel(__int64 volatile * Addend, __int64 Value);
|
||||
long _InterlockedAdd_acq(long volatile * Addend, long Value);
|
||||
long _InterlockedAdd_nf(long volatile * Addend, long Value);
|
||||
long _InterlockedAdd_rel(long volatile * Addend, long Value);
|
||||
short _InterlockedAnd16_acq(short volatile * Value, short Mask);
|
||||
short _InterlockedAnd16_nf(short volatile * Value, short Mask);
|
||||
short _InterlockedAnd16_rel(short volatile * Value, short Mask);
|
||||
__int64 _InterlockedAnd64_acq(__int64 volatile * Value, __int64 Mask);
|
||||
__int64 _InterlockedAnd64_nf(__int64 volatile * Value, __int64 Mask);
|
||||
__int64 _InterlockedAnd64_rel(__int64 volatile * Value, __int64 Mask);
|
||||
char _InterlockedAnd8_acq(char volatile * Value, char Mask);
|
||||
char _InterlockedAnd8_nf(char volatile * Value, char Mask);
|
||||
char _InterlockedAnd8_rel(char volatile * Value, char Mask);
|
||||
long _InterlockedAnd_acq(long volatile * Value, long Mask);
|
||||
long _InterlockedAnd_nf(long volatile * Value, long Mask);
|
||||
long _InterlockedAnd_rel(long volatile * Value, long Mask);
|
||||
short _InterlockedCompareExchange16_acq(short volatile * Destination, short Exchange, short Comparand);
|
||||
short _InterlockedCompareExchange16_nf(short volatile * Destination, short Exchange, short Comparand);
|
||||
short _InterlockedCompareExchange16_rel(short volatile * Destination, short Exchange, short Comparand);
|
||||
__int64 _InterlockedCompareExchange64_acq(__int64 volatile * Destination, __int64 Exchange, __int64 Comparand);
|
||||
__int64 _InterlockedCompareExchange64_nf(__int64 volatile * Destination, __int64 Exchange, __int64 Comparand);
|
||||
__int64 _InterlockedCompareExchange64_rel(__int64 volatile * Destination, __int64 Exchange, __int64 Comparand);
|
||||
char _InterlockedCompareExchange8_acq(char volatile * Destination, char Exchange, char Comparand);
|
||||
char _InterlockedCompareExchange8_nf(char volatile * Destination, char Exchange, char Comparand);
|
||||
char _InterlockedCompareExchange8_rel(char volatile * Destination, char Exchange, char Comparand);
|
||||
void * _InterlockedCompareExchangePointer_acq(void * volatile * Destination, void * Exchange, void * Comparand);
|
||||
void * _InterlockedCompareExchangePointer_nf(void * volatile * Destination, void * Exchange, void * Comparand);
|
||||
void * _InterlockedCompareExchangePointer_rel(void * volatile * Destination, void * Exchange, void * Comparand);
|
||||
long _InterlockedCompareExchange_acq(long volatile * Destination, long Exchange, long Comparand);
|
||||
long _InterlockedCompareExchange_nf(long volatile * Destination, long Exchange, long Comparand);
|
||||
long _InterlockedCompareExchange_rel(long volatile * Destination, long Exchange, long Comparand);
|
||||
short _InterlockedDecrement16_acq(short volatile * Addend);
|
||||
short _InterlockedDecrement16_nf(short volatile * Addend);
|
||||
short _InterlockedDecrement16_rel(short volatile * Addend);
|
||||
__int64 _InterlockedDecrement64_acq(__int64 volatile * Addend);
|
||||
__int64 _InterlockedDecrement64_nf(__int64 volatile * Addend);
|
||||
__int64 _InterlockedDecrement64_rel(__int64 volatile * Addend);
|
||||
long _InterlockedDecrement_acq(long volatile * Addend);
|
||||
long _InterlockedDecrement_nf(long volatile * Addend);
|
||||
long _InterlockedDecrement_rel(long volatile * Addend);
|
||||
short _InterlockedExchange16_acq(short volatile * Target, short Value);
|
||||
short _InterlockedExchange16_nf(short volatile * Target, short Value);
|
||||
__int64 _InterlockedExchange64_acq(__int64 volatile * Target, __int64 Value);
|
||||
__int64 _InterlockedExchange64_nf(__int64 volatile * Target, __int64 Value);
|
||||
char _InterlockedExchange8_acq(char volatile * Target, char Value);
|
||||
char _InterlockedExchange8_nf(char volatile * Target, char Value);
|
||||
short _InterlockedExchangeAdd16_acq(short volatile * Addend, short Value);
|
||||
short _InterlockedExchangeAdd16_nf(short volatile * Addend, short Value);
|
||||
short _InterlockedExchangeAdd16_rel(short volatile * Addend, short Value);
|
||||
__int64 _InterlockedExchangeAdd64_acq(__int64 volatile * Addend, __int64 Value);
|
||||
__int64 _InterlockedExchangeAdd64_nf(__int64 volatile * Addend, __int64 Value);
|
||||
__int64 _InterlockedExchangeAdd64_rel(__int64 volatile * Addend, __int64 Value);
|
||||
char _InterlockedExchangeAdd8_acq(char volatile * Addend, char Value);
|
||||
char _InterlockedExchangeAdd8_nf(char volatile * Addend, char Value);
|
||||
char _InterlockedExchangeAdd8_rel(char volatile * Addend, char Value);
|
||||
long _InterlockedExchangeAdd_acq(long volatile * Addend, long Value);
|
||||
long _InterlockedExchangeAdd_nf(long volatile * Addend, long Value);
|
||||
long _InterlockedExchangeAdd_rel(long volatile * Addend, long Value);
|
||||
void * _InterlockedExchangePointer_acq(void * volatile * Target, void * Value);
|
||||
void * _InterlockedExchangePointer_nf(void * volatile * Target, void * Value);
|
||||
long _InterlockedExchange_acq(long volatile * Target, long Value);
|
||||
long _InterlockedExchange_nf(long volatile * Target, long Value);
|
||||
short _InterlockedIncrement16_acq(short volatile * Addend);
|
||||
short _InterlockedIncrement16_nf(short volatile * Addend);
|
||||
short _InterlockedIncrement16_rel(short volatile * Addend);
|
||||
__int64 _InterlockedIncrement64_acq(__int64 volatile * Addend);
|
||||
__int64 _InterlockedIncrement64_nf(__int64 volatile * Addend);
|
||||
__int64 _InterlockedIncrement64_rel(__int64 volatile * Addend);
|
||||
long _InterlockedIncrement_acq(long volatile * Addend);
|
||||
long _InterlockedIncrement_nf(long volatile * Addend);
|
||||
long _InterlockedIncrement_rel(long volatile * Addend);
|
||||
short _InterlockedOr16_acq(short volatile * Value, short Mask);
|
||||
short _InterlockedOr16_nf(short volatile * Value, short Mask);
|
||||
short _InterlockedOr16_rel(short volatile * Value, short Mask);
|
||||
__int64 _InterlockedOr64_acq(__int64 volatile * Value, __int64 Mask);
|
||||
__int64 _InterlockedOr64_nf(__int64 volatile * Value, __int64 Mask);
|
||||
__int64 _InterlockedOr64_rel(__int64 volatile * Value, __int64 Mask);
|
||||
char _InterlockedOr8_acq(char volatile * Value, char Mask);
|
||||
char _InterlockedOr8_nf(char volatile * Value, char Mask);
|
||||
char _InterlockedOr8_rel(char volatile * Value, char Mask);
|
||||
long _InterlockedOr_acq(long volatile * Value, long Mask);
|
||||
long _InterlockedOr_nf(long volatile * Value, long Mask);
|
||||
long _InterlockedOr_rel(long volatile * Value, long Mask);
|
||||
short _InterlockedXor16_acq(short volatile * Value, short Mask);
|
||||
short _InterlockedXor16_nf(short volatile * Value, short Mask);
|
||||
short _InterlockedXor16_rel(short volatile * Value, short Mask);
|
||||
__int64 _InterlockedXor64_acq(__int64 volatile * Value, __int64 Mask);
|
||||
__int64 _InterlockedXor64_nf(__int64 volatile * Value, __int64 Mask);
|
||||
__int64 _InterlockedXor64_rel(_Interlocked_operand_ __int64 volatile * Value, __int64 Mask);
|
||||
char _InterlockedXor8_acq(char volatile * Value, char Mask);
|
||||
char _InterlockedXor8_nf(char volatile * Value, char Mask);
|
||||
char _InterlockedXor8_rel(char volatile * Value, char Mask);
|
||||
long _InterlockedXor_acq(long volatile * Value, long Mask);
|
||||
long _InterlockedXor_nf(long volatile * Value, long Mask);
|
||||
long _InterlockedXor_rel(long volatile * Value, long Mask);
|
||||
unsigned char _interlockedbittestandreset_acq(long volatile *, long);
|
||||
unsigned char _interlockedbittestandreset_nf(long volatile *, long);
|
||||
unsigned char _interlockedbittestandreset_rel(long volatile *, long);
|
||||
unsigned char _interlockedbittestandset_acq(long volatile *, long);
|
||||
unsigned char _interlockedbittestandset_nf(long volatile *, long);
|
||||
unsigned char _interlockedbittestandset_rel(long volatile *, long);
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_M_AMD64) || defined(_M_ARM)
|
||||
__int64 _InterlockedAnd64(_Interlocked_operand_ __int64 volatile * Value, __int64 Mask);
|
||||
void * _InterlockedCompareExchangePointer(_Interlocked_operand_ void * volatile * Destination, void * Exchange, void * Comparand);
|
||||
__int64 _InterlockedDecrement64(_Interlocked_operand_ __int64 volatile * Addend);
|
||||
__int64 _InterlockedExchange64(_Interlocked_operand_ __int64 volatile * Target, __int64 Value);
|
||||
__int64 _InterlockedExchangeAdd64(_Interlocked_operand_ __int64 volatile * Addend, __int64 Value);
|
||||
void * _InterlockedExchangePointer(_Interlocked_operand_ void * volatile * Target, void * Value);
|
||||
__int64 _InterlockedIncrement64(_Interlocked_operand_ __int64 volatile * Addend);
|
||||
__int64 _InterlockedOr64(_Interlocked_operand_ __int64 volatile * Value, __int64 Mask);
|
||||
__int64 _InterlockedXor64(_Interlocked_operand_ __int64 volatile * Value, __int64 Mask);
|
||||
#endif
|
||||
|
||||
/*** String operations ***/
|
||||
#if defined(_M_IX86) || defined(_M_AMD64)
|
||||
void __stosb(unsigned char * Dest, unsigned char Data, size_t Count);
|
||||
#pragma intrinsic(__stosb)
|
||||
void __stosw(unsigned short * Dest, unsigned short Data, size_t Count);
|
||||
#pragma intrinsic(__stosw)
|
||||
void __stosd(unsigned long * Dest, unsigned long Data, size_t Count);
|
||||
#pragma intrinsic(__stosd)
|
||||
void __movsb(unsigned char * Destination, unsigned char const * Source, size_t Count);
|
||||
#pragma intrinsic(__movsb)
|
||||
void __movsw(unsigned short * Destination, unsigned short const * Source, size_t Count);
|
||||
#pragma intrinsic(__movsw)
|
||||
void __movsd(unsigned long * Destination, unsigned long const * Source, size_t Count);
|
||||
#pragma intrinsic(__movsd)
|
||||
#endif
|
||||
#ifdef _M_AMD64
|
||||
void __stosq(unsigned __int64 * Dest, unsigned __int64 Data, size_t Count);
|
||||
#pragma intrinsic(__stosq)
|
||||
void __movsq(unsigned __int64 * Destination, unsigned __int64 const * Source, size_t Count);
|
||||
#pragma intrinsic(__movsq)
|
||||
#endif
|
||||
|
||||
/*** GS segment addressing ***/
|
||||
#if defined(_M_AMD64)
|
||||
void __writegsbyte(unsigned long Offset, unsigned char Data);
|
||||
#pragma intrinsic(__writegsbyte)
|
||||
void __writegsword(unsigned long Offset, unsigned short Data);
|
||||
#pragma intrinsic(__writegsword)
|
||||
void __writegsdword(unsigned long Offset, unsigned long Data);
|
||||
#pragma intrinsic(__writegsdword)
|
||||
void __writegsqword(unsigned long Offset, unsigned __int64 Data);
|
||||
#pragma intrinsic(__writegsqword)
|
||||
unsigned char __readgsbyte(unsigned long Offset);
|
||||
#pragma intrinsic(__readgsbyte)
|
||||
unsigned short __readgsword(unsigned long Offset);
|
||||
#pragma intrinsic(__readgsword)
|
||||
unsigned long __readgsdword(unsigned long Offset);
|
||||
#pragma intrinsic(__readgsdword)
|
||||
unsigned __int64 __readgsqword(unsigned long Offset);
|
||||
#pragma intrinsic(__readgsqword)
|
||||
void __incgsbyte(unsigned long Offset);
|
||||
#pragma intrinsic(__incgsbyte)
|
||||
void __incgsword(unsigned long Offset);
|
||||
#pragma intrinsic(__incgsword)
|
||||
void __incgsdword(unsigned long Offset);
|
||||
#pragma intrinsic(__incgsdword)
|
||||
void __incgsqword(unsigned long);
|
||||
#pragma intrinsic(__incgsqword)
|
||||
void __addgsbyte(unsigned long Offset, unsigned char Data);
|
||||
#pragma intrinsic(__addgsbyte)
|
||||
void __addgsword(unsigned long Offset, unsigned short Data);
|
||||
#pragma intrinsic(__addgsword)
|
||||
void __addgsdword(unsigned long Offset, unsigned long Data);
|
||||
#pragma intrinsic(__addgsdword)
|
||||
void __addgsqword(unsigned long Offset, unsigned __int64 Data);
|
||||
#pragma intrinsic(__addgsqword)
|
||||
#endif
|
||||
|
||||
/*** FS segment addressing ***/
|
||||
#if defined(_M_IX86)
|
||||
void __writefsbyte(unsigned long Offset, unsigned char Data);
|
||||
#pragma intrinsic(__writefsbyte)
|
||||
void __writefsword(unsigned long Offset, unsigned short Data);
|
||||
#pragma intrinsic(__writefsword)
|
||||
void __writefsdword(unsigned long Offset, unsigned long Data);
|
||||
#pragma intrinsic(__writefsdword)
|
||||
void __writefsqword(unsigned long Offset, unsigned __int64 Data);
|
||||
#pragma intrinsic(__writefsdword)
|
||||
unsigned char __readfsbyte(unsigned long Offset);
|
||||
#pragma intrinsic(__readfsbyte)
|
||||
unsigned short __readfsword(unsigned long Offset);
|
||||
#pragma intrinsic(__readfsword)
|
||||
unsigned long __readfsdword(unsigned long Offset);
|
||||
#pragma intrinsic(__readfsdword)
|
||||
void __incfsbyte(unsigned long Offset);
|
||||
#pragma intrinsic(__incfsbyte)
|
||||
void __incfsword(unsigned long Offset);
|
||||
#pragma intrinsic(__incfsword)
|
||||
void __incfsdword(unsigned long Offset);
|
||||
#pragma intrinsic(__incfsdword)
|
||||
void __addfsbyte(unsigned long Offset, unsigned char Data);
|
||||
#pragma intrinsic(__addfsbyte)
|
||||
void __addfsword(unsigned long Offset, unsigned short Data);
|
||||
#pragma intrinsic(__addfsword)
|
||||
void __addfsdword(unsigned long Offset, unsigned long Data);
|
||||
#pragma intrinsic(__addfsdword)
|
||||
#endif
|
||||
|
||||
/*** Bit manipulation ***/
|
||||
unsigned char _BitScanForward(unsigned long * Index, unsigned long Mask);
|
||||
#pragma intrinsic(_BitScanForward)
|
||||
unsigned char _BitScanReverse(unsigned long * Index, unsigned long Mask);
|
||||
#pragma intrinsic(_BitScanReverse)
|
||||
#ifdef _WIN64
|
||||
unsigned char _BitScanForward64(unsigned long * Index, unsigned long long Mask);
|
||||
#pragma intrinsic(_BitScanForward64)
|
||||
unsigned char _BitScanReverse64(unsigned long * Index, unsigned long long Mask);
|
||||
#pragma intrinsic(_BitScanReverse64)
|
||||
#endif
|
||||
unsigned char _bittest(const long * a, long b);
|
||||
#pragma intrinsic(_bittest)
|
||||
unsigned char _bittestandcomplement(long * a, long b);
|
||||
#pragma intrinsic(_bittestandcomplement)
|
||||
unsigned char _bittestandreset(long * a, long b);
|
||||
#pragma intrinsic(_bittestandreset)
|
||||
unsigned char _bittestandset(long * a, long b);
|
||||
#pragma intrinsic(_bittestandset)
|
||||
unsigned char _rotl8(unsigned char value, unsigned char shift);
|
||||
#pragma intrinsic(_rotl8)
|
||||
unsigned short _rotl16(unsigned short value, unsigned char shift);
|
||||
#pragma intrinsic(_rotl16)
|
||||
_Check_return_ unsigned int _rotl(unsigned int value, int shift);
|
||||
#pragma intrinsic(_rotl)
|
||||
_Check_return_ unsigned __int64 __cdecl _rotl64(_In_ unsigned __int64 Value, _In_ int Shift);
|
||||
#pragma intrinsic(_rotl64)
|
||||
_Check_return_ unsigned long __cdecl _lrotl(_In_ unsigned long, _In_ int);
|
||||
#pragma intrinsic(_lrotl)
|
||||
unsigned char _rotr8(unsigned char value, unsigned char shift);
|
||||
#pragma intrinsic(_rotr8)
|
||||
unsigned short _rotr16(unsigned short value, unsigned char shift);
|
||||
#pragma intrinsic(_rotr16)
|
||||
_Check_return_ unsigned int _rotr(unsigned int value, int shift);
|
||||
#pragma intrinsic(_rotr)
|
||||
_Check_return_ unsigned __int64 __cdecl _rotr64(_In_ unsigned __int64 Value, _In_ int Shift);
|
||||
#pragma intrinsic(_rotr64)
|
||||
_Check_return_ unsigned long __cdecl _lrotr(_In_ unsigned long, _In_ int);
|
||||
#pragma intrinsic(_lrotr)
|
||||
unsigned short _byteswap_ushort(unsigned short value);
|
||||
#pragma intrinsic(_byteswap_ushort)
|
||||
unsigned long _byteswap_ulong(unsigned long value);
|
||||
#pragma intrinsic(_byteswap_ulong)
|
||||
unsigned __int64 _byteswap_uint64(unsigned __int64 value);
|
||||
#pragma intrinsic(_byteswap_uint64)
|
||||
#if defined(_M_IX86) || defined(_M_AMD64)
|
||||
unsigned __int64 __ll_lshift(unsigned __int64 Mask, int Bit);
|
||||
#pragma intrinsic(__ll_lshift)
|
||||
__int64 __ll_rshift(__int64 Mask, int Bit);
|
||||
#pragma intrinsic(__ll_rshift)
|
||||
unsigned __int64 __ull_rshift(unsigned __int64 Mask, int Bit);
|
||||
#pragma intrinsic(__ull_rshift)
|
||||
unsigned int __lzcnt(unsigned int Value);
|
||||
#pragma intrinsic(__lzcnt)
|
||||
unsigned short __lzcnt16(unsigned short Value);
|
||||
#pragma intrinsic(__lzcnt16)
|
||||
unsigned int __popcnt(unsigned int Value);
|
||||
#pragma intrinsic(__popcnt)
|
||||
unsigned short __popcnt16(unsigned short Value);
|
||||
#pragma intrinsic(__popcnt16)
|
||||
#endif
|
||||
#ifdef _M_AMD64
|
||||
unsigned __int64 __shiftleft128(unsigned __int64 LowPart, unsigned __int64 HighPart, unsigned char Shift);
|
||||
#pragma intrinsic(__shiftleft128)
|
||||
unsigned __int64 __shiftright128(unsigned __int64 LowPart, unsigned __int64 HighPart, unsigned char Shift);
|
||||
#pragma intrinsic(__shiftright128)
|
||||
unsigned char _bittest64(__int64 const *a, __int64 b);
|
||||
#pragma intrinsic(_bittest64)
|
||||
unsigned char _bittestandcomplement64(__int64 *a, __int64 b);
|
||||
#pragma intrinsic(_bittestandcomplement64)
|
||||
unsigned char _bittestandreset64(__int64 *a, __int64 b);
|
||||
#pragma intrinsic(_bittestandreset64)
|
||||
unsigned char _bittestandset64(__int64 *a, __int64 b);
|
||||
#pragma intrinsic(_bittestandset64)
|
||||
unsigned __int64 __lzcnt64(unsigned __int64 Value);
|
||||
#pragma intrinsic(__lzcnt64)
|
||||
unsigned __int64 __popcnt64(unsigned __int64 Value);
|
||||
#pragma intrinsic(__popcnt64)
|
||||
#elif defined(_M_ARM)
|
||||
unsigned int _CountLeadingOnes(unsigned long Value);
|
||||
unsigned int _CountLeadingOnes64(unsigned __int64 Value);
|
||||
unsigned int _CountLeadingSigns(long Value);
|
||||
unsigned int _CountLeadingSigns64(__int64 Value);
|
||||
unsigned int _CountLeadingZeros(unsigned long Value);
|
||||
unsigned int _CountLeadingZeros64(unsigned __int64 Value);
|
||||
unsigned int _CountOneBits(unsigned long Value);
|
||||
unsigned int _CountOneBits64(unsigned __int64 Value);
|
||||
|
||||
#endif
|
||||
|
||||
/*** 64/128-bit math ***/
|
||||
__int64 __cdecl _abs64(__int64);
|
||||
#pragma intrinsic(_abs64)
|
||||
#if defined(_M_IX86) || defined(_M_AMD64)
|
||||
__int64 __emul(int a, int b);
|
||||
#pragma intrinsic(__emul)
|
||||
unsigned __int64 __emulu(unsigned int a, unsigned int b);
|
||||
#pragma intrinsic(__emulu)
|
||||
#endif
|
||||
#ifdef _M_AMD64
|
||||
__int64 __mulh(__int64 a, __int64 b);
|
||||
#pragma intrinsic(__mulh)
|
||||
unsigned __int64 __umulh(unsigned __int64 a, unsigned __int64 b);
|
||||
#pragma intrinsic(__umulh)
|
||||
__int64 _mul128(__int64 Multiplier, __int64 Multiplicand, __int64 * HighProduct);
|
||||
#pragma intrinsic(_mul128)
|
||||
unsigned __int64 _umul128(unsigned __int64 Multiplier, unsigned __int64 Multiplicand, unsigned __int64 * HighProduct);
|
||||
#pragma intrinsic(_umul128)
|
||||
#elif defined(_M_ARM)
|
||||
long _MulHigh(long Multiplier, long Multiplicand);
|
||||
#pragma intrinsic(_MulHigh)
|
||||
unsigned long _MulUnsignedHigh(unsigned long Multiplier, unsigned long Multiplicand);
|
||||
#pragma intrinsic(_MulUnsignedHigh)
|
||||
#endif
|
||||
|
||||
/** Floating point stuff **/
|
||||
#if defined(_M_ARM)
|
||||
int _isunordered(double arg1, double arg2);
|
||||
#pragma intrinsic(_isunordered)
|
||||
int _isunorderedf(float arg1, float arg2);
|
||||
#pragma intrinsic(_isunorderedf)
|
||||
double _CopyDoubleFromInt64(__int64);
|
||||
#pragma intrinsic(_CopyDoubleFromInt64)
|
||||
float _CopyFloatFromInt32(__int32);
|
||||
#pragma intrinsic(_CopyFloatFromInt32)
|
||||
__int32 _CopyInt32FromFloat(float);
|
||||
#pragma intrinsic(_CopyInt32FromFloat)
|
||||
__int64 _CopyInt64FromDouble(double);
|
||||
#pragma intrinsic(_CopyInt64FromDouble)
|
||||
#endif
|
||||
|
||||
/*** Port I/O ***/
|
||||
#if defined(_M_IX86) || defined(_M_AMD64)
|
||||
unsigned char __inbyte(unsigned short Port);
|
||||
#pragma intrinsic(__inbyte)
|
||||
unsigned short __inword(unsigned short Port);
|
||||
#pragma intrinsic(__inword)
|
||||
unsigned long __indword(unsigned short Port);
|
||||
#pragma intrinsic(__indword)
|
||||
void __inbytestring(unsigned short Port, unsigned char * Buffer, unsigned long Count);
|
||||
#pragma intrinsic(__inbytestring)
|
||||
void __inwordstring(unsigned short Port, unsigned short * Buffer, unsigned long Count);
|
||||
#pragma intrinsic(__inwordstring)
|
||||
void __indwordstring(unsigned short Port, unsigned long * Buffer, unsigned long Count);
|
||||
#pragma intrinsic(__indwordstring)
|
||||
void __outbyte(unsigned short Port, unsigned char Data);
|
||||
#pragma intrinsic(__outbyte)
|
||||
void __outword(unsigned short Port, unsigned short Data);
|
||||
#pragma intrinsic(__outword)
|
||||
void __outdword(unsigned short Port, unsigned long Data);
|
||||
#pragma intrinsic(__outdword)
|
||||
void __outbytestring(unsigned short Port, unsigned char * Buffer, unsigned long Count);
|
||||
#pragma intrinsic(__outbytestring)
|
||||
void __outwordstring(unsigned short Port, unsigned short * Buffer, unsigned long Count);
|
||||
#pragma intrinsic(__outwordstring)
|
||||
void __outdwordstring(unsigned short Port, unsigned long * Buffer, unsigned long Count);
|
||||
#pragma intrinsic(__outdwordstring)
|
||||
int __cdecl _inp(unsigned short Port);
|
||||
#pragma intrinsic(_inp)
|
||||
unsigned long __cdecl _inpd(unsigned short Port);
|
||||
#pragma intrinsic(_inpd)
|
||||
unsigned short __cdecl _inpw(unsigned short Port);
|
||||
#pragma intrinsic(_inpw)
|
||||
int __cdecl inp(unsigned short Port);
|
||||
#pragma intrinsic(inp)
|
||||
unsigned long __cdecl inpd(unsigned short Port);
|
||||
#pragma intrinsic(inpd)
|
||||
unsigned short __cdecl inpw(unsigned short Port);
|
||||
#pragma intrinsic(inpw)
|
||||
int __cdecl _outp(unsigned short Port, int Value);
|
||||
#pragma intrinsic(_outp)
|
||||
unsigned long __cdecl _outpd(unsigned short Port, unsigned long Value);
|
||||
#pragma intrinsic(_outpd)
|
||||
unsigned short __cdecl _outpw(unsigned short Port, unsigned short Value);
|
||||
#pragma intrinsic(_outpw)
|
||||
int __cdecl outp(unsigned short Port, int Value);
|
||||
#pragma intrinsic(outp)
|
||||
unsigned long __cdecl outpd(unsigned short Port, unsigned long Value);
|
||||
#pragma intrinsic(outpd)
|
||||
unsigned short __cdecl outpw(unsigned short Port, unsigned short Value);
|
||||
#pragma intrinsic(outpw)
|
||||
#endif
|
||||
|
||||
/*** System information ***/
|
||||
#if defined(_M_IX86) || defined(_M_AMD64)
|
||||
void __cpuid(int CPUInfo[4], int InfoType);
|
||||
#pragma intrinsic(__cpuid)
|
||||
void __cpuidex(int CPUInfo[4], int InfoType, int ECXValue);
|
||||
#pragma intrinsic(__cpuidex)
|
||||
unsigned __int64 __rdtsc(void);
|
||||
#pragma intrinsic(__rdtsc)
|
||||
unsigned __int64 __rdtscp(unsigned int *);
|
||||
#pragma intrinsic(__rdtscp)
|
||||
void __writeeflags(uintptr_t Value);
|
||||
#pragma intrinsic(__writeeflags)
|
||||
uintptr_t __readeflags(void);
|
||||
#pragma intrinsic(__readeflags)
|
||||
#endif
|
||||
|
||||
/*** Interrupts and traps ***/
|
||||
void __debugbreak(void);
|
||||
#pragma intrinsic(__debugbreak)
|
||||
void _disable(void);
|
||||
#pragma intrinsic(_disable)
|
||||
void _enable(void);
|
||||
#pragma intrinsic(_enable)
|
||||
#if defined(_M_IX86) || defined(_M_AMD64)
|
||||
void __int2c(void);
|
||||
#pragma intrinsic(__int2c)
|
||||
void __halt(void);
|
||||
#pragma intrinsic(__halt)
|
||||
void __ud2(void);
|
||||
#pragma intrinsic(__ud2)
|
||||
#if (_MSC_VER >= 1700)
|
||||
__declspec(noreturn) void __fastfail(unsigned int Code);
|
||||
#pragma intrinsic(__fastfail)
|
||||
#else
|
||||
__declspec(noreturn) __forceinline
|
||||
|
@ -600,37 +284,25 @@ void __fastfail(unsigned int Code)
|
|||
#endif
|
||||
#endif
|
||||
#if defined(_M_ARM)
|
||||
int __trap(int Arg1, ...);
|
||||
#endif
|
||||
|
||||
/*** Protected memory management ***/
|
||||
#if defined(_M_IX86) || defined(_M_AMD64)
|
||||
void __writecr0(uintptr_t Data);
|
||||
#pragma intrinsic(__writecr0)
|
||||
void __writecr3(uintptr_t Data);
|
||||
#pragma intrinsic(__writecr3)
|
||||
void __writecr4(uintptr_t Data);
|
||||
#pragma intrinsic(__writecr4)
|
||||
void __writecr8(uintptr_t Data);
|
||||
#pragma intrinsic(__writecr8)
|
||||
#endif
|
||||
#if defined(_M_IX86)
|
||||
unsigned long __readcr0(void);
|
||||
#pragma intrinsic(__readcr0)
|
||||
unsigned long __readcr2(void);
|
||||
#pragma intrinsic(__readcr2)
|
||||
unsigned long __readcr3(void);
|
||||
#pragma intrinsic(__readcr3)
|
||||
//unsigned long __readcr4(void);
|
||||
//#pragma intrinsic(__readcr4)
|
||||
// HACK: MSVC is broken
|
||||
unsigned long ___readcr4(void);
|
||||
#define __readcr4 ___readcr4
|
||||
unsigned long __readcr8(void);
|
||||
#pragma intrinsic(__readcr8)
|
||||
unsigned int __readdr(unsigned int reg);
|
||||
#pragma intrinsic(__readdr)
|
||||
void __writedr(unsigned reg, unsigned int value);
|
||||
#pragma intrinsic(__writedr)
|
||||
// This intrinsic is broken and generates wrong opcodes,
|
||||
// when optimization is enabled!
|
||||
|
@ -649,133 +321,78 @@ void __forceinline __invlpg_fixed(void * Address)
|
|||
#pragma warning(pop)
|
||||
#define __invlpg __invlpg_fixed
|
||||
#elif defined(_M_AMD64)
|
||||
void __invlpg(void * Address);
|
||||
#pragma intrinsic(__invlpg)
|
||||
unsigned __int64 __readcr0(void);
|
||||
#pragma intrinsic(__readcr0)
|
||||
unsigned __int64 __readcr2(void);
|
||||
#pragma intrinsic(__readcr2)
|
||||
unsigned __int64 __readcr3(void);
|
||||
#pragma intrinsic(__readcr3)
|
||||
unsigned __int64 __readcr4(void);
|
||||
#pragma intrinsic(__readcr4)
|
||||
unsigned __int64 __readcr8(void);
|
||||
#pragma intrinsic(__readcr8)
|
||||
unsigned __int64 __readdr(unsigned int reg);
|
||||
#pragma intrinsic(__readdr)
|
||||
void __writedr(unsigned reg, unsigned __int64 value);
|
||||
#pragma intrinsic(__writedr)
|
||||
#elif defined(_M_ARM)
|
||||
void __cdecl __prefetch(const void *);
|
||||
#pragma intrinsic(__prefetch)
|
||||
#endif
|
||||
|
||||
/*** System operations ***/
|
||||
#if defined(_M_IX86) || defined(_M_AMD64)
|
||||
unsigned __int64 __readmsr(unsigned long reg);
|
||||
#pragma intrinsic(__readmsr)
|
||||
void __writemsr(unsigned long Register, unsigned __int64 Value);
|
||||
#pragma intrinsic(__writemsr)
|
||||
unsigned __int64 __readpmc(unsigned long counter);
|
||||
#pragma intrinsic(__readpmc)
|
||||
unsigned long __segmentlimit(unsigned long a);
|
||||
#pragma intrinsic(__segmentlimit)
|
||||
void __wbinvd(void);
|
||||
#pragma intrinsic(__wbinvd)
|
||||
void __lidt(void *Source);
|
||||
#pragma intrinsic(__lidt)
|
||||
void __sidt(void *Destination);
|
||||
#pragma intrinsic(__sidt)
|
||||
void _mm_pause(void);
|
||||
#pragma intrinsic(_mm_pause)
|
||||
#endif
|
||||
#if defined(_M_ARM)
|
||||
unsigned int _MoveFromCoprocessor(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
|
||||
#pragma intrinsic(_MoveFromCoprocessor)
|
||||
unsigned int _MoveFromCoprocessor2(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
|
||||
#pragma intrinsic(_MoveFromCoprocessor2)
|
||||
unsigned __int64 _MoveFromCoprocessor64(unsigned int, unsigned int, unsigned int);
|
||||
#pragma intrinsic(_MoveFromCoprocessor64)
|
||||
void _MoveToCoprocessor(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
|
||||
#pragma intrinsic(_MoveToCoprocessor)
|
||||
void _MoveToCoprocessor2(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int);
|
||||
#pragma intrinsic(_MoveToCoprocessor2)
|
||||
void _MoveToCoprocessor64(unsigned __int64, unsigned int, unsigned int, unsigned int);
|
||||
#pragma intrinsic(_MoveToCoprocessor64)
|
||||
int _ReadStatusReg(int);
|
||||
#pragma intrinsic(_ReadStatusReg)
|
||||
void _WriteStatusReg(int, int, int);
|
||||
#pragma intrinsic(_WriteStatusReg)
|
||||
void __yield(void);
|
||||
#pragma intrinsic(__yield)
|
||||
void __wfe(void);
|
||||
#pragma intrinsic(__wfe)
|
||||
void __wfi(void);
|
||||
#pragma intrinsic(__wfi)
|
||||
unsigned int __swi(unsigned int, ...);
|
||||
#pragma intrinsic(__swi)
|
||||
unsigned int __hvc(unsigned int, ...);
|
||||
#pragma intrinsic(__hvc)
|
||||
__int64 __ldrexd(__int64 volatile *);
|
||||
#pragma intrinsic(__ldrexd)
|
||||
unsigned __int64 __rdpmccntr64(void);
|
||||
#pragma intrinsic(__rdpmccntr64)
|
||||
void __sev(void);
|
||||
#pragma intrinsic(__sev)
|
||||
#endif
|
||||
|
||||
/** Secure virtual machine **/
|
||||
#if defined(_M_IX86) || defined(_M_AMD64)
|
||||
void __svm_clgi(void);
|
||||
#pragma intrinsic(__svm_clgi)
|
||||
void __svm_invlpga(void * Va, int Asid);
|
||||
#pragma intrinsic(__svm_invlpga)
|
||||
void __svm_skinit(int Slb);
|
||||
#pragma intrinsic(__svm_skinit)
|
||||
void __svm_stgi(void);
|
||||
#pragma intrinsic(__svm_stgi)
|
||||
void __svm_vmload(uintptr_t VmcbPhysicalAddress);
|
||||
#pragma intrinsic(__svm_vmload)
|
||||
void __svm_vmrun(uintptr_t VmcbPhysicalAddress);
|
||||
#pragma intrinsic(__svm_vmrun)
|
||||
void __svm_vmsave(uintptr_t VmcbPhysicalAddress);
|
||||
#pragma intrinsic(__svm_vmsave)
|
||||
#endif
|
||||
|
||||
/** Virtual machine extension **/
|
||||
#if defined(_M_IX86) || defined(_M_AMD64)
|
||||
void __vmx_off(void);
|
||||
void __vmx_vmptrst(unsigned __int64 * VmcsPhysicalAddress );
|
||||
|
||||
#endif
|
||||
#if defined(_M_AMD64)
|
||||
unsigned char __vmx_on(unsigned __int64 * VmsSupportPhysicalAddress);
|
||||
unsigned char __vmx_vmclear(unsigned __int64 * VmcsPhysicalAddress);
|
||||
unsigned char __vmx_vmlaunch(void);
|
||||
unsigned char __vmx_vmptrld(unsigned __int64 *VmcsPhysicalAddress );
|
||||
unsigned char __vmx_vmread(size_t Field, size_t *FieldValue);
|
||||
unsigned char __vmx_vmresume(void);
|
||||
unsigned char __vmx_vmwrite(size_t Field, size_t FieldValue);
|
||||
|
||||
#endif
|
||||
|
||||
/** Misc **/
|
||||
void __nop(void);
|
||||
#pragma intrinsic(__nop)
|
||||
#if (_MSC_VER >= 1700)
|
||||
void __code_seg(const char *);
|
||||
#pragma intrinsic(__code_seg)
|
||||
#endif
|
||||
#ifdef _M_ARM
|
||||
int _AddSatInt(int, int);
|
||||
#pragma intrinsic(_AddSatInt)
|
||||
int _DAddSatInt(int, int);
|
||||
#pragma intrinsic(_DAddSatInt)
|
||||
int _DSubSatInt(int, int);
|
||||
#pragma intrinsic(_DSubSatInt)
|
||||
int _SubSatInt(int, int);
|
||||
#pragma intrinsic(_SubSatInt)
|
||||
void __emit(unsigned __int32);
|
||||
#pragma intrinsic(__emit)
|
||||
void __static_assert(int, const char *);
|
||||
#pragma intrinsic(__static_assert)
|
||||
#endif
|
||||
|
||||
|
@ -783,6 +400,4 @@ void __static_assert(int, const char *);
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif /* KJK_INTRIN_H_ */
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -228,7 +228,7 @@ extern "C" {
|
|||
#define _countof(_Array) (sizeof(_Array) / sizeof(_Array[0]))
|
||||
#else
|
||||
extern "C++" {
|
||||
template <typename _CountofType,size_t _SizeOfArray>
|
||||
template <typename _CountofType,size_t _SizeOfArray>
|
||||
char (*__countof_helper(/*UNALIGNED*/ _CountofType (&_Array)[_SizeOfArray]))[_SizeOfArray];
|
||||
#define _countof(_Array) sizeof(*__countof_helper(_Array))
|
||||
}
|
||||
|
@ -1195,6 +1195,7 @@ extern "C" {
|
|||
|
||||
#if !defined(__GNUC__) && !defined(__clang__)
|
||||
|
||||
_Check_return_
|
||||
unsigned int
|
||||
__cdecl
|
||||
_rotl(
|
||||
|
@ -1211,6 +1212,7 @@ extern "C" {
|
|||
_In_ int _Shift);
|
||||
#endif
|
||||
|
||||
_Check_return_
|
||||
unsigned int
|
||||
__cdecl
|
||||
_rotr(
|
||||
|
|
Loading…
Reference in a new issue