[OpenBIOS] make unoptimized sparc64 build usable with linux kernel

Igor Kovalenko igor.v.kovalenko at gmail.com
Thu Apr 16 23:48:38 CEST 2009


Hi!

After doing some homework with sparc64-elf-gcc -O0 :) I made this
local change in sparc64-call-client.diff
It allocates larger stack frame so unoptimized code could save
arguments on stack, and then calls of_client_interface().
This at least allows me to use debugger with qemu and unoptimized
sparc64 openbios build.

-- 
Kind regards,
Igor V. Kovalenko
-------------- next part --------------
Index: arch/sparc64/boot.c
===================================================================
--- arch/sparc64/boot.c	(revision 484)
+++ arch/sparc64/boot.c	(working copy)
@@ -26,11 +26,11 @@
         if (kernel_size) {
             void (*entry)(unsigned long p1, unsigned long p2, unsigned long p3,
                           unsigned long p4, unsigned long p5);
-            extern int of_client_interface( int *params );
+            extern int sparc64_of_client_interface( int *params );
 
             printk("[sparc64] Kernel already loaded\n");
             entry = (void *) (unsigned long)kernel_image;
-            entry(0, 0, 0, 0, (unsigned long)&of_client_interface);
+            entry(0, 0, 0, 0, (unsigned long)&sparc64_of_client_interface);
         }
 
 	if(!path) {
Index: arch/sparc64/build.xml
===================================================================
--- arch/sparc64/build.xml	(revision 484)
+++ arch/sparc64/build.xml	(working copy)
@@ -29,6 +29,10 @@
   <rule><![CDATA[ $(SRCDIR)/arch/sparc64/vectors.S
 	$(CC) $$EXTRACFLAGS $(AS_FLAGS) $(CFLAGS) $(INCLUDES) -c -o $@ $^]]></rule>
  </executable>
+ <executable name="target/arch/sparc64/call-client.o" target="target">
+  <rule><![CDATA[ $(SRCDIR)/arch/sparc64/call-client.S
+	$(CC) $$EXTRACFLAGS $(AS_FLAGS) $(CFLAGS) $(INCLUDES) -c -o $@ $^]]></rule>
+ </executable>
 
  <executable name="openbios-plain.elf" target="target" condition="IMAGE_ELF">
   <rule>
@@ -39,6 +43,7 @@
   <object source="plainboot.c"/>
   <external-object source="target/arch/sparc64/vectors.o"/>
   <external-object source="target/arch/sparc64/entry.o"/>
+  <external-object source="target/arch/sparc64/call-client.o"/>
   <external-object source="libsparc64.a"/>
   <external-object source="libbootstrap.a"/>
   <external-object source="libdrivers.a"/>
@@ -77,6 +82,7 @@
   <external-object source="target/arch/sparc64/vectors.o"/>
   <external-object source="target/arch/sparc64/entry.o"/>
   <external-object source="target/arch/sparc64/builtin.o"/>
+  <external-object source="target/arch/sparc64/call-client.o"/>
   <external-object source="libsparc64.a"/>
   <external-object source="libbootstrap.a"/>
   <external-object source="libdrivers.a"/>
Index: arch/sparc64/call-client.S
===================================================================
--- arch/sparc64/call-client.S	(revision 0)
+++ arch/sparc64/call-client.S	(revision 0)
@@ -0,0 +1,17 @@
+	.globl	sparc64_of_client_interface
+
+	.text
+	.align	4
+/*
+	make some more space on stack since linux kernel only provides 128 bytes
+	without memory to spill registers (used by gcc in -O0 mode)
+*/
+
+sparc64_of_client_interface:
+	save %sp, -192, %sp
+	call of_client_interface
+	mov %i0, %o0
+	mov %o0, %i0
+	return  %i7+8
+	nop
+


More information about the OpenBIOS mailing list