[ros-diffs] [tfaber] 56456: [KMTESTS] - Fix 64 bit warnings - Do not force assembly syntax on GCC in ExInterlocked

tfaber at svn.reactos.org tfaber at svn.reactos.org
Tue May 1 09:13:19 UTC 2012


Author: tfaber
Date: Tue May  1 09:13:19 2012
New Revision: 56456

URL: http://svn.reactos.org/svn/reactos?rev=56456&view=rev
Log:
[KMTESTS]
- Fix 64 bit warnings
- Do not force assembly syntax on GCC in ExInterlocked

Modified:
    trunk/rostests/kmtests/include/kmt_test.h
    trunk/rostests/kmtests/kmtest/support.c
    trunk/rostests/kmtests/kmtest_drv/kmtest_drv.c
    trunk/rostests/kmtests/kmtest_drv/printf_stubs.c
    trunk/rostests/kmtests/ntos_ex/ExInterlocked.c
    trunk/rostests/kmtests/rtl/RtlMemory.c

Modified: trunk/rostests/kmtests/include/kmt_test.h
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/include/kmt_test.h?rev=56456&r1=56455&r2=56456&view=diff
==============================================================================
--- trunk/rostests/kmtests/include/kmt_test.h [iso-8859-1] (original)
+++ trunk/rostests/kmtests/include/kmt_test.h [iso-8859-1] Tue May  1 09:13:19 2012
@@ -234,7 +234,7 @@
     Buffer->Failures = 0;
     Buffer->Skipped = 0;
     Buffer->LogBufferLength = 0;
-    Buffer->LogBufferMaxLength = ResultBufferSize - FIELD_OFFSET(KMT_RESULTBUFFER, LogBuffer);
+    Buffer->LogBufferMaxLength = (ULONG)ResultBufferSize - FIELD_OFFSET(KMT_RESULTBUFFER, LogBuffer);
 
     return Buffer;
 }
@@ -260,7 +260,7 @@
     do
     {
         OldLength = Buffer->LogBufferLength;
-        NewLength = OldLength + Length;
+        NewLength = OldLength + (ULONG)Length;
         if (NewLength > Buffer->LogBufferMaxLength)
             return;
     } while (InterlockedCompareExchange(&Buffer->LogBufferLength, NewLength, OldLength) != OldLength);

Modified: trunk/rostests/kmtests/kmtest/support.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/kmtest/support.c?rev=56456&r1=56455&r2=56456&view=diff
==============================================================================
--- trunk/rostests/kmtests/kmtest/support.c [iso-8859-1] (original)
+++ trunk/rostests/kmtests/kmtest/support.c [iso-8859-1] Tue May  1 09:13:19 2012
@@ -31,7 +31,7 @@
     DWORD Error = ERROR_SUCCESS;
     DWORD BytesRead;
 
-    if (!DeviceIoControl(KmtestHandle, IOCTL_KMTEST_RUN_TEST, (PVOID)TestName, strlen(TestName), NULL, 0, &BytesRead, NULL))
+    if (!DeviceIoControl(KmtestHandle, IOCTL_KMTEST_RUN_TEST, (PVOID)TestName, (DWORD)strlen(TestName), NULL, 0, &BytesRead, NULL))
         error(Error);
 
     return Error;
@@ -181,7 +181,7 @@
 
     assert(ControlCode < 0x400);
 
-    if (!DeviceIoControl(TestDeviceHandle, KMT_MAKE_CODE(ControlCode), (PVOID)String, strlen(String), NULL, 0, &BytesRead, NULL))
+    if (!DeviceIoControl(TestDeviceHandle, KMT_MAKE_CODE(ControlCode), (PVOID)String, (DWORD)strlen(String), NULL, 0, &BytesRead, NULL))
         return GetLastError();
 
     return ERROR_SUCCESS;

