[OpenBIOS] [PATCH] PPC64: Switch to 32-bit mode in interrupts

Alexander Graf agraf at suse.de
Thu Mar 5 22:24:13 CET 2009


All the code in OpenBIOS runs in 32 bits, which is fine. Now, when
an interrupt arrives, the 970 CPU automatically sets the MSR_SF bit,
making us run in 64 bit mode.

That breaks address calculation, because 'lis' and 'ba' get sign
extended.

In order to circumvent that mess, let's just go back to 32 bit mode
whenever we get an interrupt.

Signed-off-by: Alexander Graf <alex at csgraf.de>
---
 arch/ppc/qemu/start.S |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/ppc/qemu/start.S b/arch/ppc/qemu/start.S
index 857885a..66df9a2 100644
--- a/arch/ppc/qemu/start.S
+++ b/arch/ppc/qemu/start.S
@@ -34,6 +34,9 @@
 
 #define EXCEPTION_PREAMBLE_TEMPLATE \
 	mtsprg1	r1 ;				/* scratch */ \
+	mfmsr	r1 ;				/* unset MSR_SF */ \
+	clrlwi	r1,r1,0 ; \
+	mtmsr	r1 ; \
 	mfsprg0	r1 ;				/* exception stack in sprg0 */ \
 .ifc ULONG_SIZE, 8 ; \
 	addi	r1,r1,-(40 * ULONG_SIZE) ;	/* push exception frame */ \
-- 
1.6.0.2




More information about the OpenBIOS mailing list