[OpenBIOS] [SOLVED] [WIP] ppc: Set up r2, respect function descriptors on ppc64

Andreas Färber andreas.faerber at web.de
Tue Nov 23 09:00:56 CET 2010


Ugly but functional!
---
 arch/ppc/qemu/start.S    |   24 ++++++++++++++++++++++++
 arch/ppc64/qemu/ldscript |   10 ++++++++++
 2 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/arch/ppc/qemu/start.S b/arch/ppc/qemu/start.S
index eef4293..a3b727d 100644
--- a/arch/ppc/qemu/start.S
+++ b/arch/ppc/qemu/start.S
@@ -272,12 +272,18 @@ GLOBL(__vectors):
 
 call_dsi_exception:
 	LOAD_REG_IMMEDIATE(r3, dsi_exception)
+#ifdef __powerpc64__
+	ld r3, 0(r3)
+#endif
 	mtctr	r3
 	bctrl
 	b	exception_return
 
 call_isi_exception:
 	LOAD_REG_IMMEDIATE(r3, isi_exception)
+#ifdef __powerpc64__
+	ld r3, 0(r3)
+#endif
 	mtctr	r3
 	bctrl
 	b	exception_return
@@ -289,7 +295,11 @@ exception_return:
 __divide_error:
 trap_error:
 	mflr	r3
+#ifdef __powerpc64__
+	b	.unexpected_excep
+#else
 	b	unexpected_excep
+#endif
 
 VECTOR( 0x100, "SRE" ):
         b       _entry
@@ -445,8 +455,22 @@ GLOBL(_entry):
 
 	/* save memory size in stack */
 
+#ifdef __powerpc64__
+	LOAD_REG_IMMEDIATE(r2, __toc_start)
+	addi r2, r2, 0x4000
+	addi r2, r2, 0x4000
+#endif
+
+#ifdef __powerpc64__
+	bl .setup_mmu
+#else
 	bl	setup_mmu
+#endif
+#ifdef __powerpc64__
+	bl .entry
+#else
 	bl	entry
+#endif
 1:	nop
 	b	1b
 
diff --git a/arch/ppc64/qemu/ldscript b/arch/ppc64/qemu/ldscript
index 1d8aa8e..28f0b69 100644
--- a/arch/ppc64/qemu/ldscript
+++ b/arch/ppc64/qemu/ldscript
@@ -41,8 +41,18 @@ SECTIONS
         _data = .;
         *(.data)
         *(.data.*)
+		*(.toc1)
+		*(.branch_lt)
 	_edata = .;
     }
+	.opd : {
+		*(.opd)
+	}
+	.got : {
+		__toc_start = .;
+		*(.got)
+		*(.toc)
+	}
 
     .bss ALIGN(4096): {
         _bss = .;
-- 
1.7.3




More information about the OpenBIOS mailing list