SPU overlay example?

Marcus G. Daniels mdaniels@lanl.gov
Thu Jul 5 23:22:00 GMT 2007


Hi,

I'm trying to use a linker script to describe overlays for a small 
program on a Cell SPU, but I get crashes on the overlay loads.
At the end of this message is the output of `objdump --section-headers' 
for my executable.  The relevant overlay sections are .text.0 and 
.text.1, which I created like so:

OVERLAY :
{
   .text.0 { func1.o(.text.calc1) }
   .text.1 { func2.o(.text.calc2) }
}

What I find is that the SPU stubs are invoked for these functions, but 
that I get a bus error in __ovly_xfer_loop.
It looks to me like this is a DMA call setup that fails to run 
successfully, but I haven't yet tried to follow it in detail.
Here's the end of the execution:

0x000021a8 in __ovly_xfer_loop ()
1: x/i $pc  0x21a8 <__ovly_xfer_loop+4>:        cg      $75,$8,$76
(gdb)
0x000021ac in __ovly_xfer_loop ()
1: x/i $pc  0x21ac <__ovly_xfer_loop+8>:        shufb   $75,$75,$75,$78
(gdb)
0x000021b0 in __ovly_xfer_loop ()
1: x/i $pc  0x21b0 <__ovly_xfer_loop+12>:       addx    $75,$8,$76
(gdb)
0x000021b4 in __ovly_xfer_loop ()
1: x/i $pc  0x21b4 <__ovly_xfer_loop+16>:       ori     $8,$75,0
(gdb)
0x000021b8 in __ovly_xfer_loop ()
1: x/i $pc  0x21b8 <__ovly_xfer_loop+20>:       rotqbyi $75,$75,4
(gdb)
0x000021bc in __ovly_xfer_loop ()
1: x/i $pc  0x21bc <__ovly_xfer_loop+24>:       ila     $76,0x4000
(gdb)
0x000021c0 in __ovly_xfer_loop ()
1: x/i $pc  0x21c0 <__ovly_xfer_loop+28>:       cgt     $77,$7,$76
(gdb)
0x000021c4 in __ovly_xfer_loop ()
1: x/i $pc  0x21c4 <__ovly_xfer_loop+32>:       selb    $76,$7,$76,$77
(gdb)
0x000021c8 in __ovly_xfer_loop ()
1: x/i $pc  0x21c8 <__ovly_xfer_loop+36>:       ila     $77,0
(gdb)
0x000021cc in __ovly_xfer_loop ()
1: x/i $pc  0x21cc <__ovly_xfer_loop+40>:       wrch    $ch16,$6
(gdb)
0x000021d0 in __ovly_xfer_loop ()
1: x/i $pc  0x21d0 <__ovly_xfer_loop+44>:       wrch    $ch17,$8
(gdb)
0x000021d4 in __ovly_xfer_loop ()
1: x/i $pc  0x21d4 <__ovly_xfer_loop+48>:       wrch    $ch18,$75
(gdb)
0x000021d8 in __ovly_xfer_loop ()
1: x/i $pc  0x21d8 <__ovly_xfer_loop+52>:       wrch    $ch19,$76
(gdb)
0x000021dc in __ovly_xfer_loop ()
1: x/i $pc  0x21dc <__ovly_xfer_loop+56>:       wrch    $ch20,$77
(gdb)
0x000021e0 in __ovly_xfer_loop ()
1: x/i $pc  0x21e0 <__ovly_xfer_loop+60>:       ila     $77,0x40 <_start+16>
(gdb)
0x000021e4 in __ovly_xfer_loop ()
1: x/i $pc  0x21e4 <__ovly_xfer_loop+64>:       wrch    $ch21,$77
(gdb)
0x000021e8 in __ovly_xfer_loop ()
1: x/i $pc  0x21e8 <__ovly_xfer_loop+68>:       a       $6,$6,$76
(gdb)

Program received signal SIGBUS, Bus error.
0x000021e8 in __ovly_xfer_loop ()
1: x/i $pc  0x21e8 <__ovly_xfer_loop+68>:       a       $6,$6,$76
(gdb)
Killed by signal 7


I'm using a build of GCC from the trunk which is not more than a few 
days old,  and a binutils trunk build from today.  
I couldn't find any examples or discussion on automatic SPU overlays, so 
I'm hoping someone here might have an idea what might be wrong.

Thanks,

Marcus

testAlternating:     file format elf32-big

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .init         00000024  00000000  00000000  00000100  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .text         00002210  00000030  00000030  00000130  2**4
                  CONTENTS, ALLOC, LOAD, CODE
  2 .fini         0000001c  00002280  00002280  00002380  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  3 .text.0       000000a0  000022a0  000022a0  000023a0  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  4 .text.1       000000a0  000022a0  00002340  000024a0  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  5 .rodata.cst16 00000020  00002340  000023e0  00002540  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  6 .rodata.str1.16 00000020  00002360  00002400  00002560  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  7 .rodata       00000020  00002380  00002420  00002580  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  8 .rodata._global_impure_ptr 00000010  000023a0  00002440  000025a0  2**4
                  CONTENTS, ALLOC, LOAD, READONLY, DATA
  9 .ctors        00000008  00002400  000024a0  00002600  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 10 .dtors        00000008  00002408  000024a8  00002608  2**2
                  CONTENTS, ALLOC, LOAD, DATA
 11 .data.impure_data 00000400  00002440  000024e0  00002640  2**4
                  CONTENTS, ALLOC, LOAD, DATA
 12 .data._impure_ptr 00000010  00002840  000028e0  00002a40  2**4
                  CONTENTS, ALLOC, LOAD, DATA
 13 .data.__malloc_sbrk_base 00000010  00002850  000028f0  00002a50  2**4
                  CONTENTS, ALLOC, LOAD, DATA
 14 .data.__malloc_trim_threshold 00000010  00002860  00002900  
00002a60  2**4
                  CONTENTS, ALLOC, LOAD, DATA
 15 .data.__malloc_av_ 00000410  00002870  00002910  00002a70  2**4
                  CONTENTS, ALLOC, LOAD, DATA
 16 .bss          00000034  00002c80  00002d20  00002e80  2**4
                  ALLOC
 17 .bss.__malloc_current_mallinfo 00000030  00002cc0  00002d60  
00002e80  2**4
                  ALLOC
 18 .bss.__malloc_max_total_mem 00000010  00002cf0  00002d90  00002e80  2**4
                  ALLOC
 19 .bss.__malloc_max_sbrked_mem 00000010  00002d00  00002da0  00002e80  
2**4
                  ALLOC
 20 .bss.__malloc_top_pad 00000010  00002d10  00002db0  00002e80  2**4
                  ALLOC
 21 .toe          00000010  00002d20  00002dc0  00002ea0  2**4
                  ALLOC
 22 .comment      00000372  00000000  00000000  00002e80  2**0
                  CONTENTS, READONLY
 23 .debug_abbrev 000002ec  00000000  00000000  000031f2  2**0
                  CONTENTS, READONLY, DEBUGGING
 24 .debug_info   00000528  00000000  00000000  000034de  2**0
                  CONTENTS, READONLY, DEBUGGING
 25 .debug_line   000002c8  00000000  00000000  00003a06  2**0
                  CONTENTS, READONLY, DEBUGGING
 26 .debug_frame  0000012c  00000000  00000000  00003cd0  2**2
                  CONTENTS, READONLY, DEBUGGING
 27 .debug_loc    0000022c  00000000  00000000  00003dfc  2**0
                  CONTENTS, READONLY, DEBUGGING
 28 .debug_pubnames 000000d0  00000000  00000000  00004028  2**0
                  CONTENTS, READONLY, DEBUGGING
 29 .debug_aranges 000000d8  00000000  00000000  000040f8  2**0
                  CONTENTS, READONLY, DEBUGGING
 30 .debug_str    0000022d  00000000  00000000  000041d0  2**0
                  CONTENTS, READONLY, DEBUGGING
 31 .data         00000024  00002410  000024b0  00002610  2**4
                  CONTENTS, ALLOC, LOAD, DATA



More information about the Binutils mailing list