2007-03-15 15:42:11 +00:00
|
|
|
/*
|
|
|
|
Compatibility <intrin_x86.h> header for GCC -- GCC equivalents of intrinsic
|
|
|
|
Microsoft Visual C++ functions. Originally developed for the ReactOS
|
|
|
|
(<http://www.reactos.org/>) and TinyKrnl (<http://www.tinykrnl.org/>)
|
|
|
|
projects.
|
|
|
|
|
|
|
|
Copyright (c) 2006 KJK::Hyperion <hackbunny@reactos.com>
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
copy of this software and associated documentation files (the "Software"),
|
|
|
|
to deal in the Software without restriction, including without limitation
|
|
|
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
Software is furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
DEALINGS IN THE SOFTWARE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef KJK_INTRIN_X86_H_
|
|
|
|
#define KJK_INTRIN_X86_H_
|
|
|
|
|
|
|
|
/*
|
|
|
|
FIXME: review all "memory" clobbers, add/remove to match Visual C++
|
|
|
|
behavior: some "obvious" memory barriers are not present in the Visual C++
|
|
|
|
implementation - e.g. __stosX; on the other hand, some memory barriers that
|
|
|
|
*are* present could have been missed
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
NOTE: this is a *compatibility* header. Some functions may look wrong at
|
|
|
|
first, but they're only "as wrong" as they would be on Visual C++. Our
|
|
|
|
priority is compatibility
|
|
|
|
|
|
|
|
NOTE: unlike most people who write inline asm for GCC, I didn't pull the
|
|
|
|
constraints and the uses of __volatile__ out of my... hat. Do not touch
|
|
|
|
them. I hate cargo cult programming
|
|
|
|
|
|
|
|
NOTE: be very careful with declaring "memory" clobbers. Some "obvious"
|
|
|
|
barriers aren't there in Visual C++ (e.g. __stosX)
|
|
|
|
|
|
|
|
NOTE: review all intrinsics with a return value, add/remove __volatile__
|
|
|
|
where necessary. If an intrinsic whose value is ignored generates a no-op
|
|
|
|
under Visual C++, __volatile__ must be omitted; if it always generates code
|
|
|
|
(for example, if it has side effects), __volatile__ must be specified. GCC
|
|
|
|
will only optimize out non-volatile asm blocks with outputs, so input-only
|
|
|
|
blocks are safe. Oddities such as the non-volatile 'rdmsr' are intentional
|
|
|
|
and follow Visual C++ behavior
|
|
|
|
|
|
|
|
NOTE: on GCC 4.1.0, please use the __sync_* built-ins for barriers and
|
|
|
|
atomic operations. Test the version like this:
|
|
|
|
|
|
|
|
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100
|
|
|
|
...
|
|
|
|
|
|
|
|
Pay attention to the type of barrier. Make it match with what Visual C++
|
|
|
|
would use in the same case
|
|
|
|
*/
|
|
|
|
|
2008-12-21 03:22:17 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2012-12-27 22:26:35 +00:00
|
|
|
/*** memcopy must be memmove ***/
|
2017-10-01 10:14:03 +00:00
|
|
|
void* __cdecl memmove(void* dest, const void* source, size_t num);
|
|
|
|
__INTRIN_INLINE void* __cdecl memcpy(void* dest, const void* source, size_t num)
|
2012-12-27 22:26:35 +00:00
|
|
|
{
|
|
|
|
return memmove(dest, source, num);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-03-15 15:42:11 +00:00
|
|
|
/*** Stack frame juggling ***/
|
|
|
|
#define _ReturnAddress() (__builtin_return_address(0))
|
|
|
|
#define _AddressOfReturnAddress() (&(((void **)(__builtin_frame_address(0)))[1]))
|
|
|
|
/* TODO: __getcallerseflags but how??? */
|
|
|
|
|
2011-01-21 20:56:36 +00:00
|
|
|
/*** Memory barriers ***/
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_ReadWriteBarrier)
|
2011-08-09 14:22:29 +00:00
|
|
|
__INTRIN_INLINE void _ReadWriteBarrier(void)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
2011-08-09 14:22:29 +00:00
|
|
|
__asm__ __volatile__("" : : : "memory");
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2011-08-09 14:22:29 +00:00
|
|
|
|
|
|
|
/* GCC only supports full barriers */
|
|
|
|
#define _ReadBarrier _ReadWriteBarrier
|
|
|
|
#define _WriteBarrier _ReadWriteBarrier
|
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_mm_mfence)
|
2011-08-09 14:22:29 +00:00
|
|
|
__INTRIN_INLINE void _mm_mfence(void)
|
|
|
|
{
|
|
|
|
__asm__ __volatile__("mfence" : : : "memory");
|
2007-03-15 15:42:11 +00:00
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_mm_lfence)
|
2011-01-21 20:56:36 +00:00
|
|
|
__INTRIN_INLINE void _mm_lfence(void)
|
|
|
|
{
|
2011-08-09 14:22:29 +00:00
|
|
|
_ReadBarrier();
|
2011-01-21 20:56:36 +00:00
|
|
|
__asm__ __volatile__("lfence");
|
2011-08-09 14:22:29 +00:00
|
|
|
_ReadBarrier();
|
2011-01-21 20:56:36 +00:00
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2011-01-21 20:56:36 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_mm_sfence)
|
2011-01-21 20:56:36 +00:00
|
|
|
__INTRIN_INLINE void _mm_sfence(void)
|
|
|
|
{
|
2011-08-09 14:22:29 +00:00
|
|
|
_WriteBarrier();
|
2011-01-21 20:56:36 +00:00
|
|
|
__asm__ __volatile__("sfence");
|
2011-08-09 14:22:29 +00:00
|
|
|
_WriteBarrier();
|
2011-01-21 20:56:36 +00:00
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2011-01-21 20:56:36 +00:00
|
|
|
|
2012-05-01 15:45:49 +00:00
|
|
|
#ifdef __x86_64__
|
2011-08-09 14:22:29 +00:00
|
|
|
__INTRIN_INLINE void __faststorefence(void)
|
2011-01-21 20:56:36 +00:00
|
|
|
{
|
2012-05-01 15:45:49 +00:00
|
|
|
long local;
|
2011-08-09 14:22:29 +00:00
|
|
|
__asm__ __volatile__("lock; orl $0, %0;" : : "m"(local));
|
2011-01-21 20:56:36 +00:00
|
|
|
}
|
2011-08-09 14:22:29 +00:00
|
|
|
#endif
|
2011-01-21 20:56:36 +00:00
|
|
|
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2011-01-21 20:56:36 +00:00
|
|
|
/*** Atomic operations ***/
|
|
|
|
|
2007-03-15 15:42:11 +00:00
|
|
|
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE char _InterlockedCompareExchange8(volatile char * Destination, char Exchange, char Comperand)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
return __sync_val_compare_and_swap(Destination, Comperand, Exchange);
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE short _InterlockedCompareExchange16(volatile short * Destination, short Exchange, short Comperand)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
return __sync_val_compare_and_swap(Destination, Comperand, Exchange);
|
|
|
|
}
|
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedCompareExchange)
|
2017-10-01 10:14:03 +00:00
|
|
|
__INTRIN_INLINE long __cdecl _InterlockedCompareExchange(volatile long * Destination, long Exchange, long Comperand)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
return __sync_val_compare_and_swap(Destination, Comperand, Exchange);
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedCompareExchangePointer)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void * _InterlockedCompareExchangePointer(void * volatile * Destination, void * Exchange, void * Comperand)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
2010-05-30 13:02:29 +00:00
|
|
|
return (void *)__sync_val_compare_and_swap(Destination, Comperand, Exchange);
|
2007-03-15 15:42:11 +00:00
|
|
|
}
|
2014-09-07 17:09:34 +00:00
|
|
|
#endif
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE char _InterlockedExchange8(volatile char * Target, char Value)
|
2014-06-08 22:28:35 +00:00
|
|
|
{
|
|
|
|
/* NOTE: __sync_lock_test_and_set would be an acquire barrier, so we force a full barrier */
|
|
|
|
__sync_synchronize();
|
|
|
|
return __sync_lock_test_and_set(Target, Value);
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE short _InterlockedExchange16(volatile short * Target, short Value)
|
2014-06-08 22:28:35 +00:00
|
|
|
{
|
|
|
|
/* NOTE: __sync_lock_test_and_set would be an acquire barrier, so we force a full barrier */
|
|
|
|
__sync_synchronize();
|
|
|
|
return __sync_lock_test_and_set(Target, Value);
|
|
|
|
}
|
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedExchange)
|
2017-10-01 10:14:03 +00:00
|
|
|
__INTRIN_INLINE long __cdecl _InterlockedExchange(volatile long * Target, long Value)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
/* NOTE: __sync_lock_test_and_set would be an acquire barrier, so we force a full barrier */
|
|
|
|
__sync_synchronize();
|
|
|
|
return __sync_lock_test_and_set(Target, Value);
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedExchangePointer)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void * _InterlockedExchangePointer(void * volatile * Target, void * Value)
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
{
|
|
|
|
/* NOTE: __sync_lock_test_and_set would be an acquire barrier, so we force a full barrier */
|
|
|
|
__sync_synchronize();
|
2014-09-07 17:09:34 +00:00
|
|
|
return (void *)__sync_lock_test_and_set(Target, Value);
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#if defined(__x86_64__)
|
|
|
|
__INTRIN_INLINE long long _InterlockedExchange64(volatile long long * Target, long long Value)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
2014-06-08 22:28:35 +00:00
|
|
|
/* NOTE: __sync_lock_test_and_set would be an acquire barrier, so we force a full barrier */
|
2007-03-15 15:42:11 +00:00
|
|
|
__sync_synchronize();
|
2014-09-07 17:09:34 +00:00
|
|
|
return __sync_lock_test_and_set(Target, Value);
|
2007-03-15 15:42:11 +00:00
|
|
|
}
|
2014-09-07 17:09:34 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE char _InterlockedExchangeAdd8(char volatile * Addend, char Value)
|
|
|
|
{
|
|
|
|
return __sync_fetch_and_add(Addend, Value);
|
|
|
|
}
|
|
|
|
|
|
|
|
__INTRIN_INLINE short _InterlockedExchangeAdd16(volatile short * Addend, short Value)
|
2007-09-26 16:41:35 +00:00
|
|
|
{
|
|
|
|
return __sync_fetch_and_add(Addend, Value);
|
|
|
|
}
|
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedExchangeAdd)
|
2017-10-01 10:14:03 +00:00
|
|
|
__INTRIN_INLINE long __cdecl _InterlockedExchangeAdd(volatile long * Addend, long Value)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
return __sync_fetch_and_add(Addend, Value);
|
|
|
|
}
|
2014-03-02 20:42:26 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#if defined(__x86_64__)
|
|
|
|
__INTRIN_INLINE long long _InterlockedExchangeAdd64(volatile long long * Addend, long long Value)
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
{
|
|
|
|
return __sync_fetch_and_add(Addend, Value);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE char _InterlockedAnd8(volatile char * value, char mask)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
return __sync_fetch_and_and(value, mask);
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE short _InterlockedAnd16(volatile short * value, short mask)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
return __sync_fetch_and_and(value, mask);
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE long _InterlockedAnd(volatile long * value, long mask)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
return __sync_fetch_and_and(value, mask);
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#if defined(__x86_64__)
|
|
|
|
__INTRIN_INLINE long long _InterlockedAnd64(volatile long long * value, long long mask)
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
{
|
|
|
|
return __sync_fetch_and_and(value, mask);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE char _InterlockedOr8(volatile char * value, char mask)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
return __sync_fetch_and_or(value, mask);
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE short _InterlockedOr16(volatile short * value, short mask)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
return __sync_fetch_and_or(value, mask);
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE long _InterlockedOr(volatile long * value, long mask)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
return __sync_fetch_and_or(value, mask);
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#if defined(__x86_64__)
|
|
|
|
__INTRIN_INLINE long long _InterlockedOr64(volatile long long * value, long long mask)
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
{
|
|
|
|
return __sync_fetch_and_or(value, mask);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE char _InterlockedXor8(volatile char * value, char mask)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
return __sync_fetch_and_xor(value, mask);
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE short _InterlockedXor16(volatile short * value, short mask)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
return __sync_fetch_and_xor(value, mask);
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE long _InterlockedXor(volatile long * value, long mask)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
return __sync_fetch_and_xor(value, mask);
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#if defined(__x86_64__)
|
|
|
|
__INTRIN_INLINE long long _InterlockedXor64(volatile long long * value, long long mask)
|
2012-05-01 15:45:49 +00:00
|
|
|
{
|
|
|
|
return __sync_fetch_and_xor(value, mask);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedDecrement)
|
2017-10-01 10:14:03 +00:00
|
|
|
__INTRIN_INLINE long __cdecl _InterlockedDecrement(volatile long * lpAddend)
|
2012-07-13 14:51:46 +00:00
|
|
|
{
|
|
|
|
return __sync_sub_and_fetch(lpAddend, 1);
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2012-07-13 14:51:46 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedIncrement)
|
2017-10-01 10:14:03 +00:00
|
|
|
__INTRIN_INLINE long __cdecl _InterlockedIncrement(volatile long * lpAddend)
|
2012-07-13 14:51:46 +00:00
|
|
|
{
|
|
|
|
return __sync_add_and_fetch(lpAddend, 1);
|
|
|
|
}
|
2014-03-02 20:42:26 +00:00
|
|
|
#endif
|
2012-07-13 14:51:46 +00:00
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE short _InterlockedDecrement16(volatile short * lpAddend)
|
2012-07-13 14:51:46 +00:00
|
|
|
{
|
|
|
|
return __sync_sub_and_fetch(lpAddend, 1);
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE short _InterlockedIncrement16(volatile short * lpAddend)
|
2012-07-13 14:51:46 +00:00
|
|
|
{
|
|
|
|
return __sync_add_and_fetch(lpAddend, 1);
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#if defined(__x86_64__)
|
|
|
|
__INTRIN_INLINE long long _InterlockedDecrement64(volatile long long * lpAddend)
|
2012-07-13 14:51:46 +00:00
|
|
|
{
|
|
|
|
return __sync_sub_and_fetch(lpAddend, 1);
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE long long _InterlockedIncrement64(volatile long long * lpAddend)
|
2012-07-13 14:51:46 +00:00
|
|
|
{
|
|
|
|
return __sync_add_and_fetch(lpAddend, 1);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-08-10 21:17:38 +00:00
|
|
|
#else /* (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100 */
|
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedCompareExchange8)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE char _InterlockedCompareExchange8(volatile char * Destination, char Exchange, char Comperand)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
char retval = Comperand;
|
|
|
|
__asm__("lock; cmpxchgb %b[Exchange], %[Destination]" : [retval] "+a" (retval) : [Destination] "m" (*Destination), [Exchange] "q" (Exchange) : "memory");
|
|
|
|
return retval;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedCompareExchange16)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE short _InterlockedCompareExchange16(volatile short * Destination, short Exchange, short Comperand)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
short retval = Comperand;
|
|
|
|
__asm__("lock; cmpxchgw %w[Exchange], %[Destination]" : [retval] "+a" (retval) : [Destination] "m" (*Destination), [Exchange] "q" (Exchange): "memory");
|
|
|
|
return retval;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedCompareExchange)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE long _InterlockedCompareExchange(volatile long * Destination, long Exchange, long Comperand)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
long retval = Comperand;
|
|
|
|
__asm__("lock; cmpxchgl %k[Exchange], %[Destination]" : [retval] "+a" (retval) : [Destination] "m" (*Destination), [Exchange] "q" (Exchange): "memory");
|
|
|
|
return retval;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedCompareExchangePointer)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void * _InterlockedCompareExchangePointer(void * volatile * Destination, void * Exchange, void * Comperand)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
void * retval = (void *)Comperand;
|
|
|
|
__asm__("lock; cmpxchgl %k[Exchange], %[Destination]" : [retval] "=a" (retval) : "[retval]" (retval), [Destination] "m" (*Destination), [Exchange] "q" (Exchange) : "memory");
|
|
|
|
return retval;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedExchange8)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE char _InterlockedExchange8(volatile char * Target, char Value)
|
2014-06-08 22:28:35 +00:00
|
|
|
{
|
|
|
|
char retval = Value;
|
|
|
|
__asm__("xchgb %[retval], %[Target]" : [retval] "+r" (retval) : [Target] "m" (*Target) : "memory");
|
|
|
|
return retval;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2014-06-08 22:28:35 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedExchange16)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE short _InterlockedExchange16(volatile short * Target, short Value)
|
2014-06-08 22:28:35 +00:00
|
|
|
{
|
|
|
|
short retval = Value;
|
|
|
|
__asm__("xchgw %[retval], %[Target]" : [retval] "+r" (retval) : [Target] "m" (*Target) : "memory");
|
|
|
|
return retval;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2014-06-08 22:28:35 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedExchange)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE long _InterlockedExchange(volatile long * Target, long Value)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
long retval = Value;
|
|
|
|
__asm__("xchgl %[retval], %[Target]" : [retval] "+r" (retval) : [Target] "m" (*Target) : "memory");
|
|
|
|
return retval;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedExchangePointer)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void * _InterlockedExchangePointer(void * volatile * Target, void * Value)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
void * retval = Value;
|
|
|
|
__asm__("xchgl %[retval], %[Target]" : [retval] "+r" (retval) : [Target] "m" (*Target) : "memory");
|
|
|
|
return retval;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedExchangeAdd8)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE char _InterlockedExchangeAdd8(char volatile * Addend, char Value)
|
2007-09-26 16:41:35 +00:00
|
|
|
{
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
char retval = Value;
|
|
|
|
__asm__("lock; xaddb %[retval], %[Addend]" : [retval] "+r" (retval) : [Addend] "m" (*Addend) : "memory");
|
|
|
|
return retval;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedExchangeAdd16)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE short _InterlockedExchangeAdd16(volatile short * Addend, short Value)
|
|
|
|
{
|
|
|
|
short retval = Value;
|
2007-09-26 16:41:35 +00:00
|
|
|
__asm__("lock; xaddw %[retval], %[Addend]" : [retval] "+r" (retval) : [Addend] "m" (*Addend) : "memory");
|
|
|
|
return retval;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-09-26 16:41:35 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedExchangeAdd)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE long _InterlockedExchangeAdd(volatile long * Addend, long Value)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
long retval = Value;
|
|
|
|
__asm__("lock; xaddl %[retval], %[Addend]" : [retval] "+r" (retval) : [Addend] "m" (*Addend) : "memory");
|
|
|
|
return retval;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedAnd8)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE char _InterlockedAnd8(volatile char * value, char mask)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
char x;
|
|
|
|
char y;
|
|
|
|
|
|
|
|
y = *value;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
x = y;
|
|
|
|
y = _InterlockedCompareExchange8(value, x & mask, x);
|
|
|
|
}
|
|
|
|
while(y != x);
|
|
|
|
|
|
|
|
return y;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedAnd16)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE short _InterlockedAnd16(volatile short * value, short mask)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
short x;
|
|
|
|
short y;
|
|
|
|
|
|
|
|
y = *value;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
x = y;
|
|
|
|
y = _InterlockedCompareExchange16(value, x & mask, x);
|
|
|
|
}
|
|
|
|
while(y != x);
|
|
|
|
|
|
|
|
return y;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedAnd)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE long _InterlockedAnd(volatile long * value, long mask)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
long x;
|
|
|
|
long y;
|
|
|
|
|
|
|
|
y = *value;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
x = y;
|
|
|
|
y = _InterlockedCompareExchange(value, x & mask, x);
|
|
|
|
}
|
|
|
|
while(y != x);
|
|
|
|
|
|
|
|
return y;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedOr8)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE char _InterlockedOr8(volatile char * value, char mask)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
char x;
|
|
|
|
char y;
|
|
|
|
|
|
|
|
y = *value;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
x = y;
|
|
|
|
y = _InterlockedCompareExchange8(value, x | mask, x);
|
|
|
|
}
|
|
|
|
while(y != x);
|
|
|
|
|
|
|
|
return y;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedOr16)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE short _InterlockedOr16(volatile short * value, short mask)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
short x;
|
|
|
|
short y;
|
|
|
|
|
|
|
|
y = *value;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
x = y;
|
|
|
|
y = _InterlockedCompareExchange16(value, x | mask, x);
|
|
|
|
}
|
|
|
|
while(y != x);
|
|
|
|
|
|
|
|
return y;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedOr)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE long _InterlockedOr(volatile long * value, long mask)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
long x;
|
|
|
|
long y;
|
|
|
|
|
|
|
|
y = *value;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
x = y;
|
|
|
|
y = _InterlockedCompareExchange(value, x | mask, x);
|
|
|
|
}
|
|
|
|
while(y != x);
|
|
|
|
|
|
|
|
return y;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedXor8)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE char _InterlockedXor8(volatile char * value, char mask)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
char x;
|
|
|
|
char y;
|
|
|
|
|
|
|
|
y = *value;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
x = y;
|
|
|
|
y = _InterlockedCompareExchange8(value, x ^ mask, x);
|
|
|
|
}
|
|
|
|
while(y != x);
|
|
|
|
|
|
|
|
return y;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedXor16)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE short _InterlockedXor16(volatile short * value, short mask)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
short x;
|
|
|
|
short y;
|
|
|
|
|
|
|
|
y = *value;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
x = y;
|
|
|
|
y = _InterlockedCompareExchange16(value, x ^ mask, x);
|
|
|
|
}
|
|
|
|
while(y != x);
|
|
|
|
|
|
|
|
return y;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedXor)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE long _InterlockedXor(volatile long * value, long mask)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
long x;
|
|
|
|
long y;
|
|
|
|
|
|
|
|
y = *value;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
x = y;
|
|
|
|
y = _InterlockedCompareExchange(value, x ^ mask, x);
|
|
|
|
}
|
|
|
|
while(y != x);
|
|
|
|
|
|
|
|
return y;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedDecrement)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE long _InterlockedDecrement(volatile long * lpAddend)
|
2012-07-13 14:51:46 +00:00
|
|
|
{
|
|
|
|
return _InterlockedExchangeAdd(lpAddend, -1) - 1;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2012-07-13 14:51:46 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedIncrement)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE long _InterlockedIncrement(volatile long * lpAddend)
|
2012-07-13 14:51:46 +00:00
|
|
|
{
|
|
|
|
return _InterlockedExchangeAdd(lpAddend, 1) + 1;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2012-07-13 14:51:46 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedDecrement16)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE short _InterlockedDecrement16(volatile short * lpAddend)
|
2012-07-13 14:51:46 +00:00
|
|
|
{
|
|
|
|
return _InterlockedExchangeAdd16(lpAddend, -1) - 1;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2012-07-13 14:51:46 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedIncrement16)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE short _InterlockedIncrement16(volatile short * lpAddend)
|
2012-07-13 14:51:46 +00:00
|
|
|
{
|
|
|
|
return _InterlockedExchangeAdd16(lpAddend, 1) + 1;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2017-10-30 21:51:00 +00:00
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#if defined(__x86_64__)
|
|
|
|
__INTRIN_INLINE long long _InterlockedDecrement64(volatile long long * lpAddend)
|
2012-07-13 14:51:46 +00:00
|
|
|
{
|
|
|
|
return _InterlockedExchangeAdd64(lpAddend, -1) - 1;
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE long long _InterlockedIncrement64(volatile long long * lpAddend)
|
2012-07-13 14:51:46 +00:00
|
|
|
{
|
|
|
|
return _InterlockedExchangeAdd64(lpAddend, 1) + 1;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-08-10 21:17:38 +00:00
|
|
|
#endif /* (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100 */
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2008-09-10 15:02:57 +00:00
|
|
|
#if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100 && defined(__x86_64__)
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE long long _InterlockedCompareExchange64(volatile long long * Destination, long long Exchange, long long Comperand)
|
2008-09-10 15:02:57 +00:00
|
|
|
{
|
|
|
|
return __sync_val_compare_and_swap(Destination, Comperand, Exchange);
|
|
|
|
}
|
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#else /* (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100 && defined(__x86_64__) */
|
2008-09-10 15:02:57 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_InterlockedCompareExchange64)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE long long _InterlockedCompareExchange64(volatile long long * Destination, long long Exchange, long long Comperand)
|
2008-09-10 15:02:57 +00:00
|
|
|
{
|
|
|
|
long long retval = Comperand;
|
|
|
|
|
|
|
|
__asm__
|
|
|
|
(
|
|
|
|
"lock; cmpxchg8b %[Destination]" :
|
|
|
|
[retval] "+A" (retval) :
|
|
|
|
[Destination] "m" (*Destination),
|
|
|
|
"b" ((unsigned long)((Exchange >> 0) & 0xFFFFFFFF)),
|
|
|
|
"c" ((unsigned long)((Exchange >> 32) & 0xFFFFFFFF)) :
|
|
|
|
"memory"
|
|
|
|
);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif /* (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) > 40100 && defined(__x86_64__) */
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#ifdef __i386__
|
|
|
|
__INTRIN_INLINE long _InterlockedAddLargeStatistic(volatile long long * Addend, long Value)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
__asm__
|
|
|
|
(
|
2014-09-09 16:39:19 +00:00
|
|
|
"lock; addl %[Value], %[Lo32];"
|
2007-03-15 15:42:11 +00:00
|
|
|
"jae LABEL%=;"
|
2014-09-09 16:39:19 +00:00
|
|
|
"lock; adcl $0, %[Hi32];"
|
2007-03-15 15:42:11 +00:00
|
|
|
"LABEL%=:;" :
|
2008-11-22 08:32:15 +00:00
|
|
|
[Lo32] "+m" (*((volatile long *)(Addend) + 0)), [Hi32] "+m" (*((volatile long *)(Addend) + 1)) :
|
|
|
|
[Value] "ir" (Value) :
|
|
|
|
"memory"
|
2007-03-15 15:42:11 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
return Value;
|
|
|
|
}
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#endif /* __i386__ */
|
2007-03-15 15:42:11 +00:00
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned char _interlockedbittestandreset(volatile long * a, long b)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
unsigned char retval;
|
2008-11-22 08:32:15 +00:00
|
|
|
__asm__("lock; btrl %[b], %[a]; setb %b[retval]" : [retval] "=q" (retval), [a] "+m" (*a) : [b] "Ir" (b) : "memory");
|
2007-03-15 15:42:11 +00:00
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#if defined(__x86_64__)
|
|
|
|
__INTRIN_INLINE unsigned char _interlockedbittestandreset64(volatile long long * a, long long b)
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
{
|
|
|
|
unsigned char retval;
|
2008-10-26 10:47:07 +00:00
|
|
|
__asm__("lock; btrq %[b], %[a]; setb %b[retval]" : [retval] "=r" (retval), [a] "+m" (*a) : [b] "Ir" (b) : "memory");
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_interlockedbittestandset)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned char _interlockedbittestandset(volatile long * a, long b)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
unsigned char retval;
|
2008-11-22 08:32:15 +00:00
|
|
|
__asm__("lock; btsl %[b], %[a]; setc %b[retval]" : [retval] "=q" (retval), [a] "+m" (*a) : [b] "Ir" (b) : "memory");
|
2007-03-15 15:42:11 +00:00
|
|
|
return retval;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#if defined(__x86_64__)
|
|
|
|
__INTRIN_INLINE unsigned char _interlockedbittestandset64(volatile long long * a, long long b)
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
{
|
|
|
|
unsigned char retval;
|
2008-10-26 10:47:07 +00:00
|
|
|
__asm__("lock; btsq %[b], %[a]; setc %b[retval]" : [retval] "=r" (retval), [a] "+m" (*a) : [b] "Ir" (b) : "memory");
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
|
|
|
/*** String operations ***/
|
2013-08-10 21:17:38 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(__stosb)
|
2007-03-15 15:42:11 +00:00
|
|
|
/* NOTE: we don't set a memory clobber in the __stosX functions because Visual C++ doesn't */
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void __stosb(unsigned char * Dest, unsigned char Data, size_t Count)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
|
|
|
"rep; stosb" :
|
|
|
|
[Dest] "=D" (Dest), [Count] "=c" (Count) :
|
|
|
|
"[Dest]" (Dest), "a" (Data), "[Count]" (Count)
|
|
|
|
);
|
|
|
|
}
|
2017-10-30 21:51:00 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void __stosw(unsigned short * Dest, unsigned short Data, size_t Count)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
|
|
|
"rep; stosw" :
|
|
|
|
[Dest] "=D" (Dest), [Count] "=c" (Count) :
|
|
|
|
"[Dest]" (Dest), "a" (Data), "[Count]" (Count)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void __stosd(unsigned long * Dest, unsigned long Data, size_t Count)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
|
|
|
"rep; stosl" :
|
|
|
|
[Dest] "=D" (Dest), [Count] "=c" (Count) :
|
|
|
|
"[Dest]" (Dest), "a" (Data), "[Count]" (Count)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#ifdef __x86_64__
|
|
|
|
__INTRIN_INLINE void __stosq(unsigned long long * Dest, unsigned long long Data, size_t Count)
|
2010-03-30 16:25:51 +00:00
|
|
|
{
|
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
|
|
|
"rep; stosq" :
|
|
|
|
[Dest] "=D" (Dest), [Count] "=c" (Count) :
|
|
|
|
"[Dest]" (Dest), "a" (Data), "[Count]" (Count)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2009-06-16 00:24:26 +00:00
|
|
|
__INTRIN_INLINE void __movsb(unsigned char * Destination, const unsigned char * Source, size_t Count)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
|
|
|
"rep; movsb" :
|
|
|
|
[Destination] "=D" (Destination), [Source] "=S" (Source), [Count] "=c" (Count) :
|
|
|
|
"[Destination]" (Destination), "[Source]" (Source), "[Count]" (Count)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2009-06-16 00:24:26 +00:00
|
|
|
__INTRIN_INLINE void __movsw(unsigned short * Destination, const unsigned short * Source, size_t Count)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
|
|
|
"rep; movsw" :
|
|
|
|
[Destination] "=D" (Destination), [Source] "=S" (Source), [Count] "=c" (Count) :
|
|
|
|
"[Destination]" (Destination), "[Source]" (Source), "[Count]" (Count)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2009-06-16 00:24:26 +00:00
|
|
|
__INTRIN_INLINE void __movsd(unsigned long * Destination, const unsigned long * Source, size_t Count)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
|
|
|
"rep; movsd" :
|
|
|
|
[Destination] "=D" (Destination), [Source] "=S" (Source), [Count] "=c" (Count) :
|
|
|
|
"[Destination]" (Destination), "[Source]" (Source), "[Count]" (Count)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#ifdef __x86_64__
|
2010-03-30 16:25:51 +00:00
|
|
|
__INTRIN_INLINE void __movsq(unsigned long * Destination, const unsigned long * Source, size_t Count)
|
|
|
|
{
|
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
|
|
|
"rep; movsq" :
|
|
|
|
[Destination] "=D" (Destination), [Source] "=S" (Source), [Count] "=c" (Count) :
|
|
|
|
"[Destination]" (Destination), "[Source]" (Source), "[Count]" (Count)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#if defined(__x86_64__)
|
2013-08-10 21:17:38 +00:00
|
|
|
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
/*** GS segment addressing ***/
|
|
|
|
|
2015-03-05 21:09:36 +00:00
|
|
|
__INTRIN_INLINE void __writegsbyte(unsigned long Offset, unsigned char Data)
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
{
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("movb %b[Data], %%gs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "ir" (Data) : "memory");
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
}
|
|
|
|
|
2015-03-05 21:09:36 +00:00
|
|
|
__INTRIN_INLINE void __writegsword(unsigned long Offset, unsigned short Data)
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
{
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("movw %w[Data], %%gs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "ir" (Data) : "memory");
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
}
|
|
|
|
|
2015-03-05 21:09:36 +00:00
|
|
|
__INTRIN_INLINE void __writegsdword(unsigned long Offset, unsigned long Data)
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
{
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("movl %k[Data], %%gs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "ir" (Data) : "memory");
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void __writegsqword(unsigned long Offset, unsigned long long Data)
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
{
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("movq %q[Data], %%gs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "ir" (Data) : "memory");
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
}
|
|
|
|
|
2015-03-05 21:09:36 +00:00
|
|
|
__INTRIN_INLINE unsigned char __readgsbyte(unsigned long Offset)
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
{
|
|
|
|
unsigned char value;
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("movb %%gs:%a[Offset], %b[value]" : [value] "=r" (value) : [Offset] "ir" (Offset));
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
return value;
|
|
|
|
}
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2015-03-05 21:09:36 +00:00
|
|
|
__INTRIN_INLINE unsigned short __readgsword(unsigned long Offset)
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
{
|
|
|
|
unsigned short value;
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("movw %%gs:%a[Offset], %w[value]" : [value] "=r" (value) : [Offset] "ir" (Offset));
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
2015-03-05 21:09:36 +00:00
|
|
|
__INTRIN_INLINE unsigned long __readgsdword(unsigned long Offset)
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
{
|
|
|
|
unsigned long value;
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("movl %%gs:%a[Offset], %k[value]" : [value] "=r" (value) : [Offset] "ir" (Offset));
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned long long __readgsqword(unsigned long Offset)
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
{
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
unsigned long long value;
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("movq %%gs:%a[Offset], %q[value]" : [value] "=r" (value) : [Offset] "ir" (Offset));
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
2015-03-05 21:09:36 +00:00
|
|
|
__INTRIN_INLINE void __incgsbyte(unsigned long Offset)
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
{
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
__asm__ __volatile__("incb %%gs:%a[Offset]" : : [Offset] "ir" (Offset) : "memory");
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
}
|
|
|
|
|
2015-03-05 21:09:36 +00:00
|
|
|
__INTRIN_INLINE void __incgsword(unsigned long Offset)
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
{
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
__asm__ __volatile__("incw %%gs:%a[Offset]" : : [Offset] "ir" (Offset) : "memory");
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
}
|
|
|
|
|
2015-03-05 21:09:36 +00:00
|
|
|
__INTRIN_INLINE void __incgsdword(unsigned long Offset)
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
{
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
__asm__ __volatile__("incl %%gs:%a[Offset]" : : [Offset] "ir" (Offset) : "memory");
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void __incgsqword(unsigned long Offset)
|
|
|
|
{
|
|
|
|
__asm__ __volatile__("incq %%gs:%a[Offset]" : : [Offset] "ir" (Offset) : "memory");
|
|
|
|
}
|
|
|
|
|
2015-03-05 21:09:36 +00:00
|
|
|
__INTRIN_INLINE void __addgsbyte(unsigned long Offset, unsigned char Data)
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
{
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("addb %b[Data], %%gs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "ir" (Data) : "memory");
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
}
|
|
|
|
|
2015-03-05 21:09:36 +00:00
|
|
|
__INTRIN_INLINE void __addgsword(unsigned long Offset, unsigned short Data)
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
{
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("addw %w[Data], %%gs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "ir" (Data) : "memory");
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
}
|
|
|
|
|
2015-03-05 21:09:36 +00:00
|
|
|
__INTRIN_INLINE void __addgsdword(unsigned long Offset, unsigned int Data)
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
{
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("addl %k[Data], %%gs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "ir" (Data) : "memory");
|
2008-12-13 21:28:05 +00:00
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void __addgsqword(unsigned long Offset, unsigned long long Data)
|
2008-12-13 21:28:05 +00:00
|
|
|
{
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("addq %k[Data], %%gs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "ir" (Data) : "memory");
|
Merge 34703, 34704, 34705, 34706, 34707, 34708, 34709 and 34710 from ros-amd64-bringup branch:
- Fix inline versions of integer <-> pointer conversion functions.
- Implement _InterlockedAnd64, _InterlockedOr64, _interlockedbittestandreset64, _interlockedbittestandset64 and gs-segment-adressing functions
- As amd64 shares most of the intrinsics of x86, implement them in intrin_x86.h
- Fix IMAGE_FIRST_SECTION macro
- Implement GetCurrentFiber(), NtCurrentTeb() and YieldProcessor()
- Fix ENUMRESLANGPROC, ENUMRESNAMEPROC and ENUMRESTYPEPROC
- Add Interlocked functions for pointers
- Add InterlockedCompareExchangePointer and InterlockedExchangePointer
- Add intrinsic port and register access functions
fix LIST_ENTRY() macro for 64 bits
add size_t definition to _mingw.h (ported from mingw)
- Update some loader structs ULONG -> ULONG_PTR / SIZE_T
svn path=/trunk/; revision=35636
2008-08-25 18:47:44 +00:00
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#else /* defined(__x86_64__) */
|
2013-08-10 21:17:38 +00:00
|
|
|
|
2007-03-15 15:42:11 +00:00
|
|
|
/*** FS segment addressing ***/
|
2013-08-10 21:17:38 +00:00
|
|
|
|
2015-03-05 21:09:36 +00:00
|
|
|
__INTRIN_INLINE void __writefsbyte(unsigned long Offset, unsigned char Data)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
__asm__ __volatile__("movb %b[Data], %%fs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "iq" (Data) : "memory");
|
2007-03-15 15:42:11 +00:00
|
|
|
}
|
|
|
|
|
2015-03-05 21:09:36 +00:00
|
|
|
__INTRIN_INLINE void __writefsword(unsigned long Offset, unsigned short Data)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("movw %w[Data], %%fs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "ir" (Data) : "memory");
|
2007-03-15 15:42:11 +00:00
|
|
|
}
|
|
|
|
|
2015-03-05 21:09:36 +00:00
|
|
|
__INTRIN_INLINE void __writefsdword(unsigned long Offset, unsigned long Data)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("movl %k[Data], %%fs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "ir" (Data) : "memory");
|
2007-03-15 15:42:11 +00:00
|
|
|
}
|
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(__readfsbyte)
|
2015-03-05 21:09:36 +00:00
|
|
|
__INTRIN_INLINE unsigned char __readfsbyte(unsigned long Offset)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
unsigned char value;
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("movb %%fs:%a[Offset], %b[value]" : [value] "=q" (value) : [Offset] "ir" (Offset));
|
2007-03-15 15:42:11 +00:00
|
|
|
return value;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(__readfsword)
|
2015-03-05 21:09:36 +00:00
|
|
|
__INTRIN_INLINE unsigned short __readfsword(unsigned long Offset)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
unsigned short value;
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("movw %%fs:%a[Offset], %w[value]" : [value] "=r" (value) : [Offset] "ir" (Offset));
|
2007-03-15 15:42:11 +00:00
|
|
|
return value;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(__readfsdword)
|
2015-03-05 21:09:36 +00:00
|
|
|
__INTRIN_INLINE unsigned long __readfsdword(unsigned long Offset)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
unsigned long value;
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("movl %%fs:%a[Offset], %k[value]" : [value] "=r" (value) : [Offset] "ir" (Offset));
|
2007-03-15 15:42:11 +00:00
|
|
|
return value;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2017-10-30 21:51:00 +00:00
|
|
|
|
2015-03-05 21:09:36 +00:00
|
|
|
__INTRIN_INLINE void __incfsbyte(unsigned long Offset)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
__asm__ __volatile__("incb %%fs:%a[Offset]" : : [Offset] "ir" (Offset) : "memory");
|
2007-03-15 15:42:11 +00:00
|
|
|
}
|
|
|
|
|
2015-03-05 21:09:36 +00:00
|
|
|
__INTRIN_INLINE void __incfsword(unsigned long Offset)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
__asm__ __volatile__("incw %%fs:%a[Offset]" : : [Offset] "ir" (Offset) : "memory");
|
2007-03-15 15:42:11 +00:00
|
|
|
}
|
|
|
|
|
2015-03-05 21:09:36 +00:00
|
|
|
__INTRIN_INLINE void __incfsdword(unsigned long Offset)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
__asm__ __volatile__("incl %%fs:%a[Offset]" : : [Offset] "ir" (Offset) : "memory");
|
2007-03-15 15:42:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* NOTE: the bizarre implementation of __addfsxxx mimics the broken Visual C++ behavior */
|
2015-03-05 21:09:36 +00:00
|
|
|
__INTRIN_INLINE void __addfsbyte(unsigned long Offset, unsigned char Data)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
if(!__builtin_constant_p(Offset))
|
2009-06-16 00:24:26 +00:00
|
|
|
__asm__ __volatile__("addb %b[Offset], %%fs:%a[Offset]" : : [Offset] "r" (Offset) : "memory");
|
2007-03-15 15:42:11 +00:00
|
|
|
else
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
__asm__ __volatile__("addb %b[Data], %%fs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "iq" (Data) : "memory");
|
2007-03-15 15:42:11 +00:00
|
|
|
}
|
|
|
|
|
2015-03-05 21:09:36 +00:00
|
|
|
__INTRIN_INLINE void __addfsword(unsigned long Offset, unsigned short Data)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
if(!__builtin_constant_p(Offset))
|
2009-06-16 00:24:26 +00:00
|
|
|
__asm__ __volatile__("addw %w[Offset], %%fs:%a[Offset]" : : [Offset] "r" (Offset) : "memory");
|
2007-03-15 15:42:11 +00:00
|
|
|
else
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
__asm__ __volatile__("addw %w[Data], %%fs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "iq" (Data) : "memory");
|
2007-03-15 15:42:11 +00:00
|
|
|
}
|
|
|
|
|
2015-03-05 21:09:36 +00:00
|
|
|
__INTRIN_INLINE void __addfsdword(unsigned long Offset, unsigned long Data)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
if(!__builtin_constant_p(Offset))
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
__asm__ __volatile__("addl %k[Offset], %%fs:%a[Offset]" : : [Offset] "r" (Offset) : "memory");
|
2007-03-15 15:42:11 +00:00
|
|
|
else
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
__asm__ __volatile__("addl %k[Data], %%fs:%a[Offset]" : : [Offset] "ir" (Offset), [Data] "iq" (Data) : "memory");
|
2007-03-15 15:42:11 +00:00
|
|
|
}
|
2013-08-10 21:17:38 +00:00
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#endif /* defined(__x86_64__) */
|
2007-03-15 15:42:11 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*** Bit manipulation ***/
|
2013-08-10 21:17:38 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_BitScanForward)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned char _BitScanForward(unsigned long * Index, unsigned long Mask)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
__asm__("bsfl %[Mask], %[Index]" : [Index] "=r" (*Index) : [Mask] "mr" (Mask));
|
|
|
|
return Mask ? 1 : 0;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_BitScanReverse)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned char _BitScanReverse(unsigned long * Index, unsigned long Mask)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
__asm__("bsrl %[Mask], %[Index]" : [Index] "=r" (*Index) : [Mask] "mr" (Mask));
|
|
|
|
return Mask ? 1 : 0;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2017-10-30 21:51:00 +00:00
|
|
|
|
2007-03-15 15:42:11 +00:00
|
|
|
/* NOTE: again, the bizarre implementation follows Visual C++ */
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned char _bittest(const long * a, long b)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
unsigned char retval;
|
|
|
|
|
|
|
|
if(__builtin_constant_p(b))
|
|
|
|
__asm__("bt %[b], %[a]; setb %b[retval]" : [retval] "=q" (retval) : [a] "mr" (*(a + (b / 32))), [b] "Ir" (b % 32));
|
|
|
|
else
|
2014-02-20 19:28:27 +00:00
|
|
|
__asm__("bt %[b], %[a]; setb %b[retval]" : [retval] "=q" (retval) : [a] "m" (*a), [b] "r" (b));
|
2007-03-15 15:42:11 +00:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#ifdef __x86_64__
|
2015-05-11 12:10:19 +00:00
|
|
|
__INTRIN_INLINE unsigned char _BitScanForward64(unsigned long * Index, unsigned long long Mask)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
{
|
2015-05-11 12:10:19 +00:00
|
|
|
unsigned long long Index64;
|
|
|
|
__asm__("bsfq %[Mask], %[Index]" : [Index] "=r" (Index64) : [Mask] "mr" (Mask));
|
|
|
|
*Index = Index64;
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
return Mask ? 1 : 0;
|
|
|
|
}
|
|
|
|
|
2015-05-11 12:10:19 +00:00
|
|
|
__INTRIN_INLINE unsigned char _BitScanReverse64(unsigned long * Index, unsigned long long Mask)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
{
|
2015-05-11 12:10:19 +00:00
|
|
|
unsigned long long Index64;
|
|
|
|
__asm__("bsrq %[Mask], %[Index]" : [Index] "=r" (Index64) : [Mask] "mr" (Mask));
|
|
|
|
*Index = Index64;
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
return Mask ? 1 : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
__INTRIN_INLINE unsigned char _bittest64(const long long * a, long long b)
|
2010-03-30 16:25:51 +00:00
|
|
|
{
|
|
|
|
unsigned char retval;
|
|
|
|
|
|
|
|
if(__builtin_constant_p(b))
|
|
|
|
__asm__("bt %[b], %[a]; setb %b[retval]" : [retval] "=q" (retval) : [a] "mr" (*(a + (b / 64))), [b] "Ir" (b % 64));
|
|
|
|
else
|
2014-02-20 19:28:27 +00:00
|
|
|
__asm__("bt %[b], %[a]; setb %b[retval]" : [retval] "=q" (retval) : [a] "m" (*a), [b] "r" (b));
|
2010-03-30 16:25:51 +00:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned char _bittestandcomplement(long * a, long b)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
unsigned char retval;
|
|
|
|
|
|
|
|
if(__builtin_constant_p(b))
|
2008-11-30 23:08:02 +00:00
|
|
|
__asm__("btc %[b], %[a]; setb %b[retval]" : [a] "+mr" (*(a + (b / 32))), [retval] "=q" (retval) : [b] "Ir" (b % 32));
|
2007-03-15 15:42:11 +00:00
|
|
|
else
|
2014-02-20 19:28:27 +00:00
|
|
|
__asm__("btc %[b], %[a]; setb %b[retval]" : [a] "+m" (*a), [retval] "=q" (retval) : [b] "r" (b));
|
2007-03-15 15:42:11 +00:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned char _bittestandreset(long * a, long b)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
unsigned char retval;
|
|
|
|
|
|
|
|
if(__builtin_constant_p(b))
|
2008-11-30 23:08:02 +00:00
|
|
|
__asm__("btr %[b], %[a]; setb %b[retval]" : [a] "+mr" (*(a + (b / 32))), [retval] "=q" (retval) : [b] "Ir" (b % 32));
|
2007-03-15 15:42:11 +00:00
|
|
|
else
|
2014-02-20 19:28:27 +00:00
|
|
|
__asm__("btr %[b], %[a]; setb %b[retval]" : [a] "+m" (*a), [retval] "=q" (retval) : [b] "r" (b));
|
2007-03-15 15:42:11 +00:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned char _bittestandset(long * a, long b)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
unsigned char retval;
|
|
|
|
|
|
|
|
if(__builtin_constant_p(b))
|
2008-11-30 23:08:02 +00:00
|
|
|
__asm__("bts %[b], %[a]; setb %b[retval]" : [a] "+mr" (*(a + (b / 32))), [retval] "=q" (retval) : [b] "Ir" (b % 32));
|
2007-03-15 15:42:11 +00:00
|
|
|
else
|
2014-02-20 19:28:27 +00:00
|
|
|
__asm__("bts %[b], %[a]; setb %b[retval]" : [a] "+m" (*a), [retval] "=q" (retval) : [b] "r" (b));
|
2007-03-15 15:42:11 +00:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#ifdef __x86_64__
|
|
|
|
|
2015-05-11 12:10:19 +00:00
|
|
|
__INTRIN_INLINE unsigned char _bittestandset64(long long * a, long long b)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
{
|
|
|
|
unsigned char retval;
|
|
|
|
|
|
|
|
if(__builtin_constant_p(b))
|
|
|
|
__asm__("btsq %[b], %[a]; setb %b[retval]" : [a] "+mr" (*(a + (b / 64))), [retval] "=q" (retval) : [b] "Ir" (b % 64));
|
|
|
|
else
|
|
|
|
__asm__("btsq %[b], %[a]; setb %b[retval]" : [a] "+m" (*a), [retval] "=q" (retval) : [b] "r" (b));
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2015-05-11 12:10:19 +00:00
|
|
|
__INTRIN_INLINE unsigned char _bittestandreset64(long long * a, long long b)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
{
|
|
|
|
unsigned char retval;
|
|
|
|
|
|
|
|
if(__builtin_constant_p(b))
|
|
|
|
__asm__("btrq %[b], %[a]; setb %b[retval]" : [a] "+mr" (*(a + (b / 64))), [retval] "=q" (retval) : [b] "Ir" (b % 64));
|
|
|
|
else
|
|
|
|
__asm__("btrq %[b], %[a]; setb %b[retval]" : [a] "+m" (*a), [retval] "=q" (retval) : [b] "r" (b));
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2015-05-11 12:10:19 +00:00
|
|
|
__INTRIN_INLINE unsigned char _bittestandcomplement64(long long * a, long long b)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
{
|
|
|
|
unsigned char retval;
|
|
|
|
|
|
|
|
if(__builtin_constant_p(b))
|
|
|
|
__asm__("btcq %[b], %[a]; setb %b[retval]" : [a] "+mr" (*(a + (b / 64))), [retval] "=q" (retval) : [b] "Ir" (b % 64));
|
|
|
|
else
|
|
|
|
__asm__("btcq %[b], %[a]; setb %b[retval]" : [a] "+m" (*a), [retval] "=q" (retval) : [b] "r" (b));
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif /* __x86_64__ */
|
2017-10-30 21:51:00 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_rotl8)
|
2017-10-01 10:14:03 +00:00
|
|
|
__INTRIN_INLINE unsigned char __cdecl _rotl8(unsigned char value, unsigned char shift)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
unsigned char retval;
|
|
|
|
__asm__("rolb %b[shift], %b[retval]" : [retval] "=rm" (retval) : "[retval]" (value), [shift] "Nc" (shift));
|
|
|
|
return retval;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_rotl16)
|
2017-10-01 10:14:03 +00:00
|
|
|
__INTRIN_INLINE unsigned short __cdecl _rotl16(unsigned short value, unsigned char shift)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
unsigned short retval;
|
|
|
|
__asm__("rolw %b[shift], %w[retval]" : [retval] "=rm" (retval) : "[retval]" (value), [shift] "Nc" (shift));
|
|
|
|
return retval;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_rotl)
|
2017-10-01 10:14:03 +00:00
|
|
|
__INTRIN_INLINE unsigned int __cdecl _rotl(unsigned int value, int shift)
|
2008-04-01 17:49:03 +00:00
|
|
|
{
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
unsigned int retval;
|
2008-05-30 12:10:28 +00:00
|
|
|
__asm__("roll %b[shift], %k[retval]" : [retval] "=rm" (retval) : "[retval]" (value), [shift] "Nc" (shift));
|
2008-04-01 17:49:03 +00:00
|
|
|
return retval;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2017-10-30 21:51:00 +00:00
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#ifdef __x86_64__
|
|
|
|
__INTRIN_INLINE unsigned long long _rotl64(unsigned long long value, int shift)
|
[INCLUDE]
- ntdef.h: add missing RTL_NUMBER_OF_FIELD, RTL_PADDING_BETWEEN_FIELDS, RotateLeft*, PRODUCT_*, SUBLANG_*, SORT_*, LANG_SYSTEM_DEFAULT, LANG_USER_DEFAULT, a few LOCALE_*
- winnt.h: add missing LOCALE_SYSTEM_DEFAULT, LOCALE_USER_DEFAULT
- winnls.h: remove definitions that don't belong there, add some missing ones, remove wineisms
- intrin.h Implement _rotl64 for GCC
- basetyps.h: add #pragma once, move include to the top
svn path=/trunk/; revision=63524
2014-06-01 10:15:07 +00:00
|
|
|
{
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
unsigned long long retval;
|
[INCLUDE]
- ntdef.h: add missing RTL_NUMBER_OF_FIELD, RTL_PADDING_BETWEEN_FIELDS, RotateLeft*, PRODUCT_*, SUBLANG_*, SORT_*, LANG_SYSTEM_DEFAULT, LANG_USER_DEFAULT, a few LOCALE_*
- winnt.h: add missing LOCALE_SYSTEM_DEFAULT, LOCALE_USER_DEFAULT
- winnls.h: remove definitions that don't belong there, add some missing ones, remove wineisms
- intrin.h Implement _rotl64 for GCC
- basetyps.h: add #pragma once, move include to the top
svn path=/trunk/; revision=63524
2014-06-01 10:15:07 +00:00
|
|
|
__asm__("rolq %b[shift], %k[retval]" : [retval] "=rm" (retval) : "[retval]" (value), [shift] "Nc" (shift));
|
|
|
|
return retval;
|
|
|
|
}
|
2017-10-30 21:51:00 +00:00
|
|
|
#else /* __x86_64__ */
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_rotl64)
|
2017-10-01 10:14:03 +00:00
|
|
|
__INTRIN_INLINE unsigned long long __cdecl _rotl64(unsigned long long value, int shift)
|
[INCLUDE]
- ntdef.h: add missing RTL_NUMBER_OF_FIELD, RTL_PADDING_BETWEEN_FIELDS, RotateLeft*, PRODUCT_*, SUBLANG_*, SORT_*, LANG_SYSTEM_DEFAULT, LANG_USER_DEFAULT, a few LOCALE_*
- winnt.h: add missing LOCALE_SYSTEM_DEFAULT, LOCALE_USER_DEFAULT
- winnls.h: remove definitions that don't belong there, add some missing ones, remove wineisms
- intrin.h Implement _rotl64 for GCC
- basetyps.h: add #pragma once, move include to the top
svn path=/trunk/; revision=63524
2014-06-01 10:15:07 +00:00
|
|
|
{
|
|
|
|
/* FIXME: this is probably not optimal */
|
|
|
|
return (value << shift) | (value >> (64 - shift));
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif /* !HAS_BUILTIN(_rotl64) */
|
2017-10-30 21:51:00 +00:00
|
|
|
#endif /* __x86_64__ */
|
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_rotr)
|
2017-10-01 10:14:03 +00:00
|
|
|
__INTRIN_INLINE unsigned int __cdecl _rotr(unsigned int value, int shift)
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
{
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
unsigned int retval;
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
__asm__("rorl %b[shift], %k[retval]" : [retval] "=rm" (retval) : "[retval]" (value), [shift] "Nc" (shift));
|
|
|
|
return retval;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2008-04-01 17:49:03 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_rotr8)
|
2017-10-01 10:14:03 +00:00
|
|
|
__INTRIN_INLINE unsigned char __cdecl _rotr8(unsigned char value, unsigned char shift)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
unsigned char retval;
|
2011-06-05 20:59:09 +00:00
|
|
|
__asm__("rorb %b[shift], %b[retval]" : [retval] "=qm" (retval) : "[retval]" (value), [shift] "Nc" (shift));
|
2007-03-15 15:42:11 +00:00
|
|
|
return retval;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_rotr16)
|
2017-10-01 10:14:03 +00:00
|
|
|
__INTRIN_INLINE unsigned short __cdecl _rotr16(unsigned short value, unsigned char shift)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
unsigned short retval;
|
|
|
|
__asm__("rorw %b[shift], %w[retval]" : [retval] "=rm" (retval) : "[retval]" (value), [shift] "Nc" (shift));
|
|
|
|
return retval;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2017-10-30 21:51:00 +00:00
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#ifdef __x86_64__
|
|
|
|
__INTRIN_INLINE unsigned long long _rotr64(unsigned long long value, int shift)
|
|
|
|
{
|
|
|
|
unsigned long long retval;
|
|
|
|
__asm__("rorq %b[shift], %k[retval]" : [retval] "=rm" (retval) : "[retval]" (value), [shift] "Nc" (shift));
|
|
|
|
return retval;
|
|
|
|
}
|
2017-10-30 21:51:00 +00:00
|
|
|
#else /* __x86_64__ */
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_rotr64)
|
2017-10-01 10:14:03 +00:00
|
|
|
__INTRIN_INLINE unsigned long long __cdecl _rotr64(unsigned long long value, int shift)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
{
|
|
|
|
/* FIXME: this is probably not optimal */
|
|
|
|
return (value >> shift) | (value << (64 - shift));
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif /* !HAS_BUILTIN(_rotr64) */
|
2017-10-30 21:51:00 +00:00
|
|
|
#endif /* __x86_64__ */
|
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_lrotl)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned long __cdecl _lrotl(unsigned long value, int shift)
|
|
|
|
{
|
|
|
|
unsigned long retval;
|
|
|
|
__asm__("roll %b[shift], %k[retval]" : [retval] "=rm" (retval) : "[retval]" (value), [shift] "Nc" (shift));
|
|
|
|
return retval;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_lrotr)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned long __cdecl _lrotr(unsigned long value, int shift)
|
|
|
|
{
|
|
|
|
unsigned long retval;
|
|
|
|
__asm__("rorl %b[shift], %k[retval]" : [retval] "=rm" (retval) : "[retval]" (value), [shift] "Nc" (shift));
|
|
|
|
return retval;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2017-10-30 21:51:00 +00:00
|
|
|
|
2007-03-15 15:42:11 +00:00
|
|
|
/*
|
|
|
|
NOTE: in __ll_lshift, __ll_rshift and __ull_rshift we use the "A"
|
|
|
|
constraint (edx:eax) for the Mask argument, because it's the only way GCC
|
|
|
|
can pass 64-bit operands around - passing the two 32 bit parts separately
|
|
|
|
just confuses it. Also we declare Bit as an int and then truncate it to
|
|
|
|
match Visual C++ behavior
|
|
|
|
*/
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned long long __ll_lshift(unsigned long long Mask, int Bit)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
unsigned long long retval = Mask;
|
|
|
|
|
|
|
|
__asm__
|
|
|
|
(
|
|
|
|
"shldl %b[Bit], %%eax, %%edx; sall %b[Bit], %%eax" :
|
|
|
|
"+A" (retval) :
|
|
|
|
[Bit] "Nc" ((unsigned char)((unsigned long)Bit) & 0xFF)
|
|
|
|
);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE long long __ll_rshift(long long Mask, int Bit)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
2013-08-10 21:17:38 +00:00
|
|
|
long long retval = Mask;
|
2007-03-15 15:42:11 +00:00
|
|
|
|
|
|
|
__asm__
|
|
|
|
(
|
2013-08-10 21:17:38 +00:00
|
|
|
"shrdl %b[Bit], %%edx, %%eax; sarl %b[Bit], %%edx" :
|
2007-03-15 15:42:11 +00:00
|
|
|
"+A" (retval) :
|
|
|
|
[Bit] "Nc" ((unsigned char)((unsigned long)Bit) & 0xFF)
|
|
|
|
);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned long long __ull_rshift(unsigned long long Mask, int Bit)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
unsigned long long retval = Mask;
|
|
|
|
|
|
|
|
__asm__
|
|
|
|
(
|
2013-08-10 21:17:38 +00:00
|
|
|
"shrdl %b[Bit], %%edx, %%eax; shrl %b[Bit], %%edx" :
|
2007-03-15 15:42:11 +00:00
|
|
|
"+A" (retval) :
|
|
|
|
[Bit] "Nc" ((unsigned char)((unsigned long)Bit) & 0xFF)
|
|
|
|
);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2017-10-01 10:14:03 +00:00
|
|
|
__INTRIN_INLINE unsigned short __cdecl _byteswap_ushort(unsigned short value)
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
{
|
|
|
|
unsigned short retval;
|
|
|
|
__asm__("rorw $8, %w[retval]" : [retval] "=rm" (retval) : "[retval]" (value));
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2017-10-01 10:14:03 +00:00
|
|
|
__INTRIN_INLINE unsigned long __cdecl _byteswap_ulong(unsigned long value)
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
{
|
|
|
|
unsigned long retval;
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__("bswapl %[retval]" : [retval] "=r" (retval) : "[retval]" (value));
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#ifdef __x86_64__
|
|
|
|
__INTRIN_INLINE unsigned long long _byteswap_uint64(unsigned long long value)
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
{
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
unsigned long long retval;
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__("bswapq %[retval]" : [retval] "=r" (retval) : "[retval]" (value));
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
#else
|
2017-10-01 10:14:03 +00:00
|
|
|
__INTRIN_INLINE unsigned long long __cdecl _byteswap_uint64(unsigned long long value)
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
{
|
|
|
|
union {
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
unsigned long long int64part;
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
struct {
|
|
|
|
unsigned long lowpart;
|
|
|
|
unsigned long hipart;
|
|
|
|
};
|
|
|
|
} retval;
|
|
|
|
retval.int64part = value;
|
|
|
|
__asm__("bswapl %[lowpart]\n"
|
|
|
|
"bswapl %[hipart]\n"
|
2009-08-23 21:41:05 +00:00
|
|
|
: [lowpart] "=r" (retval.hipart), [hipart] "=r" (retval.lowpart) : "[lowpart]" (retval.lowpart), "[hipart]" (retval.hipart) );
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
return retval.int64part;
|
|
|
|
}
|
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned int __lzcnt(unsigned int value)
|
|
|
|
{
|
|
|
|
return __builtin_clz(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
__INTRIN_INLINE unsigned short __lzcnt16(unsigned short value)
|
|
|
|
{
|
|
|
|
return __builtin_clz(value);
|
|
|
|
}
|
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(__popcnt)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned int __popcnt(unsigned int value)
|
|
|
|
{
|
|
|
|
return __builtin_popcount(value);
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(__popcnt16)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned short __popcnt16(unsigned short value)
|
|
|
|
{
|
|
|
|
return __builtin_popcount(value);
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2017-10-30 21:51:00 +00:00
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#ifdef __x86_64__
|
2015-05-11 12:27:54 +00:00
|
|
|
__INTRIN_INLINE unsigned long long __lzcnt64(unsigned long long value)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
{
|
|
|
|
return __builtin_clzll(value);
|
|
|
|
}
|
|
|
|
|
2015-05-11 12:27:54 +00:00
|
|
|
__INTRIN_INLINE unsigned long long __popcnt64(unsigned long long value)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
{
|
|
|
|
return __builtin_popcountll(value);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-03-15 15:42:11 +00:00
|
|
|
/*** 64-bit math ***/
|
2013-08-10 21:17:38 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(__emul)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE long long __emul(int a, int b)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
long long retval;
|
|
|
|
__asm__("imull %[b]" : "=A" (retval) : [a] "a" (a), [b] "rm" (b));
|
|
|
|
return retval;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(__emulu)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned long long __emulu(unsigned int a, unsigned int b)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
unsigned long long retval;
|
|
|
|
__asm__("mull %[b]" : "=A" (retval) : [a] "a" (a), [b] "rm" (b));
|
|
|
|
return retval;
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2017-10-30 21:51:00 +00:00
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE long long __cdecl _abs64(long long value)
|
|
|
|
{
|
|
|
|
return (value >= 0) ? value : -value;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef __x86_64__
|
2009-12-06 03:24:18 +00:00
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE long long __mulh(long long a, long long b)
|
2009-12-06 03:24:18 +00:00
|
|
|
{
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
long long retval;
|
2009-12-06 03:24:18 +00:00
|
|
|
__asm__("imulq %[b]" : "=d" (retval) : [a] "a" (a), [b] "rm" (b));
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned long long __umulh(unsigned long long a, unsigned long long b)
|
2009-12-06 03:24:18 +00:00
|
|
|
{
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
unsigned long long retval;
|
2009-12-06 03:24:18 +00:00
|
|
|
__asm__("mulq %[b]" : "=d" (retval) : [a] "a" (a), [b] "rm" (b));
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
|
|
|
/*** Port I/O ***/
|
2013-08-10 21:17:38 +00:00
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned char __inbyte(unsigned short Port)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
unsigned char byte;
|
|
|
|
__asm__ __volatile__("inb %w[Port], %b[byte]" : [byte] "=a" (byte) : [Port] "Nd" (Port));
|
|
|
|
return byte;
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned short __inword(unsigned short Port)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
unsigned short word;
|
|
|
|
__asm__ __volatile__("inw %w[Port], %w[word]" : [word] "=a" (word) : [Port] "Nd" (Port));
|
|
|
|
return word;
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned long __indword(unsigned short Port)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
unsigned long dword;
|
|
|
|
__asm__ __volatile__("inl %w[Port], %k[dword]" : [dword] "=a" (dword) : [Port] "Nd" (Port));
|
|
|
|
return dword;
|
|
|
|
}
|
|
|
|
|
2009-06-16 00:24:26 +00:00
|
|
|
__INTRIN_INLINE void __inbytestring(unsigned short Port, unsigned char * Buffer, unsigned long Count)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
|
|
|
"rep; insb" :
|
|
|
|
[Buffer] "=D" (Buffer), [Count] "=c" (Count) :
|
|
|
|
"d" (Port), "[Buffer]" (Buffer), "[Count]" (Count) :
|
|
|
|
"memory"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2009-06-16 00:24:26 +00:00
|
|
|
__INTRIN_INLINE void __inwordstring(unsigned short Port, unsigned short * Buffer, unsigned long Count)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
|
|
|
"rep; insw" :
|
|
|
|
[Buffer] "=D" (Buffer), [Count] "=c" (Count) :
|
|
|
|
"d" (Port), "[Buffer]" (Buffer), "[Count]" (Count) :
|
|
|
|
"memory"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2009-06-16 00:24:26 +00:00
|
|
|
__INTRIN_INLINE void __indwordstring(unsigned short Port, unsigned long * Buffer, unsigned long Count)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
__asm__ __volatile__
|
|
|
|
(
|
|
|
|
"rep; insl" :
|
|
|
|
[Buffer] "=D" (Buffer), [Count] "=c" (Count) :
|
|
|
|
"d" (Port), "[Buffer]" (Buffer), "[Count]" (Count) :
|
|
|
|
"memory"
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void __outbyte(unsigned short Port, unsigned char Data)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
__asm__ __volatile__("outb %b[Data], %w[Port]" : : [Port] "Nd" (Port), [Data] "a" (Data));
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void __outword(unsigned short Port, unsigned short Data)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
__asm__ __volatile__("outw %w[Data], %w[Port]" : : [Port] "Nd" (Port), [Data] "a" (Data));
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void __outdword(unsigned short Port, unsigned long Data)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
__asm__ __volatile__("outl %k[Data], %w[Port]" : : [Port] "Nd" (Port), [Data] "a" (Data));
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void __outbytestring(unsigned short Port, unsigned char * Buffer, unsigned long Count)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
__asm__ __volatile__("rep; outsb" : : [Port] "d" (Port), [Buffer] "S" (Buffer), "c" (Count));
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void __outwordstring(unsigned short Port, unsigned short * Buffer, unsigned long Count)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
__asm__ __volatile__("rep; outsw" : : [Port] "d" (Port), [Buffer] "S" (Buffer), "c" (Count));
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void __outdwordstring(unsigned short Port, unsigned long * Buffer, unsigned long Count)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
__asm__ __volatile__("rep; outsl" : : [Port] "d" (Port), [Buffer] "S" (Buffer), "c" (Count));
|
|
|
|
}
|
|
|
|
|
2017-10-01 10:14:03 +00:00
|
|
|
__INTRIN_INLINE int __cdecl _inp(unsigned short Port)
|
2011-02-11 13:48:41 +00:00
|
|
|
{
|
|
|
|
return __inbyte(Port);
|
|
|
|
}
|
|
|
|
|
2017-10-01 10:14:03 +00:00
|
|
|
__INTRIN_INLINE unsigned short __cdecl _inpw(unsigned short Port)
|
2011-02-11 13:48:41 +00:00
|
|
|
{
|
|
|
|
return __inword(Port);
|
|
|
|
}
|
|
|
|
|
2017-10-01 10:14:03 +00:00
|
|
|
__INTRIN_INLINE unsigned long __cdecl _inpd(unsigned short Port)
|
2011-02-11 13:48:41 +00:00
|
|
|
{
|
|
|
|
return __indword(Port);
|
|
|
|
}
|
|
|
|
|
2017-10-01 10:14:03 +00:00
|
|
|
__INTRIN_INLINE int __cdecl _outp(unsigned short Port, int databyte)
|
2011-02-11 13:48:41 +00:00
|
|
|
{
|
2013-08-10 21:17:38 +00:00
|
|
|
__outbyte(Port, (unsigned char)databyte);
|
2011-02-11 13:48:41 +00:00
|
|
|
return databyte;
|
|
|
|
}
|
|
|
|
|
2017-10-01 10:14:03 +00:00
|
|
|
__INTRIN_INLINE unsigned short __cdecl _outpw(unsigned short Port, unsigned short dataword)
|
2011-02-11 13:48:41 +00:00
|
|
|
{
|
|
|
|
__outword(Port, dataword);
|
|
|
|
return dataword;
|
|
|
|
}
|
|
|
|
|
2017-10-01 10:14:03 +00:00
|
|
|
__INTRIN_INLINE unsigned long __cdecl _outpd(unsigned short Port, unsigned long dataword)
|
2011-02-11 13:48:41 +00:00
|
|
|
{
|
|
|
|
__outdword(Port, dataword);
|
|
|
|
return dataword;
|
|
|
|
}
|
|
|
|
|
2007-03-15 15:42:11 +00:00
|
|
|
|
|
|
|
/*** System information ***/
|
2013-08-10 21:17:38 +00:00
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void __cpuid(int CPUInfo[4], int InfoType)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
__asm__ __volatile__("cpuid" : "=a" (CPUInfo[0]), "=b" (CPUInfo[1]), "=c" (CPUInfo[2]), "=d" (CPUInfo[3]) : "a" (InfoType));
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void __cpuidex(int CPUInfo[4], int InfoType, int ECXValue)
|
|
|
|
{
|
|
|
|
__asm__ __volatile__("cpuid" : "=a" (CPUInfo[0]), "=b" (CPUInfo[1]), "=c" (CPUInfo[2]), "=d" (CPUInfo[3]) : "a" (InfoType), "c" (ECXValue));
|
|
|
|
}
|
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(__rdtsc)
|
2009-06-16 00:24:26 +00:00
|
|
|
__INTRIN_INLINE unsigned long long __rdtsc(void)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#ifdef __x86_64__
|
2008-12-13 21:28:05 +00:00
|
|
|
unsigned long long low, high;
|
|
|
|
__asm__ __volatile__("rdtsc" : "=a"(low), "=d"(high));
|
|
|
|
return low | (high << 32);
|
|
|
|
#else
|
2007-03-15 15:42:11 +00:00
|
|
|
unsigned long long retval;
|
|
|
|
__asm__ __volatile__("rdtsc" : "=A"(retval));
|
|
|
|
return retval;
|
2008-12-13 21:28:05 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif /* !HAS_BUILTIN(__rdtsc) */
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2009-06-16 00:24:26 +00:00
|
|
|
__INTRIN_INLINE void __writeeflags(uintptr_t Value)
|
2008-12-13 21:28:05 +00:00
|
|
|
{
|
|
|
|
__asm__ __volatile__("push %0\n popf" : : "rim"(Value));
|
|
|
|
}
|
|
|
|
|
2009-06-16 00:24:26 +00:00
|
|
|
__INTRIN_INLINE uintptr_t __readeflags(void)
|
2008-12-13 21:28:05 +00:00
|
|
|
{
|
|
|
|
uintptr_t retval;
|
|
|
|
__asm__ __volatile__("pushf\n pop %0" : "=rm"(retval));
|
|
|
|
return retval;
|
|
|
|
}
|
2007-03-15 15:42:11 +00:00
|
|
|
|
|
|
|
/*** Interrupts ***/
|
2013-08-10 21:17:38 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(__debugbreak)
|
2017-10-01 10:14:03 +00:00
|
|
|
__INTRIN_INLINE void __cdecl __debugbreak(void)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
__asm__("int $3");
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(__ud2)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void __ud2(void)
|
|
|
|
{
|
|
|
|
__asm__("ud2");
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(__int2c)
|
2009-06-16 00:24:26 +00:00
|
|
|
__INTRIN_INLINE void __int2c(void)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
__asm__("int $0x2c");
|
|
|
|
}
|
2017-11-19 14:09:06 +00:00
|
|
|
#endif
|
2017-10-30 21:51:00 +00:00
|
|
|
|
2017-10-01 10:14:03 +00:00
|
|
|
__INTRIN_INLINE void __cdecl _disable(void)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
2011-08-28 12:40:55 +00:00
|
|
|
__asm__("cli" : : : "memory");
|
2007-03-15 15:42:11 +00:00
|
|
|
}
|
|
|
|
|
2017-10-01 10:14:03 +00:00
|
|
|
__INTRIN_INLINE void __cdecl _enable(void)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
2011-08-28 12:40:55 +00:00
|
|
|
__asm__("sti" : : : "memory");
|
2007-03-15 15:42:11 +00:00
|
|
|
}
|
|
|
|
|
2009-09-27 10:09:38 +00:00
|
|
|
__INTRIN_INLINE void __halt(void)
|
|
|
|
{
|
2014-10-04 12:03:37 +00:00
|
|
|
__asm__("hlt" : : : "memory");
|
|
|
|
}
|
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(__fastfail)
|
2014-10-04 12:03:37 +00:00
|
|
|
__declspec(noreturn)
|
|
|
|
__INTRIN_INLINE void __fastfail(unsigned int Code)
|
|
|
|
{
|
|
|
|
__asm__("int $0x29" : : "c"(Code) : "memory");
|
2014-10-09 10:57:10 +00:00
|
|
|
__builtin_unreachable();
|
2009-09-27 10:09:38 +00:00
|
|
|
}
|
2017-10-30 21:51:00 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
|
|
|
/*** Protected memory management ***/
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#ifdef __x86_64__
|
2013-08-10 21:17:38 +00:00
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void __writecr0(unsigned long long Data)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__("mov %[Data], %%cr0" : : [Data] "r" (Data) : "memory");
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void __writecr3(unsigned long long Data)
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
{
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__("mov %[Data], %%cr3" : : [Data] "r" (Data) : "memory");
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void __writecr4(unsigned long long Data)
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
{
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__("mov %[Data], %%cr4" : : [Data] "r" (Data) : "memory");
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void __writecr8(unsigned long long Data)
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
{
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__("mov %[Data], %%cr8" : : [Data] "r" (Data) : "memory");
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned long long __readcr0(void)
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
{
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
unsigned long long value;
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("mov %%cr0, %[value]" : [value] "=r" (value));
|
2007-03-15 15:42:11 +00:00
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned long long __readcr2(void)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
unsigned long long value;
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("mov %%cr2, %[value]" : [value] "=r" (value));
|
2007-03-15 15:42:11 +00:00
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned long long __readcr3(void)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
unsigned long long value;
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("mov %%cr3, %[value]" : [value] "=r" (value));
|
2007-03-15 15:42:11 +00:00
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned long long __readcr4(void)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
unsigned long long value;
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("mov %%cr4, %[value]" : [value] "=r" (value));
|
2007-03-15 15:42:11 +00:00
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned long long __readcr8(void)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
unsigned long long value;
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("movq %%cr8, %q[value]" : [value] "=r" (value));
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
return value;
|
2007-03-15 15:42:11 +00:00
|
|
|
}
|
2013-08-10 21:17:38 +00:00
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#else /* __x86_64__ */
|
2013-08-10 21:17:38 +00:00
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void __writecr0(unsigned int Data)
|
2011-10-03 20:57:43 +00:00
|
|
|
{
|
|
|
|
__asm__("mov %[Data], %%cr0" : : [Data] "r" (Data) : "memory");
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void __writecr3(unsigned int Data)
|
2011-10-03 20:57:43 +00:00
|
|
|
{
|
|
|
|
__asm__("mov %[Data], %%cr3" : : [Data] "r" (Data) : "memory");
|
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void __writecr4(unsigned int Data)
|
2011-10-03 20:57:43 +00:00
|
|
|
{
|
|
|
|
__asm__("mov %[Data], %%cr4" : : [Data] "r" (Data) : "memory");
|
|
|
|
}
|
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(__writecr8)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void __writecr8(unsigned int Data)
|
|
|
|
{
|
|
|
|
__asm__("mov %[Data], %%cr8" : : [Data] "r" (Data) : "memory");
|
|
|
|
}
|
2017-10-30 21:51:00 +00:00
|
|
|
#endif
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
|
2009-06-18 00:41:56 +00:00
|
|
|
__INTRIN_INLINE unsigned long __readcr0(void)
|
|
|
|
{
|
|
|
|
unsigned long value;
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("mov %%cr0, %[value]" : [value] "=r" (value));
|
2009-06-18 00:41:56 +00:00
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
__INTRIN_INLINE unsigned long __readcr2(void)
|
|
|
|
{
|
|
|
|
unsigned long value;
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("mov %%cr2, %[value]" : [value] "=r" (value));
|
2009-06-18 00:41:56 +00:00
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
__INTRIN_INLINE unsigned long __readcr3(void)
|
|
|
|
{
|
|
|
|
unsigned long value;
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("mov %%cr3, %[value]" : [value] "=r" (value));
|
2009-06-18 00:41:56 +00:00
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
__INTRIN_INLINE unsigned long __readcr4(void)
|
|
|
|
{
|
|
|
|
unsigned long value;
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("mov %%cr4, %[value]" : [value] "=r" (value));
|
2009-06-18 00:41:56 +00:00
|
|
|
return value;
|
|
|
|
}
|
2013-08-10 21:17:38 +00:00
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(__readcr8)
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned long __readcr8(void)
|
|
|
|
{
|
|
|
|
unsigned long value;
|
|
|
|
__asm__ __volatile__("mov %%cr8, %[value]" : [value] "=r" (value));
|
|
|
|
return value;
|
|
|
|
}
|
2017-10-30 21:51:00 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#endif /* __x86_64__ */
|
2013-08-10 21:17:38 +00:00
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#ifdef __x86_64__
|
|
|
|
|
|
|
|
__INTRIN_INLINE unsigned long long __readdr(unsigned int reg)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
unsigned long long value;
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
switch (reg)
|
|
|
|
{
|
|
|
|
case 0:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("movq %%dr0, %q[value]" : [value] "=r" (value));
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("movq %%dr1, %q[value]" : [value] "=r" (value));
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("movq %%dr2, %q[value]" : [value] "=r" (value));
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("movq %%dr3, %q[value]" : [value] "=r" (value));
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("movq %%dr4, %q[value]" : [value] "=r" (value));
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
break;
|
|
|
|
case 5:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("movq %%dr5, %q[value]" : [value] "=r" (value));
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
break;
|
|
|
|
case 6:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("movq %%dr6, %q[value]" : [value] "=r" (value));
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
break;
|
|
|
|
case 7:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("movq %%dr7, %q[value]" : [value] "=r" (value));
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return value;
|
2007-03-15 15:42:11 +00:00
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void __writedr(unsigned reg, unsigned long long value)
|
2009-06-18 00:41:56 +00:00
|
|
|
{
|
|
|
|
switch (reg)
|
|
|
|
{
|
|
|
|
case 0:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__("movq %q[value], %%dr0" : : [value] "r" (value) : "memory");
|
2009-06-18 00:41:56 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__("movq %q[value], %%dr1" : : [value] "r" (value) : "memory");
|
2009-06-18 00:41:56 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__("movq %q[value], %%dr2" : : [value] "r" (value) : "memory");
|
2009-06-18 00:41:56 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__("movq %q[value], %%dr3" : : [value] "r" (value) : "memory");
|
2009-06-18 00:41:56 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__("movq %q[value], %%dr4" : : [value] "r" (value) : "memory");
|
2009-06-18 00:41:56 +00:00
|
|
|
break;
|
|
|
|
case 5:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__("movq %q[value], %%dr5" : : [value] "r" (value) : "memory");
|
2009-06-18 00:41:56 +00:00
|
|
|
break;
|
|
|
|
case 6:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__("movq %q[value], %%dr6" : : [value] "r" (value) : "memory");
|
2009-06-18 00:41:56 +00:00
|
|
|
break;
|
|
|
|
case 7:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__("movq %q[value], %%dr7" : : [value] "r" (value) : "memory");
|
2009-06-18 00:41:56 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2013-08-10 21:17:38 +00:00
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#else /* __x86_64__ */
|
2013-08-10 21:17:38 +00:00
|
|
|
|
2009-06-18 00:41:56 +00:00
|
|
|
__INTRIN_INLINE unsigned int __readdr(unsigned int reg)
|
|
|
|
{
|
|
|
|
unsigned int value;
|
|
|
|
switch (reg)
|
|
|
|
{
|
|
|
|
case 0:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("mov %%dr0, %[value]" : [value] "=r" (value));
|
2009-06-18 00:41:56 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("mov %%dr1, %[value]" : [value] "=r" (value));
|
2009-06-18 00:41:56 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("mov %%dr2, %[value]" : [value] "=r" (value));
|
2009-06-18 00:41:56 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("mov %%dr3, %[value]" : [value] "=r" (value));
|
2009-06-18 00:41:56 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("mov %%dr4, %[value]" : [value] "=r" (value));
|
2009-06-18 00:41:56 +00:00
|
|
|
break;
|
|
|
|
case 5:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("mov %%dr5, %[value]" : [value] "=r" (value));
|
2009-06-18 00:41:56 +00:00
|
|
|
break;
|
|
|
|
case 6:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("mov %%dr6, %[value]" : [value] "=r" (value));
|
2009-06-18 00:41:56 +00:00
|
|
|
break;
|
|
|
|
case 7:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__ __volatile__("mov %%dr7, %[value]" : [value] "=r" (value));
|
2009-06-18 00:41:56 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
__INTRIN_INLINE void __writedr(unsigned reg, unsigned int value)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
switch (reg)
|
|
|
|
{
|
|
|
|
case 0:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__("mov %[value], %%dr0" : : [value] "r" (value) : "memory");
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__("mov %[value], %%dr1" : : [value] "r" (value) : "memory");
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__("mov %[value], %%dr2" : : [value] "r" (value) : "memory");
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__("mov %[value], %%dr3" : : [value] "r" (value) : "memory");
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__("mov %[value], %%dr4" : : [value] "r" (value) : "memory");
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
break;
|
|
|
|
case 5:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__("mov %[value], %%dr5" : : [value] "r" (value) : "memory");
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
break;
|
|
|
|
case 6:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__("mov %[value], %%dr6" : : [value] "r" (value) : "memory");
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
break;
|
|
|
|
case 7:
|
2009-08-23 21:41:05 +00:00
|
|
|
__asm__("mov %[value], %%dr7" : : [value] "r" (value) : "memory");
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-03-15 15:42:11 +00:00
|
|
|
}
|
2013-08-10 21:17:38 +00:00
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#endif /* __x86_64__ */
|
2007-03-15 15:42:11 +00:00
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void __invlpg(void *Address)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
2016-09-25 18:35:52 +00:00
|
|
|
__asm__ __volatile__ ("invlpg (%[Address])" : : [Address] "b" (Address) : "memory");
|
2007-03-15 15:42:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*** System operations ***/
|
2013-08-10 21:17:38 +00:00
|
|
|
|
2015-03-05 21:09:36 +00:00
|
|
|
__INTRIN_INLINE unsigned long long __readmsr(unsigned long reg)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#ifdef __x86_64__
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
unsigned long low, high;
|
|
|
|
__asm__ __volatile__("rdmsr" : "=a" (low), "=d" (high) : "c" (reg));
|
2008-12-05 12:00:39 +00:00
|
|
|
return ((unsigned long long)high << 32) | low;
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
#else
|
2007-03-15 15:42:11 +00:00
|
|
|
unsigned long long retval;
|
|
|
|
__asm__ __volatile__("rdmsr" : "=A" (retval) : "c" (reg));
|
|
|
|
return retval;
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
}
|
|
|
|
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE void __writemsr(unsigned long Register, unsigned long long Value)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
#ifdef __x86_64__
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
__asm__ __volatile__("wrmsr" : : "a" (Value), "d" (Value >> 32), "c" (Register));
|
|
|
|
#else
|
2007-03-15 15:42:11 +00:00
|
|
|
__asm__ __volatile__("wrmsr" : : "A" (Value), "c" (Register));
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
#endif
|
2007-03-15 15:42:11 +00:00
|
|
|
}
|
|
|
|
|
2015-03-05 21:09:36 +00:00
|
|
|
__INTRIN_INLINE unsigned long long __readpmc(unsigned long counter)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
unsigned long long retval;
|
|
|
|
__asm__ __volatile__("rdpmc" : "=A" (retval) : "c" (counter));
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* NOTE: an immediate value for 'a' will raise an ICE in Visual C++ */
|
[INTRIN]
Add some missing intrinsics for GCC (_InterlockedExchangeAdd8, __incgsqword, _BitScanForward64, _BitScanReverse64, _bittest64, _bittestandset64, _bittestandreset64, _bittestandcomplement64, _rotr64, _lrotl, _lrotr, __lzcnt, __lzcnt16, __popcnt, __popcnt16, __lzcnt64, __popcnt64, __cpuidex, __ud2, __writecr8/__readcr8 (x86))
Remove useless top level const modifiers from parameters (they do only tell the compiler that the variable cannot be modified, they do not tell the compiler whether the parameter is a compiler constant!)
svn path=/trunk/; revision=66598
2015-03-07 13:22:42 +00:00
|
|
|
__INTRIN_INLINE unsigned long __segmentlimit(unsigned long a)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
|
|
|
unsigned long retval;
|
|
|
|
__asm__ __volatile__("lsl %[a], %[retval]" : [retval] "=r" (retval) : [a] "rm" (a));
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2009-06-16 00:24:26 +00:00
|
|
|
__INTRIN_INLINE void __wbinvd(void)
|
2007-03-15 15:42:11 +00:00
|
|
|
{
|
2011-08-09 14:22:29 +00:00
|
|
|
__asm__ __volatile__("wbinvd" : : : "memory");
|
2007-03-15 15:42:11 +00:00
|
|
|
}
|
|
|
|
|
2009-06-16 00:24:26 +00:00
|
|
|
__INTRIN_INLINE void __lidt(void *Source)
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
{
|
|
|
|
__asm__ __volatile__("lidt %0" : : "m"(*(short*)Source));
|
|
|
|
}
|
|
|
|
|
2009-06-16 00:24:26 +00:00
|
|
|
__INTRIN_INLINE void __sidt(void *Destination)
|
Merge 34739 - 34769, 34796 - 34905, 34916 - 34967, 34970 - 35135, 35167, 35325, 35326, 35443 - 35506, 35510 - 35546, 35587, 35616,
35644 from ros-amd64-bringup branch:
- Update AMD64 intrinsic Interlocked functions
- Add _InterlockedExchange64 to intin_x86.h
-Fix definitions of IsBadHugeReadPtr, IsBadHugeWritePtr, IsBadReadPtr, IsBadStringPtrA, IsBadStringPtrW, IsBadWritePtr and SetProcessWorkingSetSize
- Define CONTEXT and XMM_SAVE_AREA32, taken from WINE
- Include _M_AMD64 for defintitions in ioaccess.h
- Add Interlocked intrinisc definitions for AMD64 platform
- Add KI_USER_SHARED_DATA and KeGetCurrentIrql() prototype to winddh
- Fix prototypes for KfAcquireSpinLock, KfReleaseSpinLock, KeAcquireInStackQueuedSpinLock and KeReleaseInStackQueuedSpinLock on amd64
- Fix rotl declaration, add mysteriously missing rotr.
winnt.h:
- Fix CONTEXT_AMD64 and friends, add various constants.
- Define RUNTIME_FUNCTION, RtlCaptureContext, RtlRestoreContext, RtlAddFunctionTable, RtlInstallFunctionTableCallback, RtlDeleteFunctionTable.
- Fix definitions for EXCEPTION_RECORD and friends to support amd64.
- Define IMAGE_THUNK_DATA64 and related constants.
- Define IMAGE_TLS_DIRECTORY64 and related constants.
- Remove WINEisms
- Remove multiple declarations and minor fixes.
- Fix KESEG0_BASE for amd64
- Fix definition for NdisCopyLookaheadData on amd64
- Only add function prototypes if NO_INTERLOCKED_INTRINSICS is defined
- Move the inlined InterlockedAnd/Or from rtl to winbase.h and rename it to InterlockedAnd/Or_Inline
- Fix TreeView_EnsureVisible macro.
- Add missing 64 bit intrinsic Interlocked functions
- Fix _InterlockedDecrement64
- Fix InterlockedExchangeAddSizeT
- Fix __writecrx instrinsics
- Fix ExQueryPoolBlockSize prototype
- Make KI_USER_SHARED_DATA and IMAGE_ORDINAL_FLAG64 a ULONGLONG
- Fix definition if IMAGE_OPTIONAL_HEADER64
- Add KPCR structure
- Add __readcrx intrinsics
- Ad some definitions to winddk.h
- Add a field for a DbgPrint function pointer to the ROS_LOADER_PARAMETER_BLOCK for early debug prints in ntoskrnl
- Update KPCR and KIPCR
- Add KeGetPcr() and update KeGetCurrentProcessorNumber
- Fix SECURITY_DESCRIPTOR_RELATIVE and KDPC_DATA
- Implement byteswap intrinsics
- Add macro definitions for KeQuerySystemTime, KeQueryTickCount and KeQueryInterruptTime to ddk
- Add NtCurrentTeb inline function
- Update amd64 prototypes for KeGetCurrentIrql, KfRaiseIrql, KfLowerIrql, KeRaiseIrqlToDpcLevel, KeRaiseIrqlToSynchLevel, KeLowerIrql, KeRaiseIrql
- Implement __readcr8, __writecr8, __lidt and __sidt intrinsics.
- Implement KeGetCurrentIrql as intrinsic.
- Make KeGetCurrentIrql, KeLowerIrql, KfRaiseIrql, KeRaiseIrql, KeRaiseIrqlToDpcLevel and KeRaiseIrqlToSynchLevel intrinsics as in the WDK 2008.
- Fix _interlockedbittest intrinsics
- Fix __readmsr and __writemsr on amd64
- Fix __readgsqword, it was using a long internally. Add volatile keyword to segment addressing intrinsics. Add "memory" to clobber list on all those that do write.
- Merge __readcr and __writecr x86 / x64 definitions, because they are the same. Implement __readdr and __writedr for x64.
- __readcr3() returns an unsigned __int64, fix x86 MmGetPageDirectory accordingly.
svn path=/trunk/; revision=35646
2008-08-25 21:57:13 +00:00
|
|
|
{
|
|
|
|
__asm__ __volatile__("sidt %0" : : "m"(*(short*)Destination) : "memory");
|
|
|
|
}
|
|
|
|
|
2017-02-04 23:50:32 +00:00
|
|
|
__INTRIN_INLINE void _sgdt(void *Destination)
|
|
|
|
{
|
|
|
|
__asm__ __volatile__("sgdt %0" : : "m"(*(short*)Destination) : "memory");
|
|
|
|
}
|
|
|
|
|
2011-08-29 23:10:04 +00:00
|
|
|
/*** Misc operations ***/
|
|
|
|
|
2017-11-19 14:09:06 +00:00
|
|
|
#if !HAS_BUILTIN(_mm_pause)
|
2009-06-16 00:24:26 +00:00
|
|
|
__INTRIN_INLINE void _mm_pause(void)
|
2009-02-09 20:28:24 +00:00
|
|
|
{
|
2011-08-07 23:16:39 +00:00
|
|
|
__asm__ __volatile__("pause" : : : "memory");
|
2009-02-09 20:28:24 +00:00
|
|
|
}
|
2017-10-30 21:51:00 +00:00
|
|
|
#endif
|
2009-02-09 20:28:24 +00:00
|
|
|
|
2011-08-29 23:10:04 +00:00
|
|
|
__INTRIN_INLINE void __nop(void)
|
|
|
|
{
|
|
|
|
__asm__ __volatile__("nop");
|
|
|
|
}
|
|
|
|
|
2008-12-21 03:22:17 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-03-15 16:32:56 +00:00
|
|
|
#endif /* KJK_INTRIN_X86_H_ */
|
|
|
|
|
2007-03-15 15:42:11 +00:00
|
|
|
/* EOF */
|