diff options
author | Scott Wood <scottwood@freescale.com> | 2011-07-25 07:02:11 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2011-08-05 00:47:54 -0400 |
commit | 326ed6a9bcf8d451a6d714d10c8b0f40941a3ed3 (patch) | |
tree | d57cbea021dc1866dbe68e1d32a42fd508c869a9 /arch/powerpc/include | |
parent | 53d1e658df6e26d62500410719aaee2b82067c03 (diff) |
powerpc: mtspr/mtmsr should take an unsigned long
Add a cast in case the caller passes in a different type, as it would
if mtspr/mtmsr were functions.
Previously, if a 64-bit type was passed in on 32-bit, GCC would bind the
constraint to a pair of registers, and would substitute the first register
in the pair in the asm code. This corresponds to the upper half of the
64-bit register, which is generally not the desired behavior.
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/include')
-rw-r--r-- | arch/powerpc/include/asm/reg.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h index e8aaf6fce38b..9561e6016ec6 100644 --- a/arch/powerpc/include/asm/reg.h +++ b/arch/powerpc/include/asm/reg.h | |||
@@ -1024,13 +1024,16 @@ | |||
1024 | #define mtmsrd(v) __mtmsrd((v), 0) | 1024 | #define mtmsrd(v) __mtmsrd((v), 0) |
1025 | #define mtmsr(v) mtmsrd(v) | 1025 | #define mtmsr(v) mtmsrd(v) |
1026 | #else | 1026 | #else |
1027 | #define mtmsr(v) asm volatile("mtmsr %0" : : "r" (v) : "memory") | 1027 | #define mtmsr(v) asm volatile("mtmsr %0" : \ |
1028 | : "r" ((unsigned long)(v)) \ | ||
1029 | : "memory") | ||
1028 | #endif | 1030 | #endif |
1029 | 1031 | ||
1030 | #define mfspr(rn) ({unsigned long rval; \ | 1032 | #define mfspr(rn) ({unsigned long rval; \ |
1031 | asm volatile("mfspr %0," __stringify(rn) \ | 1033 | asm volatile("mfspr %0," __stringify(rn) \ |
1032 | : "=r" (rval)); rval;}) | 1034 | : "=r" (rval)); rval;}) |
1033 | #define mtspr(rn, v) asm volatile("mtspr " __stringify(rn) ",%0" : : "r" (v)\ | 1035 | #define mtspr(rn, v) asm volatile("mtspr " __stringify(rn) ",%0" : \ |
1036 | : "r" ((unsigned long)(v)) \ | ||
1034 | : "memory") | 1037 | : "memory") |
1035 | 1038 | ||
1036 | #ifdef __powerpc64__ | 1039 | #ifdef __powerpc64__ |