Mercurial > hg > Game > Cerium
changeset 1467:d585a7614cd5 draft
look like working now.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 15 Jul 2012 17:33:50 +0900 |
parents | cb57420a8219 |
children | 840dee241530 |
files | TaskManager/kernel/ppe/HTask.cc TaskManager/kernel/schedule/SchedExit.h TaskManager/kernel/schedule/SchedMail.h TaskManager/kernel/schedule/SchedNop.h TaskManager/kernel/schedule/SchedNop2Ready.h TaskManager/kernel/schedule/SchedTask.cc TaskManager/kernel/schedule/SchedTask.h TaskManager/kernel/schedule/SchedTaskBase.h TaskManager/kernel/schedule/SchedTaskList.cc TaskManager/kernel/schedule/SchedTaskList.h |
diffstat | 10 files changed, 34 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/kernel/ppe/HTask.cc Sun Jul 15 13:36:55 2012 +0900 +++ b/TaskManager/kernel/ppe/HTask.cc Sun Jul 15 17:33:50 2012 +0900 @@ -91,6 +91,7 @@ bzero(tl->tasks,sizeof(Task)*TASK_MAX_SIZE); Task *task = tl->tasks; task->init(id, num_param,num_inData,num_outData); + last = task->next(); return task; // first task } @@ -137,7 +138,6 @@ rbuf = (memaddr)tl; } next->init(id, param_count, inData_count, outData_count); - last = next->next(); return next; }
--- a/TaskManager/kernel/schedule/SchedExit.h Sun Jul 15 13:36:55 2012 +0900 +++ b/TaskManager/kernel/schedule/SchedExit.h Sun Jul 15 17:33:50 2012 +0900 @@ -11,6 +11,7 @@ BASE_NEW_DELETE(SchedExit); /* functions */ SchedTaskBase* next(Scheduler *, SchedTaskBase *); + const char * name() { return "Exit" ; }; };
--- a/TaskManager/kernel/schedule/SchedMail.h Sun Jul 15 13:36:55 2012 +0900 +++ b/TaskManager/kernel/schedule/SchedMail.h Sun Jul 15 17:33:50 2012 +0900 @@ -7,13 +7,15 @@ #include "error.h" -class SchedMail : public SchedTaskBase{ +class SchedMail : public SchedTaskBase { public: /* constructor */ BASE_NEW_DELETE(SchedMail); /* functions */ SchedTaskBase* next(Scheduler *, SchedTaskBase *); + const char * name() { return "Mail" ; }; + };
--- a/TaskManager/kernel/schedule/SchedNop.h Sun Jul 15 13:36:55 2012 +0900 +++ b/TaskManager/kernel/schedule/SchedNop.h Sun Jul 15 17:33:50 2012 +0900 @@ -13,6 +13,8 @@ /* functions */ SchedTaskBase* next(Scheduler *, SchedTaskBase *); + const char * name() { return "Nop" ; }; + }; #endif
--- a/TaskManager/kernel/schedule/SchedNop2Ready.h Sun Jul 15 13:36:55 2012 +0900 +++ b/TaskManager/kernel/schedule/SchedNop2Ready.h Sun Jul 15 17:33:50 2012 +0900 @@ -22,6 +22,8 @@ void exec(void); void write(void); SchedTaskBase* next(Scheduler *, SchedTaskBase *); + const char * name() { return "Nop2" ; }; + #if DEBUG void read(void) { __debug("[SchedNop2Ready:%s]\n", __FUNCTION__); }
--- a/TaskManager/kernel/schedule/SchedTask.cc Sun Jul 15 13:36:55 2012 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.cc Sun Jul 15 17:33:50 2012 +0900 @@ -13,8 +13,6 @@ extern TaskObject task_list[MAX_TASK_OBJECT]; -static int dummy[1]; - SchedTask::SchedTask() { list = NULL; @@ -23,6 +21,7 @@ writebuf = NULL; scheduler = NULL; cur_index = 0; + din[0] = dout[0] = 0; this->stdout_ = stdout; this->stderr_ = stderr; this->stdin_ = stdin; @@ -44,11 +43,11 @@ manager = sc->manager; connector = sc->connector; - inListData.bound = dummy; + inListData.bound = din; inListData.size = 0; inListData.length = 0; inListData.element = 0; - outListData.bound = dummy; + outListData.bound = dout; outListData.size = 0; outListData.length = 0; outListData.element = 0; @@ -98,7 +97,7 @@ outListData.size = atask->outData_total_size(); // atask->outData_offset += cur_index + 1 ; // to avoid compiler bug outListData.element = atask->outData(0); - free(outListData.bound); + // if (outListData.bound!=dout) free(outListData.bound); outListData.bound = (int*)manager->allocate(outListData.length*sizeof(int)); connector->bound(&outListData); writebuf = connector->get_writebuf(scheduler, (memaddr)outListData.element[0].addr, outListData.size); @@ -113,7 +112,8 @@ setup_outputData(); // we need write buffer before run() } connector->dma_wait((DMA_READ + this->tag)); - run(this, get_input(readbuf, 0), get_output(writebuf, 0)); + void *read = get_input(readbuf, 0); void *write = get_output(writebuf, 0); + run(this, read,write); connector->free_(readbuf); // User 側で作る方法が必要... // 書き込む領域がなければ無視 @@ -130,8 +130,8 @@ connector->dma_wait(DMA_WRITE); connector->free_(writebuf); - free(inListData.bound); - free(outListData.bound); + if (inListData.bound != din) free(inListData.bound); + if (outListData.bound != dout) free(outListData.bound); #ifdef TASK_LIST_MAIL if ((cur_index->next() >= list->last()) ) connector->mail_write(waiter); @@ -145,10 +145,16 @@ { __debug("[SchedTask:%s]\n", __FUNCTION__); - if (cur_index->next() < list->last()) { + if (cur_index == 0) { // 最初の一つ + SchedTask *nextSched = new SchedTask(); + nextSched->init(list, &list->tasks[0], scheduler, this->tag^1); + return nextSched; + } + TaskPtr nextTask = cur_index->next(); + if (nextTask < list->last()) { // Task List が残っているので、次を準備 - TaskPtr nextTask = cur_index = cur_index->next(); + TaskPtr nextTask = cur_index->next(); SchedTask *nextSched = new SchedTask(); nextSched->init(list, nextTask, scheduler, this->tag^1);
--- a/TaskManager/kernel/schedule/SchedTask.h Sun Jul 15 13:36:55 2012 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.h Sun Jul 15 17:33:50 2012 +0900 @@ -26,6 +26,8 @@ void exec(); void write(); SchedTaskBase* next(Scheduler *, SchedTaskBase *); + const char * name() { return "SchedTask" ; }; + // タスクの処理は、task_list に登録された C の関数によっておこなう
--- a/TaskManager/kernel/schedule/SchedTaskBase.h Sun Jul 15 13:36:55 2012 +0900 +++ b/TaskManager/kernel/schedule/SchedTaskBase.h Sun Jul 15 17:33:50 2012 +0900 @@ -30,6 +30,7 @@ virtual SchedTaskBase* next(Scheduler *, SchedTaskBase*) {return 0;} virtual void setup_outputData() {}; + virtual const char * name() { return "Base" ; }; /* functions */ virtual void* get_output(void *buff, int index) { return 0; } @@ -107,6 +108,9 @@ void *readbuf; void *writebuf; + int din[1]; + int dout[1]; + /* system call */ FILE *stdout_;
--- a/TaskManager/kernel/schedule/SchedTaskList.cc Sun Jul 15 13:36:55 2012 +0900 +++ b/TaskManager/kernel/schedule/SchedTaskList.cc Sun Jul 15 17:33:50 2012 +0900 @@ -27,7 +27,7 @@ connector = scheduler->connector; list = (TaskListPtr)connector->dma_load1(list, params_addr, sizeof(TaskList), DMA_READ_TASKLIST); - cur_index = list->tasks; + cur_index = 0; this->tag = tag; @@ -52,12 +52,5 @@ { } -/** - * next は、SchedTask のものが使われる。 - * それで正しく動くはず。 - * - * next() が呼ばれた時点で、TaskList のloadが終了しているように工夫する。 - * - */ /* end */