From e6483a7858775f9b33d2d565e0844db4d2a41f2f Mon Sep 17 00:00:00 2001 From: yamt Date: Wed, 13 Aug 2003 12:40:31 +0000 Subject: [PATCH] - leave a compiler which register is used for an asm argument. - use correct asm constraints. - eliminate usage of dummy variables. --- sys/arch/i386/include/acpi_func.h | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/sys/arch/i386/include/acpi_func.h b/sys/arch/i386/include/acpi_func.h index 6008147a63b2..a97362c60ea0 100644 --- a/sys/arch/i386/include/acpi_func.h +++ b/sys/arch/i386/include/acpi_func.h @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_func.h,v 1.3 2003/08/13 12:38:35 yamt Exp $ */ +/* $NetBSD: acpi_func.h,v 1.4 2003/08/13 12:40:31 yamt Exp $ */ #include @@ -9,37 +9,35 @@ #define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) \ do { \ - int dummy; \ __asm __volatile( \ - "1: movl (%1),%%eax ;" \ + "1: movl %1,%%eax ;" \ " movl %%eax,%%edx ;" \ - " andl %3,%%edx ;" \ + " andl %2,%%edx ;" \ " btsl $0x1,%%edx ;" \ " adcl $0x0,%%edx ;" \ " lock ;" \ - " cmpxchgl %%edx,(%1) ;" \ + " cmpxchgl %%edx,%1 ;" \ " jnz 1b ;" \ " andb $0x3,%%dl ;" \ " cmpb $0x3,%%dl ;" \ - " sbbl %%eax,%%eax " \ - : "=a" (Acq), "=c" (dummy) \ - : "c" (GLptr), "i" (~1L) \ - : "dx"); \ + " sbbl %%eax,%%eax ;" \ + : "=&a" (Acq), "+m" (*GLptr) \ + : "i" (~1L) \ + : "edx"); \ } while (0) #define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \ do { \ - int dummy; \ __asm __volatile( \ - "1: movl (%1),%%eax ;" \ - " andl %3,%%edx ;" \ + "1: movl %1,%%eax ;" \ + " andl %2,%%edx ;" \ " lock ;" \ - " cmpxchgl %%edx,(%1) ;" \ + " cmpxchgl %%edx,%1 ;" \ " jnz 1b ;" \ " andl $0x1,%%eax ;" \ - : "=a" (Acq), "=c" (dummy) \ - : "c" (GLptr), "i" (~3L) \ - : "dx"); \ + : "=&a" (Acq), "+m" (*GLptr) \ + : "i" (~3L) \ + : "edx"); \ } while (0) #define ACPI_FLUSH_CPU_CACHE() wbinvd()