lkml.org 
[lkml]   [2003]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRE: [ACPI] ACPI global lock macros
Date
From
>>#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \
>> do { \
>> asm volatile("1:movl (%1),%%eax;" \
>> "movl %%eax,%%edx;" \
>> "andl %2,%%edx;" \
>> "btsl $0x1,%%edx;" \
>> "adcl $0x0,%%edx;" \
>> "lock; cmpxchgl %%edx,(%1);" \
>> "jnz 1b;" \
>> "cmpb $0x3,%%dl;" \
>> "sbbl %0,%0" \
>> :"=r"(Acq):"r"(GLptr),"i"(~1L):"dx", "ax"); \
>> } while(0)

Above code have a bug! Considering below code:

u8 acquired = FALSE;

ACPI_ACQUIRE_GLOBAL_LOC(acpi_gbl_common_fACS.global_lock, acquired);
if(acquired) {
....
}

Gcc will complain " ERROR: '%cl' not allowed with sbbl ". And I think any other compiler will
complain that too !

How about below changes to your proposal code.

< "sbbl %0,%0" \
< :"=r"(Acq):"r"(GLptr),"i"(~1L):"dx","ax"); \
---
> "sbbl %%eax,%%eax" \
> :"=a"(Acq):"r"(GLptr),"i"(~1L):"dx"); \

PS. I'm very curious about how could you find this bug.

Thanks
Luming

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:59    [W:0.034 / U:29.964 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site