Author: tfaber
Date: Tue Nov 10 12:43:58 2015
New Revision: 69863
URL:
http://svn.reactos.org/svn/reactos?rev=69863&view=rev
Log:
[ACPICA]
- Fix GCC versions of ACPI_ACQUIRE_GLOBAL_LOCK/ACPI_RELEASE_GLOBAL_LOCK. It now generates
the same code as the original
CORE-10509
Modified:
trunk/reactos/drivers/bus/acpi/acpica/include/platform/acgcc.h
Modified: trunk/reactos/drivers/bus/acpi/acpica/include/platform/acgcc.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/bus/acpi/acpica/in…
==============================================================================
--- trunk/reactos/drivers/bus/acpi/acpica/include/platform/acgcc.h [iso-8859-1]
(original)
+++ trunk/reactos/drivers/bus/acpi/acpica/include/platform/acgcc.h [iso-8859-1] Tue Nov 10
12:43:58 2015
@@ -159,35 +159,42 @@
/*
* Global Lock acquire/release code
*
- * Note: Taken from our old adaptation.
- * TODO: Check whether it is equivalent to the MSVC code
- * (which was also the same in the older version).
- */
-#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \
+ * Note: Handles case where the FACS pointer is null
+ */
+#define ACPI_ACQUIRE_GLOBAL_LOCK(FacsPtr, Acq) \
do { \
- int dummy; \
- asm("1: movl (%1),%%eax;" \
+ asm("orl %2,%2;" \
+ "jz 2f;" \
+ "leal 16(%2),%2;" \
+ "1:" \
+ "movl (%2),%%eax;" \
"movl %%eax,%%edx;" \
- "andl %2,%%edx;" \
+ "andl %3,%%edx;" \
"btsl $0x1,%%edx;" \
"adcl $0x0,%%edx;" \
- "lock; cmpxchgl %%edx,(%1);" \
+ "lock; cmpxchgl %%edx,(%2);" \
"jnz 1b;" \
"cmpb $0x3,%%dl;" \
- "sbbl %%eax,%%eax" \
-
:"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~1L):"dx");
\
+ "sbbl %%eax,%%eax;" \
+ "2:" \
+
:"=a"(Acq):"a"(0xFF),"c"(FacsPtr),"i"(~1L):"edx");\
} while(0)
-#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \
+#define ACPI_RELEASE_GLOBAL_LOCK(FacsPtr, Acq) \
do { \
- int dummy; \
- asm("1: movl (%1),%%eax;" \
+ asm("orl %2,%2;" \
+ "jz 2f;" \
+ "leal 16(%2),%2;" \
+ "1:" \
+ "movl (%2),%%eax;" \
"movl %%eax,%%edx;" \
- "andl %2,%%edx;" \
- "lock; cmpxchgl %%edx,(%1);" \
+ "andl %3,%%edx;" \
+ "lock; cmpxchgl %%edx,(%2);" \
"jnz 1b;" \
- "andl $0x1,%%eax" \
-
:"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~3L):"dx");
\
+ "cmpb $0x3,%%dl;" /* FIXME: this is pointless */ \
+ "andl $0x1,%%eax;" \
+ "2:" \
+
:"=a"(Acq):"a"(0),"c"(FacsPtr),"i"(~3L):"edx");\
} while(0)