[ros-diffs] [tkreuzer] 39439: merge from amd64 branch: 37868: Add CONTEXT flags for x64 (Timo Kreuzer) 39346: Use intrinsics for rtl byteswap functions for GNUC, too. Only include them if NTOS_MODE_USER. (Timo Kreuzer) 39347: Move rtl byteswap functions to wdm.h and add intrinsic definitions (Timo Kreuzer)

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Fri Feb 6 14:04:19 CET 2009


Author: tkreuzer
Date: Fri Feb  6 07:04:18 2009
New Revision: 39439

URL: http://svn.reactos.org/svn/reactos?rev=39439&view=rev
Log:
merge from amd64 branch:
37868: Add CONTEXT flags for x64 (Timo Kreuzer)
39346: Use intrinsics for rtl byteswap functions for GNUC, too. Only include them if NTOS_MODE_USER. (Timo Kreuzer)
39347: Move rtl byteswap functions to wdm.h and add intrinsic definitions (Timo Kreuzer)

Modified:
    trunk/reactos/include/ddk/wdm.h
    trunk/reactos/include/ddk/winddk.h
    trunk/reactos/include/ndk/rtlfuncs.h

Modified: trunk/reactos/include/ddk/wdm.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/wdm.h?rev=39439&r1=39438&r2=39439&view=diff
==============================================================================
--- trunk/reactos/include/ddk/wdm.h [iso-8859-1] (original)
+++ trunk/reactos/include/ddk/wdm.h [iso-8859-1] Fri Feb  6 07:04:18 2009
@@ -646,5 +646,48 @@
 #define QUOTA_LIMITS_USE_DEFAULT_LIMITS 0x00000010
 
 
+//
+// Byte Swap Functions
+//
+#if (defined(_M_IX86) && (_MSC_FULL_VER > 13009037)) || \
+    ((defined(_M_AMD64) || \
+     defined(_M_IA64)) && (_MSC_FULL_VER > 13009175))
+
+unsigned short __cdecl _byteswap_ushort(unsigned short);
+unsigned long  __cdecl _byteswap_ulong (unsigned long);
+unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64);
+#pragma intrinsic(_byteswap_ushort)
+#pragma intrinsic(_byteswap_ulong)
+#pragma intrinsic(_byteswap_uint64)
+#define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x))
+#define RtlUlongByteSwap(_x) _byteswap_ulong((_x))
+#define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x))
+
+#elif defined(__GNUC__)
+
+#define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x))
+#define RtlUlongByteSwap(_x) _byteswap_ulong((_x))
+#define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x))
+
+#else
+
+#if (NTDDI_VERSION >= NTDDI_WIN2K)
+NTSYSAPI
+USHORT
+FASTCALL
+RtlUshortByteSwap(IN USHORT Source);
+
+NTSYSAPI
+ULONG
+FASTCALL
+RtlUlongByteSwap(IN ULONG Source);
+
+NTSYSAPI
+ULONGLONG
+FASTCALL
+RtlUlonglongByteSwap(IN ULONGLONG Source);
+#endif
+
+#endif
 
 #endif // _WDMDDK_

Modified: trunk/reactos/include/ddk/winddk.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/ddk/winddk.h?rev=39439&r1=39438&r2=39439&view=diff
==============================================================================
--- trunk/reactos/include/ddk/winddk.h [iso-8859-1] (original)
+++ trunk/reactos/include/ddk/winddk.h [iso-8859-1] Fri Feb  6 07:04:18 2009
@@ -5632,6 +5632,23 @@
 
 #elif defined(__x86_64__)
 
+#define CONTEXT_AMD64 0x100000
+#if !defined(RC_INVOKED)
+#define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x1L)
+#define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x2L)
+#define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x4L)
+#define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x8L)
+#define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x10L)
+
+#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
+#define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
+
+#define CONTEXT_EXCEPTION_ACTIVE 0x8000000
+#define CONTEXT_SERVICE_ACTIVE 0x10000000
+#define CONTEXT_EXCEPTION_REQUEST 0x40000000
+#define CONTEXT_EXCEPTION_REPORTING 0x80000000
+#endif
+
 typedef struct DECLSPEC_ALIGN(16) _M128A {
     ULONGLONG Low;
     LONGLONG High;
@@ -7166,16 +7183,6 @@
   IN PLARGE_INTEGER  Time,
   IN PTIME_FIELDS  TimeFields);
 
-ULONG
-FASTCALL
-RtlUlongByteSwap(
-  IN ULONG  Source);
-
-ULONGLONG
-FASTCALL
-RtlUlonglongByteSwap(
-  IN ULONGLONG  Source);
-
 #define RtlUnicodeStringToAnsiSize(STRING) (                  \
     NLS_MB_CODE_PAGE_TAG ?                                    \
     RtlxUnicodeStringToAnsiSize(STRING) :                     \
@@ -7246,11 +7253,6 @@
 RtlUpperString(
   IN OUT PSTRING  DestinationString,
   IN PSTRING  SourceString);
-
-USHORT
-FASTCALL
-RtlUshortByteSwap(
-  IN USHORT  Source);
 
 NTSYSAPI
 BOOLEAN

Modified: trunk/reactos/include/ndk/rtlfuncs.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/rtlfuncs.h?rev=39439&r1=39438&r2=39439&view=diff
==============================================================================
--- trunk/reactos/include/ndk/rtlfuncs.h [iso-8859-1] (original)
+++ trunk/reactos/include/ndk/rtlfuncs.h [iso-8859-1] Fri Feb  6 07:04:18 2009
@@ -1370,6 +1370,8 @@
 //
 // Byte Swap Functions
 //
+#ifdef NTOS_MODE_USER
+
 #if (defined(_M_IX86) && (_MSC_FULL_VER > 13009037)) || \
     ((defined(_M_AMD64) || \
      defined(_M_IA64)) && (_MSC_FULL_VER > 13009175))
@@ -1384,8 +1386,15 @@
 #define RtlUlongByteSwap(_x) _byteswap_ulong((_x))
 #define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x))
 
+#elif defined (__GNUC__)
+
+#define RtlUshortByteSwap(_x) _byteswap_ushort((USHORT)(_x))
+#define RtlUlongByteSwap(_x) _byteswap_ulong((_x))
+#define RtlUlonglongByteSwap(_x) _byteswap_uint64((_x))
+
 #else
 
+#if (NTDDI_VERSION >= NTDDI_WIN2K)
 NTSYSAPI
 USHORT
 FASTCALL
@@ -1400,8 +1409,10 @@
 ULONGLONG
 FASTCALL
 RtlUlonglongByteSwap(IN ULONGLONG Source);
-
 #endif
+
+#endif
+#endif // NTOS_MODE_USER
 
 //
 // Unicode->Ansi String Functions



More information about the Ros-diffs mailing list