annotate TaskManager/kernel/schedule/Scheduler.cc @ 1229:424c1f16e704 draft

add args useRefDma
author Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
date Wed, 24 Aug 2011 07:45:27 +0900
parents a49c02dffe6f
children 6b4a0846afcb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1142
801d57ae1e29 cut compile CreatePolygonTask on spe side because not enough spe memory. We have to use code loading.
yutaka@localhost.localdomain
parents: 1124
diff changeset
1 //#include <stdio.h>
50
7927e00fb8e2 *** empty log message ***
gongo
parents: 48
diff changeset
2 #include <stdlib.h>
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
3 #include <stdarg.h>
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
4 #include "Scheduler.h"
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
5 #include "SchedTask.h"
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
6 #include "SchedNop.h"
923
382a48afb061 fix DMA/Mail wait profiler
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 893
diff changeset
7 #include "SysFunc.h"
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
8 #include "error.h"
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
9 #include <assert.h>
621
64e05530e333 Cell fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
10 #include "TaskManagerImpl.h"
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
11
313
25dfa7499162 fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents: 301
diff changeset
12 /*
25dfa7499162 fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents: 301
diff changeset
13 * Edit kernel/schedule/xx.cc, Cell/spe/xx.cc will be over writen by this.
25dfa7499162 fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents: 301
diff changeset
14 * Do not edit Cell/spe/xx.cc unless there is no kernel/schedule/xx.cc files.
25dfa7499162 fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents: 301
diff changeset
15 */
25dfa7499162 fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents: 301
diff changeset
16
698
72b2da99e875 no compile error for Task Array
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 690
diff changeset
17 TaskObject task_list[MAX_TASK_OBJECT];
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
18
1147
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
19 #ifndef NOT_CHECK
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
20 int entry_cmd[MAX_TASK_OBJECT];
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
21 int task_count = 0;
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
22 #endif
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
23
501
7ddbe22d4cdb Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
24 Scheduler::~Scheduler()
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
25 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
26 delete connector;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
27 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
28
664
beb0f17c19f9 word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 635
diff changeset
29 static int
beb0f17c19f9 word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 635
diff changeset
30 null_run(SchedTask* smanager, void* r, void *w)
beb0f17c19f9 word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 635
diff changeset
31 {
923
382a48afb061 fix DMA/Mail wait profiler
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 893
diff changeset
32 smanager->printf("Calling Undefined Task %d\n", smanager->task->command==TaskArray1? smanager->atask->command: smanager->task->command);
664
beb0f17c19f9 word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 635
diff changeset
33 return 0;
beb0f17c19f9 word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 635
diff changeset
34 }
beb0f17c19f9 word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 635
diff changeset
35
689
ecf63089f5bb Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
36 static void null_loader(Scheduler *m, int task_id);
ecf63089f5bb Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
37
301
7f991471d43f remove deprecated source. not work.
tkaito@localhost.localdomain
parents: 298
diff changeset
38 /*! @brief speTaskの入出力のパイプラインバッファを確保する
7f991471d43f remove deprecated source. not work.
tkaito@localhost.localdomain
parents: 298
diff changeset
39 */
7f991471d43f remove deprecated source. not work.
tkaito@localhost.localdomain
parents: 298
diff changeset
40
1229
424c1f16e704 add args useRefDma
Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
parents: 1213
diff changeset
41 //useRefDmaは、0という初期値が設定されている。
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
42 void
1229
424c1f16e704 add args useRefDma
Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
parents: 1213
diff changeset
43 Scheduler::init(TaskManagerImpl *m, int useRefDma)
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
44 {
388
3d1e86396d16 MemHash (OS X version)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 387
diff changeset
45 hash = 0;
664
beb0f17c19f9 word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 635
diff changeset
46
1147
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
47 #ifndef NOT_CHECK
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
48 task_count = 0;
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
49 #endif
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
50
664
beb0f17c19f9 word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 635
diff changeset
51 for (int i = 0; i< MAX_TASK_OBJECT; i++) {
689
ecf63089f5bb Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
52 task_list[i].run = null_run;
ecf63089f5bb Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
53 task_list[i].load = null_loader;
ecf63089f5bb Task Array generation worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 664
diff changeset
54 task_list[i].wait = null_loader;
1147
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
55
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
56 #ifndef NOT_CHECK
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
57 entry_cmd[i] = NULL;
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
58 #endif
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
59
664
beb0f17c19f9 word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 635
diff changeset
60 }
beb0f17c19f9 word count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 635
diff changeset
61
635
c56f6847fb87 SimpleTask worked on Mac OS X
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 634
diff changeset
62 set_manager(m);
1229
424c1f16e704 add args useRefDma
Daichi TOMA <e085740@ie.u-ryukyu.ac.jp>
parents: 1213
diff changeset
63 init_impl(useRefDma);
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
64
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
65 for (int i = 0; i < 2; i++) {
800
54f0180cea0f run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 792
diff changeset
66 buff_taskList[i] = (TaskListPtr)m->allocate(sizeof(TaskList));
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
67 }
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
68
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
69 buffFlag_taskList = 0;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
70
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
71 // bzero でもいいけど
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
72 for (int i = 0; i < MAX_GLOBAL_AREA; i++) {
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
73 globalList[i] = NULL;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
74 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
75
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
76 for (int i = 0; i < MAX_MAINMEM_AREA; i++) {
631
30dd8a3deb4a Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
77 mainMemList[i] = (memaddr)NULL;
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
78 }
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
79
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
80 }
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
81
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
82 void
690
107e6e77f482 Bulk task on going.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 689
diff changeset
83 Scheduler::run(SchedTaskBase* task1)
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
84 {
690
107e6e77f482 Bulk task on going.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 689
diff changeset
85
107e6e77f482 Bulk task on going.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 689
diff changeset
86 // Pipeline Stage
107e6e77f482 Bulk task on going.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 689
diff changeset
87 SchedTaskBase* task2 = new SchedNop();
107e6e77f482 Bulk task on going.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 689
diff changeset
88 SchedTaskBase* task3 = new SchedNop();
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
89 // main loop
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
90 do {
970
1a4849b2acad change pipeline and TaskArray fast
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
91
1a4849b2acad change pipeline and TaskArray fast
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
92 task1->read();
1a4849b2acad change pipeline and TaskArray fast
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
93 task2->exec();
1015
29355ae40e6c debug mail timing.
yutaka@localhost.localdomain
parents: 1009
diff changeset
94 task3->write();
970
1a4849b2acad change pipeline and TaskArray fast
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
95
468
796f72cb21d9 test_nogl on Mac OS X worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
96 delete task3;
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
97
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
98 task3 = task2;
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
99 task2 = task1;
1015
29355ae40e6c debug mail timing.
yutaka@localhost.localdomain
parents: 1009
diff changeset
100 //SchedMailの場合、Mailの待ちが入る
893
2faa1f62d925 fix SimpleTask alignment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 874
diff changeset
101 task1 = task1->next(this, 0);
970
1a4849b2acad change pipeline and TaskArray fast
Yutaka Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp>
parents: 923
diff changeset
102
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
103 } while (task1);
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
104
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
105 delete task3;
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
106 delete task2;
50
7927e00fb8e2 *** empty log message ***
gongo
parents: 48
diff changeset
107 }
48
70a0ac46133e *** empty log message ***
gongo
parents: 42
diff changeset
108
50
7927e00fb8e2 *** empty log message ***
gongo
parents: 48
diff changeset
109
7927e00fb8e2 *** empty log message ***
gongo
parents: 48
diff changeset
110 void
501
7ddbe22d4cdb Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
111 Scheduler::finish()
50
7927e00fb8e2 *** empty log message ***
gongo
parents: 48
diff changeset
112 {
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
113 free(buff_taskList[0]);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
114 free(buff_taskList[1]);
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
115 }
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
116
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
117 /**
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
118 * あらかじめ memory allocte してある TaskList の領域を
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
119 * パイプラインの各処理が交代して使う。
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
120 */
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
121 TaskListPtr
501
7ddbe22d4cdb Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
122 Scheduler::get_curListBuf()
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
123 {
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
124 buffFlag_taskList ^= 1;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
125
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
126 return buff_taskList[buffFlag_taskList];
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
127 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
128
871
d30617ef4b20 fix get segment dma tag zero problem
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 804
diff changeset
129
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
130 /*
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
131 ここから下は、memory 以下にあるべき
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
132 */
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
133
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
134 void*
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
135 Scheduler::global_alloc(int id, int size)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
136 {
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 786
diff changeset
137
800
54f0180cea0f run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 792
diff changeset
138 globalList[id] = manager->allocate(size);
792
b480fc04206f add light switch
yutaka@localhost.localdomain
parents: 786
diff changeset
139
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
140 return globalList[id];
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
141 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
142
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
143 void*
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
144 Scheduler::global_get(int id)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
145 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
146 return globalList[id];
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
147 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
148
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
149 void
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
150 Scheduler::global_set(int id, void *addr)
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
151 {
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
152 globalList[id] = addr;
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
153 }
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
154
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
155 void
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
156 Scheduler::global_free(int id)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
157 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
158 free(globalList[id]);
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
159 globalList[id] = NULL;
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
160 }
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
161
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
162 /**
298
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
163 * mainMem_alloc で確保したメインメモリの領域アドレスを返す。
768452fab95e from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
164 * これは Fifo, Cell で共通
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
165 */
631
30dd8a3deb4a Cell 64 bit tried, but not yet worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 625
diff changeset
166 memaddr
109
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
167 Scheduler::mainMem_get(int id)
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
168 {
028ffc9c0375 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
169 return mainMemList[id];
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
170 }
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
171
423
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
172 /**
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
173 * Task load API
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
174 */
425
cebb48da955e add code load API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 423
diff changeset
175 void
872
d7b0c0f8514c add overlay segment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 871
diff changeset
176 Scheduler::allocate_code_segment(int size, int count, struct tbl *table)
425
cebb48da955e add code load API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 423
diff changeset
177 {
437
e924d6cca813 overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
178 // 既に overlay 領域があるので、それを追加する必要がある...
442
6c63423a7dea hoge... size/count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
179 code_segment_pool = createMemList(size, count);
872
d7b0c0f8514c add overlay segment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 871
diff changeset
180 if (table) {
d7b0c0f8514c add overlay segment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 871
diff changeset
181 MemorySegment* here = (MemorySegment*)(
d7b0c0f8514c add overlay segment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 871
diff changeset
182 manager->allocate(sizeof(MemorySegment)));
d7b0c0f8514c add overlay segment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 871
diff changeset
183 here->data = (void*)(table->vma);
d7b0c0f8514c add overlay segment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 871
diff changeset
184 here->size = size;
d7b0c0f8514c add overlay segment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 871
diff changeset
185 here->address = (memaddr)here;
d7b0c0f8514c add overlay segment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 871
diff changeset
186 code_segment_pool->addLast(here);
d7b0c0f8514c add overlay segment
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 871
diff changeset
187 }
425
cebb48da955e add code load API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 423
diff changeset
188 }
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
189
423
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
190 static void
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
191 load_task(Scheduler *m, int task_id)
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
192 {
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
193 MemorySegment *s = m->get_segment(
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
194 task_list[task_id].location,
437
e924d6cca813 overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
195 m->code_segment_pool,
e924d6cca813 overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
196 task_list[task_id].end-task_list[task_id].location);
423
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
197 task_list[task_id].segment = s;
871
d30617ef4b20 fix get segment dma tag zero problem
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 804
diff changeset
198 // calcurate call address
d30617ef4b20 fix get segment dma tag zero problem
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 804
diff changeset
199 TaskObjectRun run =
d30617ef4b20 fix get segment dma tag zero problem
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 804
diff changeset
200 (TaskObjectRun)(
d30617ef4b20 fix get segment dma tag zero problem
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 804
diff changeset
201 (char*)task_list[task_id].segment->data +
d30617ef4b20 fix get segment dma tag zero problem
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 804
diff changeset
202 task_list[task_id].entry_offset);
d30617ef4b20 fix get segment dma tag zero problem
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 804
diff changeset
203 task_list[task_id].run = run;
874
188e8bc16aca new hash function
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 873
diff changeset
204 #if 0
873
c50f39fbb6ca fix hash problem ( unsigned int-> long overflow )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 872
diff changeset
205 m->printf("loadng task id %d at 0x%x entry 0x%x location 0x%x\n",task_id,
461
009a2db963de overlay worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 458
diff changeset
206 (unsigned int)(task_list[task_id].segment->data ),
009a2db963de overlay worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 458
diff changeset
207 (unsigned int)(
009a2db963de overlay worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 458
diff changeset
208 (char*)task_list[task_id].segment->data +
873
c50f39fbb6ca fix hash problem ( unsigned int-> long overflow )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 872
diff changeset
209 task_list[task_id].entry_offset),
c50f39fbb6ca fix hash problem ( unsigned int-> long overflow )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 872
diff changeset
210 task_list[task_id].location);
538
5641d121818e code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
211 #endif
423
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
212 }
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
213
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
214 static void
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
215 null_loader(Scheduler *m, int task_id)
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
216 {
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
217 }
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
218
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
219 static void
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
220 wait_load(Scheduler *m, int task_id)
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
221 {
555
c5e09e9bbfa5 half finish for Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 538
diff changeset
222 #if 0
442
6c63423a7dea hoge... size/count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
223 MemorySegment *s = task_list[task_id].segment;
6c63423a7dea hoge... size/count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
224 if (s)
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
225 m->printf("wait load task id %d 0x%x\n",task_id,(int)s->data);
442
6c63423a7dea hoge... size/count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
226 else
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
227 m->printf("wait load task id %d 000000\n",task_id);
538
5641d121818e code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
228 #endif
423
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
229 // wait for code segment load
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
230 m->wait_segment(task_list[task_id].segment);
538
5641d121818e code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
231 #if 0
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
232 m->printf("wait load task id %d done. creator = 0x%x entry_offset = 0x%x\n",task_id,
871
d30617ef4b20 fix get segment dma tag zero problem
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 804
diff changeset
233 (unsigned int)(task_list[task_id].run),
439
13c6740ab15f still overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 437
diff changeset
234 task_list[task_id].entry_offset);
538
5641d121818e code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
235 #endif
423
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
236 }
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
237
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
238 static void
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
239 null_waiter(Scheduler *m, int task_id)
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
240 {
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
241 }
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
242
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
243 extern void
1058
d3cb29f1eccb create task_name_list array in Scheduler.h
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 1024
diff changeset
244 register_task(int cmd, TaskObjectRun run, const char *str)
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
245 {
464
0d64bdb63005 task run is mere C function now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 461
diff changeset
246 task_list[cmd].run = run;
423
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
247 task_list[cmd].load = null_loader;
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
248 task_list[cmd].wait = null_waiter;
1147
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
249 task_list[cmd].name = str;
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
250
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
251 #ifndef NOT_CHECK
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
252 entry_cmd[task_count++] = cmd;
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
253 #endif
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
254
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
255 }
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
256
423
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
257 extern void
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
258 register_dynamic_task(int cmd,
441
54c49df8dcda slightly worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 439
diff changeset
259 memaddr start, int size,
1058
d3cb29f1eccb create task_name_list array in Scheduler.h
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 1024
diff changeset
260 TaskObjectRun run, int entry_offset,
d3cb29f1eccb create task_name_list array in Scheduler.h
kazz <kazz@cr.ie.u-ryukyu.ac.jp>
parents: 1024
diff changeset
261 const char *str)
423
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
262 {
464
0d64bdb63005 task run is mere C function now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 461
diff changeset
263 task_list[cmd].run = run;
423
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
264 task_list[cmd].location = start;
442
6c63423a7dea hoge... size/count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
265 size &= 0xfffffffe;
441
54c49df8dcda slightly worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 439
diff changeset
266 task_list[cmd].end = start+size;
423
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
267 task_list[cmd].entry_offset = entry_offset;
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
268 task_list[cmd].load = load_task;
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
269 task_list[cmd].wait = wait_load;
1147
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
270 task_list[cmd].name = str;
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
271
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
272 #ifndef NOT_CHECK
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
273 entry_cmd[task_count++] = cmd;
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
274 #endif
279b41354753 add check code.
Yutaka_Kinjyo
parents: 1142
diff changeset
275
538
5641d121818e code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
276 #if 0
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
277 this->printf("cmd = %d\n",cmd);
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
278 this->printf("locatation = 0x%x\n",start);
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
279 this->printf("end = 0x%x\n",start+size);
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
280 this->printf("size = 0x%x\n",size);
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
281 this->printf("entry = 0x%x\n",entry_offset);
538
5641d121818e code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
282 #endif
439
13c6740ab15f still overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 437
diff changeset
283
423
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
284 }
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
285
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
286
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
287 /*!
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
288
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
289 size 単位のMemory Segment を count 個作る
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
290
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
291 @param [size] リストの要素1つのサイズ
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
292 @param [count] 要素数
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
293 @return allocate した領域のポインタ
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
294
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
295 */
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
296 MemList*
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
297 Scheduler::createMemList(int size, int count)
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
298 {
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
299 uint32 head_size = round_up16(sizeof(MemorySegment));
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
300 uint32 seg_size = round_up16(head_size+size);
800
54f0180cea0f run16 word count ( not yet worked. )
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 792
diff changeset
301 char* mseg = (char*)manager->allocate(seg_size*count);
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
302 MemList* mlist = new MemList((MemorySegment*)mseg);
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
303
388
3d1e86396d16 MemHash (OS X version)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 387
diff changeset
304 if (!hash) {
3d1e86396d16 MemHash (OS X version)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 387
diff changeset
305 hash = new MemHash();
3d1e86396d16 MemHash (OS X version)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 387
diff changeset
306 }
3d1e86396d16 MemHash (OS X version)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 387
diff changeset
307
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
308 for(int i = 0; i < count; i++) {
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
309 MemorySegment* next = (MemorySegment*)(mseg+seg_size*i);
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
310 char* data = (char*)next+head_size;
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
311 next->data = (void*)data;
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
312 next->size = size;
395
208ba3551474 chain on SPE
game@localhost.localdomain
parents: 391
diff changeset
313 next->address = (memaddr)next;
373
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
314 mlist->addLast(next);
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
315 }
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
316
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
317 return mlist;
205e4a4af635 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
318 }
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
319
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
320 /*!
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
321
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
322 Main Memory のSegmentを取得する
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
323
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
324 @param [addr] Main Memory のアドレス
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
325 @param [m] Mem List
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
326 @return allocate した領域のポインタ
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
327 memory directory にあるべきだが...
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
328
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
329 */
387
b6fce69839b5 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 386
diff changeset
330 MemorySegment *
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
331 Scheduler::get_segment(memaddr addr, MemList *m)
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
332 {
1154
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 1152
diff changeset
333
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 1152
diff changeset
334 #ifdef USE_CACHE
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 1152
diff changeset
335
449
0bed2a9889f5 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 442
diff changeset
336 MemorySegment *s = m->getFirst();
0bed2a9889f5 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 442
diff changeset
337 return get_segment(addr, m, s->size);
1154
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 1152
diff changeset
338
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 1152
diff changeset
339 #else
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 1152
diff changeset
340
1161
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1156
diff changeset
341 //addr が空だった場合はどうなるか
1162
8917aff8629c global allocate
Yutaka_Kinjyo
parents: 1161
diff changeset
342 //こうすると単純にFIFOか
1161
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1156
diff changeset
343
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1156
diff changeset
344 MemorySegment *s = m->getLast();
cc1a50cac83d use MemorySegment API for pp load. do not check execution of the cell side. to be continued..
Yutaka_Kinjyo
parents: 1156
diff changeset
345 m->moveToFirst(s);
1213
a49c02dffe6f DMA connector reogranization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1175
diff changeset
346 s->tag = connector->get_tag();
1163
b417abf82193 use Segment API for spackload
Yutaka_Kinjyo
parents: 1162
diff changeset
347 s->address = addr;
1213
a49c02dffe6f DMA connector reogranization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1175
diff changeset
348 s->data = connector->dma_load(0, s->data, addr, s->size, s->tag);
1154
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 1152
diff changeset
349
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 1152
diff changeset
350 return s;
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 1152
diff changeset
351
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 1152
diff changeset
352 #endif
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 1152
diff changeset
353
437
e924d6cca813 overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
354 }
e924d6cca813 overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
355
1173
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
356 /*!
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
357
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
358 free な Segmentを取得する(SPEのLSから)
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
359 書き込み専用の場合、dma_loadは必要ないので
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
360 こういう感じになるのかな.
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
361
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
362 @param [addr] Main Memory のアドレス
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
363 @param [m] Mem List
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
364 @return allocate した領域のポインタ
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
365 memory directory にあるべきだが...
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
366
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
367 */
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
368
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
369 MemorySegment *
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
370 Scheduler::get_free_segment(memaddr addr, MemList *m)
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
371 {
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
372
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
373
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
374 if(addr == NULL) {
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
375 return NULL;
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
376 }
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
377
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
378 MemorySegment *s = m->getLast();
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
379 m->moveToFirst(s);
1213
a49c02dffe6f DMA connector reogranization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1175
diff changeset
380 s->tag = connector->get_tag();
1173
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
381 s->address = addr;
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
382
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
383 return s;
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
384
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
385 }
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
386
1175
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
387 /*!
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
388
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
389 指定した MemorySegment を上書きする
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
390
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
391 @param [s] 上書きするMemorySegment
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
392 @param [addr] 上書きするdataへのアドレス
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
393
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
394 */
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
395
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
396 void
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
397 Scheduler::overwrite_segment(MemorySegment *s, memaddr addr)
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
398 {
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
399
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
400 if(addr == NULL) {
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
401 return;
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
402 }
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
403
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
404 s->address = addr;
1213
a49c02dffe6f DMA connector reogranization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1175
diff changeset
405 s->data = connector->dma_load(0, s->data, addr, s->size, s->tag);
1175
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
406
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
407 }
d7486d6a5e37 minor change
Yutaka_Kinjyo
parents: 1173
diff changeset
408
1173
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
409
437
e924d6cca813 overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
410 MemorySegment *
e924d6cca813 overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
411 Scheduler::get_segment(memaddr addr, MemList *m, int size)
e924d6cca813 overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
412 {
1124
c43f49400c22 add mail profile
yutaka@localhost.localdomain
parents: 1123
diff changeset
413
437
e924d6cca813 overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
414 // memory segment のsizeをoverride する場合がある
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
415 MemorySegment *s = hash->get(addr);
1123
2a63ba2c9506 bug fix.
yutaka@localhost.localdomain
parents: 1121
diff changeset
416
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
417 if (s) {
1124
c43f49400c22 add mail profile
yutaka@localhost.localdomain
parents: 1123
diff changeset
418
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
419 /* 既に load されている */
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
420 // this->printf("get_segement loaded %llx 0x%x size 0x%d\n",addr,s->data,size);
391
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 388
diff changeset
421 m->moveToFirst(s);
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
422 return s;
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
423 }
1154
yutaka@charles.cr.ie.u-ryukyu.ac.jp
parents: 1152
diff changeset
424
1121
d6725e0a7b3e get_segment test.
tkaito@henri
parents: 1062
diff changeset
425
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
426 /* LRU なので、もっとも使われてない segment を上書きする */
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
427 s = m->getLast();
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
428 m->moveToFirst(s);
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
429
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
430 memaddr old_addr = s->address;
1213
a49c02dffe6f DMA connector reogranization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1175
diff changeset
431 s->tag = connector->get_tag();
a49c02dffe6f DMA connector reogranization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1175
diff changeset
432 s->data = connector->dma_load(0, s->data, addr, size, s->tag);
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
433 /* 前のをhashから削除 */
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
434 hash->remove(old_addr);
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
435 /* 新しいaddress を登録 */
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
436 s->address = addr;
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
437 hash->put(s->address, s);
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
438
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
439 // this->printf("get_segement %llx 0x%x size 0x%d\n",addr, s->data,size);
439
13c6740ab15f still overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 437
diff changeset
440
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
441 return s;
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
442 }
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
443
423
609758f9f350 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
444
1173
cce350bed940 add MemIterator. (no test)
Yutaka_Kinjyo
parents: 1163
diff changeset
445
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
446 /*!
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
447
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
448 Main Memory のSegmentを書き出す
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
449 Segment は get_segement されていて、
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
450 追い出されていてはいけない。
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
451 それを保証するのは難しい?
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
452
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
453 @param [addr] Main Memory のアドレス
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
454 @param [m] Mem List
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
455 @return allocate した領域のポインタ
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
456
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
457 */
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
458 void
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
459 Scheduler::put_segment(MemorySegment *s)
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
460 {
1163
b417abf82193 use Segment API for spackload
Yutaka_Kinjyo
parents: 1162
diff changeset
461
b417abf82193 use Segment API for spackload
Yutaka_Kinjyo
parents: 1162
diff changeset
462 if (s == NULL) return;
1213
a49c02dffe6f DMA connector reogranization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1175
diff changeset
463 s->tag = connector->get_tag();
a49c02dffe6f DMA connector reogranization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1175
diff changeset
464 connector->dma_store(s->data, s->address, s->size, s->tag);
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
465 }
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
466
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
467 /*!
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
468
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
469 Main Memory のSegmentを読込、書き出しを待つ
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
470
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
471 @param [id] MemorySegment のid
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
472
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
473 */
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
474 void
387
b6fce69839b5 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 386
diff changeset
475 Scheduler::wait_segment(MemorySegment *s)
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
476 {
391
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 388
diff changeset
477 // えーと、dma してない時には、skip しないとだめなんじゃないの?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 388
diff changeset
478
1163
b417abf82193 use Segment API for spackload
Yutaka_Kinjyo
parents: 1162
diff changeset
479 if (s == NULL) return;
1213
a49c02dffe6f DMA connector reogranization
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 1175
diff changeset
480 if (s->tag) connector->dma_wait(s->tag);
391
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 388
diff changeset
481 s->tag = 0;
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
482 }
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
483
621
64e05530e333 Cell fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
484 long Scheduler::get_random() {
64e05530e333 Cell fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
485 #if defined(__SPU__)
64e05530e333 Cell fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
486 return 0;
64e05530e333 Cell fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
487 #else
64e05530e333 Cell fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
488 return random();
64e05530e333 Cell fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
489 #endif
64e05530e333 Cell fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
490
64e05530e333 Cell fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
491 }
64e05530e333 Cell fix
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 619
diff changeset
492
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
493 int
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
494 Scheduler::printf(const char * format, ...)
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
495 {
786
043c98537bc5 fix early free of TaskArray, add SchedTaskArrayNop stage.
yutaka@localhost.localdomain
parents: 743
diff changeset
496 #if !defined(__SPU__) || 1
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
497 va_list ap;
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
498 va_start(ap,format);
743
55ccf5f6d9af continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 736
diff changeset
499 int ret= vprintf0(format, ap);
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
500 va_end(ap);
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
501 return ret;
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
502 #else
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
503 return 0;
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
504 #endif
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
505 }
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
506
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
507 int
743
55ccf5f6d9af continue..
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 736
diff changeset
508 Scheduler::vprintf0(const char * format, va_list ap)
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
509 {
786
043c98537bc5 fix early free of TaskArray, add SchedTaskArrayNop stage.
yutaka@localhost.localdomain
parents: 743
diff changeset
510 #if !defined(__SPU__) || 1
736
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
511 int ret= vprintf(format, ap);
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
512 return ret;
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
513 #else
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
514 return 0;
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
515 #endif
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
516 }
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
517
1b225972ae88 cut printf
hiroki@localhost.localdomain
parents: 698
diff changeset
518
386
da7b1e5b8449 MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
519 /* end */