mirror of
https://github.com/reactos/reactos.git
synced 2025-02-21 16:04:57 +00:00
- _mingw.h: Don't define USE_MINGW_SETJMP_TWO_ARGS for MSVC
- _mingw.h: Fix definition of _CRT_ALIGN for MSVC - intrin.h: _InterlockedAddLargeStatistic is not an intrinsic on MSVC for x64 - intrin.h: Fix return type of _InterlockedOr64 - wdm.h: Fix warnings in KfRaiseIrql and RtlExtendedMagicDivide inline implementations - winnt.h: Simplify definition of GetCurrentFiber svn path=/branches/cmake-bringup/; revision=50470
This commit is contained in:
parent
1fb963feea
commit
5f6e050626
7 changed files with 27 additions and 52 deletions
|
@ -187,7 +187,7 @@ allow GCC to optimize away some EH unwind code, at least in DW2 case. */
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _WIN64
|
||||
#if defined(_WIN64) && !defined(_MSC_VER)
|
||||
#undef USE_MINGW_SETJMP_TWO_ARGS
|
||||
#define USE_MINGW_SETJMP_TWO_ARGS
|
||||
#endif
|
||||
|
|
|
@ -133,8 +133,14 @@
|
|||
#endif
|
||||
|
||||
#ifndef _CRT_ALIGN
|
||||
#if defined (__midl) || defined(__WIDL__)
|
||||
#define _CRT_ALIGN(x)
|
||||
#elif defined(_MSC_VER)
|
||||
#define _CRT_ALIGN(x) __declspec(align(x))
|
||||
#else
|
||||
#define _CRT_ALIGN(x) __attribute__ ((aligned(x)))
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _CRTNOALIAS
|
||||
#define _CRTNOALIAS
|
||||
|
|
|
@ -45,8 +45,6 @@ short _InterlockedXor16(volatile short * const value, const short mask);
|
|||
#pragma intrinsic(_InterlockedXor16)
|
||||
long _InterlockedXor(volatile long * const value, const long mask);
|
||||
#pragma intrinsic(_InterlockedXor)
|
||||
long _InterlockedAddLargeStatistic(volatile __int64 * const Addend, const long Value);
|
||||
#pragma intrinsic(_InterlockedAddLargeStatistic)
|
||||
long _InterlockedDecrement(volatile long * const lpAddend);
|
||||
#pragma intrinsic(_InterlockedDecrement)
|
||||
long _InterlockedIncrement(volatile long * const lpAddend);
|
||||
|
@ -60,7 +58,10 @@ unsigned char _interlockedbittestandreset(volatile long * a, const long b);
|
|||
unsigned char _interlockedbittestandset(volatile long * a, const long b);
|
||||
#pragma intrinsic(_interlockedbittestandset)
|
||||
|
||||
#if defined(_M_AMD64)
|
||||
#if defined(_M_IX86)
|
||||
long _InterlockedAddLargeStatistic(volatile __int64 * const Addend, const long Value);
|
||||
#pragma intrinsic(_InterlockedAddLargeStatistic)
|
||||
#elif defined(_M_AMD64)
|
||||
__int64 _InterlockedExchange64(volatile __int64 * const Target, const __int64 Value);
|
||||
#pragma intrinsic(_InterlockedExchange64)
|
||||
__int64 _InterlockedExchangeAdd64(volatile __int64 * const Addend, const __int64 Value);
|
||||
|
@ -71,7 +72,7 @@ void * _InterlockedExchangePointer(void * volatile * const Target, void * const
|
|||
#pragma intrinsic(_InterlockedExchangePointer)
|
||||
__int64 _InterlockedAnd64(volatile __int64 * const value, const __int64 mask);
|
||||
#pragma intrinsic(_InterlockedAnd64)
|
||||
long _InterlockedOr64(volatile __int64 * const value, const __int64 mask);
|
||||
__int64 _InterlockedOr64(volatile __int64 * const value, const __int64 mask);
|
||||
#pragma intrinsic(_InterlockedOr64)
|
||||
__int64 _InterlockedCompareExchange64(volatile __int64 * const Destination, const __int64 Exchange, const __int64 Comperand);
|
||||
#pragma intrinsic(_InterlockedCompareExchange64)
|
||||
|
@ -133,7 +134,7 @@ void __addgsqword(const unsigned long Offset, const unsigned __int64 Data);
|
|||
#pragma intrinsic(__addgsqword)
|
||||
#endif
|
||||
|
||||
//#if defined(_M_IX86)
|
||||
#if defined(_M_IX86)
|
||||
/*** FS segment addressing ***/
|
||||
void __writefsbyte(const unsigned long Offset, const unsigned char Data);
|
||||
#pragma intrinsic(__writefsbyte)
|
||||
|
@ -159,7 +160,7 @@ void __addfsword(const unsigned long Offset, const unsigned short Data);
|
|||
#pragma intrinsic(__addfsword)
|
||||
void __addfsdword(const unsigned long Offset, const unsigned int Data);
|
||||
#pragma intrinsic(__addfsdword)
|
||||
//#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*** Bit manipulation ***/
|
||||
|
|
|
@ -7897,7 +7897,7 @@ KfRaiseIrql(IN KIRQL NewIrql)
|
|||
{
|
||||
KIRQL OldIrql;
|
||||
|
||||
OldIrql = __readcr8();
|
||||
OldIrql = (KIRQL)__readcr8();
|
||||
//ASSERT(OldIrql <= NewIrql);
|
||||
__writecr8(NewIrql);
|
||||
return OldIrql;
|
||||
|
@ -9309,7 +9309,7 @@ RtlExtendedMagicDivide(
|
|||
ret64 = UnsignedMultiplyHigh(Pos ? Dividend.QuadPart : -Dividend.QuadPart,
|
||||
MagicDivisor.QuadPart);
|
||||
ret64 >>= ShiftCount;
|
||||
ret.QuadPart = Pos ? ret64 : -ret64;
|
||||
ret.QuadPart = Pos ? ret64 : -(LONG64)ret64;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1361,7 +1361,7 @@ typedef enum {
|
|||
#define SEC_RESERVE 0x04000000
|
||||
#define SEC_COMMIT 0x08000000
|
||||
#define SEC_NOCACHE 0x10000000
|
||||
#define SEC_WRITECOMBINE 0x40000000
|
||||
#define SEC_WRITECOMBINE 0x40000000
|
||||
#define SEC_LARGE_PAGES 0x80000000
|
||||
#define SECTION_EXTEND_SIZE 16
|
||||
#define SECTION_MAP_READ 4
|
||||
|
@ -5097,18 +5097,12 @@ typedef struct _OBJECT_TYPE_LIST {
|
|||
GUID *ObjectType;
|
||||
} OBJECT_TYPE_LIST, *POBJECT_TYPE_LIST;
|
||||
|
||||
#if defined(__GNUC__)
|
||||
|
||||
#if defined(_M_IX86)
|
||||
static __inline__ PVOID GetCurrentFiber(void)
|
||||
FORCEINLINE PVOID GetCurrentFiber(VOID)
|
||||
{
|
||||
void* ret;
|
||||
__asm__ __volatile__ (
|
||||
"movl %%fs:0x10,%0"
|
||||
: "=r" (ret) /* allow use of reg eax,ebx,ecx,edx,esi,edi */
|
||||
);
|
||||
return ret;
|
||||
return (PVOID)(ULONG_PTR)__readfsdword(0x10);
|
||||
}
|
||||
|
||||
#elif defined (_M_AMD64)
|
||||
FORCEINLINE PVOID GetCurrentFiber(VOID)
|
||||
{
|
||||
|
@ -5118,10 +5112,11 @@ FORCEINLINE PVOID GetCurrentFiber(VOID)
|
|||
return (PVOID)__readgsqword(FIELD_OFFSET(NT_TIB, FiberData));
|
||||
#endif
|
||||
}
|
||||
|
||||
#elif defined (_M_ARM)
|
||||
PVOID WINAPI GetCurrentFiber(VOID);
|
||||
#else
|
||||
#if defined(_M_PPC)
|
||||
|
||||
#elif defined(_M_PPC)
|
||||
static __inline__ __attribute__((always_inline)) unsigned long __readfsdword_winnt(const unsigned long Offset)
|
||||
{
|
||||
unsigned long result;
|
||||
|
@ -5133,42 +5128,15 @@ static __inline__ __attribute__((always_inline)) unsigned long __readfsdword_win
|
|||
return result;
|
||||
}
|
||||
|
||||
#else
|
||||
#error Unknown architecture
|
||||
#endif
|
||||
static __inline__ PVOID GetCurrentFiber(void)
|
||||
{
|
||||
return __readfsdword_winnt(0x10);
|
||||
}
|
||||
#else
|
||||
#error Unknown architecture
|
||||
#endif
|
||||
|
||||
#elif defined(__WATCOMC__)
|
||||
|
||||
extern PVOID GetCurrentFiber(void);
|
||||
#pragma aux GetCurrentFiber = \
|
||||
"mov eax, dword ptr fs:0x10" \
|
||||
value [eax] \
|
||||
modify [eax];
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
#if (_MSC_FULL_VER >= 13012035)
|
||||
|
||||
__inline PVOID GetCurrentFiber(void) { return (PVOID)(ULONG_PTR)__readfsdword(0x10); }
|
||||
|
||||
#else
|
||||
|
||||
static __inline PVOID GetCurrentFiber(void)
|
||||
{
|
||||
PVOID p;
|
||||
__asm mov eax, fs:[10h]
|
||||
__asm mov [p], eax
|
||||
return p;
|
||||
}
|
||||
|
||||
#endif /* _MSC_FULL_VER */
|
||||
|
||||
#endif /* __GNUC__/__WATCOMC__/_MSC_VER */
|
||||
|
||||
#include "inline_ntcurrentteb.h"
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ KfRaiseIrql(IN KIRQL NewIrql)
|
|||
{
|
||||
KIRQL OldIrql;
|
||||
|
||||
OldIrql = __readcr8();
|
||||
OldIrql = (KIRQL)__readcr8();
|
||||
//ASSERT(OldIrql <= NewIrql);
|
||||
__writecr8(NewIrql);
|
||||
return OldIrql;
|
||||
|
|
|
@ -2630,7 +2630,7 @@ RtlExtendedMagicDivide(
|
|||
ret64 = UnsignedMultiplyHigh(Pos ? Dividend.QuadPart : -Dividend.QuadPart,
|
||||
MagicDivisor.QuadPart);
|
||||
ret64 >>= ShiftCount;
|
||||
ret.QuadPart = Pos ? ret64 : -ret64;
|
||||
ret.QuadPart = Pos ? ret64 : -(LONG64)ret64;
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue