annotate example/get_segment/spe/Hello.cc @ 1615:2c6e9ed9db3b draft

merge
author Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp>
date Tue, 14 May 2013 13:38:17 +0900
parents d7b0c0f8514c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
354
cfd20d609ace add example/get_segment and change spe/DrawSpan.cpp
koba
parents:
diff changeset
1 #include <stdio.h>
cfd20d609ace add example/get_segment and change spe/DrawSpan.cpp
koba
parents:
diff changeset
2 #include "Hello.h"
cfd20d609ace add example/get_segment and change spe/DrawSpan.cpp
koba
parents:
diff changeset
3 #include "Func.h"
cfd20d609ace add example/get_segment and change spe/DrawSpan.cpp
koba
parents:
diff changeset
4
cfd20d609ace add example/get_segment and change spe/DrawSpan.cpp
koba
parents:
diff changeset
5 /* これは必須 */
441
54c49df8dcda slightly worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 439
diff changeset
6 SchedDefineDynamicTask(Hello,0);
354
cfd20d609ace add example/get_segment and change spe/DrawSpan.cpp
koba
parents:
diff changeset
7
464
0d64bdb63005 task run is mere C function now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 462
diff changeset
8 static int
473
16f0abb574b7 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
9 rel_offset()
16f0abb574b7 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
10 {
16f0abb574b7 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
11 unsigned int pc;
16f0abb574b7 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
12 unsigned int label;
16f0abb574b7 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
13 __asm__ __volatile__(
16f0abb574b7 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
14 " brsl %0,____LLLL\n"
16f0abb574b7 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
15 "____LLLL:"
16f0abb574b7 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
16 " ila %1,____LLLL"
16f0abb574b7 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
17 : "=r" (pc), "=r" (label));
16f0abb574b7 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
18 return pc-label;
16f0abb574b7 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
19 }
16f0abb574b7 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
20
16f0abb574b7 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
21
16f0abb574b7 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
22 static int
464
0d64bdb63005 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
cfd20d609ace add example/get_segment and change spe/DrawSpan.cpp
koba
parents:
diff changeset
24 {
626
0e91ddaad798 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
cfd20d609ace add example/get_segment and change spe/DrawSpan.cpp
koba
parents:
diff changeset
26
462
ca987c0beb11 show pc in get_segement.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
27 unsigned int pc;
467
839e34d0cc3c 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
16f0abb574b7 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
29 " brsl %0,____LLLL1\n"
16f0abb574b7 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
30 "____LLLL1:"
467
839e34d0cc3c 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
ca987c0beb11 show pc in get_segement.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
32
473
16f0abb574b7 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";
16f0abb574b7 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
34 int offset = rel_offset();
16f0abb574b7 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
35
836
74fd8d2a7b9d example fix 50%
tkaito
parents: 626
diff changeset
36 //smanager->fprintf(smanager->stderr_,fmt+offset, fmt, offset);
74fd8d2a7b9d example fix 50%
tkaito
parents: 626
diff changeset
37
74fd8d2a7b9d example fix 50%
tkaito
parents: 626
diff changeset
38 //smanager->fprintf(smanager->stderr_,"[%d] Hello, World!! Seg1 \n"+offset, task_id);
74fd8d2a7b9d example fix 50%
tkaito
parents: 626
diff changeset
39 //smanager->fprintf(smanager->stderr_,"pc=0x%0x 0x%0lx\n"+offset,pc, (unsigned long)&runTask_Hello);
473
16f0abb574b7 string offset for get_segment relocation code...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 467
diff changeset
40
836
74fd8d2a7b9d example fix 50%
tkaito
parents: 626
diff changeset
41 smanager->printf(fmt+offset, fmt, offset);
74fd8d2a7b9d example fix 50%
tkaito
parents: 626
diff changeset
42
872
d7b0c0f8514c add overlay segment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 836
diff changeset
43 smanager->printf("[%d] Hello, World!! Seg1\n"+offset, task_id);
836
74fd8d2a7b9d example fix 50%
tkaito
parents: 626
diff changeset
44 smanager->printf("pc=0x%0x 0x%0lx\n"+offset,pc, (unsigned long)&runTask_Hello);
354
cfd20d609ace add example/get_segment and change spe/DrawSpan.cpp
koba
parents:
diff changeset
45
cfd20d609ace add example/get_segment and change spe/DrawSpan.cpp
koba
parents:
diff changeset
46 return 0;
cfd20d609ace add example/get_segment and change spe/DrawSpan.cpp
koba
parents:
diff changeset
47 }
872
d7b0c0f8514c add overlay segment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 836
diff changeset
48