changeset 483:0b933bef0328

renew task worked. but not test_nogl...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 05 Oct 2009 20:29:28 +0900
parents 25947fcfe880
children 8602bb323369
files TaskManager/kernel/ppe/TaskManagerImpl.cc TaskManager/kernel/ppe/TaskQueue.cc TaskManager/kernel/ppe/TaskQueue.h TaskManager/kernel/ppe/TaskQueueInfo.cc TaskManager/kernel/schedule/SchedTask.cc TaskManager/kernel/schedule/SchedTask.h TaskManager/kernel/schedule/SchedTaskList.cc TaskManager/kernel/schedule/Scheduler.cc TaskManager/kernel/schedule/TaskGroup.cc TaskManager/kernel/schedule/TaskGroup.h
diffstat 10 files changed, 219 insertions(+), 176 deletions(-) [+]
line wrap: on
line diff
--- a/TaskManager/kernel/ppe/TaskManagerImpl.cc	Mon Oct 05 16:52:45 2009 +0900
+++ b/TaskManager/kernel/ppe/TaskManagerImpl.cc	Mon Oct 05 20:29:28 2009 +0900
@@ -126,9 +126,9 @@
 	TaskQueueInfo *wait_i = htask->wait_i;
 	// 相手の wait queue から自分(を指しているTaskQueue)を削除
 	wait_i->remove(p->waiter);
-
 	// queue を free する
 	wait_i->free(p->waiter);
+
 	wait_i->free(p);
     }
 
--- a/TaskManager/kernel/ppe/TaskQueue.cc	Mon Oct 05 16:52:45 2009 +0900
+++ b/TaskManager/kernel/ppe/TaskQueue.cc	Mon Oct 05 20:29:28 2009 +0900
@@ -8,3 +8,22 @@
     waiter = NULL;
 }
 
+/*
+ *  こんなものは使いたくないが、renew task/task group が
+ *  が、あまりに ad-hoc で直し切れないので、とりあえず、
+ *  存続。TaskQueueInfo は SchedTask で使うにはでかすぎる。
+ */
+TaskQueuePtr
+TaskQueue::append(TaskQueuePtr list, TaskQueuePtr q)
+{
+    TaskQueuePtr p = list;
+
+    if (!p) {
+       return q;
+    } else {
+       while(p->next) p = p->next;
+       p->next = q;
+       return list;
+    }
+}
+
--- a/TaskManager/kernel/ppe/TaskQueue.h	Mon Oct 05 16:52:45 2009 +0900
+++ b/TaskManager/kernel/ppe/TaskQueue.h	Mon Oct 05 20:29:28 2009 +0900
@@ -14,6 +14,8 @@
     Task *task;
     TaskQueue *waiter;
 
+    static TaskQueue* append(TaskQueue* list, TaskQueue* q);
+
     TaskQueue *next;
     TaskQueue *prev;
 
--- a/TaskManager/kernel/ppe/TaskQueueInfo.cc	Mon Oct 05 16:52:45 2009 +0900
+++ b/TaskManager/kernel/ppe/TaskQueueInfo.cc	Mon Oct 05 20:29:28 2009 +0900
@@ -67,7 +67,7 @@
 void
 TaskQueueInfo::free(TaskQueuePtr q)
 {
-    if (!q) return;
+    // if (!q) return;
     q->next = freeTaskQueue;
     q->prev = NULL;
     freeTaskQueue = q;
@@ -140,7 +140,7 @@
 int
 TaskQueueInfo::remove(TaskQueue* e)
 {
-    if (!e) return 0;
+    // if (!e) return 0;
 
     e->prev->next = e->next;
     e->next->prev = e->prev;
--- a/TaskManager/kernel/schedule/SchedTask.cc	Mon Oct 05 16:52:45 2009 +0900
+++ b/TaskManager/kernel/schedule/SchedTask.cc	Mon Oct 05 20:29:28 2009 +0900
@@ -39,17 +39,17 @@
 
 SchedTask::SchedTask()
 {
-    __list        = NULL;
-    __task        = NULL;
-    __inListData  = NULL;
-    __outListData = NULL;
-    __readbuf     = NULL;
-    __writebuf    = NULL;
-    __scheduler   = NULL;
-    __taskGroup   = NULL;
-    __renew_flag  = 0;
-    __cur_index   = 0;
-    __flag_renewTask = SCHED_TASK_NORMAL;
+    list        = NULL;
+    task        = NULL;
+    inListData  = NULL;
+    outListData = NULL;
+    readbuf     = NULL;
+    writebuf    = NULL;
+    scheduler   = NULL;
+    taskGroup   = NULL;
+    renew_flag  = 0;
+    cur_index   = 0;
+    flag_renewTask = SCHED_TASK_NORMAL;
     this->stdout_ = stdout;
     this->stderr_ = stderr;
     this->stdin_ = stdin;
@@ -65,25 +65,25 @@
 /**
  * dma_store の wait を行う
  * このタスクが RenewTask だった場合、
- * __inListData や __outListData は
+ * inListData や outListData は
  * Scheduler の持つ、使い回しの buffer ではなく
  * 新たに allocate されたものなので、ここで free する
  */
 SchedTask::~SchedTask()
 {
-    if (__flag_renewTask == SCHED_TASK_RENEW) {
-        free(__inListData);
-        free(__outListData);
+    if (flag_renewTask == SCHED_TASK_RENEW) {
+        free(inListData);
+        free(outListData);
 
         /**
-         * __list != NULL の場合、
-         * この Task が __list の最後の Task になるので (SchedTask::next 参照)
-         * このタイミングで __list を解放する
+         * list != NULL の場合、
+         * この Task が list の最後の Task になるので (SchedTask::next 参照)
+         * このタイミングで list を解放する
          *   (free に渡されるアドレスが正しいものとなる)。
          * それ以外の Task では当然解放しない。
-         *  __list == NULL なので、free に渡しても無問題
+         *  list == NULL なので、free に渡しても無問題
          */
-        free(__list);
+        free(list);
     }
 
 
@@ -93,9 +93,9 @@
  * このタスクを Renew Task とし、それに応じた関数をセットする
  */
 void
-SchedTask::__setRenew()
+SchedTask::setRenew()
 {
-    __flag_renewTask = SCHED_TASK_RENEW;
+    flag_renewTask = SCHED_TASK_RENEW;
 
     ex_init   = &SchedTask::ex_init_renew;
     ex_read   = &SchedTask::ex_read_renew;
@@ -105,17 +105,17 @@
 }
 
 void
-SchedTask::__init__(TaskListPtr _list, TaskPtr _task, int index,
+SchedTask::init(TaskListPtr _list, TaskPtr _task, int index,
                     ListDataPtr rbuf, ListDataPtr wbuf, Scheduler* sc)
 {
-    __list        = _list;
-    __task        = _task;
-    __inListData  = rbuf;
-    __outListData = wbuf;
-    __scheduler   = sc;
-    __cur_index   = index;
+    list        = _list;
+    task        = _task;
+    inListData  = rbuf;
+    outListData = wbuf;
+    scheduler   = sc;
+    cur_index   = index;
 
-    __scheduler->mainMem_wait();
+    scheduler->mainMem_wait();
 
     (this->*ex_init)();
 }
@@ -126,17 +126,17 @@
 void
 SchedTask::ex_init_normal()
 {
-    __scheduler->dma_load(__inListData, (uint32)__task->inData,
+    scheduler->dma_load(inListData, (uint32)task->inData,
                           sizeof(ListData), DMA_READ_IN_LIST);
-    __scheduler->dma_load(__outListData, (uint32)__task->outData,
+    scheduler->dma_load(outListData, (uint32)task->outData,
                           sizeof(ListData), DMA_READ_OUT_LIST);
 #if defined(NO_PIPELINE)
-    __scheduler->dma_wait(DMA_READ_IN_LIST);
-    __scheduler->dma_wait(DMA_READ_OUT_LIST);
+    scheduler->dma_wait(DMA_READ_IN_LIST);
+    scheduler->dma_wait(DMA_READ_OUT_LIST);
 #endif
 
-    __taskGroup = new TaskGroup;
-    __taskGroup->command = __task->self;
+    taskGroup = new TaskGroup;
+    taskGroup->command = task->self;
 }
 
 /**
@@ -147,9 +147,9 @@
 void
 SchedTask::ex_init_renew()
 {
-    __inListData = __task->inData;
-    __outListData = __task->outData;
-    __taskGroup = (TaskGroupPtr)__task->self;
+    inListData = task->inData;
+    outListData = task->outData;
+    taskGroup = (TaskGroupPtr)task->self;
 }
 
 /**
@@ -167,21 +167,21 @@
     __debug("[SchedTask:%s]\n", __FUNCTION__);
 
 #if !defined(NO_PIPELINE)
-    __scheduler->dma_wait(DMA_READ_IN_LIST);
-    __scheduler->dma_wait(DMA_READ_OUT_LIST);
+    scheduler->dma_wait(DMA_READ_IN_LIST);
+    scheduler->dma_wait(DMA_READ_OUT_LIST);
 #endif
 
-    __writebuf = __scheduler->allocate(__outListData->size);
+    writebuf = scheduler->allocate(outListData->size);
 
     // 読むデータが一つもなければ無視
-    if (__inListData->length == 0) return;
+    if (inListData->length == 0) return;
 
     // load Input Data
-    __readbuf = __scheduler->allocate(__inListData->size);
-    __scheduler->dma_loadList(__inListData, __readbuf, DMA_READ);
+    readbuf = scheduler->allocate(inListData->size);
+    scheduler->dma_loadList(inListData, readbuf, DMA_READ);
 
 #if defined(NO_PIPELINE)
-    __scheduler->dma_wait(DMA_READ);
+    scheduler->dma_wait(DMA_READ);
 #endif
 
     (this->*ex_read)();
@@ -193,28 +193,28 @@
     __debug("[SchedTask:%s]\n", __FUNCTION__);
 
 #if !defined(NO_PIPELINE)
-    __scheduler->dma_wait(DMA_READ);
-    task_list[__task->command].wait(__scheduler,__task->command);
+    scheduler->dma_wait(DMA_READ);
+    task_list[task->command].wait(scheduler,task->command);
 #endif
 
-    task_list[__task->command].run(this, __readbuf, __writebuf);
+    task_list[task->command].run(this, readbuf, writebuf);
 
-    free(__readbuf);
+    free(readbuf);
 
-    if (__taskGroup->status() != 0) {
-        __task->self = __taskGroup->command;
-        delete __taskGroup;
-        __taskGroup = NULL;
+    if (taskGroup->status() != 0) {
+        task->self = taskGroup->command;
+        delete taskGroup;
+        taskGroup = NULL;
     }
 
 
     // 書き込む領域がなければ無視
-    if (__outListData->length > 0) {
-        __scheduler->dma_storeList(__outListData, __writebuf, DMA_WRITE);
+    if (outListData->length > 0) {
+        scheduler->dma_storeList(outListData, writebuf, DMA_WRITE);
 
 #if defined(NO_PIPELINE)
-        __scheduler->dma_wait(DMA_WRITE);
-        free(__writebuf);
+        scheduler->dma_wait(DMA_WRITE);
+        free(writebuf);
 #endif
     }
 
@@ -227,11 +227,11 @@
     __debug("[SchedTask:%s]\n", __FUNCTION__);
 
 #if !defined(NO_PIPELINE)
-    __scheduler->dma_wait(DMA_WRITE);
-    free(__writebuf);
+    scheduler->dma_wait(DMA_WRITE);
+    free(writebuf);
 #endif
 
-    if (__task->self == MY_SPE_NOP) return;
+    if (task->self == MY_SPE_NOP) return;
 
     (this->*ex_write)();
 }
@@ -284,8 +284,8 @@
      * このタスク内で新たにタスクが生成されなかった
      * or 生成されたが、そのタスクの終了を待つ必要は無い
      */
-    if (__renew_flag == 0) {
-        __scheduler->mail_write(__task->self);
+    if (renew_flag == 0) {
+        scheduler->mail_write(task->self);
     }
 }
 
@@ -306,13 +306,13 @@
 {
     uint32 cmd;
 
-    __taskGroup->remove(__task);
-    cmd = __taskGroup->status();
+    taskGroup->remove(task);
+    cmd = taskGroup->status();
 
     // タスク内で作られた全てのタスクが終了した
     if (cmd != 0) {
-        delete __taskGroup;
-        __scheduler->mail_write(cmd);
+        delete taskGroup;
+        scheduler->mail_write(cmd);
     }
 }
 
@@ -329,36 +329,36 @@
 SchedTaskBase*
 SchedTask::ex_next_normal()
 {
-    if (__cur_index < __list->length) {
+    if (cur_index < list->length) {
         SchedTaskBase *nextSched;
 
-        nextSched = __scheduler->get_nextRenewTaskList();
+        nextSched = scheduler->get_nextRenewTaskList();
 
         // RenewTask がある
         if (nextSched) {
-            __scheduler->set_backupTaskList(__list);
-            __scheduler->set_backupTaskListIndex(__cur_index);
+            scheduler->set_backupTaskList(list);
+            scheduler->set_backupTaskListIndex(cur_index);
             return nextSched;
         } else {
-            TaskPtr nextTask = &__list->tasks[__cur_index++];
-	    if (__cur_index < __list->length) {
+            TaskPtr nextTask = &list->tasks[cur_index++];
+	    if (cur_index < list->length) {
 		// load next task
-		loadSchedTask(__scheduler, &__list->tasks[__cur_index]);
+		loadSchedTask(scheduler, &list->tasks[cur_index]);
 	    }
-            nextSched = createSchedTask(__scheduler, nextTask);
-            ((SchedTask*)nextSched)->__init__(__list, nextTask, __cur_index,
-                                              __scheduler->get_curReadBuf(),
-                                              __scheduler->get_curWriteBuf(),
-                                              __scheduler);
+            nextSched = createSchedTask(scheduler, nextTask);
+            ((SchedTask*)nextSched)->init(list, nextTask, cur_index,
+                                              scheduler->get_curReadBuf(),
+                                              scheduler->get_curWriteBuf(),
+                                              scheduler);
             return nextSched;
         }
     } else {
-        uint32 nextList = (uint32)__list->next;
+        uint32 nextList = (uint32)list->next;
 
         if (nextList == 0) {
-            return new SchedNop2Ready(__scheduler);
+            return new SchedNop2Ready(scheduler);
         } else {
-            return createSchedTaskList(nextList, __scheduler,
+            return createSchedTaskList(nextList, scheduler,
                                        SCHED_TASKLIST_NORMAL);
         }
     }
@@ -373,54 +373,54 @@
     TaskPtr nextTask;
     SchedTask *nextSched;
 
-    if (__cur_index < __list->length) {
-        nextTask = &__list->tasks[__cur_index++];
-	if (__cur_index < __list->length) {
+    if (cur_index < list->length) {
+        nextTask = &list->tasks[cur_index++];
+	if (cur_index < list->length) {
 	    // load next task
-	    loadSchedTask(__scheduler, &__list->tasks[__cur_index]);
+	    loadSchedTask(scheduler, &list->tasks[cur_index]);
 	}
-        nextSched = createSchedTask(__scheduler, nextTask);
+        nextSched = createSchedTask(scheduler, nextTask);
 
         // RenewTaskList を実行中なので
-        nextSched->__setRenew();
-        nextSched->__init__(__list, nextTask, __cur_index,
-                            __scheduler->get_curReadBuf(),
-                            __scheduler->get_curWriteBuf(),
-                            __scheduler);
+        nextSched->setRenew();
+        nextSched->init(list, nextTask, cur_index,
+                            scheduler->get_curReadBuf(),
+                            scheduler->get_curWriteBuf(),
+                            scheduler);
 
         /**
          * この理由は SchedTask:~SchedTask() で
          */
-        __list = NULL;
+        list = NULL;
         return nextSched;
     } else {
         SchedTaskBase *nextList;
 
-        nextList = __scheduler->get_nextRenewTaskList();
+        nextList = scheduler->get_nextRenewTaskList();
 
         if (nextList) {
             return nextList;
         } else {
-            TaskListPtr nextList = __scheduler->get_backupTaskList();
+            TaskListPtr nextList = scheduler->get_backupTaskList();
 
             // 中断した TaskList がある
             if (nextList) {
-                __cur_index = __scheduler->get_backupTaskListIndex();
+                cur_index = scheduler->get_backupTaskListIndex();
 
-                nextTask = &nextList->tasks[__cur_index++];
-		if (__cur_index < __list->length) {
+                nextTask = &nextList->tasks[cur_index++];
+		if (cur_index < list->length) {
 		    // load next task
-		    loadSchedTask(__scheduler, &__list->tasks[__cur_index]);
+		    loadSchedTask(scheduler, &list->tasks[cur_index]);
 		}
-                nextSched = createSchedTask(__scheduler, nextTask);
+                nextSched = createSchedTask(scheduler, nextTask);
 
-                nextSched->__init__(nextList, nextTask, __cur_index,
-                                    __scheduler->get_curReadBuf(),
-                                    __scheduler->get_curWriteBuf(),
-                                    __scheduler);
+                nextSched->init(nextList, nextTask, cur_index,
+                                    scheduler->get_curReadBuf(),
+                                    scheduler->get_curWriteBuf(),
+                                    scheduler);
                 return nextSched;
             } else {
-                return new SchedNop2Ready(__scheduler);
+                return new SchedNop2Ready(scheduler);
             }
         }
     }
@@ -429,7 +429,7 @@
 int
 SchedTask::get_cpuid()
 {
-    return __scheduler->id;
+    return scheduler->id;
 }
 
 /**
@@ -440,7 +440,7 @@
 SchedTask::get_input(void *buff, int index)
 {
     if (buff != NULL) {
-        return (void*)((int)buff + __inListData->bound[index]);
+        return (void*)((int)buff + inListData->bound[index]);
     } else {
         return NULL;
     }
@@ -452,7 +452,7 @@
 uint32
 SchedTask::get_inputAddr(int index)
 {
-    return __inListData->element[index].addr;
+    return inListData->element[index].addr;
 }
 
 /**
@@ -461,7 +461,7 @@
 int
 SchedTask::get_inputSize(int index)
 {
-    return __inListData->element[index].size;
+    return inListData->element[index].size;
 }
 
 /**
@@ -471,7 +471,7 @@
 SchedTask::get_output(void *buff, int index)
 {
     if (buff != NULL) {
-        return (void*)((int)buff + __outListData->bound[index]);
+        return (void*)((int)buff + outListData->bound[index]);
     } else {
         return NULL;
     }
@@ -483,7 +483,7 @@
 uint32
 SchedTask::get_outputAddr(int index)
 {
-    return __outListData->element[index].addr;
+    return outListData->element[index].addr;
 }
 
 /**
@@ -492,24 +492,24 @@
 int
 SchedTask::get_outputSize(int index)
 {
-    return __outListData->element[index].size;
+    return outListData->element[index].size;
 }
 
 int
 SchedTask::get_param(int index)
 {
-    return __task->param[index];
+    return task->param[index];
 }
 
 TaskPtr
 SchedTask::create_task(int cmd)
 {
-    TaskListPtr taskList = __scheduler->get_renewListBuf();
+    TaskListPtr taskList = scheduler->get_renewListBuf();
     TaskPtr p = &taskList->tasks[taskList->length++];
     p->command = cmd;
 
-    p->inData = (ListData*)__scheduler->allocate(sizeof(ListData));
-    p->outData = (ListData*)__scheduler->allocate(sizeof(ListData));
+    p->inData = (ListData*)scheduler->allocate(sizeof(ListData));
+    p->outData = (ListData*)scheduler->allocate(sizeof(ListData));
 
     p->inData->clear();
     p->outData->clear();
@@ -521,97 +521,95 @@
 }
 
 /**
- * 生成したタスクが終了してから、メインスケジューラ(PPE) に
- * タスクが終了した旨を知らせる。
  *
- * @param[in] waitTask タスク内で生成したタスク
+ * @param[in] waitTask タスク内で生成したタスクの登録(spawn()に相当)
  */
 void
 SchedTask::wait_task(TaskPtr waitTask)
 {
-    waitTask->self = (uint32)__taskGroup;
+    waitTask->self = (uint32)taskGroup;
 
-    __scheduler->add_groupTask(__taskGroup, waitTask);
+    scheduler->add_groupTask(taskGroup, waitTask);
 
-    __renew_flag++;
+    renew_flag++;
 }
 
 void*
 SchedTask::global_alloc(int id, int size) {
-    return __scheduler->global_alloc(id, size);
+    return scheduler->global_alloc(id, size);
 }
 
 void*
 SchedTask::global_get(int id) {
-    return __scheduler->global_get(id);
+    return scheduler->global_get(id);
 }
 
 void
 SchedTask::global_set(int id, void *addr) {
-    __scheduler->global_set(id, addr);
+    scheduler->global_set(id, addr);
 }
 
 void
 SchedTask::global_free(int id) {
-    __scheduler->global_free(id);
+    scheduler->global_free(id);
 }
 
 MemList*
 SchedTask::createMemList(int size, int count) {
-    return __scheduler->createMemList(size, count);
+    return scheduler->createMemList(size, count);
 }
 
 void
 SchedTask::mainMem_alloc(int id, int size) {
-    __scheduler->mainMem_alloc(id, size);
+    scheduler->mainMem_alloc(id, size);
 }
 
 void
 SchedTask::mainMem_wait() {
-    __scheduler->mainMem_wait();
+    scheduler->mainMem_wait();
 }
 
 void*
 SchedTask::mainMem_get(int id) {
-    return __scheduler->mainMem_get(id);
+    return scheduler->mainMem_get(id);
 }
 
 void*
 SchedTask::allocate(int size) {
-    return __scheduler->allocate(size);
+    return scheduler->allocate(size);
 }
 
 
 void
 SchedTask::dma_load(void *buf, uint32 addr, uint32 size, uint32 mask) {
-    __scheduler->dma_load(buf, addr, size, mask);
+    scheduler->dma_load(buf, addr, size, mask);
 }
 
 void
 SchedTask::dma_store(void *buf,uint32 addr, uint32 size, uint32 mask) {
-    __scheduler->dma_store(buf, addr, size, mask);
+    scheduler->dma_store(buf, addr, size, mask);
 }
 
 void
 SchedTask::dma_wait(uint32 mask) {
-    __scheduler->dma_wait(mask);
+    scheduler->dma_wait(mask);
 }
 
 void
 SchedTask::show_dma_wait() {
-    __scheduler->show_dma_wait();
+    scheduler->show_dma_wait();
 }
 
 MemorySegment * SchedTask::get_segment(memaddr addr, MemList *m) {
-    return __scheduler->get_segment(addr,m);
+    return scheduler->get_segment(addr,m);
 }
 
 void SchedTask::put_segment(MemorySegment *s) {
-    __scheduler->put_segment(s);
+    scheduler->put_segment(s);
 }
 
 void SchedTask::wait_segment(MemorySegment *s) {
-    __scheduler->wait_segment(s);
+    scheduler->wait_segment(s);
 }
 
 /* system call */
--- a/TaskManager/kernel/schedule/SchedTask.h	Mon Oct 05 16:52:45 2009 +0900
+++ b/TaskManager/kernel/schedule/SchedTask.h	Mon Oct 05 20:29:28 2009 +0900
@@ -22,15 +22,15 @@
     /* variables */
 
     // Task を実行するスケジューラ自身
-    Scheduler *__scheduler;
+    Scheduler *scheduler;
     
     // 現在スケジューラが実行している TaskList と、このタスクに対応する Task
-    TaskListPtr __list;
-    TaskPtr __task;
+    TaskListPtr list;
+    TaskPtr task;
 
     // read/write 用の ListData
-    ListDataPtr __inListData;
-    ListDataPtr __outListData;
+    ListDataPtr inListData;
+    ListDataPtr outListData;
 
     /**
      * read データ、write 用のバッファ
@@ -38,24 +38,24 @@
      * writebuf にデータを描き込んでおくと、
      * タスク登録時に設定した出力先に書き込む
      */
-    void *__readbuf;
-    void *__writebuf;
+    void *readbuf;
+    void *writebuf;
 
     // Task の、Tasklist での位置。(task = &list[cur_index-1])
-    int __cur_index;
+    int cur_index;
 
     // タスク内で生成されたタスクのグループ
-    TaskGroup *__taskGroup;
+    TaskGroup *taskGroup;
 
     // このタスク内で生成されたタスクの数
-    int __renew_flag;
+    int renew_flag;
 
     // このタスクが SPE 内で生成されたタスクか否か 1: Yes, 0: No
-    int __flag_renewTask;
+    int flag_renewTask;
 
     // タスクがメインメモリ側で生成されたものか、
     // SPE で生成されたものかによって、データの扱いが変わってくる。
-    // そのために if (__flag_renewTask) を連発するのはよくないので
+    // そのために if (flag_renewTask) を連発するのはよくないので
     // 関数ポインタで持っておく
     void (SchedTask::*ex_init)();
     void (SchedTask::*ex_read)();
@@ -78,7 +78,7 @@
 
     /**
      * PPE で生成されたタスクに対する
-     * __init__, read,exec,write,next の付属(?)処理
+     * init, read,exec,write,next の付属(?)処理
      */
     void ex_init_normal();
     void ex_read_normal();
@@ -88,7 +88,7 @@
 
     /**
      * SPE で生成されたタスクに対する
-     * __inti__, ead,exec,write,next の付属(?)処理
+     * inti, ead,exec,write,next の付属(?)処理
      */
     void ex_init_renew();
     void ex_read_renew();
@@ -99,8 +99,8 @@
 public:
     /* functions */
 
-    void __setRenew();
-    void __init__(TaskListPtr _list, TaskPtr _task, int index,
+    void setRenew();
+    void init(TaskListPtr _list, TaskPtr _task, int index,
                   ListDataPtr rbuf, ListDataPtr wbuf, Scheduler* sc);
 
     //---  User API ---
@@ -136,7 +136,7 @@
 
     void *allocate(int size);
     void free_(void *p) {
-	__scheduler->free_(p);
+	scheduler->free_(p);
     }
 
     void dma_load(void *buf, uint32 addr, uint32 size, uint32 mask);
@@ -149,11 +149,11 @@
      */
 
     void* get_input(int index) {
-      return get_input(__readbuf, index);
+      return get_input(readbuf, index);
     }
 
     void* get_output(int index) {
-      return get_output(__writebuf, index);
+      return get_output(writebuf, index);
     }
 
     /* system call */
--- a/TaskManager/kernel/schedule/SchedTaskList.cc	Mon Oct 05 16:52:45 2009 +0900
+++ b/TaskManager/kernel/schedule/SchedTaskList.cc	Mon Oct 05 20:29:28 2009 +0900
@@ -77,10 +77,10 @@
 	nextSched = createSchedTask(scheduler, nextTask);
 
 	if (flag_renewTaskList == SCHED_TASKLIST_RENEW) {
-	    ((SchedTask*)nextSched)->__setRenew();
+	    ((SchedTask*)nextSched)->setRenew();
 	}
 	
-	((SchedTask*)nextSched)->__init__(list, nextTask, 1,
+	((SchedTask*)nextSched)->init(list, nextTask, 1,
 					  scheduler->get_curReadBuf(),
 					  scheduler->get_curWriteBuf(),
 					  scheduler);
--- a/TaskManager/kernel/schedule/Scheduler.cc	Mon Oct 05 16:52:45 2009 +0900
+++ b/TaskManager/kernel/schedule/Scheduler.cc	Mon Oct 05 20:29:28 2009 +0900
@@ -50,6 +50,7 @@
     taskGroup = new TaskGroup;
     renewTop_taskList = NULL;
     renewCur_taskList = NULL;
+    bak_curTaskList = NULL;
 }
 
 void
--- a/TaskManager/kernel/schedule/TaskGroup.cc	Mon Oct 05 16:52:45 2009 +0900
+++ b/TaskManager/kernel/schedule/TaskGroup.cc	Mon Oct 05 20:29:28 2009 +0900
@@ -3,15 +3,30 @@
 void
 TaskGroup::add(TaskPtr add_task) {
     TaskQueuePtr q = new TaskQueue(add_task);
-    group->addLast(q);
+    group = TaskQueue::append(group, q);
 }
 
 void
 TaskGroup::remove(TaskPtr delete_task) {
-    // Task は TaskQueue を知らないので探し出す必要がある (HTask は知っている)
-    TaskQueue *p = group->find(delete_task);
-    group->remove(p);
-    group->free(p);
+    TaskQueuePtr p = group;
+    TaskQueuePtr p1;
+
+    if (p == NULL) return;
+
+    if (p->task == delete_task) {
+	group = group->next;
+	delete p;
+    } else {
+	p1 = p->next;
+	while (p1 && p1->task != delete_task) {
+	    p1 = p1->next;
+	    p = p->next;
+	}
+	if (p1) {
+	    p->next = p1->next;
+	    delete p1;
+	}
+    }
 }
 
 /**
@@ -21,12 +36,20 @@
  * command を返す。
  */
 unsigned int
-TaskGroup::status() {
+TaskGroup::status(void) {
     /**                                                                     
      * bool の                                                              
      *  true == 1;                                                          
      *  false == 0;                                                         
      * って保証されてるんだっけ?                                           
      */
-    return (group->empty()) * command;
+#if 1
+    return (group == NULL) * command;
+#else
+    if (group.empty()) {
+	return command;
+    } else {
+	return 0;
+    }
+#endif
 }
--- a/TaskManager/kernel/schedule/TaskGroup.h	Mon Oct 05 16:52:45 2009 +0900
+++ b/TaskManager/kernel/schedule/TaskGroup.h	Mon Oct 05 20:29:28 2009 +0900
@@ -2,20 +2,20 @@
 #define INCLUDED_TASK_GROUP
 
 #include "base.h"
-#include "TaskQueueInfo.h"
+#include "Task.h"
+#include "TaskQueue.h"
 
 class TaskGroup {
 public:
+    TaskGroup(): group(NULL) {}
 
     BASE_NEW_DELETE(TaskGroup);
 
-    unsigned int command;
-    TaskQueueInfo *group;
+    // この command を引き渡すだけのためのオブジェクトらしい
 
-    TaskGroup(): group() {
-	group = new TaskQueueInfo();
-    }
- 
+    unsigned int command;
+    TaskQueue *group;
+
     /**
      * 待つ Task を追加
      */