comparison TaskManager/kernel/schedule/Scheduler.cc @ 437:e924d6cca813 draft

overlay...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 24 Sep 2009 22:40:58 +0900
parents cebb48da955e
children 13c6740ab15f
comparison
equal deleted inserted replaced
434:852e3f6a6357 437:e924d6cca813
329 * Task load API 329 * Task load API
330 */ 330 */
331 void 331 void
332 Scheduler::allocate_code_segment(int count, int size) 332 Scheduler::allocate_code_segment(int count, int size)
333 { 333 {
334 // 既に overlay 領域があるので、それを追加する必要がある...
334 code_segment_pool = createMemList(count, size); 335 code_segment_pool = createMemList(count, size);
335 } 336 }
336 337
337 static void 338 static void
338 load_task(Scheduler *m, int task_id) 339 load_task(Scheduler *m, int task_id)
339 { 340 {
341 fprintf(stderr,"loadng task id %d\n",task_id);
340 MemorySegment *s = m->get_segment( 342 MemorySegment *s = m->get_segment(
341 task_list[task_id].location, 343 task_list[task_id].location,
342 m->code_segment_pool); 344 m->code_segment_pool,
345 task_list[task_id].end-task_list[task_id].location);
343 task_list[task_id].segment = s; 346 task_list[task_id].segment = s;
344 } 347 }
345 348
346 static void 349 static void
347 null_loader(Scheduler *m, int task_id) 350 null_loader(Scheduler *m, int task_id)
349 } 352 }
350 353
351 static void 354 static void
352 wait_load(Scheduler *m, int task_id) 355 wait_load(Scheduler *m, int task_id)
353 { 356 {
357 fprintf(stderr,"wait load task id %d\n",task_id);
354 // wait for code segment load 358 // wait for code segment load
355 m->wait_segment(task_list[task_id].segment); 359 m->wait_segment(task_list[task_id].segment);
356 // calcurate call address 360 // calcurate call address
357 TaskObjectCreator creator = 361 TaskObjectCreator creator =
358 (TaskObjectCreator)( 362 (TaskObjectCreator)(
431 435
432 */ 436 */
433 MemorySegment * 437 MemorySegment *
434 Scheduler::get_segment(memaddr addr, MemList *m) 438 Scheduler::get_segment(memaddr addr, MemList *m)
435 { 439 {
440 return get_segment(addr, m, m->size);
441 }
442
443 MemorySegment *
444 Scheduler::get_segment(memaddr addr, MemList *m, int size)
445 {
446 // memory segment のsizeをoverride する場合がある
436 MemorySegment *s = hash->get(addr); 447 MemorySegment *s = hash->get(addr);
437 if (s) { 448 if (s) {
438 /* 既に load されている */ 449 /* 既に load されている */
439 m->moveToFirst(s); 450 m->moveToFirst(s);
440 return s; 451 return s;
445 m->moveToFirst(s); 456 m->moveToFirst(s);
446 457
447 memaddr old_addr = s->address; 458 memaddr old_addr = s->address;
448 s->tag = get_tag(); 459 s->tag = get_tag();
449 dma_load(s->data, addr, 460 dma_load(s->data, addr,
450 s->size, s->tag); 461 size, s->tag);
451 /* 前のをhashから削除 */ 462 /* 前のをhashから削除 */
452 hash->remove(old_addr); 463 hash->remove(old_addr);
453 /* 新しいaddress を登録 */ 464 /* 新しいaddress を登録 */
454 s->address = addr; 465 s->address = addr;
455 hash->put(s->address, s); 466 hash->put(s->address, s);