12#include_next <intrin.h>
21#if defined(__i386__) || (defined(__x86_64__) && !defined(__arm64ec__))
29#if defined(__aarch64__) || defined(__arm64ec__)
39#define __DEFAULT_FN_ATTRS __attribute__((__always_inline__, __nodebug__))
42#define __LPTRINT_TYPE__ __int64
44#define __LPTRINT_TYPE__ long
53__m64 _m_from_float(
float);
54float _m_to_float(__m64);
58void __addfsbyte(
unsigned long,
unsigned char);
59void __addfsdword(
unsigned long,
unsigned long);
60void __addfsword(
unsigned long,
unsigned short);
61void __code_seg(
const char *);
64__int64 __emul(
int,
int);
65unsigned __int64 __emulu(
unsigned int,
unsigned int);
66unsigned int __getcallerseflags(
void);
68unsigned char __inbyte(
unsigned short);
69void __inbytestring(
unsigned short,
unsigned char *,
unsigned long);
70void __incfsbyte(
unsigned long);
71void __incfsdword(
unsigned long);
72void __incfsword(
unsigned long);
73unsigned long __indword(
unsigned short);
74void __indwordstring(
unsigned short,
unsigned long *,
unsigned long);
77unsigned short __inword(
unsigned short);
78void __inwordstring(
unsigned short,
unsigned short *,
unsigned long);
80unsigned __int64 __ll_lshift(
unsigned __int64,
int);
81__int64 __ll_rshift(__int64,
int);
82void __movsb(
unsigned char *,
unsigned char const *,
size_t);
83void __movsd(
unsigned long *,
unsigned long const *,
size_t);
84void __movsw(
unsigned short *,
unsigned short const *,
size_t);
86void __nvreg_restore_fence(
void);
87void __nvreg_save_fence(
void);
88void __outbyte(
unsigned short,
unsigned char);
89void __outbytestring(
unsigned short,
unsigned char *,
unsigned long);
90void __outdword(
unsigned short,
unsigned long);
91void __outdwordstring(
unsigned short,
unsigned long *,
unsigned long);
92void __outword(
unsigned short,
unsigned short);
93void __outwordstring(
unsigned short,
unsigned short *,
unsigned long);
94unsigned long __readcr0(
void);
95unsigned long __readcr2(
void);
96unsigned __LPTRINT_TYPE__ __readcr3(
void);
97unsigned long __readcr4(
void);
98unsigned long __readcr8(
void);
99unsigned int __readdr(
unsigned int);
101unsigned char __readfsbyte(
unsigned long);
102unsigned short __readfsword(
unsigned long);
103unsigned long __readfsdword(
unsigned long);
104unsigned __int64 __readfsqword(
unsigned long);
106unsigned __int64 __readmsr(
unsigned long);
107unsigned __int64 __readpmc(
unsigned long);
108unsigned long __segmentlimit(
unsigned long);
110void __stosb(
unsigned char *,
unsigned char,
size_t);
111void __stosd(
unsigned long *,
unsigned long,
size_t);
112void __stosw(
unsigned short *,
unsigned short,
size_t);
113void __svm_clgi(
void);
114void __svm_invlpga(
void *,
int);
115void __svm_skinit(
int);
116void __svm_stgi(
void);
117void __svm_vmload(
size_t);
118void __svm_vmrun(
size_t);
119void __svm_vmsave(
size_t);
121unsigned __int64 __ull_rshift(
unsigned __int64,
int);
123void __vmx_vmptrst(
unsigned __int64 *);
125void __writecr0(
unsigned int);
126void __writecr3(
unsigned __INTPTR_TYPE__);
127void __writecr4(
unsigned int);
128void __writecr8(
unsigned int);
129void __writedr(
unsigned int,
unsigned int);
130void __writefsbyte(
unsigned long,
unsigned char);
131void __writefsdword(
unsigned long,
unsigned long);
132void __writefsqword(
unsigned long,
unsigned __int64);
133void __writefsword(
unsigned long,
unsigned short);
134void __writemsr(
unsigned long,
unsigned __int64);
135void *_AddressOfReturnAddress(
void);
136unsigned char _bittest(
long const *,
long);
137unsigned char _bittestandcomplement(
long *,
long);
138unsigned char _bittestandreset(
long *,
long);
139unsigned char _bittestandset(
long *,
long);
140void __cdecl _disable(
void);
141void __cdecl _enable(
void);
142long _InterlockedAddLargeStatistic(__int64
volatile *_Addend,
long _Value);
143unsigned char _interlockedbittestandreset(
long volatile *,
long);
144unsigned char _interlockedbittestandset(
long volatile *,
long);
145void *_InterlockedCompareExchangePointer_HLEAcquire(
void *
volatile *,
void *,
147void *_InterlockedCompareExchangePointer_HLERelease(
void *
volatile *,
void *,
149long _InterlockedExchangeAdd_HLEAcquire(
long volatile *,
long);
150long _InterlockedExchangeAdd_HLERelease(
long volatile *,
long);
151__int64 _InterlockedExchangeAdd64_HLEAcquire(__int64
volatile *, __int64);
152__int64 _InterlockedExchangeAdd64_HLERelease(__int64
volatile *, __int64);
153void _ReadBarrier(
void);
154unsigned int _rorx_u32(
unsigned int,
const unsigned int);
155int _sarx_i32(
int,
unsigned int);
157int __cdecl _setjmp(jmp_buf);
159unsigned int _shlx_u32(
unsigned int,
unsigned int);
160unsigned int _shrx_u32(
unsigned int,
unsigned int);
161void _Store_HLERelease(
long volatile *,
long);
162void _Store64_HLERelease(__int64
volatile *, __int64);
163void _StorePointer_HLERelease(
void *
volatile *,
void *);
164void _WriteBarrier(
void);
165unsigned __int32 xbegin(
void);
169#if defined(__x86_64__) && !defined(__arm64ec__)
170void __addgsbyte(
unsigned long,
unsigned char);
171void __addgsdword(
unsigned long,
unsigned long);
172void __addgsqword(
unsigned long,
unsigned __int64);
173void __addgsword(
unsigned long,
unsigned short);
174void __faststorefence(
void);
175void __incgsbyte(
unsigned long);
176void __incgsdword(
unsigned long);
177void __incgsqword(
unsigned long);
178void __incgsword(
unsigned long);
179void __movsq(
unsigned long long *,
unsigned long long const *,
size_t);
180unsigned char __readgsbyte(
unsigned long);
181unsigned long __readgsdword(
unsigned long);
182unsigned __int64 __readgsqword(
unsigned long);
183unsigned short __readgsword(
unsigned long);
184void __stosq(
unsigned __int64 *,
unsigned __int64,
size_t);
185unsigned char __vmx_on(
unsigned __int64 *);
186unsigned char __vmx_vmclear(
unsigned __int64 *);
187unsigned char __vmx_vmlaunch(
void);
188unsigned char __vmx_vmptrld(
unsigned __int64 *);
189unsigned char __vmx_vmread(
size_t,
size_t *);
190unsigned char __vmx_vmresume(
void);
191unsigned char __vmx_vmwrite(
size_t,
size_t);
192void __writegsbyte(
unsigned long,
unsigned char);
193void __writegsdword(
unsigned long,
unsigned long);
194void __writegsqword(
unsigned long,
unsigned __int64);
195void __writegsword(
unsigned long,
unsigned short);
196unsigned char _bittest64(__int64
const *, __int64);
197unsigned char _bittestandcomplement64(__int64 *, __int64);
198unsigned char _bittestandreset64(__int64 *, __int64);
199unsigned char _bittestandset64(__int64 *, __int64);
200long _InterlockedAnd_np(
long volatile *_Value,
long _Mask);
201short _InterlockedAnd16_np(
short volatile *_Value,
short _Mask);
202__int64 _InterlockedAnd64_np(__int64
volatile *_Value, __int64 _Mask);
203char _InterlockedAnd8_np(
char volatile *_Value,
char _Mask);
204unsigned char _interlockedbittestandreset64(__int64
volatile *, __int64);
205unsigned char _interlockedbittestandset64(__int64
volatile *, __int64);
206long _InterlockedCompareExchange_np(
long volatile *_Destination,
long _Exchange,
208unsigned char _InterlockedCompareExchange128_np(__int64
volatile *_Destination,
209 __int64 _ExchangeHigh,
210 __int64 _ExchangeLow,
211 __int64 *_ComparandResult);
212short _InterlockedCompareExchange16_np(
short volatile *_Destination,
213 short _Exchange,
short _Comparand);
214__int64 _InterlockedCompareExchange64_np(__int64
volatile *_Destination,
215 __int64 _Exchange, __int64 _Comparand);
216void *_InterlockedCompareExchangePointer_np(
void *
volatile *_Destination,
217 void *_Exchange,
void *_Comparand);
218long _InterlockedOr_np(
long volatile *_Value,
long _Mask);
219short _InterlockedOr16_np(
short volatile *_Value,
short _Mask);
220__int64 _InterlockedOr64_np(__int64
volatile *_Value, __int64 _Mask);
221char _InterlockedOr8_np(
char volatile *_Value,
char _Mask);
222long _InterlockedXor_np(
long volatile *_Value,
long _Mask);
223short _InterlockedXor16_np(
short volatile *_Value,
short _Mask);
224__int64 _InterlockedXor64_np(__int64
volatile *_Value, __int64 _Mask);
225char _InterlockedXor8_np(
char volatile *_Value,
char _Mask);
226unsigned __int64 _rorx_u64(
unsigned __int64,
const unsigned int);
227__int64 _sarx_i64(__int64,
unsigned int);
228unsigned __int64 _shlx_u64(
unsigned __int64,
unsigned int);
229unsigned __int64 _shrx_u64(
unsigned __int64,
unsigned int);
230__int64 __mulh(__int64, __int64);
231unsigned __int64 __umulh(
unsigned __int64,
unsigned __int64);
232__int64 _mul128(__int64, __int64, __int64 *);
240#if defined(__i386__) || (defined(__x86_64__) && !defined(__arm64ec__))
242 unsigned char const *
__src,
244#if defined(__x86_64__)
245 __asm__ __volatile__(
"rep movsb"
246 :
"+D"(__dst),
"+S"(
__src),
"+c"(__n)
250 __asm__ __volatile__(
"xchg {%%esi, %1|%1, esi}\n"
252 "xchg {%%esi, %1|%1, esi}"
253 :
"+D"(__dst),
"+r"(
__src),
"+c"(__n)
259 unsigned long const *
__src,
261#if defined(__x86_64__)
262 __asm__ __volatile__(
"rep movs{l|d}"
263 :
"+D"(__dst),
"+S"(
__src),
"+c"(__n)
267 __asm__ __volatile__(
"xchg {%%esi, %1|%1, esi}\n"
269 "xchg {%%esi, %1|%1, esi}"
270 :
"+D"(__dst),
"+r"(
__src),
"+c"(__n)
276 unsigned short const *
__src,
278#if defined(__x86_64__)
279 __asm__ __volatile__(
"rep movsw"
280 :
"+D"(__dst),
"+S"(
__src),
"+c"(__n)
284 __asm__ __volatile__(
"xchg {%%esi, %1|%1, esi}\n"
286 "xchg {%%esi, %1|%1, esi}"
287 :
"+D"(__dst),
"+r"(
__src),
"+c"(__n)
295 __asm__ __volatile__(
"rep stos{l|d}"
296 :
"+D"(__dst),
"+c"(__n)
303 __asm__ __volatile__(
"rep stosw"
304 :
"+D"(__dst),
"+c"(__n)
309#if defined(__x86_64__) && !defined(__arm64ec__)
311 unsigned long long *__dst,
unsigned long long const *
__src,
size_t __n) {
312 __asm__ __volatile__(
"rep movsq"
313 :
"+D"(__dst),
"+S"(
__src),
"+c"(__n)
318 unsigned __int64 __x,
320 __asm__ __volatile__(
"rep stosq" :
"+D"(__dst),
"+c"(__n) :
"a"(__x)
328#if defined(__i386__) || (defined(__x86_64__) && !defined(__arm64ec__))
330 __asm__
volatile(
"hlt");
333static inline unsigned char __inbyte(
unsigned short port) {
335 __asm__ __volatile__(
"inb %w1, %b0" :
"=a"(ret) :
"Nd"(port));
339static inline unsigned short __inword(
unsigned short port) {
341 __asm__ __volatile__(
"inw %w1, %w0" :
"=a"(ret) :
"Nd"(port));
345static inline unsigned long __indword(
unsigned short port) {
347 __asm__ __volatile__(
"inl %w1, %k0" :
"=a"(ret) :
"Nd"(port));
351static inline void __outbyte(
unsigned short port,
unsigned char data) {
352 __asm__ __volatile__(
"outb %b0, %w1" : :
"a"(data),
"Nd"(port));
355static inline void __outword(
unsigned short port,
unsigned short data) {
356 __asm__ __volatile__(
"outw %w0, %w1" : :
"a"(data),
"Nd"(port));
359static inline void __outdword(
unsigned short port,
unsigned long data) {
360 __asm__ __volatile__(
"outl %k0, %w1" : :
"a"(data),
"Nd"(port));
364#if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__)
366 __asm__
volatile(
"nop");
373#if defined(__aarch64__) || defined(__arm64ec__)
374unsigned __int64 __getReg(
int);
375long _InterlockedAdd(
long volatile *Addend,
long Value);
376__int64 _InterlockedAdd64(__int64
volatile *Addend, __int64
Value);
377__int64 _ReadStatusReg(
int);
378void _WriteStatusReg(
int, __int64);
380unsigned short __cdecl _byteswap_ushort(
unsigned short val);
381unsigned long __cdecl _byteswap_ulong (
unsigned long val);
382unsigned __int64 __cdecl _byteswap_uint64(
unsigned __int64 val);
384__int64 __mulh(__int64
__a, __int64
__b);
385unsigned __int64 __umulh(
unsigned __int64
__a,
unsigned __int64
__b);
389void __writex18byte(
unsigned long offset,
unsigned char data);
390void __writex18word(
unsigned long offset,
unsigned short data);
391void __writex18dword(
unsigned long offset,
unsigned long data);
392void __writex18qword(
unsigned long offset,
unsigned __int64 data);
394unsigned char __readx18byte(
unsigned long offset);
395unsigned short __readx18word(
unsigned long offset);
396unsigned long __readx18dword(
unsigned long offset);
397unsigned __int64 __readx18qword(
unsigned long offset);
399double _CopyDoubleFromInt64(__int64);
400float _CopyFloatFromInt32(__int32);
401__int32 _CopyInt32FromFloat(
float);
402__int64 _CopyInt64FromDouble(
double);
404unsigned int _CountLeadingOnes(
unsigned long);
405unsigned int _CountLeadingOnes64(
unsigned __int64);
406unsigned int _CountLeadingSigns(
long);
407unsigned int _CountLeadingSigns64(__int64);
408unsigned int _CountOneBits(
unsigned long);
409unsigned int _CountOneBits64(
unsigned __int64);
411unsigned int __hlt(
unsigned int, ...);
413void __cdecl __prefetch(
const void *);
420#if defined(__i386__) || (defined(__x86_64__) && !defined(__arm64ec__))
422__readmsr(
unsigned long __register) {
431 __asm__ (
"rdmsr" :
"=d"(__edx),
"=a"(__eax) :
"c"(__register));
432 return (((
unsigned __int64)__edx) << 32) | (
unsigned __int64)__eax;
436 unsigned __LPTRINT_TYPE__ __cr3_val;
437 __asm__ __volatile__(
438 "mov {%%cr3, %0|%0, cr3}"
446__writecr3(
unsigned __INTPTR_TYPE__ __cr3_val) {
447 __asm__ (
"mov {%0, %%cr3|cr3, %0}" : :
"r"(__cr3_val) :
"memory");
455#undef __LPTRINT_TYPE__
457#undef __DEFAULT_FN_ATTRS
#define __DEFAULT_FN_ATTRS
static __inline__ vector float vector float __b
#define __cpuid(__leaf, __eax, __ebx, __ecx, __edx)
static __inline void __cpuidex(int __cpu_info[4], int __leaf, int __subleaf)
static __inline__ void int __a
static __inline__ void const void * __src
static __inline__ void __DEFAULT_FN_ATTRS _xend(void)