Fix Uniata for msvc:
authorStefan Ginsberg <stefanginsberg@gmail.com>
Sat, 8 Aug 2009 18:27:01 +0000 (18:27 +0000)
committerStefan Ginsberg <stefanginsberg@gmail.com>
Sat, 8 Aug 2009 18:27:01 +0000 (18:27 +0000)
- Add missing msvc intrinsics to winddk.h
- Don't assume compiler means a specific header set, and don't rely on the default calling convention being stdcall.
- Disable a warning spotted by MSVC -- requesting anyone with understanding of the code to have a look.

svn path=/trunk/; revision=42531

reactos/drivers/storage/ide/uniata/config.h
reactos/drivers/storage/ide/uniata/id_sata.cpp
reactos/drivers/storage/ide/uniata/ntddk_ex.h
reactos/include/ddk/winddk.h

index 17768e4..e17416f 100644 (file)
 /*  Compiler dependencies                          */
 /***************************************************/
 
 /*  Compiler dependencies                          */
 /***************************************************/
 
-/* ReactOS-specific defines */
-#ifdef DDKAPI
- #define USE_REACTOS_DDK
-#endif //DDKAPI
+#define DDKAPI          __stdcall
+#define DDKFASTAPI      __fastcall
+#define DDKCDECLAPI     __cdecl
 
 /* Are we under GNU C (mingw) ??? */
 
 /* Are we under GNU C (mingw) ??? */
-#if __GNUC__ >=3
+#ifdef __GNUC__
 
  #define  DEF_U64(x)     (x##ULL)
  #define  DEF_I64(x)     (x##LL)
 
 
  #define  DEF_U64(x)     (x##ULL)
  #define  DEF_I64(x)     (x##LL)
 
- /* ReactOS-specific defines */
- #ifdef USE_REACTOS_DDK
-  #define DDKFASTAPI __attribute__((fastcall))
- #else //USE_REACTOS_DDK
-
-  #define DDKAPI          __attribute__((stdcall))
-  #define DDKFASTAPI      __attribute__((fastcall))
-  #define DDKCDECLAPI     __attribute__((cdecl))
-
- #endif  //DDKAPI
-
- #define DECLSPEC_NAKED   __attribute__((naked))
-
 #else // !__GNUC__ => MSVC/Intel
 
  #define  DEF_U64(x)     (x##UI64)
  #define  DEF_I64(x)     (x##I64)
 
 #else // !__GNUC__ => MSVC/Intel
 
  #define  DEF_U64(x)     (x##UI64)
  #define  DEF_I64(x)     (x##I64)
 
- /* ReactOS-specific defines */
- #ifdef USE_REACTOS_DDK
- #else //USE_REACTOS_DDK
-
-  #define DDKAPI          __stdcall
-  #define DDKFASTAPI      __fastcall
-  #define DDKCDECLAPI     _cdecl
-
- #endif  //DDKAPI
-
- #define DECLSPEC_NAKED   __declspec(naked)
-
 #endif //__GNUC__
 
 
 #endif //__GNUC__
 
 
index 277b37b..9b0d1e0 100644 (file)
@@ -425,7 +425,15 @@ UniataAhciSetupFIS(
         deviceExtension->lun[ldev].IdentifyData.FeaturesSupport.Address48) {
         i++;
     } else {
         deviceExtension->lun[ldev].IdentifyData.FeaturesSupport.Address48) {
         i++;
     } else {
+#ifdef _MSC_VER
+#pragma message ("HACK HACK HACK Disabling warning HACK HACK HACK")
+#pragma warning(push)
+#pragma warning(disable:4333)
+#endif
         fis[7] |= (plba[3] >> 24) & 0x0f;
         fis[7] |= (plba[3] >> 24) & 0x0f;
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
     }
 
     fis[8] = plba[3];
     }
 
     fis[8] = plba[3];
index c61de2b..221ba79 100644 (file)
@@ -629,12 +629,14 @@ typedef struct _IMAGE_EXPORT_DIRECTORY {
 
 NTHALAPI
 VOID
 
 NTHALAPI
 VOID
+NTAPI
 HalDisplayString (
     PUCHAR String
     );
 
 NTHALAPI
 VOID
 HalDisplayString (
     PUCHAR String
     );
 
 NTHALAPI
 VOID
+NTAPI
 HalQueryDisplayParameters (
     OUT PULONG WidthInCharacters,
     OUT PULONG HeightInLines,
 HalQueryDisplayParameters (
     OUT PULONG WidthInCharacters,
     OUT PULONG HeightInLines,
@@ -644,6 +646,7 @@ HalQueryDisplayParameters (
 
 NTHALAPI
 VOID
 
 NTHALAPI
 VOID
+NTAPI
 HalSetDisplayParameters (
     IN ULONG CursorColumn,
     IN ULONG CursorRow
 HalSetDisplayParameters (
     IN ULONG CursorColumn,
     IN ULONG CursorRow
index 9807da9..edb671d 100644 (file)
@@ -35,6 +35,24 @@ extern "C" {
 #include "intrin.h"
 #endif
 
 #include "intrin.h"
 #endif
 
+#ifdef _MSC_VER
+//
+// FIXME: MSVC Intrinsics
+//
+unsigned char __readfsbyte(const unsigned long Offset);
+#pragma intrinsic(__readfsbyte)
+long _InterlockedExchange(volatile long * const Target, const long Value);
+#pragma intrinsic(_InterlockedExchange)
+long _InterlockedExchangeAdd(volatile long * const Addend, const long Value);
+#pragma intrinsic(_InterlockedExchangeAdd)
+long _InterlockedCompareExchange(volatile long * const Destination, const long Exchange, const long Comperand);
+#pragma intrinsic(_InterlockedCompareExchange)
+long _InterlockedDecrement(volatile long * const lpAddend);
+#pragma intrinsic(_InterlockedDecrement)
+long _InterlockedIncrement(volatile long * const lpAddend);
+#pragma intrinsic(_InterlockedIncrement)
+#endif
+
 #if !defined(_NTHAL_)
 #define NTHALAPI DECLSPEC_IMPORT
 #else
 #if !defined(_NTHAL_)
 #define NTHALAPI DECLSPEC_IMPORT
 #else
@@ -5116,15 +5134,6 @@ typedef struct _KFLOATING_SAVE {
   ULONG  Spare1;
 } KFLOATING_SAVE, *PKFLOATING_SAVE;
 
   ULONG  Spare1;
 } KFLOATING_SAVE, *PKFLOATING_SAVE;
 
-#ifdef _MSC_VER
-//
-// FIXME: Intrinsics
-//
-unsigned char __readfsbyte(const unsigned long Offset);
-#pragma intrinsic(__readfsbyte)
-#endif
-
-
 FORCEINLINE
 ULONG
 KeGetCurrentProcessorNumber(VOID)
 FORCEINLINE
 ULONG
 KeGetCurrentProcessorNumber(VOID)