lkml.org 
[lkml]   [2003]   [Dec]   [11]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateThu, 11 Dec 2003 00:20:14 -0800
FromPaul Menage <>
SubjectRe: [ACPI] ACPI global lock macros
Yu, Luming wrote:
> 
> 
> 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 !

Oops - the version I posted differed in one character from the version 
that I'd compiled - I'd just used "sbb" in the working version and let 
the compiler figure out which version to use.

> 
> 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"); \

Yes, that would work too, but I don't like forcing the asm to use 
particular registers when there's no good reason to do so.

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

It was mainly down to the differences between the i386 and x86_64 
versions, and trying to understand the reasons for those differences, 
and indeed how the entire set of macros worked at all.

Paul

-
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 12:59    [from the cache]
©2003-2008