On 16.11.2010, at 00:30, Andreas Färber wrote:
Am 16.11.2010 um 00:27 schrieb Alexander Graf:
On 16.11.2010, at 00:25, Andreas Färber wrote:
Cc: Alexander Graf agraf@suse.de Signed-off-by: Andreas Färber andreas.faerber@web.de
arch/ppc/qemu/ofmem.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/arch/ppc/qemu/ofmem.c b/arch/ppc/qemu/ofmem.c index 9c60841..e8b0b24 100644 --- a/arch/ppc/qemu/ofmem.c +++ b/arch/ppc/qemu/ofmem.c @@ -25,6 +25,12 @@
#define BIT(n) (1U<<(31-(n)))
+#ifdef __powerpc64__ +#define MTMSR "mtmsrd" +#else +#define MTMSR "mtmsr" +#endif
/* called from assembly */ extern void dsi_exception( void ); extern void isi_exception( void ); @@ -417,7 +423,7 @@ setup_mmu( unsigned long ramsize )
asm volatile("mfmsr %0" : "=r" (msr) : ); msr |= MSR_IR | MSR_DR;
- asm volatile("mtmsr %0" :: "r" (msr) );
- asm volatile(MTMSR " %0" :: "r" (msr) );
Is that the only occurence of mtmsr in all the code? Better replace all at once or you'll be chasing bugs later on :).
The only one in inline assembler. The question would be how to go about turning this into a header-capable macro. For simplicity I defined it as a string literal here, doesn't work for real assembler obviously.
Real assembler needs a different define. I'd again suggest to stick to Linux nomenclatures:
#ifdef CONFIG_PPC_BOOK3S_64 #define RFI rfid #define MTMSRD(r) mtmsrd r #else #define RFI rfi #define MTMSRD(r) mtmsr r #endif
For C, please go with something like
static inline unsigned long mfmsr(void) { unsigned long msr; asm volatile("mfmsr %0" : "=r" (msr) : ); return msr; }
static inline void mtmsr(unsigned long msr) { #ifdef __powerpc64__ asm volatile("mtmsrd %0" :: "r" (msr) : ); #else asm volatile("mtmsr %0" :: "r" (msr) : ); #endif return msr; }
in a globally defined place and use that:
mtmsr(mfmsr() | MSR_IR | MSR_DR);
Alex