[OpenBIOS] [PATCH, RFC 6/6] ppc: Fix stack setup

Andreas Färber andreas.faerber at web.de
Mon Oct 11 00:54:28 CEST 2010


The exception stack was always set up 64 KiB below the ROM,
ignoring hash table alignment.
Align the stack pointer based on the PVR value.

Cc: Alexander Graf <agraf at suse.de>
Signed-off-by: Andreas Färber <andreas.faerber at web.de>
---
 arch/ppc/qemu/start.S |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/arch/ppc/qemu/start.S b/arch/ppc/qemu/start.S
index 9417098..ac1c0a3 100644
--- a/arch/ppc/qemu/start.S
+++ b/arch/ppc/qemu/start.S
@@ -334,9 +334,27 @@ GLOBL(_entry):
 
 	addis	r1, r3, -16		/* ramsize - 1MB */
 
-	/* setup exception stack */
+	/* setup hash table */
 
 	addis	r1, r1, -1		/* - 64 kB */
+
+	mfpvr	r14				/* check if ppc64 */
+	li		r15, 4
+	srw		r14, r14, r15	/* >> 4 */
+	cmplwi	r14, 0x33
+	blt		1f
+	cmplwi	r14, 0x7033
+	bge		1f
+	/* ppc64 */
+	clrrdi	r1, r1, 5		/* & 0xfffffffffff00000 */
+	b		2f
+1:
+	/* ppc */
+	clrrwi	r1, r1, 4		/* & 0xffff0000 */
+2:
+
+	/* setup exception stack */
+
 	mtsprg0	r1
 
 	/* setup stack */
-- 
1.7.3




More information about the OpenBIOS mailing list