Mercurial > hg > Game > Cerium
changeset 439:13c6740ab15f draft
still overlay...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 25 Sep 2009 00:46:50 +0900 |
parents | b7c226fdea2d |
children | a1c670e29cde |
files | TaskManager/kernel/schedule/SchedTask.cc TaskManager/kernel/schedule/SchedTaskList.cc TaskManager/kernel/schedule/Scheduler.cc TaskManager/kernel/schedule/Scheduler.h example/get_segment/spe/Hello.cc example/get_segment/spe/Hello1.cc example/get_segment/spe/Makefile example/get_segment/spe/spe-main.cc |
diffstat | 8 files changed, 42 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/kernel/schedule/SchedTask.cc Thu Sep 24 22:41:41 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.cc Fri Sep 25 00:46:50 2009 +0900 @@ -16,6 +16,7 @@ code loading ならば、loading の終了を待つ */ + SchedTask * createSchedTask(Scheduler *scheduler, TaskPtr task) { @@ -32,6 +33,7 @@ void loadSchedTask(Scheduler *scheduler,TaskPtr task) { +// fprintf(stderr,"loadSchedTask %d\n",task->command); task_list[task->command].load(scheduler,task->command); } @@ -374,6 +376,10 @@ if (__cur_index < __list->length) { nextTask = &__list->tasks[__cur_index++]; + if (__cur_index < __list->length) { + // load next task + loadSchedTask(__scheduler, &__list->tasks[__cur_index]); + } nextSched = createSchedTask(__scheduler, nextTask); // RenewTaskList を実行中なので @@ -403,6 +409,10 @@ __cur_index = __scheduler->get_backupTaskListIndex(); nextTask = &nextList->tasks[__cur_index++]; + if (__cur_index < __list->length) { + // load next task + loadSchedTask(__scheduler, &__list->tasks[__cur_index]); + } nextSched = createSchedTask(__scheduler, nextTask); nextSched->__init__(nextList, nextTask, __cur_index,
--- a/TaskManager/kernel/schedule/SchedTaskList.cc Thu Sep 24 22:41:41 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTaskList.cc Fri Sep 25 00:46:50 2009 +0900 @@ -69,6 +69,11 @@ TaskPtr nextTask = &list->tasks[0]; // code load を開始する。 loadSchedTask(scheduler, nextTask); + if (1 < list->length) { + // 次のもloadしておく + // load next task + loadSchedTask(scheduler, &list->tasks[1]); + } nextSched = createSchedTask(scheduler, nextTask); if (flag_renewTaskList == SCHED_TASKLIST_RENEW) {
--- a/TaskManager/kernel/schedule/Scheduler.cc Thu Sep 24 22:41:41 2009 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.cc Fri Sep 25 00:46:50 2009 +0900 @@ -362,7 +362,10 @@ (TaskObjectCreator)( (char*)task_list[task_id].segment->data + task_list[task_id].entry_offset); - task_list[task_id].creator = creator; + // task_list[task_id].creator = creator; + fprintf(stderr,"wait load task id %d done. creator = 0x%x entry_offset = 0x%x\n",task_id, + (unsigned int)creator, + task_list[task_id].entry_offset); } static void @@ -380,14 +383,20 @@ extern void register_dynamic_task(int cmd, - memaddr start, memaddr end, int entry_offset) + memaddr start, memaddr end, + TaskObjectCreator creator, int entry_offset) { - task_list[cmd].creator = 0; + task_list[cmd].creator = creator; task_list[cmd].location = start; task_list[cmd].end = end; task_list[cmd].entry_offset = entry_offset; task_list[cmd].load = load_task; task_list[cmd].wait = wait_load; +fprintf(stderr,"cmd = %d\n",cmd); +fprintf(stderr,"locatation = 0x%llx\n",start); +fprintf(stderr,"end = 0x%llx\n",end); +fprintf(stderr,"entry = 0x%x\n",entry_offset); + } @@ -447,6 +456,7 @@ MemorySegment *s = hash->get(addr); if (s) { /* 既に load されている */ +// fprintf(stderr,"get_segement loaded %llx 0x%x size 0x%d\n",addr,s->data,size); m->moveToFirst(s); return s; } @@ -465,6 +475,8 @@ s->address = addr; hash->put(s->address, s); +// fprintf(stderr,"get_segement %llx 0x%x size 0x%d\n",addr, s->data,size); + return s; }
--- a/TaskManager/kernel/schedule/Scheduler.h Thu Sep 24 22:41:41 2009 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.h Fri Sep 25 00:46:50 2009 +0900 @@ -173,7 +173,8 @@ extern void register_task(int cmd, TaskObjectCreator creator); extern void register_dynamic_task(int cmd, - memaddr start, memaddr end, int entry_offset); + memaddr start, memaddr end, TaskObjectCreator creator, + int entry_offset); #endif @@ -208,7 +209,7 @@ extern SchedTask* createTask_##str(Scheduler *manager); \ extern unsigned long long _EAR_; #else -#define SchedExternDynamicTask(str,segment) SchedExternTask(str,segment) +#define SchedExternDynamicTask(str,segment) SchedExternTask(str) #endif @@ -216,7 +217,8 @@ #define SchedRegisterDynamicTask(cmd, str, segment) \ register_dynamic_task(cmd, _EAR_+(memaddr)__load_start_##segment, \ _EAR_+(memaddr)__load_stop_##segment,\ - ((char *)createTask_##str)-(char *)spe_load_entry); + createTask_##str, \ + ((char *)createTask_##str)-(char *)spe_load_entry); #else #define SchedRegisterDynamicTask(cmd, str, segment) SchedRegisterTask(cmd, str) #endif
--- a/example/get_segment/spe/Hello.cc Thu Sep 24 22:41:41 2009 +0900 +++ b/example/get_segment/spe/Hello.cc Fri Sep 25 00:46:50 2009 +0900 @@ -3,18 +3,15 @@ #include "Func.h" /* これは必須 */ -#if OVLY SchedDefineDynamicTask(Hello,segment1); -#else -SchedDefineTask(Hello); -#endif int Hello::run(SchedTask *smanager, void *rbuf, void *wbuf) { int task_id = get_param(0); - printf("[%d] Hello, World!! Seg1 \n", task_id); + fprintf(stderr,"[%d] Hello, World!! Seg1 \n", task_id); + fprintf(stderr,"0x%0x\n", (unsigned int)&createTask_Hello); return 0; }
--- a/example/get_segment/spe/Hello1.cc Thu Sep 24 22:41:41 2009 +0900 +++ b/example/get_segment/spe/Hello1.cc Fri Sep 25 00:46:50 2009 +0900 @@ -3,18 +3,15 @@ #include "Func.h" /* これは必須 */ -#if OVLY SchedDefineDynamicTask(Hello1,segment2); -#else -SchedDefineTask(Hello1); -#endif int Hello1::run(SchedTask *smanager, void *rbuf, void *wbuf) { int task_id = get_param(0); - printf("[%d] Hello, World Seg 2!!\n", task_id); + fprintf(stderr,"[%d] Hello, World Seg 2!!\n", task_id); + fprintf(stderr,"0x%0x\n", (unsigned int)&createTask_Hello1); return 0; }
--- a/example/get_segment/spe/Makefile Thu Sep 24 22:41:41 2009 +0900 +++ b/example/get_segment/spe/Makefile Fri Sep 25 00:46:50 2009 +0900 @@ -9,7 +9,9 @@ CC = spu-g++ INCLUDE = -I../${CERIUM}/include/TaskManager -I. -I.. -CFLAGS = -DOVLY=1 $(INCLUDE) -O0 -g -Wall -fno-exceptions -fno-rtti#-DDEBUG +CFLAGS = $(INCLUDE) -O2 -g -Wall -fno-exceptions -fno-rtti#-DDEBUG +# CFLAGS = -DNO_OVERLAY=1 $(CFLAGS) + LIBS = -L../${CERIUM}/TaskManager -lspemanager -Wl,--gc-sections SPELIBS = -Wl,-T,$(LDSCRIPT) -Wl,-N $(LIBS)
--- a/example/get_segment/spe/spe-main.cc Thu Sep 24 22:41:41 2009 +0900 +++ b/example/get_segment/spe/spe-main.cc Fri Sep 25 00:46:50 2009 +0900 @@ -2,13 +2,8 @@ #include "Scheduler.h" #include "LoadEntry.h" -#if OVLY SchedExternDynamicTask(Hello,segment1); SchedExternDynamicTask(Hello1,segment2); -#else -SchedExternTask(Hello); -SchedExternTask(Hello1); -#endif /** * この関数は SpeScheduler から呼ばれるので @@ -17,12 +12,7 @@ void task_init(Scheduler *scheduler) { -#if OVLY SchedRegisterDynamicTask(HELLO_TASK, Hello, segment1); SchedRegisterDynamicTask(HELLO_TASK1, Hello1, segment2); -#else - SchedRegisterTask(HELLO_TASK, Hello); - SchedRegisterTask(HELLO_TASK1, Hello1); -#endif scheduler->allocate_code_segment(4,1024); }