diff --git a/reactos/base/system/smss/smss.h b/reactos/base/system/smss/smss.h index 23e3cd0a46a..2db83d39ebb 100644 --- a/reactos/base/system/smss/smss.h +++ b/reactos/base/system/smss/smss.h @@ -2,6 +2,7 @@ #define _SMSS_H_INCLUDED_ #include +#include #define WIN32_NO_STATUS #include #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 index 00000000000..612edf938c2 --- /dev/null +++ b/reactos/drivers/bus/acpi/include/platform/acmsc.h @@ -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__ */ diff --git a/reactos/drivers/bus/acpi/include/platform/acwin.h b/reactos/drivers/bus/acpi/include/platform/acwin.h index 297f29f6ae9..cfab7728f6f 100644 --- a/reactos/drivers/bus/acpi/include/platform/acwin.h +++ b/reactos/drivers/bus/acpi/include/platform/acwin.h @@ -47,14 +47,25 @@ #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 diff --git a/reactos/lib/3rdparty/mingw/crt1.c b/reactos/lib/3rdparty/mingw/crt1.c index a4fb015d1e4..4f6b17c193e 100644 --- a/reactos/lib/3rdparty/mingw/crt1.c +++ b/reactos/lib/3rdparty/mingw/crt1.c @@ -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 /* diff --git a/reactos/lib/3rdparty/mingw/mingw.rbuild b/reactos/lib/3rdparty/mingw/mingw.rbuild index c1dbef73be1..c901f39f1aa 100644 --- a/reactos/lib/3rdparty/mingw/mingw.rbuild +++ b/reactos/lib/3rdparty/mingw/mingw.rbuild @@ -13,10 +13,7 @@ isascii.c iscsym.c iscsymf.c - strcasecmp.c - strncasecmp.c toascii.c - wcscmpi.c _wgetopt.c pseudo-reloc.c diff --git a/reactos/lib/3rdparty/mingw/strcasecmp.c b/reactos/lib/3rdparty/mingw/strcasecmp.c deleted file mode 100644 index a238e22f259..00000000000 --- a/reactos/lib/3rdparty/mingw/strcasecmp.c +++ /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 - -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 index 7607ea1d001..00000000000 --- a/reactos/lib/3rdparty/mingw/strncasecmp.c +++ /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 - -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 index 497964b3964..00000000000 --- a/reactos/lib/3rdparty/mingw/wcscmpi.c +++ /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 - -int -wcscmpi (const wchar_t * ws1, const wchar_t * ws2) -{ - return _wcsicmp (ws1, ws2); -} - diff --git a/reactos/lib/rtl/debug.c b/reactos/lib/rtl/debug.c index bfde2e0f2f3..a17367fc39f 100644 --- a/reactos/lib/rtl/debug.c +++ b/reactos/lib/rtl/debug.c @@ -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; } /* diff --git a/reactos/lib/rtl/res.c b/reactos/lib/rtl/res.c index 900e1efecd0..4714ae68775 100644 --- a/reactos/lib/rtl/res.c +++ b/reactos/lib/rtl/res.c @@ -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; diff --git a/reactos/lib/rtl/rtl.h b/reactos/lib/rtl/rtl.h index 7f1eaf73ad7..81d82686a70 100644 --- a/reactos/lib/rtl/rtl.h +++ b/reactos/lib/rtl/rtl.h @@ -31,9 +31,7 @@ #include #include -#ifndef _MSC_VER #include -#endif #endif /* RTL_H */ diff --git a/reactos/lib/sdk/crt/math/i386/ci.c b/reactos/lib/sdk/crt/math/i386/ci.c index b0a58eb2d5c..0aeb0d1379c 100644 --- a/reactos/lib/sdk/crt/math/i386/ci.c +++ b/reactos/lib/sdk/crt/math/i386/ci.c @@ -1,11 +1,19 @@ #include #include +#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 diff --git a/reactos/lib/sdk/crt/string/ctype.c b/reactos/lib/sdk/crt/string/ctype.c index 46870724404..78183578dec 100644 --- a/reactos/lib/sdk/crt/string/ctype.c +++ b/reactos/lib/sdk/crt/string/ctype.c @@ -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);