From ad607262885c7f23fe1fba0de4f48ab0119cb94b Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 26 May 2019 15:06:32 +0200 Subject: [PATCH] [ACPICA] Fix MSVC x64 build See CORE-16082 --- .../bus/acpi/acpica/include/platform/acmsvc.h | 4 +- .../acpi/acpica/include/platform/acwin64.h | 41 +++++++++++++++++++ drivers/bus/acpi/acpica/namespace/nsnames.c | 2 +- 3 files changed, 44 insertions(+), 3 deletions(-) diff --git a/drivers/bus/acpi/acpica/include/platform/acmsvc.h b/drivers/bus/acpi/acpica/include/platform/acmsvc.h index 57d9693c65e..936cbf4ebff 100644 --- a/drivers/bus/acpi/acpica/include/platform/acmsvc.h +++ b/drivers/bus/acpi/acpica/include/platform/acmsvc.h @@ -149,7 +149,7 @@ #endif #ifdef __REACTOS__ - +#ifdef _M_IX86 /* Flush CPU cache - used when going to sleep. Wbinvd or similar. */ #ifdef ACPI_APPLICATION @@ -208,7 +208,7 @@ __asm exit_rel: \ __asm mov Pnd, al \ } - +#endif /* _M_IX86 */ #endif /* __REACTOS__ */ /* warn C4100: unreferenced formal parameter */ diff --git a/drivers/bus/acpi/acpica/include/platform/acwin64.h b/drivers/bus/acpi/acpica/include/platform/acwin64.h index 5dda0a5de8e..9ad34088c9d 100644 --- a/drivers/bus/acpi/acpica/include/platform/acwin64.h +++ b/drivers/bus/acpi/acpica/include/platform/acwin64.h @@ -83,6 +83,7 @@ /*! [Begin] no source code translation */ +#ifndef __REACTOS__ #define ACPI_FLUSH_CPU_CACHE() /* @@ -99,6 +100,46 @@ #endif +#else /* __REACTOS__ */ + +#ifdef ACPI_APPLICATION +#define ACPI_FLUSH_CPU_CACHE() +#else +#define ACPI_FLUSH_CPU_CACHE() __wbinvd() +#endif + +#define ACPI_ACQUIRE_GLOBAL_LOCK(FacsPtr, Acq) \ +{ \ + BOOLEAN acquired = 0xFF; \ +\ + if ((FacsPtr) != 0) \ + { \ + UINT32 compare, prev, newval; \ + UINT32* lock = &((FacsPtr)->GlobalLock); \ + do \ + { \ + compare = *lock; \ + newval = (compare & ~1) | ((compare >> 1) & 1) | 2; \ + prev = InterlockedCompareExchange(lock, newval, compare); \ + } while (prev != compare); \ + acquired = ((newval & 0xFF) < 3) ? 0xFF : 0x00; \ + } \ + (Acq) = acquired; \ +} + +#define ACPI_RELEASE_GLOBAL_LOCK(FacsPtr, Pnd) \ +{ \ + BOOLEAN pending = 0; \ +\ + if ((FacsPtr) != 0) \ + { \ + pending = InterlockedAnd(&(FacsPtr)->GlobalLock, ~3) & 1; \ + } \ + (Pnd) = pending; \ +} + +#endif /* __REACTOS__ */ + /*! [End] no source code translation !*/ #endif /* __ACWIN_H__ */ diff --git a/drivers/bus/acpi/acpica/namespace/nsnames.c b/drivers/bus/acpi/acpica/namespace/nsnames.c index 6ab5cc64430..3c40c6ac3de 100644 --- a/drivers/bus/acpi/acpica/namespace/nsnames.c +++ b/drivers/bus/acpi/acpica/namespace/nsnames.c @@ -434,7 +434,7 @@ AcpiNsBuildPrefixedPathname ( char *FullPath = NULL; char *ExternalPath = NULL; char *PrefixPath = NULL; - UINT32 PrefixPathLength = 0; + SIZE_T PrefixPathLength = 0; /* If there is a prefix, get the pathname to it */