Thread (27 messages) 27 messages, 8 authors, 2011-12-01

RE: [PATCH 5/6] powerpc/boot: Add mfdcrx

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help