[OpenBIOS] [PATCH] Use exception vectors from ROM instead of copying them to page zero

BALATON Zoltan balaton at eik.bme.hu
Mon May 26 14:20:19 CEST 2014


Instead of copying the exception vectors from ROM to page zero use the
Interrupt Prefix bit of the CPU to use the vectors at the ROM address.
This simplifies the startup routine a little bit and avoids using
addresses that can be overwritten by clients. In particular MorphOS
writes to address 0x80 during boot which corrupted the exception
return code causing a crash.

Signed-off-by: BALATON Zoltan <balaton at eik.bme.hu>
---

Index: openbios-devel/arch/ppc/qemu/start.S
===================================================================
--- openbios-devel/arch/ppc/qemu/start.S	(revision 1304)
+++ openbios-devel/arch/ppc/qemu/start.S	(working copy)
@@ -388,7 +388,7 @@ GLOBL(__vectors_end):
 GLOBL(_entry):
 
 #ifdef CONFIG_PPC_64BITSUPPORT
-	li	r0,0
+	li	r0, MSR_IP
 
 	lis	r3, 0x8000			/* r1=0x80000000 */
 	add.	r3,r3,r3			/* r1=r1+r1 (high 32bit !0) */
@@ -404,32 +404,6 @@ no_64bit:
 
 real_entry:
 #endif
-
-	/* copy exception vectors */
-
-	LOAD_REG_IMMEDIATE(r3, __vectors)
-	li	r4,0
-	li	r5,__vectors_end - __vectors + 16
-	rlwinm	r5,r5,0,0,28
-1:	lwz	r6,0(r3)
-	lwz	r7,4(r3)
-	lwz	r8,8(r3)
-	lwz	r9,12(r3)
-	stw	r6,0(r4)
-	stw	r7,4(r4)
-	stw	r8,8(r4)
-	stw	r9,12(r4)
-	dcbst	0,r4
-	sync
-	icbi	0,r4
-	sync
-	addi	r5,r5,-16
-	addi	r3,r3,16
-	addi	r4,r4,16
-	cmpwi	r5,0
-	bgt	1b
-	isync
-
 	bl compute_ramsize
 
 	/* Memory map:
@@ -521,13 +495,13 @@ _GLOBAL(call_elf):
 	LOAD_REG_IMMEDIATE(r5, of_client_callback)	// r5 = callback
 	li	r6,0			// r6 = address of client program arguments (unused)
 	li	r7,0			// r7 = length of client program arguments (unused)
-	li	r0,MSR_FP | MSR_ME | MSR_DR | MSR_IR
+	li	r0,MSR_FP | MSR_ME | MSR_IP | MSR_DR | MSR_IR
 	MTMSRD(r0)
 	blrl
 
 #ifdef CONFIG_PPC64
     /* Restore SF bit */
-    LOAD_REG_IMMEDIATE(r0, MSR_SF | MSR_FP | MSR_ME | MSR_DR | MSR_IR)
+    LOAD_REG_IMMEDIATE(r0, MSR_SF | MSR_FP | MSR_ME | MSR_IP | MSR_DR | MSR_IR)
     MTMSRD(r0)
 #endif
 	LOAD_REG_IMMEDIATE(r8, saved_stack)		// restore stack pointer



More information about the OpenBIOS mailing list