Modified: trunk/rostests/kmtests/kmtest_drv/kmtest_drv.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/kmtest_drv/kmtest_drv.c?rev=56456&r1=56455&r2=56456&view=diff
==============================================================================
--- trunk/rostests/kmtests/kmtest_drv/kmtest_drv.c [iso-8859-1] (original)
+++ trunk/rostests/kmtests/kmtest_drv/kmtest_drv.c [iso-8859-1] Tue May  1 09:13:19 2012
@@ -279,7 +279,7 @@
 {
     NTSTATUS Status = STATUS_SUCCESS;
     PIO_STACK_LOCATION IoStackLocation;
-    ULONG Length = 0;
+    SIZE_T Length = 0;
 
     PAGED_CODE();
 

Modified: trunk/rostests/kmtests/kmtest_drv/printf_stubs.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/kmtest_drv/printf_stubs.c?rev=56456&r1=56455&r2=56456&view=diff
==============================================================================
--- trunk/rostests/kmtests/kmtest_drv/printf_stubs.c [iso-8859-1] (original)
+++ trunk/rostests/kmtests/kmtest_drv/printf_stubs.c [iso-8859-1] Tue May  1 09:13:19 2012
@@ -26,7 +26,7 @@
     stream._base = (char *)buffer;
     stream._ptr = stream._base;
     stream._charbuf = 0;
-    stream._cnt = count;
+    stream._cnt = (int)count;
     stream._bufsiz = 0;
     stream._flag = _IOSTRG | _IOWRT;
     stream._tmpfname = 0;

Modified: trunk/rostests/kmtests/ntos_ex/ExInterlocked.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/ntos_ex/ExInterlocked.c?rev=56456&r1=56455&r2=56456&view=diff
==============================================================================
--- trunk/rostests/kmtests/ntos_ex/ExInterlocked.c [iso-8859-1] (original)
+++ trunk/rostests/kmtests/ntos_ex/ExInterlocked.c [iso-8859-1] Tue May  1 09:13:19 2012
@@ -5,18 +5,18 @@
  * PROGRAMMER:      Thomas Faber <thfabba at gmx.de>
  */
 
+#include <stddef.h>
+
 /* missing prototypes >:| */
-#ifndef _MSC_VER
-typedef long long __int64;
-#endif
-struct _KSPIN_LOCK;
 __declspec(dllimport)   long            __fastcall  InterlockedCompareExchange(volatile long *, long, long);
 __declspec(dllimport)   __int64         __fastcall  ExInterlockedCompareExchange64(volatile __int64 *, __int64 *, __int64 *, void *);
 __declspec(dllimport)   __int64         __fastcall  ExfInterlockedCompareExchange64(volatile __int64 *, __int64 *, __int64 *);
 __declspec(dllimport)   long            __fastcall  InterlockedExchange(volatile long *, long);
 __declspec(dllimport)   unsigned long   __stdcall   ExInterlockedExchangeUlong(unsigned long *, unsigned long, void *);
 __declspec(dllimport)   long            __fastcall  InterlockedExchangeAdd(volatile long *, long);
-__declspec(dllimport)   unsigned long   __stdcall   ExInterlockedAddUlong(unsigned long *, unsigned long, void *);
+#ifdef _X86_
+__declspec(dllimport)   unsigned long   __stdcall   ExInterlockedAddUlong(unsigned long *, unsigned long, unsigned long *);
+#endif
 __declspec(dllimport)   unsigned long   __stdcall   Exi386InterlockedExchangeUlong(unsigned long *, unsigned long);
 __declspec(dllimport)   long            __fastcall  InterlockedIncrement(long *);
 __declspec(dllimport)   long            __fastcall  InterlockedDecrement(long *);
@@ -74,13 +74,11 @@
 #elif defined(__GNUC__) && defined(_M_IX86)
 #define SaveState(State)                                                    \
     asm volatile(                                                           \
-        ".intel_syntax noprefix\n\t"                                        \
-        "mov\t[ecx], esi\n\t"                                               \
-        "mov\t[ecx+4], edi\n\t"                                             \
-        "mov\t[ecx+8], ebx\n\t"                                             \
-        "mov\t[ecx+12], ebp\n\t"                                            \
-        "mov\t[ecx+16], esp\n\t"                                            \
-        ".att_syntax prefix"                                                \
+        "movl\t%%esi, (%%ecx)\n\t"                                            \
+        "movl\t%%edi, 4(%%ecx)\n\t"                                           \
+        "movl\t%%ebx, 8(%%ecx)\n\t"                                           \
+        "movl\t%%ebp, 12(%%ecx)\n\t"                                          \
+        "movl\t%%esp, 16(%%ecx)"                                              \
         : : "c" (&State) : "memory"                                         \
     );
 
@@ -96,17 +94,15 @@
 #elif defined(__GNUC__) && defined(_M_AMD64)
 #define SaveState(State)                                                    \
     asm volatile(                                                           \
-        ".intel_syntax noprefix\n\t"                                        \
-        "mov\t[rcx], rsi\n\t"                                               \
-        "mov\t[rcx+8], rdi\n\t"                                             \
-        "mov\t[rcx+16], rbx\n\t"                                            \
-        "mov\t[rcx+24], rbp\n\t"                                            \
-        "mov\t[rcx+32], rsp\n\t"                                            \
-        "mov\t[rcx+40], r12\n\t"                                            \
-        "mov\t[rcx+48], r13\n\t"                                            \
-        "mov\t[rcx+56], r14\n\t"                                            \
-        "mov\t[rcx+64], r15\n\t"                                            \
-        ".att_syntax prefix"                                                \
+        "mov\t%%rsi, (%%rcx)\n\t"                                             \
+        "mov\t%%rdi, 8(%%rcx)\n\t"                                            \
+        "mov\t%%rbx, 16(%%rcx)\n\t"                                           \
+        "mov\t%%rbp, 24(%%rcx)\n\t"                                           \
+        "mov\t%%rsp, 32(%%rcx)\n\t"                                           \
+        "mov\t%%r12, 40(%%rcx)\n\t"                                           \
+        "mov\t%%r13, 48(%%rcx)\n\t"                                           \
+        "mov\t%%r14, 56(%%rcx)\n\t"                                           \
+        "mov\t%%r15, 64(%%rcx)"                                               \
         : : "c" (&State) : "memory"                                         \
     );
 
@@ -124,7 +120,11 @@
 } while (0)
 #else
 #define SaveState(State)
-#define CheckState(OldState, NewState)
+#define CheckState(OldState, NewState) do                                   \
+{                                                                           \
+    (void)OldState;                                                         \
+    (void)NewState;                                                         \
+} while (0)
 #endif
 
 static

Modified: trunk/rostests/kmtests/rtl/RtlMemory.c
URL: http://svn.reactos.org/svn/reactos/trunk/rostests/kmtests/rtl/RtlMemory.c?rev=56456&r1=56455&r2=56456&view=diff
==============================================================================
--- trunk/rostests/kmtests/rtl/RtlMemory.c [iso-8859-1] (original)
+++ trunk/rostests/kmtests/rtl/RtlMemory.c [iso-8859-1] Tue May  1 09:13:19 2012
@@ -160,7 +160,7 @@
     const SIZE_T HalfSize = Size / 2;
     SIZE_T RetSize;
     KIRQL Irql;
-    ULONG i;
+    SIZE_T i;
 
     KeRaiseIrql(HIGH_LEVEL, &Irql);
     /* zero everything behind 'Size'. Tests will check that this wasn't changed.




More information about the Ros-diffs mailing list