annotate example/get_segment/spe/Hello.cc @ 626:ab866bc8a624

64bit mode compatibility on Cell
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 16 Nov 2009 11:37:26 +0900
parents 7777761e8e02
children cc06efc75ad9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
354
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents:
diff changeset
1 #include <stdio.h>
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents:
diff changeset
2 #include "Hello.h"
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents:
diff changeset
3 #include "Func.h"
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents:
diff changeset
4
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents:
diff changeset
5 /* これは必須 */
441
7bae2117f239 slightly worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 439
diff changeset
6 SchedDefineDynamicTask(Hello,0);
354
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents:
diff changeset
7
464
01b321c86747 task run is mere C function now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 462
diff changeset
8 static int
473
7777761e8e02 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
9 rel_offset()
7777761e8e02 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
10 {
7777761e8e02 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
11 unsigned int pc;
7777761e8e02 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
12 unsigned int label;
7777761e8e02 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
13 __asm__ __volatile__(
7777761e8e02 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
14 " brsl %0,____LLLL\n"
7777761e8e02 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
15 "____LLLL:"
7777761e8e02 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
16 " ila %1,____LLLL"
7777761e8e02 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
17 : "=r" (pc), "=r" (label));
7777761e8e02 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
18 return pc-label;
7777761e8e02 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
19 }
7777761e8e02 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
20
7777761e8e02 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
21
7777761e8e02 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
22 static int
464
01b321c86747 task run is mere C function now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 462
diff changeset
23 run(SchedTask *smanager, void *rbuf, void *wbuf)
354
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents:
diff changeset
24 {
626
ab866bc8a624 64bit mode compatibility on Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 473
diff changeset
25 int task_id = (long)smanager->get_param(0);
354
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents:
diff changeset
26
462
9ce2750d7c70 show pc in get_segement.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
27 unsigned int pc;
467
44c0bce54dcf fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 466
diff changeset
28 __asm__ __volatile__(
473
7777761e8e02 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
29 " brsl %0,____LLLL1\n"
7777761e8e02 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
30 "____LLLL1:"
467
44c0bce54dcf fix all examples. test_render is not working now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 466
diff changeset
31 : "=r" (pc));
462
9ce2750d7c70 show pc in get_segement.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
32
473
7777761e8e02 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
33 char *fmt = "char [%0x] offset [%0x]\n";
7777761e8e02 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
34 int offset = rel_offset();
7777761e8e02 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
35
7777761e8e02 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
36 smanager->fprintf(smanager->stderr_,fmt+offset, fmt, offset);
7777761e8e02 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
37
7777761e8e02 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
38 smanager->fprintf(smanager->stderr_,"[%d] Hello, World!! Seg1 \n"+offset, task_id);
626
ab866bc8a624 64bit mode compatibility on Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 473
diff changeset
39 smanager->fprintf(smanager->stderr_,"pc=0x%0x 0x%0lx\n"+offset,pc, (unsigned long)&runTask_Hello);
354
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents:
diff changeset
40
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents:
diff changeset
41 return 0;
81b25e5d5379 add example/get_segment and change spe/DrawSpan.cpp
koba
parents:
diff changeset
42 }