mirror of
https://github.com/reactos/reactos.git
synced 2024-08-12 06:06:27 +00:00
[ACPICA]
- Fix GCC versions of ACPI_ACQUIRE_GLOBAL_LOCK/ACPI_RELEASE_GLOBAL_LOCK. It now generates the same code as the original CORE-10509 svn path=/trunk/; revision=69863
This commit is contained in:
parent
de1c000c42
commit
88b3e30fe5
|
@ -159,35 +159,42 @@
|
||||||
/*
|
/*
|
||||||
* Global Lock acquire/release code
|
* Global Lock acquire/release code
|
||||||
*
|
*
|
||||||
* Note: Taken from our old adaptation.
|
* Note: Handles case where the FACS pointer is null
|
||||||
* 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) \
|
#define ACPI_ACQUIRE_GLOBAL_LOCK(FacsPtr, Acq) \
|
||||||
do { \
|
do { \
|
||||||
int dummy; \
|
asm("orl %2,%2;" \
|
||||||
asm("1: movl (%1),%%eax;" \
|
"jz 2f;" \
|
||||||
|
"leal 16(%2),%2;" \
|
||||||
|
"1:" \
|
||||||
|
"movl (%2),%%eax;" \
|
||||||
"movl %%eax,%%edx;" \
|
"movl %%eax,%%edx;" \
|
||||||
"andl %2,%%edx;" \
|
"andl %3,%%edx;" \
|
||||||
"btsl $0x1,%%edx;" \
|
"btsl $0x1,%%edx;" \
|
||||||
"adcl $0x0,%%edx;" \
|
"adcl $0x0,%%edx;" \
|
||||||
"lock; cmpxchgl %%edx,(%1);" \
|
"lock; cmpxchgl %%edx,(%2);" \
|
||||||
"jnz 1b;" \
|
"jnz 1b;" \
|
||||||
"cmpb $0x3,%%dl;" \
|
"cmpb $0x3,%%dl;" \
|
||||||
"sbbl %%eax,%%eax" \
|
"sbbl %%eax,%%eax;" \
|
||||||
:"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~1L):"dx"); \
|
"2:" \
|
||||||
|
:"=a"(Acq):"a"(0xFF),"c"(FacsPtr),"i"(~1L):"edx");\
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \
|
#define ACPI_RELEASE_GLOBAL_LOCK(FacsPtr, Acq) \
|
||||||
do { \
|
do { \
|
||||||
int dummy; \
|
asm("orl %2,%2;" \
|
||||||
asm("1: movl (%1),%%eax;" \
|
"jz 2f;" \
|
||||||
|
"leal 16(%2),%2;" \
|
||||||
|
"1:" \
|
||||||
|
"movl (%2),%%eax;" \
|
||||||
"movl %%eax,%%edx;" \
|
"movl %%eax,%%edx;" \
|
||||||
"andl %2,%%edx;" \
|
"andl %3,%%edx;" \
|
||||||
"lock; cmpxchgl %%edx,(%1);" \
|
"lock; cmpxchgl %%edx,(%2);" \
|
||||||
"jnz 1b;" \
|
"jnz 1b;" \
|
||||||
"andl $0x1,%%eax" \
|
"cmpb $0x3,%%dl;" /* FIXME: this is pointless */ \
|
||||||
:"=a"(Acq),"=c"(dummy):"c"(GLptr),"i"(~3L):"dx"); \
|
"andl $0x1,%%eax;" \
|
||||||
|
"2:" \
|
||||||
|
:"=a"(Acq):"a"(0),"c"(FacsPtr),"i"(~3L):"edx");\
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue