[OpenBIOS] [commit] r969 - in trunk/openbios-devel/arch: ppc/qemu ppc64/qemu

Blue Swirl blauwirbel at gmail.com
Sat Nov 27 16:03:50 CET 2010


On Sat, Nov 27, 2010 at 10:36 AM, Andreas Färber <andreas.faerber at web.de> wrote:
> Am 27.11.2010 um 11:22 schrieb Blue Swirl:
>
>> On Sat, Nov 27, 2010 at 1:16 AM, Andreas Färber <andreas.faerber at web.de>
>> wrote:
>>>
>>> Am 26.11.2010 um 20:52 schrieb Blue Swirl:
>>>
>>>> On Thu, Nov 25, 2010 at 10:04 PM, Andreas Färber
>>>> <andreas.faerber at web.de>
>>>> wrote:
>>>>>
>>>>> Starting with [r969],
>>>>>
>>>>> qemu-system-ppc64 -bios .../obj-ppc64/openbios-qemu.elf -prom-env
>>>>> 'auto-boot?=false'
>>>>>
>>>>> should take you to the Forth prompt.
>>>>
>>>> I still get this:
>>>>  GEN   bootstrap.dict
>>>> panic: segmentation violation at 0x9034862c
>>>> dict=0x2aae90348010 here=0x2aae90348638(dict+0x628)
>>>> pc=0x0(dict+0x6fcb7ff0)
>>>> dstackcnt=0 rstackcnt=0 instruction=deadbeef
>>>> dstack: 0x0
>>>> rstack: 0x0
>>>> Writing dictionary core file
>>>>
>>>> This happens on a 64 bit host, but not on a 32 bit host.
>>>
>>> So I guess it might be an issue with the HOST_EQUALS_NATIVE_BITWIDTH
>>> path?
>>> The addresses are not confined to lower 32 bits so cannot be saved in
>>> ucells.
>>>
>>>> I built forthstrap on a 32 bit host to get further, but then I got:
>>>>  LINK  openbios-qemu.elf
>>>> libqemu.a(init.o): In function `go':
>>>> /src/openbios-devel/obj-ppc64/../arch/ppc/qemu/init.c:533: undefined
>>>> reference to `.call_elf'
>>>
>>> [snip]
>>>
>>> Sounds as if -m32 or the like is being passed to powerpc64-linux-ld?
>>> Dotted
>>> symbols only get generated for ppc64 target.
>>
>> No, LINK equals to (with V=1):
>>
>> powerpc64-linux-ld --warn-common -N -T ../arch/ppc64/qemu/ldscript -o
>> openbios-qemu.elf.nostrip --whole-archive target/arch/ppc/qemu/start.o
>> target/arch/ppc/timebase.o libqemu.a libbootstrap.a libopenbios.a
>> libpackages.a libdrivers.a libfs.a liblibc.a libgcc.a
>
> Ah, right, it would've warned about architecture mismatch then. What about
> CC for start.o?
> And could you try 4.5.1 to rule out your 4.6 snapshot? I'll try if
> Darwin/ppc64 works.

It looks like GLOBL macro is not correct. With this patch (using Linux
arch/powerpc/include/asm/ppc_asm.h except for the .sections which
don't work for some reason), the link succeeds:
diff --git a/arch/ppc/qemu/start.S b/arch/ppc/qemu/start.S
index 4b6df3f..8439542 100644
--- a/arch/ppc/qemu/start.S
+++ b/arch/ppc/qemu/start.S
@@ -285,14 +285,13 @@ call_isi_exception:
 exception_return:
        EXCEPTION_EPILOGUE

-       .globl  __divide_error
-__divide_error:
+GLOBL(__divide_error):
 trap_error:
        mflr    r3
        b       BRANCH_LABEL(unexpected_excep)

 VECTOR( 0x100, "SRE" ):
-        b       _entry
+        b       BRANCH_LABEL(_entry)

 ILLEGAL_VECTOR( 0x200 )

@@ -358,7 +357,7 @@ VECTOR( 0x2200, "ISI_64" ):
 GLOBL(__vectors_end):

 /************************************************************************/
-/*     entry                                                           */
+/*     _entry                                                          */
 /************************************************************************/

 GLOBL(_entry):
@@ -453,7 +452,7 @@ GLOBL(_entry):
 #endif

        bl      BRANCH_LABEL(setup_mmu)
-       bl      BRANCH_LABEL(entry)
+        bl      BRANCH_LABEL(_entry)
 1:     nop
        b       1b

@@ -678,4 +677,4 @@ compute_ramsize:

         /* Hard reset vector */
        .section .romentry,"ax"
-       bl      _entry
+        bl      BRANCH_LABEL(_entry)
diff --git a/include/arch/ppc/asmdefs.h b/include/arch/ppc/asmdefs.h
index 9c85ea5..b2cfa48 100644
--- a/include/arch/ppc/asmdefs.h
+++ b/include/arch/ppc/asmdefs.h
@@ -110,8 +110,25 @@
 #endif

 #ifndef __darwin__
+#ifdef __powerpc64__
+#define XGLUE(a,b) a##b
+#define GLUE(a,b) XGLUE(a,b)
+
+#define GLOBL(name) \
+        .align 2 ; \
+        .globl name; \
+        .globl GLUE(.,name); \
+name: \
+        .quad GLUE(.,name); \
+        .quad .TOC. at tocbase; \
+        .quad 0; \
+        .type GLUE(.,name), at function; \
+GLUE(.,name)
+#define EXTERN(name)            _##name
+#else
 #define GLOBL( name )          .globl name ; name
 #define EXTERN( name )         name
+#endif
 #else
 /* an underscore is needed on Darwin */
 #define GLOBL( name )          .globl _##name ; name: ; _##name

I don't get the Forth prompt, screen remains black. According to
qemu.log, execution stops at infinite loop:
IN: .printk
0x00000000fff087c8:  addi    r1,r1,1168
0x00000000fff087cc:  mr      r3,r30
0x00000000fff087d0:  b       0xfff29e10

IN: _restgpr0_29
0x00000000fff29e10:  ld      r0,16(r1)
0x00000000fff29e14:  ld      r29,-24(r1)
0x00000000fff29e18:  mtlr    r0
0x00000000fff29e1c:  ld      r30,-16(r1)
0x00000000fff29e20:  ld      r31,-8(r1)
0x00000000fff29e24:  blr

IN: .unexpected_excep
0x00000000fff08db4:  nop
0x00000000fff08db8:  b       0xfff08db8

IN: .unexpected_excep
0x00000000fff08db8:  b       0xfff08db8



More information about the OpenBIOS mailing list