RE: [PATCH 5/6] powerpc/boot: Add mfdcrx
From: David Laight <hidden>
Date: 2011-11-30 18:12:33
From: David Laight <hidden>
Date: 2011-11-30 18:12:33
=20
quoted
+#define mfdcrx(rn) \ + ({ \ + unsigned long rval; \ + asm volatile("mfdcrx %0,%1" : "=3Dr"(rval) : "g"(rn)); \ + rval; \ + })=20 "g" is never correct on PowerPC, you want "r" here. You can write this as a static inline btw, you only need the #define stuff when there is an "i" constraint involved.
I think you can still use static inlines even when a
constraint is one that requires a compile time constant.
eg (not ppc, but the "n" become part of the instruction
word):
static __inline__ uint32_t
custom_inic(const uint32_t op, uint32_t a, const uint32_t b)
{
uint32_t result;
__asm__ ( "custom\t%1, %0, %2, c%3"
: "=3Dr" (result) : "n" (op), "r" (a), "n" (b));
return result;
}
David