Re: [ACPI] ACPI global lock macros

From: Paul Menage
Date: Thu Dec 11 2003 - 03:21:33 EST


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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/