annotate TaskManager/kernel/schedule/Scheduler.cc @ 523:b273767962b8

half finish for Cell
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 20 Oct 2009 22:29:27 +0900
parents 1d4a8a86f26b
children 1733f3cbfa28
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
501
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
15 Scheduler::~Scheduler()
109
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
501
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
24 Scheduler::init()
42
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));
501
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
31 // buff_inListData[i] = (ListDataPtr)allocate(sizeof(ListData));
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
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;
501
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
36 // buffFlag_inListData = 0;
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
37 // buffFlag_outListData = 0;
109
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
501
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
57 Scheduler::run()
42
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
501
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
82 Scheduler::finish()
50
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]);
501
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
86 // free(buff_inListData[0]);
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
87 // free(buff_inListData[1]);
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
88 // free(buff_outListData[0]);
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
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
501
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
97 Scheduler::get_curListBuf()
42
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 /**
501
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
106 * Task に inListData, outListData を入れたので、
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
107 * これは必要ないらしい。
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
108 *
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
109 * あらかじめ memory allocte してある ListData の領域を
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
110 * パイプラインの各処理が交代して使う。
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
111 */
501
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
112 #if 0
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
113 ListDataPtr
501
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
114 Scheduler::get_curWriteBuf()
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
115 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
116 buffFlag_outListData ^= 1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
117 return buff_outListData[buffFlag_outListData];
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
118 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
119
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
120
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
121 ListDataPtr
501
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
122 Scheduler::get_curReadBuf()
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
123 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
124 buffFlag_inListData ^= 1;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
125 return buff_inListData[buffFlag_inListData];
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
126 }
501
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
127 #endif
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
128
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
129 /**
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
130 * タスク内で生成されたタスクを格納する TaskList を取得する
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
131 * 現在格納に使っている TaskList (renewCur_taskList) が使えるならそれを返す
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
132 * もしそうでないなら、新しく TaskList を allocate してそれを返す
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
133 * コード中で renewCur_taskList が NULL になるのは
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
134 * - プログラム開始時
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
135 * - タスク内生成タスクがある TaskList の実行を新しく始める (Nop2Ready 参照)
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
136 * 以上の場合です
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
137 */
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
138 TaskListPtr
501
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
139 Scheduler::get_renewListBuf()
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
140 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
141 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
142 return renewCur_taskList;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
143 } else {
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
144 TaskListPtr newList = (TaskListPtr)allocate(sizeof(TaskList));
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
145 newList->length = 0;
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
146 newList->next = NULL;
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
147 renewTop_taskList = TaskList::append(renewTop_taskList, newList);
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
148 renewCur_taskList = newList;
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
149 return newList;
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
150 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
151 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
152
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
153 /**
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
154 * 次に実行する Renew Task List を返す
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
155 *
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
156 * @param[in] curList 現在実行中の TaskList
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
157 * 中断して RenewTaskList を行うため
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
158 * バックアップを取っておく
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
159 * @return next RenewTaskList
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
160 */
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
161 SchedTaskList*
501
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
162 Scheduler::get_nextRenewTaskList()
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
163 {
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
164 if (renewTop_taskList) {
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
165 TaskListPtr list = renewTop_taskList;
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
166 renewTop_taskList = renewTop_taskList->next;
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
167 renewCur_taskList = NULL;
233
gongo@localhost.localdomain
parents: 187
diff changeset
168
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
169 list->next = NULL;
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
170 SchedTaskList *sched
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
171 = createSchedTaskList((uint32)list, this, SCHED_TASKLIST_RENEW);
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
172 return sched;
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
173 } else {
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
174 return NULL;
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
175 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
176 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
177
187
gongo@localhost.localdomain
parents: 184
diff changeset
178 void
gongo@localhost.localdomain
parents: 184
diff changeset
179 Scheduler::set_backupTaskList(TaskListPtr cur_taskList)
gongo@localhost.localdomain
parents: 184
diff changeset
180 {
gongo@localhost.localdomain
parents: 184
diff changeset
181 bak_curTaskList = cur_taskList;
gongo@localhost.localdomain
parents: 184
diff changeset
182 }
gongo@localhost.localdomain
parents: 184
diff changeset
183
gongo@localhost.localdomain
parents: 184
diff changeset
184 void
gongo@localhost.localdomain
parents: 184
diff changeset
185 Scheduler::set_backupTaskListIndex(int cur_index)
gongo@localhost.localdomain
parents: 184
diff changeset
186 {
gongo@localhost.localdomain
parents: 184
diff changeset
187 bakIndex_taskList = cur_index;
gongo@localhost.localdomain
parents: 184
diff changeset
188 }
gongo@localhost.localdomain
parents: 184
diff changeset
189
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
190 /**
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
191 * RenewTaskList 実行前に中断した TaskList を返す
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
192 * NULL の場合、中断した TaskList は無い。
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
193 *
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
194 * @return TaskList
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
195 */
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
196 TaskListPtr
501
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
197 Scheduler::get_backupTaskList()
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
198 {
187
gongo@localhost.localdomain
parents: 184
diff changeset
199 TaskListPtr ret = bak_curTaskList;
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
200
187
gongo@localhost.localdomain
parents: 184
diff changeset
201 bak_curTaskList = NULL;
gongo@localhost.localdomain
parents: 184
diff changeset
202 return ret;
gongo@localhost.localdomain
parents: 184
diff changeset
203 }
gongo@localhost.localdomain
parents: 184
diff changeset
204
gongo@localhost.localdomain
parents: 184
diff changeset
205 int
501
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
206 Scheduler::get_backupTaskListIndex()
187
gongo@localhost.localdomain
parents: 184
diff changeset
207 {
gongo@localhost.localdomain
parents: 184
diff changeset
208 int ret = bakIndex_taskList;
gongo@localhost.localdomain
parents: 184
diff changeset
209
gongo@localhost.localdomain
parents: 184
diff changeset
210 bakIndex_taskList = 0;
gongo@localhost.localdomain
parents: 184
diff changeset
211 return ret;
184
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
212 }
gongo@gendarme.cr.ie.u-ryukyu.ac.jp
parents: 109
diff changeset
213
109
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_load(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_load(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_store(void *buf, uint32 addr, uint32 size, 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_store(buf, addr, size, 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_wait(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_wait(mask);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
230 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
231
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
232 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
233 Scheduler::dma_loadList(ListDataPtr list, void *buff, uint32 mask)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
234 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
235 connector->dma_loadList(list, buff, mask);
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
236 }
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
237
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
238
109
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::dma_storeList(ListDataPtr list, void *buff, uint32 mask)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
241 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
242 return connector->dma_storeList(list, buff, mask);
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 void
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
246 Scheduler::mail_write(uint32 data)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
247 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
248 connector->mail_write(data);
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 uint32
501
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
252 Scheduler::mail_read()
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
253 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
254 return connector->mail_read();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
255 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
256
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
257 TaskGroupPtr
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
258 Scheduler::set_groupTask(uint32 command)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
259 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
260 TaskGroupPtr ret = taskGroup;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
261
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
262 reload_groupTask();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
263
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
264 ret->command = command;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
265 return ret;
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::add_groupTask(TaskGroupPtr group, TaskPtr task)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
270 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
271 group->add(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::remove_groupTask(TaskGroupPtr group, TaskPtr task)
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
276 {
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
277 group->remove(task);
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 void
501
4a2c9ff53605 Cell inData/outData DMA removal
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 483
diff changeset
281 Scheduler::reload_groupTask()
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
282 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
283 taskGroup = new TaskGroup;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
284 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
285
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
286 uint32
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
287 Scheduler::status_groupTask(TaskGroupPtr group)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
288 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
289 return group->status();
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
290 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
291
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
292 /*
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
293 ここから下は、memory 以下にあるべき
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
294 */
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
295
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
296 void*
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
297 Scheduler::global_alloc(int id, int size)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
298 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
299 globalList[id] = allocate(size);
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*
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
304 Scheduler::global_get(int id)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
305 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
306 return globalList[id];
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
307 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
308
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
309 void
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
310 Scheduler::global_set(int id, void *addr)
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
311 {
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
312 globalList[id] = addr;
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
313 }
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
314
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
315 void
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
316 Scheduler::global_free(int id)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
317 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
318 free(globalList[id]);
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
319 globalList[id] = NULL;
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
320 }
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
321
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
322 /**
298
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
323 * mainMem_alloc で確保したメインメモリの領域アドレスを返す。
58fd16298954 from EUC to UTF-8
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 233
diff changeset
324 * これは Fifo, Cell で共通
109
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
325 */
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
326 void*
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
327 Scheduler::mainMem_get(int id)
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
328 {
5c194c71eca8 Cerium cvs version
gongo@gendarme.local
parents: 50
diff changeset
329 return mainMemList[id];
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
330 }
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
331
421
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
332 /**
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
333 * Task load API
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
334 */
425
799071db126e add code load API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 421
diff changeset
335 void
442
95a856a2d552 hoge... size/count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
336 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
337 {
437
fd44dbd049aa overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
338 // 既に overlay 領域があるので、それを追加する必要がある...
442
95a856a2d552 hoge... size/count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
339 code_segment_pool = createMemList(size, count);
425
799071db126e add code load API
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 421
diff changeset
340 }
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
341
421
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
342 static void
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
343 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
344 {
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
345 MemorySegment *s = m->get_segment(
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
346 task_list[task_id].location,
437
fd44dbd049aa overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
347 m->code_segment_pool,
fd44dbd049aa overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
348 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
349 task_list[task_id].segment = s;
506
1d4a8a86f26b code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
350 #if 0
461
942f451341a4 overlay worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 458
diff changeset
351 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
352 (unsigned int)(task_list[task_id].segment->data ),
942f451341a4 overlay worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 458
diff changeset
353 (unsigned int)(
942f451341a4 overlay worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 458
diff changeset
354 (char*)task_list[task_id].segment->data +
942f451341a4 overlay worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 458
diff changeset
355 task_list[task_id].entry_offset));
506
1d4a8a86f26b code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
356 #endif
421
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
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
359 static void
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
360 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
361 {
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
362 }
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
363
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
364 static void
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
365 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
366 {
523
b273767962b8 half finish for Cell
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 506
diff changeset
367 #if 0
442
95a856a2d552 hoge... size/count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
368 MemorySegment *s = task_list[task_id].segment;
95a856a2d552 hoge... size/count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
369 if (s)
95a856a2d552 hoge... size/count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
370 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
371 else
95a856a2d552 hoge... size/count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
372 fprintf(stderr,"wait load task id %d 000000\n",task_id);
506
1d4a8a86f26b code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
373 #endif
421
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
374 // wait for code segment load
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
375 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
376 // calcurate call address
464
01b321c86747 task run is mere C function now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 461
diff changeset
377 TaskObjectRun run =
01b321c86747 task run is mere C function now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 461
diff changeset
378 (TaskObjectRun)(
421
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
379 (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
380 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
381 task_list[task_id].run = run;
506
1d4a8a86f26b code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
382 #if 0
439
95c0457a7d31 still overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 437
diff changeset
383 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
384 (unsigned int)run,
439
95c0457a7d31 still overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 437
diff changeset
385 task_list[task_id].entry_offset);
506
1d4a8a86f26b code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
386 #endif
421
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
387 }
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
388
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
389 static void
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
390 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
391 {
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
392 }
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
393
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
394 extern void
464
01b321c86747 task run is mere C function now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 461
diff changeset
395 register_task(int cmd, TaskObjectRun run)
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
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].load = null_loader;
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
399 task_list[cmd].wait = null_waiter;
42
aa11038dbdc1 *** empty log message ***
gongo
parents:
diff changeset
400 }
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
401
421
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
402 extern void
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
403 register_dynamic_task(int cmd,
441
7bae2117f239 slightly worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 439
diff changeset
404 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
405 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
406 {
464
01b321c86747 task run is mere C function now.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 461
diff changeset
407 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
408 task_list[cmd].location = start;
442
95a856a2d552 hoge... size/count
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 441
diff changeset
409 size &= 0xfffffffe;
441
7bae2117f239 slightly worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 439
diff changeset
410 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
411 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
412 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
413 task_list[cmd].wait = wait_load;
506
1d4a8a86f26b code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
414 #if 0
439
95c0457a7d31 still overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 437
diff changeset
415 fprintf(stderr,"cmd = %d\n",cmd);
441
7bae2117f239 slightly worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 439
diff changeset
416 fprintf(stderr,"locatation = 0x%x\n",start);
7bae2117f239 slightly worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 439
diff changeset
417 fprintf(stderr,"end = 0x%x\n",start+size);
7bae2117f239 slightly worked...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 439
diff changeset
418 fprintf(stderr,"size = 0x%x\n",size);
439
95c0457a7d31 still overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 437
diff changeset
419 fprintf(stderr,"entry = 0x%x\n",entry_offset);
506
1d4a8a86f26b code_load in read()
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 501
diff changeset
420 #endif
439
95c0457a7d31 still overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 437
diff changeset
421
421
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
422 }
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
423
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
424
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
425 /*!
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
426
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
427 size 単位のMemory Segment を count 個作る
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
428
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
429 @param [size] リストの要素1つのサイズ
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
430 @param [count] 要素数
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
431 @return allocate した領域のポインタ
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
432
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
433 */
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
434 MemList*
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
435 Scheduler::createMemList(int size, int count)
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
436 {
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
437 uint32 head_size = round_up16(sizeof(MemorySegment));
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
438 uint32 seg_size = round_up16(head_size+size);
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
439 char* mseg = (char*)allocate(seg_size*count);
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
440 MemList* mlist = new MemList((MemorySegment*)mseg);
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
441
388
82cb9368e3ff MemHash (OS X version)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 387
diff changeset
442 if (!hash) {
82cb9368e3ff MemHash (OS X version)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 387
diff changeset
443 hash = new MemHash();
82cb9368e3ff MemHash (OS X version)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 387
diff changeset
444 }
82cb9368e3ff MemHash (OS X version)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 387
diff changeset
445
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
446 for(int i = 0; i < count; i++) {
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
447 MemorySegment* next = (MemorySegment*)(mseg+seg_size*i);
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
448 char* data = (char*)next+head_size;
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
449 next->data = (void*)data;
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
450 next->size = size;
395
8c5fa57128cb chain on SPE
game@localhost.localdomain
parents: 391
diff changeset
451 next->address = (memaddr)next;
373
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
452 mlist->addLast(next);
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
453 }
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
454
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
455 return mlist;
eab18aa0c7f6 MemList not working
kazz@kazzone.cr.ie.u-ryukyu.ac.jp
parents: 356
diff changeset
456 }
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
457
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
458 /*!
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
459
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
460 Main Memory のSegmentを取得する
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
461
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
462 @param [addr] Main Memory のアドレス
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
463 @param [m] Mem List
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
464 @return allocate した領域のポインタ
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
465 memory directory にあるべきだが...
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
466
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
467 */
387
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 386
diff changeset
468 MemorySegment *
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
469 Scheduler::get_segment(memaddr addr, MemList *m)
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
470 {
449
4f11245e3504 get_segment fixed. and test_nogl rollback to 426. move!
kazz@henri.cr.ie.u-ryukyu.ac.jp
parents: 442
diff changeset
471 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
472 return get_segment(addr, m, s->size);
437
fd44dbd049aa overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
473 }
fd44dbd049aa overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
474
fd44dbd049aa overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
475 MemorySegment *
fd44dbd049aa overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
476 Scheduler::get_segment(memaddr addr, MemList *m, int size)
fd44dbd049aa overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
477 {
fd44dbd049aa overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
478 // memory segment のsizeをoverride する場合がある
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
479 MemorySegment *s = hash->get(addr);
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
480 if (s) {
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
481 /* 既に load されている */
439
95c0457a7d31 still overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 437
diff changeset
482 // 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
483 m->moveToFirst(s);
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
484 return s;
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
485 }
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
486
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
487 /* LRU なので、もっとも使われてない segment を上書きする */
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
488 s = m->getLast();
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
489 m->moveToFirst(s);
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
490
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
491 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
492 s->tag = get_tag();
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 386
diff changeset
493 dma_load(s->data, addr,
437
fd44dbd049aa overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 425
diff changeset
494 size, s->tag);
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
495 /* 前のをhashから削除 */
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
496 hash->remove(old_addr);
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
497 /* 新しいaddress を登録 */
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
498 s->address = addr;
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
499 hash->put(s->address, s);
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
500
439
95c0457a7d31 still overlay...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 437
diff changeset
501 // 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
502
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
503 return s;
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
421
cd77224d4224 Code load implementation... (not yet tested)
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 403
diff changeset
506
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
507 uint32
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
508 Scheduler::get_tag()
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
509 {
458
1c767b68d936 add ovly table tag modified
kono@localhost.localdomain
parents: 451
diff changeset
510 static int tag = 16;
1c767b68d936 add ovly table tag modified
kono@localhost.localdomain
parents: 451
diff changeset
511 tag ++;
1c767b68d936 add ovly table tag modified
kono@localhost.localdomain
parents: 451
diff changeset
512 tag &= 0x0f;
1c767b68d936 add ovly table tag modified
kono@localhost.localdomain
parents: 451
diff changeset
513 return tag+16;
386
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 /*!
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
517
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
518 Main Memory のSegmentを書き出す
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
519 Segment は get_segement されていて、
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 @param [addr] Main Memory のアドレス
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
524 @param [m] Mem List
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
525 @return allocate した領域のポインタ
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 */
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
528 void
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
529 Scheduler::put_segment(MemorySegment *s)
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
530 {
387
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 386
diff changeset
531 dma_store(s->data, s->address,
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
532 s->size, s->tag);
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
533 }
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
534
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
535 /*!
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 Main Memory のSegmentを読込、書き出しを待つ
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 @param [id] MemorySegment のid
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
540
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
541 */
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
542 void
387
5e2d30bfbf23 no compile error but not worked.
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 386
diff changeset
543 Scheduler::wait_segment(MemorySegment *s)
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
544 {
391
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 388
diff changeset
545 // えーと、dma してない時には、skip しないとだめなんじゃないの?
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 388
diff changeset
546
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 388
diff changeset
547 if (s->tag) dma_wait(s->tag);
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 388
diff changeset
548 s->tag = 0;
386
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
549 }
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
550
6113af8f183b MemHash...
Shinji KONO <kono@ie.u-ryukyu.ac.jp>
parents: 373
diff changeset
551 /* end */