annotate TaskManager/kernel/schedule/Scheduler.cc @ 468:bd5b93d39597

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