Hello,

On Wed, Jun 23, 2010 at 12:33 PM, Gaetan Nadon <[email protected]> wrote:
> There may be an easy way to tell the compiler to handle this situation.

What about the attached pa tch? It is not complete but gives the idea.

-- 
Otavio Salvador                  O.S. Systems
E-mail: [email protected]  http://www.ossystems.com.br
Mobile: +55 53 9981-7854         http://projetos.ossystems.com.br
diff --git a/src/durango.c b/src/durango.c
index 9d6970b..e3f27b4 100644
--- a/src/durango.c
+++ b/src/durango.c
@@ -153,35 +153,43 @@ gfx_outd(unsigned short port, unsigned long data)
 
 /* These routines use VSA to read the MSRs - these are a second resort to the Linux MSR method */
 
-#define vsa_msr_read(msr,adr,high,low)      \
-     __asm__ __volatile__(                      \
-        " mov $0x0AC1C, %%edx\n"                \
-        " mov $0xFC530007, %%eax\n"             \
-        " out %%eax,%%dx\n"                     \
-        " add $2,%%dl\n"                        \
-        " in %%dx, %%ax"                        \
-        : "=a" (*(low)), "=d" (*(high))         \
+static void vsa_msr_read(msr,adr,high,low)
+{
+	__asm__ __volatile__(
+        " mov $0x0AC1C, %%edx\n"
+        " mov $0xFC530007, %%eax\n"
+        " out %%eax,%%dx\n"
+        " add $2,%%dl\n"
+        " in %%dx, %%ax"
+        : "=a" (*(low)), "=d" (*(high))
         : "c" (msr | adr))
+		}
+
+static void vsa_msr_write(msr,adr,high,low)
+{
+    int d0, d1, d2, d3, d4;
 
-#define vsa_msr_write(msr,adr,high,low) \
-  { int d0, d1, d2, d3, d4;        \
-  __asm__ __volatile__(            \
-    " push %%ebx\n"                \
-    " mov $0x0AC1C, %%edx\n"       \
-    " mov $0xFC530007, %%eax\n"    \
-    " out %%eax,%%dx\n"            \
-    " add $2,%%dl\n"               \
-    " mov %6, %%ebx\n"             \
-    " mov %7, %0\n"                \
-    " mov %5, %3\n"                \
-    " xor %2, %2\n"                \
-    " xor %1, %1\n"                \
-    " out %%ax, %%dx\n"            \
-    " pop %%ebx\n"                 \
-    : "=a"(d0),"=&D"(d1),"=&S"(d2), \
-      "=c"(d3),"=d"(d4)  \
-    : "1"(msr | adr),"2"(*(high)),"3"(*(low))); \
-  }
+    __asm__ __volatile__(            \
+		#ifdef __x86_64__
+		" push %%rbx\n"
+#else
+		" push %%ebx\n"
+#endif
+		" mov $0x0AC1C, %%edx\n"
+		" mov $0xFC530007, %%eax\n"
+		" out %%eax,%%dx\n"
+		" add $2,%%dl\n"
+		" mov %6, %%ebx\n"
+		" mov %7, %0\n"
+		" mov %5, %3\n"
+		" xor %2, %2\n"
+		" xor %1, %1\n"
+		" out %%ax, %%dx\n"
+		" pop %%ebx\n"
+		: "=a"(d0),"=&D"(d1),"=&S"(d2),
+		  "=c"(d3),"=d"(d4)
+		: "1"(msr | adr),"2"(*(high)),"3"(*(low)));
+}
 
 extern int GeodeWriteMSR(unsigned long, unsigned long, unsigned long);
 extern int GeodeReadMSR(unsigned long, unsigned long *, unsigned long *);
_______________________________________________
Xorg-driver-geode mailing list
[email protected]
http://lists.x.org/mailman/listinfo/xorg-driver-geode

Reply via email to