mirror of
https://github.com/reactos/reactos.git
synced 2024-07-13 16:15:05 +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
|
||||
*
|
||||
* 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).
|
||||
* Note: Handles case where the FACS pointer is null
|
||||
*/
|
||||
#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \
|
||||
#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)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue