Merging r37048, r37051, r37052, r37055 from the-real-msvc branch
authorKJK::Hyperion <hackbunny@reactos.org>
Wed, 29 Oct 2008 20:06:44 +0000 (20:06 +0000)
committerKJK::Hyperion <hackbunny@reactos.org>
Wed, 29 Oct 2008 20:06:44 +0000 (20:06 +0000)
svn path=/trunk/; revision=37074

13 files changed:
reactos/base/system/smss/smss.h
reactos/drivers/bus/acpi/include/platform/acmsc.h [new file with mode: 0644]
reactos/drivers/bus/acpi/include/platform/acwin.h
reactos/lib/3rdparty/mingw/crt1.c
reactos/lib/3rdparty/mingw/mingw.rbuild
reactos/lib/3rdparty/mingw/strcasecmp.c [deleted file]
reactos/lib/3rdparty/mingw/strncasecmp.c [deleted file]
reactos/lib/3rdparty/mingw/wcscmpi.c [deleted file]
reactos/lib/rtl/debug.c
reactos/lib/rtl/res.c
reactos/lib/rtl/rtl.h
reactos/lib/sdk/crt/math/i386/ci.c
reactos/lib/sdk/crt/string/ctype.c

index 23e3cd0..2db83d3 100644 (file)
@@ -2,6 +2,7 @@
 #define _SMSS_H_INCLUDED_
 
 #include <stdio.h>
+#include <stdlib.h>
 #define WIN32_NO_STATUS
 #include <windows.h>
 #define NTOS_MODE_USER
diff --git a/reactos/drivers/bus/acpi/include/platform/acmsc.h b/reactos/drivers/bus/acpi/include/platform/acmsc.h
new file mode 100644 (file)
index 0000000..612edf9
--- /dev/null
@@ -0,0 +1,67 @@
+#ifndef __ACMSC_H__
+#define __ACMSC_H__
+
+#define COMPILER_DEPENDENT_UINT64 unsigned __int64
+
+#if defined(_M_IX86)
+
+#define ACPI_ASM_MACROS
+#define causeinterrupt(level)
+#define BREAKPOINT3
+#define halt() { __asm { sti } __asm { hlt } }
+#define wbinvd()
+
+__forceinline void _ACPI_ACQUIRE_GLOBAL_LOCK(void * GLptr, unsigned char * Acq_)
+{
+       unsigned char Acq;
+
+       __asm
+       {
+               mov ecx, [GLptr]
+
+       L1:     mov eax, [ecx]
+               mov edx, eax
+               and edx, ecx
+               bts edx, 1
+               adc edx, 0
+               lock cmpxchg [ecx], edx
+               jne L1
+               cmp dl, 3
+               sbb eax, eax
+
+               mov [Acq], al
+       };
+
+       *Acq_ = Acq;
+}
+
+#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \
+       _ACPI_ACQUIRE_GLOBAL_LOCK((GLptr), (unsigned char *)&(Acq))
+
+__forceinline void _ACPI_RELEASE_GLOBAL_LOCK(void * GLptr, unsigned char * Acq_)
+{
+       unsigned char Acq;
+
+       __asm
+       {
+               mov ecx, [GLptr]
+
+       L1:     mov eax, [ecx]
+               mov edx, eax
+               and edx, ecx
+               lock cmpxchg [ecx], edx
+               jnz L1
+               and eax, 1
+
+               mov [Acq], al
+       };
+
+       *Acq_ = Acq;
+}
+
+#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \
+       _ACPI_RELEASE_GLOBAL_LOCK((GLptr), (unsigned char *)&(Acq))
+
+#endif
+
+#endif /* __ACMSC_H__ */
index 297f29f..cfab772 100644 (file)
 
 #endif
 
-/* ReactOS uses GCC */
+#if defined(__GNUC__)
 
 #include "acgcc.h"
 
 #undef disable
-#define disable() __asm__("cli\n\t");
+#define disable() __asm__("cli\n\t")
 #undef enable
-#define enable() __asm__("sti\n\t");
+#define enable() __asm__("sti\n\t")
+
+#elif defined(_MSC_VER)
+
+#include "acmsc.h"
+
+#undef disable
+#define disable() __asm { cli }
+#undef enable
+#define enable() __asm { sti }
+
+#endif
 
 #undef DEBUGGER_THREADING
 #define DEBUGGER_THREADING          DEBUGGER_SINGLE_THREADED
index a4fb015..4f6b17c 100644 (file)
@@ -220,6 +220,7 @@ __mingw_CRTStartup (void)
   _pei386_runtime_relocator ();
 #endif
 
+#if defined(__GNUC__)
 #if defined(__i386__)
   /* Align the stack to 16 bytes for the sake of SSE ops in main
      or in functions inlined into main.  */
@@ -232,6 +233,17 @@ __mingw_CRTStartup (void)
   asm  __volatile__  ("li 0,15\n\tandc 1,1,0" : : : "r1");
 #else
 #error Unsupported architecture
+#endif
+#elif defined(_MSC_VER)
+#if defined(_M_IX86)
+  /* Align the stack to 16 bytes for the sake of SSE ops in main
+     or in functions inlined into main.  */
+  __asm and esp, 0FFFFFFF0h
+#else
+#error TODO
+#endif
+#else
+#error TODO
 #endif
 
   /*
index c1dbef7..c901f39 100644 (file)
        <file>isascii.c</file>
        <file>iscsym.c</file>
        <file>iscsymf.c</file>
-       <file>strcasecmp.c</file>
-       <file>strncasecmp.c</file>
        <file>toascii.c</file>
-       <file>wcscmpi.c</file>
        <file>_wgetopt.c</file>
        <if property="ARCH" value="i386">
                <file>pseudo-reloc.c</file>
diff --git a/reactos/lib/3rdparty/mingw/strcasecmp.c b/reactos/lib/3rdparty/mingw/strcasecmp.c
deleted file mode 100644 (file)
index a238e22..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * strcasecmp.c
- * This file has no copyright assigned and is placed in the Public Domain.
- * This file is a part of the mingw-runtime package.
- * No warranty is given; refer to the file DISCLAIMER within the package.
- *
- * Oldnames from ANSI header string.h
- *
- * Some wrapper functions for those old name functions whose appropriate
- * equivalents are not simply underscore prefixed.
- *
- */
-
-#include <string.h>
-
-int
-strcasecmp (const char *sz1, const char *sz2)
-{
-  return _stricmp (sz1, sz2);
-}
-
diff --git a/reactos/lib/3rdparty/mingw/strncasecmp.c b/reactos/lib/3rdparty/mingw/strncasecmp.c
deleted file mode 100644 (file)
index 7607ea1..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * strncasecmp.c
- * This file has no copyright assigned and is placed in the Public Domain.
- * This file is a part of the mingw-runtime package.
- * No warranty is given; refer to the file DISCLAIMER within the package.
- *
- * Oldnames from ANSI header string.h
- *
- * Some wrapper functions for those old name functions whose appropriate
- * equivalents are not simply underscore prefixed.
- *
- */
-
-#include <string.h>
-
-int
-strncasecmp (const char *sz1, const char *sz2, size_t sizeMaxCompare)
-{
-  return _strnicmp (sz1, sz2, sizeMaxCompare);
-}
-
diff --git a/reactos/lib/3rdparty/mingw/wcscmpi.c b/reactos/lib/3rdparty/mingw/wcscmpi.c
deleted file mode 100644 (file)
index 497964b..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * wcscmpi.c
- * This file has no copyright assigned and is placed in the Public Domain.
- * This file is a part of the mingw-runtime package.
- * No warranty is given; refer to the file DISCLAIMER within the package.
- *
- * Oldnames from ANSI header string.h
- *
- * Some wrapper functions for those old name functions whose appropriate
- * equivalents are not simply underscore prefixed.
- *
- */
-
-#include <string.h>
-
-int
-wcscmpi (const wchar_t * ws1, const wchar_t * ws2)
-{
-  return _wcsicmp (ws1, ws2);
-}
-
index bfde2e0..a17367f 100644 (file)
@@ -79,7 +79,7 @@ vDbgPrintExWithPrefixInternal(IN LPCSTR Prefix,
 
         /* Copy it */
         strncpy(Buffer, Prefix, PrefixLength);
-        
+
         /* Do the printf */
         Length = _vsnprintf(Buffer + PrefixLength,
                             sizeof(Buffer) - PrefixLength,
@@ -109,7 +109,7 @@ vDbgPrintExWithPrefixInternal(IN LPCSTR Prefix,
         /* Add the prefix */
         Length += PrefixLength;
     }
-    
+
     /* Build the string */
     DebugString.Length = Length;
     DebugString.Buffer = Buffer;
@@ -202,17 +202,19 @@ __cdecl
 DbgPrint(PCCH Format,
          ...)
 {
+       ULONG n;
     va_list ap;
 
     /* Call the internal routine that also handles ControlC */
     va_start(ap, Format);
-    return vDbgPrintExWithPrefixInternal("",
+    n = vDbgPrintExWithPrefixInternal("",
                                          -1,
                                          DPFLTR_ERROR_LEVEL,
                                          Format,
                                          ap,
                                          TRUE);
     va_end(ap);
+       return n;
 }
 
 /*
@@ -225,17 +227,19 @@ DbgPrintEx(IN ULONG ComponentId,
            IN PCCH Format,
            ...)
 {
+       ULONG n;
     va_list ap;
 
     /* Call the internal routine that also handles ControlC */
     va_start(ap, Format);
-    return vDbgPrintExWithPrefixInternal("",
+    n = vDbgPrintExWithPrefixInternal("",
                                          ComponentId,
                                          Level,
                                          Format,
                                          ap,
                                          TRUE);
     va_end(ap);
+       return n;
 }
 
 /*
@@ -246,16 +250,19 @@ __cdecl
 DbgPrintReturnControlC(PCH Format,
                        ...)
 {
+       ULONG n;
     va_list ap;
 
     /* Call the internal routine that also handles ControlC */
     va_start(ap, Format);
-    return vDbgPrintExWithPrefixInternal("",
+    n = vDbgPrintExWithPrefixInternal("",
                                          -1,
                                          DPFLTR_ERROR_LEVEL,
                                          Format,
                                          ap,
                                          FALSE);
+    va_end(ap);
+       return n;
 }
 
 /*
index 900e1ef..4714ae6 100644 (file)
@@ -60,7 +60,7 @@ static int is_data_file_module( PVOID BaseAddress )
  */
 int push_language( USHORT *list, ULONG pos, WORD lang )
 {
-    int i;
+    ULONG i;
     for (i = 0; i < pos; i++) if (list[i] == lang) return pos;
     list[pos++] = lang;
     return pos;
index 7f1eaf7..81d8268 100644 (file)
@@ -31,9 +31,7 @@
 #include <reactos/helper.h>
 #include <pseh/pseh.h>
 
-#ifndef _MSC_VER
 #include <intrin.h>
-#endif
 
 #endif /* RTL_H */
 
index b0a58eb..0aeb0d1 100644 (file)
@@ -1,11 +1,19 @@
 #include <precomp.h>
 #include <math.h>
 
+#if defined(__GNUC__)
 #define FPU_DOUBLE(var) double var; \
        __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var) : )
 #define FPU_DOUBLES(var1,var2) double var1,var2; \
        __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var2) : ); \
        __asm__ __volatile__( "fstpl %0;fwait" : "=m" (var1) : )
+#elif defined(_MSC_VER)
+#define FPU_DOUBLE(var) double var; \
+       __asm { fstp [var] }; __asm { fwait };
+#define FPU_DOUBLES(var1,var2) double var1,var2; \
+       __asm { fstp [var1] }; __asm { fwait }; \
+       __asm { fstp [var2] }; __asm { fwait };
+#endif
 
 /*
  * @implemented
index 4687072..7818357 100644 (file)
@@ -591,7 +591,7 @@ int toupper(int c)
 /*
  * @implemented
  */
-wchar_t towlower(wchar_t c)
+wint_t towlower(wint_t c)
 {
    if (iswctype (c, _UPPER))
        return (c - upalpha);
@@ -601,7 +601,7 @@ wchar_t towlower(wchar_t c)
 /*
  * @implemented
  */
-wchar_t towupper(wchar_t c)
+wint_t towupper(wint_t c)
 {
    if (iswctype (c, _LOWER))
       return (c + upalpha);