annotate TaskManager/kernel/schedule/Scheduler.cc @ 483:0b933bef0328

renew task worked. but not test_nogl...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 05 Oct 2009 20:29:28 +0900
parents bd5b93d39597
children 4a2c9ff53605
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
48
70a0ac46133e *** empty log message ***
gongo
parents: 42
diff changeset
1 #include <stdio.h>
50
7927e00fb8e2 *** empty log message ***
gongo
parents: 48
diff changeset
2 #include <stdlib.h>
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
3 #include "Scheduler.h"
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
4 #include "SchedNop.h"
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
5 #include "error.h"
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
6 #include <assert.h>
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
7
313
c9f8cfcdc5c2 fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents: 301
diff changeset
8 /*
c9f8cfcdc5c2 fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents: 301
diff changeset
9 * Edit kernel/schedule/xx.cc, Cell/spe/xx.cc will be over writen by this.
c9f8cfcdc5c2 fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents: 301
diff changeset
10 * Do not edit Cell/spe/xx.cc unless there is no kernel/schedule/xx.cc files.
c9f8cfcdc5c2 fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents: 301
diff changeset
11 */
c9f8cfcdc5c2 fix ppu mail box waiting (mainMem allocate)
kono@localhost.localdomain
parents: 301
diff changeset
12
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
13 Scheduler::TaskObject task_list[MAX_TASK_OBJECT];
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
14
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
15 Scheduler::~Scheduler(void)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
16 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
17 delete connector;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
18 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
19
301
bcb81858aa62 remove deprecated source. not work.
tkaito@localhost.localdomain
parents: 298
diff changeset
20 /*! @brief speTaskの入出力のパイプラインバッファを確保する
bcb81858aa62 remove deprecated source. not work.
tkaito@localhost.localdomain
parents: 298
diff changeset
21 */
bcb81858aa62 remove deprecated source. not work.
tkaito@localhost.localdomain
parents: 298
diff changeset
22
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
23 void
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
24 Scheduler::init(void)
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
25 {
388
82cb9368e3ff MemHash (OS X version)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 387
diff changeset
26 hash = 0;
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
27 init_impl();
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
28
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
29 for (int i = 0; i < 2; i++) {
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
30 buff_taskList[i] = (TaskListPtr)allocate(sizeof(TaskList));
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
31 buff_inListData[i] = (ListDataPtr)allocate(sizeof(ListData));
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
32 buff_outListData[i] = (ListDataPtr)allocate(sizeof(ListData));
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
33 }
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
34
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
35 buffFlag_taskList = 0;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
36 buffFlag_inListData = 0;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
37 buffFlag_outListData = 0;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
38 flag_renewTaskList = 0;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
39
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
40 // bzero でもいいけど
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
41 for (int i = 0; i < MAX_GLOBAL_AREA; i++) {
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
42 globalList[i] = NULL;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
43 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
44
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
45 for (int i = 0; i < MAX_MAINMEM_AREA; i++) {
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
46 mainMemList[i] = NULL;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
47 }
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
48
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
49
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
50 taskGroup = new TaskGroup;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
51 renewTop_taskList = NULL;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
52 renewCur_taskList = NULL;
483
0b933bef0328 renew task worked. but not test_nogl...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 468
diff changeset
53 bak_curTaskList = NULL;
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
54 }
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
55
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
56 void
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
57 Scheduler::run(void)
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
58 {
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
59 task1 = new SchedNop();
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
60 task2 = new SchedNop();
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
61 task3 = new SchedNop();
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
62
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
63 // main loop
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
64 do {
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
65 __debug("----------\n");
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
66 task3->write();
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
67 task2->exec();
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
68 task1->read();
468
bd5b93d39597 test_nogl on Mac OS X worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
69 delete task3;
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
70
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
71 task3 = task2;
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
72 task2 = task1;
468
bd5b93d39597 test_nogl on Mac OS X worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 464
diff changeset
73 task1 = task1->next(this, 0);
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
74 } while (task1);
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
75
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
76 delete task3;
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
77 delete task2;
50
7927e00fb8e2 *** empty log message ***
gongo
parents: 48
diff changeset
78 }
48
70a0ac46133e *** empty log message ***
gongo
parents: 42
diff changeset
79
50
7927e00fb8e2 *** empty log message ***
gongo
parents: 48
diff changeset
80
7927e00fb8e2 *** empty log message ***
gongo
parents: 48
diff changeset
81 void
7927e00fb8e2 *** empty log message ***
gongo
parents: 48
diff changeset
82 Scheduler::finish(void)
7927e00fb8e2 *** empty log message ***
gongo
parents: 48
diff changeset
83 {
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
84 free(buff_taskList[0]);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
85 free(buff_taskList[1]);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
86 free(buff_inListData[0]);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
87 free(buff_inListData[1]);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
88 free(buff_outListData[0]);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
89 free(buff_outListData[1]);
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
90 }
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
91
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
92 /**
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
93 * あらかじめ memory allocte してある TaskList の領域を
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
94 * パイプラインの各処理が交代して使う。
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
95 */
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
96 TaskListPtr
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
97 Scheduler::get_curListBuf(void)
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
98 {
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
99 buffFlag_taskList ^= 1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
100
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
101 return buff_taskList[buffFlag_taskList];
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
102 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
103
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
104
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
105 /**
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
106 * あらかじめ memory allocte してある ListData の領域を
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
107 * パイプラインの各処理が交代して使う。
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
108 */
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
109 ListDataPtr
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
110 Scheduler::get_curWriteBuf(void)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
111 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
112 buffFlag_outListData ^= 1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
113 return buff_outListData[buffFlag_outListData];
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
114 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
115
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
116
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
117 ListDataPtr
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
118 Scheduler::get_curReadBuf(void)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
119 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
120 buffFlag_inListData ^= 1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
121 return buff_inListData[buffFlag_inListData];
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
122 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
123
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
124 /**
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
125 * タスク内で生成されたタスクを格納する TaskList を取得する
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
126 * 現在格納に使っている TaskList (renewCur_taskList) が使えるならそれを返す
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
127 * もしそうでないなら、新しく TaskList を allocate してそれを返す
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
128 * コード中で renewCur_taskList が NULL になるのは
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
129 * - プログラム開始時
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
130 * - タスク内生成タスクがある TaskList の実行を新しく始める (Nop2Ready 参照)
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
131 * 以上の場合です
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
132 */
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
133 TaskListPtr
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
134 Scheduler::get_renewListBuf(void)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
135 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
136 if (renewCur_taskList && renewCur_taskList->length < TASK_MAX_SIZE) {
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
137 return renewCur_taskList;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
138 } else {
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
139 TaskListPtr newList = (TaskListPtr)allocate(sizeof(TaskList));
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
140 newList->length = 0;
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
141 newList->next = NULL;
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
142 renewTop_taskList = TaskList::append(renewTop_taskList, newList);
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
143 renewCur_taskList = newList;
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
144 return newList;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
145 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
146 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
147
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
148 /**
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
149 * 次に実行する Renew Task List を返す
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
150 *
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
151 * @param[in] curList 現在実行中の TaskList
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
152 * 中断して RenewTaskList を行うため
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
153 * バックアップを取っておく
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
154 * @return next RenewTaskList
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
155 */
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
156 SchedTaskList*
187
gongo@localhost.localdomain
parents: 184
diff changeset
157 Scheduler::get_nextRenewTaskList(void)
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
158 {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
159 if (renewTop_taskList) {
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
160 TaskListPtr list = renewTop_taskList;
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
161 renewTop_taskList = renewTop_taskList->next;
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
162 renewCur_taskList = NULL;
233
gongo@localhost.localdomain
parents: 187
diff changeset
163
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
164 list->next = NULL;
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
165 SchedTaskList *sched
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
166 = createSchedTaskList((uint32)list, this, SCHED_TASKLIST_RENEW);
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
167 return sched;
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
168 } else {
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
169 return NULL;
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
170 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
171 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
172
187
gongo@localhost.localdomain
parents: 184
diff changeset
173 void
gongo@localhost.localdomain
parents: 184
diff changeset
174 Scheduler::set_backupTaskList(TaskListPtr cur_taskList)
gongo@localhost.localdomain
parents: 184
diff changeset
175 {
gongo@localhost.localdomain
parents: 184
diff changeset
176 bak_curTaskList = cur_taskList;
gongo@localhost.localdomain
parents: 184
diff changeset
177 }
gongo@localhost.localdomain
parents: 184
diff changeset
178
gongo@localhost.localdomain
parents: 184
diff changeset
179 void
gongo@localhost.localdomain
parents: 184
diff changeset
180 Scheduler::set_backupTaskListIndex(int cur_index)
gongo@localhost.localdomain
parents: 184
diff changeset
181 {
gongo@localhost.localdomain
parents: 184
diff changeset
182 bakIndex_taskList = cur_index;
gongo@localhost.localdomain
parents: 184
diff changeset
183 }
gongo@localhost.localdomain
parents: 184
diff changeset
184
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
185 /**
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
186 * RenewTaskList 実行前に中断した TaskList を返す
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
187 * NULL の場合、中断した TaskList は無い。
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
188 *
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
189 * @return TaskList
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
190 */
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
191 TaskListPtr
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
192 Scheduler::get_backupTaskList(void)
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
193 {
187
gongo@localhost.localdomain
parents: 184
diff changeset
194 TaskListPtr ret = bak_curTaskList;
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
195
187
gongo@localhost.localdomain
parents: 184
diff changeset
196 bak_curTaskList = NULL;
gongo@localhost.localdomain
parents: 184
diff changeset
197 return ret;
gongo@localhost.localdomain
parents: 184
diff changeset
198 }
gongo@localhost.localdomain
parents: 184
diff changeset
199
gongo@localhost.localdomain
parents: 184
diff changeset
200 int
gongo@localhost.localdomain
parents: 184
diff changeset
201 Scheduler::get_backupTaskListIndex(void)
gongo@localhost.localdomain
parents: 184
diff changeset
202 {
gongo@localhost.localdomain
parents: 184
diff changeset
203 int ret = bakIndex_taskList;
gongo@localhost.localdomain
parents: 184
diff changeset
204
gongo@localhost.localdomain
parents: 184
diff changeset
205 bakIndex_taskList = 0;
gongo@localhost.localdomain
parents: 184
diff changeset
206 return ret;
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
207 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
208
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
209 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
210 Scheduler::dma_load(void *buf, uint32 addr, uint32 size, uint32 mask)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
211 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
212 connector->dma_load(buf, addr, size, mask);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
213 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
214
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
215 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
216 Scheduler::dma_store(void *buf, uint32 addr, uint32 size, uint32 mask)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
217 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
218 connector->dma_store(buf, addr, size, mask);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
219 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
220
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
221 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
222 Scheduler::dma_wait(uint32 mask)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
223 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
224 connector->dma_wait(mask);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
225 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
226
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
227 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
228 Scheduler::dma_loadList(ListDataPtr list, void *buff, uint32 mask)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
229 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
230 connector->dma_loadList(list, buff, mask);
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
231 }
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
232
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
233
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
234 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
235 Scheduler::dma_storeList(ListDataPtr list, void *buff, uint32 mask)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
236 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
237 return connector->dma_storeList(list, buff, mask);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
238 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
239
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
240 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
241 Scheduler::mail_write(uint32 data)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
242 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
243 connector->mail_write(data);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
244 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
245
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
246 uint32
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
247 Scheduler::mail_read(void)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
248 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
249 return connector->mail_read();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
250 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
251
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
252 TaskGroupPtr
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
253 Scheduler::set_groupTask(uint32 command)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
254 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
255 TaskGroupPtr ret = taskGroup;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
256
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
257 reload_groupTask();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
258
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
259 ret->command = command;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
260 return ret;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
261 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
262
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
263 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
264 Scheduler::add_groupTask(TaskGroupPtr group, TaskPtr task)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
265 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
266 group->add(task);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
267 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
268
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
269 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
270 Scheduler::remove_groupTask(TaskGroupPtr group, TaskPtr task)
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
271 {
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
272 group->remove(task);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
273 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
274
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
275 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
276 Scheduler::reload_groupTask(void)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
277 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
278 taskGroup = new TaskGroup;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
279 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
280
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
281 uint32
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
282 Scheduler::status_groupTask(TaskGroupPtr group)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
283 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
284 return group->status();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
285 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
286
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
287 /*
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
288 ここから下は、memory 以下にあるべき
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
289 */
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
290
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
291 void*
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
292 Scheduler::global_alloc(int id, int size)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
293 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
294 globalList[id] = allocate(size);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
295 return globalList[id];
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
296 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
297
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
298 void*
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
299 Scheduler::global_get(int id)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
300 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
301 return globalList[id];
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
302 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
303
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
304 void
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
305 Scheduler::global_set(int id, void *addr)
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
306 {
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
307 globalList[id] = addr;
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
308 }
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
309
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
310 void
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
311 Scheduler::global_free(int id)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
312 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
313 free(globalList[id]);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
314 globalList[id] = NULL;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
315 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
316
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
317 /**
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
318 * mainMem_alloc で確保したメインメモリの領域アドレスを返す。
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
319 * これは Fifo, Cell で共通
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
320 */
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
321 void*
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
322 Scheduler::mainMem_get(int id)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
323 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
324 return mainMemList[id];
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
325 }
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
326
421
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
327 /**
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
328 * Task load API
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
329 */
425
799071db126e add code load API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 421
diff changeset
330 void
442
95a856a2d552 hoge... size/count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
331 Scheduler::allocate_code_segment(int size, int count)
425
799071db126e add code load API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 421
diff changeset
332 {
437
fd44dbd049aa overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
333 // 既に overlay 領域があるので、それを追加する必要がある...
442
95a856a2d552 hoge... size/count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
334 code_segment_pool = createMemList(size, count);
425
799071db126e add code load API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 421
diff changeset
335 }
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
336
421
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
337 static void
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
338 load_task(Scheduler *m, int task_id)
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
339 {
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
340 MemorySegment *s = m->get_segment(
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
341 task_list[task_id].location,
437
fd44dbd049aa overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
342 m->code_segment_pool,
fd44dbd049aa overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
343 task_list[task_id].end-task_list[task_id].location);
421
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
344 task_list[task_id].segment = s;
461
942f451341a4 overlay worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 458
diff changeset
345
942f451341a4 overlay worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 458
diff changeset
346 fprintf(stderr,"loadng task id %d at 0x%x entry 0x%x\n",task_id,
942f451341a4 overlay worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 458
diff changeset
347 (unsigned int)(task_list[task_id].segment->data ),
942f451341a4 overlay worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 458
diff changeset
348 (unsigned int)(
942f451341a4 overlay worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 458
diff changeset
349 (char*)task_list[task_id].segment->data +
942f451341a4 overlay worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 458
diff changeset
350 task_list[task_id].entry_offset));
421
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
351 }
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
352
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
353 static void
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
354 null_loader(Scheduler *m, int task_id)
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
355 {
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
356 }
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
357
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
358 static void
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
359 wait_load(Scheduler *m, int task_id)
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
360 {
442
95a856a2d552 hoge... size/count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
361 MemorySegment *s = task_list[task_id].segment;
95a856a2d552 hoge... size/count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
362 if (s)
95a856a2d552 hoge... size/count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
363 fprintf(stderr,"wait load task id %d 0x%x\n",task_id,(int)s->data);
95a856a2d552 hoge... size/count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
364 else
95a856a2d552 hoge... size/count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
365 fprintf(stderr,"wait load task id %d 000000\n",task_id);
421
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
366 // wait for code segment load
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
367 m->wait_segment(task_list[task_id].segment);
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
368 // calcurate call address
464
01b321c86747 task run is mere C function now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 461
diff changeset
369 TaskObjectRun run =
01b321c86747 task run is mere C function now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 461
diff changeset
370 (TaskObjectRun)(
421
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
371 (char*)task_list[task_id].segment->data +
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
372 task_list[task_id].entry_offset);
464
01b321c86747 task run is mere C function now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 461
diff changeset
373 task_list[task_id].run = run;
439
95c0457a7d31 still overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 437
diff changeset
374 fprintf(stderr,"wait load task id %d done. creator = 0x%x entry_offset = 0x%x\n",task_id,
464
01b321c86747 task run is mere C function now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 461
diff changeset
375 (unsigned int)run,
439
95c0457a7d31 still overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 437
diff changeset
376 task_list[task_id].entry_offset);
421
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
377 }
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
378
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
379 static void
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
380 null_waiter(Scheduler *m, int task_id)
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
381 {
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
382 }
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
383
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
384 extern void
464
01b321c86747 task run is mere C function now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 461
diff changeset
385 register_task(int cmd, TaskObjectRun run)
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
386 {
464
01b321c86747 task run is mere C function now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 461
diff changeset
387 task_list[cmd].run = run;
421
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
388 task_list[cmd].load = null_loader;
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
389 task_list[cmd].wait = null_waiter;
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
390 }
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
391
421
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
392 extern void
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
393 register_dynamic_task(int cmd,
441
7bae2117f239 slightly worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 439
diff changeset
394 memaddr start, int size,
464
01b321c86747 task run is mere C function now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 461
diff changeset
395 TaskObjectRun run, int entry_offset)
421
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
396 {
464
01b321c86747 task run is mere C function now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 461
diff changeset
397 task_list[cmd].run = run;
421
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
398 task_list[cmd].location = start;
442
95a856a2d552 hoge... size/count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
399 size &= 0xfffffffe;
441
7bae2117f239 slightly worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 439
diff changeset
400 task_list[cmd].end = start+size;
421
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
401 task_list[cmd].entry_offset = entry_offset;
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
402 task_list[cmd].load = load_task;
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
403 task_list[cmd].wait = wait_load;
439
95c0457a7d31 still overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 437
diff changeset
404 fprintf(stderr,"cmd = %d\n",cmd);
441
7bae2117f239 slightly worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 439
diff changeset
405 fprintf(stderr,"locatation = 0x%x\n",start);
7bae2117f239 slightly worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 439
diff changeset
406 fprintf(stderr,"end = 0x%x\n",start+size);
7bae2117f239 slightly worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 439
diff changeset
407 fprintf(stderr,"size = 0x%x\n",size);
439
95c0457a7d31 still overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 437
diff changeset
408 fprintf(stderr,"entry = 0x%x\n",entry_offset);
95c0457a7d31 still overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 437
diff changeset
409
421
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
410 }
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
411
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
412
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
413 /*!
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
414
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
415 size 単位のMemory Segment を count 個作る
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
416
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
417 @param [size] リストの要素1つのサイズ
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
418 @param [count] 要素数
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
419 @return allocate した領域のポインタ
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
420
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
421 */
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
422 MemList*
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
423 Scheduler::createMemList(int size, int count)
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
424 {
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
425 uint32 head_size = round_up16(sizeof(MemorySegment));
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
426 uint32 seg_size = round_up16(head_size+size);
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
427 char* mseg = (char*)allocate(seg_size*count);
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
428 MemList* mlist = new MemList((MemorySegment*)mseg);
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
429
388
82cb9368e3ff MemHash (OS X version)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 387
diff changeset
430 if (!hash) {
82cb9368e3ff MemHash (OS X version)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 387
diff changeset
431 hash = new MemHash();
82cb9368e3ff MemHash (OS X version)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 387
diff changeset
432 }
82cb9368e3ff MemHash (OS X version)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 387
diff changeset
433
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
434 for(int i = 0; i < count; i++) {
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
435 MemorySegment* next = (MemorySegment*)(mseg+seg_size*i);
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
436 char* data = (char*)next+head_size;
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
437 next->data = (void*)data;
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
438 next->size = size;
395
8c5fa57128cb chain on SPE
game@localhost.localdomain
parents: 391
diff changeset
439 next->address = (memaddr)next;
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
440 mlist->addLast(next);
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
441 }
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
442
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
443 return mlist;
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
444 }
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
445
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
446 /*!
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
447
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
448 Main Memory のSegmentを取得する
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
449
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
450 @param [addr] Main Memory のアドレス
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
451 @param [m] Mem List
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
452 @return allocate した領域のポインタ
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
453 memory directory にあるべきだが...
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
454
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
455 */
387
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 386
diff changeset
456 MemorySegment *
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
457 Scheduler::get_segment(memaddr addr, MemList *m)
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
458 {
449
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 442
diff changeset
459 MemorySegment *s = m->getFirst();
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 442
diff changeset
460 return get_segment(addr, m, s->size);
437
fd44dbd049aa overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
461 }
fd44dbd049aa overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
462
fd44dbd049aa overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
463 MemorySegment *
fd44dbd049aa overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
464 Scheduler::get_segment(memaddr addr, MemList *m, int size)
fd44dbd049aa overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
465 {
fd44dbd049aa overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
466 // memory segment のsizeをoverride する場合がある
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
467 MemorySegment *s = hash->get(addr);
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
468 if (s) {
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
469 /* 既に load されている */
439
95c0457a7d31 still overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 437
diff changeset
470 // fprintf(stderr,"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
471 m->moveToFirst(s);
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
472 return s;
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
473 }
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
474
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
475 /* LRU なので、もっとも使われてない segment を上書きする */
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
476 s = m->getLast();
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
477 m->moveToFirst(s);
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
478
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
479 memaddr old_addr = s->address;
387
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 386
diff changeset
480 s->tag = get_tag();
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 386
diff changeset
481 dma_load(s->data, addr,
437
fd44dbd049aa overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
482 size, s->tag);
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
483 /* 前のをhashから削除 */
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
484 hash->remove(old_addr);
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
485 /* 新しいaddress を登録 */
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
486 s->address = addr;
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
487 hash->put(s->address, s);
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
488
439
95c0457a7d31 still overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 437
diff changeset
489 // fprintf(stderr,"get_segement %llx 0x%x size 0x%d\n",addr, s->data,size);
95c0457a7d31 still overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 437
diff changeset
490
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
491 return s;
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
492 }
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
493
421
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
494
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
495 uint32
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
496 Scheduler::get_tag()
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
497 {
458
1c767b68d936 add ovly table tag modified
kono@localhost.localdomain
parents: 451
diff changeset
498 static int tag = 16;
1c767b68d936 add ovly table tag modified
kono@localhost.localdomain
parents: 451
diff changeset
499 tag ++;
1c767b68d936 add ovly table tag modified
kono@localhost.localdomain
parents: 451
diff changeset
500 tag &= 0x0f;
1c767b68d936 add ovly table tag modified
kono@localhost.localdomain
parents: 451
diff changeset
501 return tag+16;
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
502 }
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
503
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
504 /*!
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
505
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
506 Main Memory のSegmentを書き出す
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
507 Segment は get_segement されていて、
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
508 追い出されていてはいけない。
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
509 それを保証するのは難しい?
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
510
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
511 @param [addr] Main Memory のアドレス
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
512 @param [m] Mem List
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
513 @return allocate した領域のポインタ
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
514
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
515 */
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
516 void
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
517 Scheduler::put_segment(MemorySegment *s)
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
518 {
387
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 386
diff changeset
519 dma_store(s->data, s->address,
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
520 s->size, s->tag);
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
521 }
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
522
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
523 /*!
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
524
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
525 Main Memory のSegmentを読込、書き出しを待つ
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
526
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
527 @param [id] MemorySegment のid
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
528
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
529 */
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
530 void
387
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 386
diff changeset
531 Scheduler::wait_segment(MemorySegment *s)
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
532 {
391
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 388
diff changeset
533 // えーと、dma してない時には、skip しないとだめなんじゃないの?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 388
diff changeset
534
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 388
diff changeset
535 if (s->tag) dma_wait(s->tag);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 388
diff changeset
536 s->tag = 0;
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
537 }
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
538
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
539 /* end */