Mercurial > hg > Members > kono > Cerium
changeset 388:82cb9368e3ff
MemHash (OS X version)
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 06 Aug 2009 23:30:26 +0900 |
parents | 5e2d30bfbf23 |
children | 016d45583994 |
files | TaskManager/Cell/spe/CellScheduler.cc TaskManager/Cell/spe/CellScheduler.h TaskManager/Test/test_render/chain.cpp TaskManager/kernel/memory/MemHash.cc TaskManager/kernel/schedule/Scheduler.cc TaskManager/kernel/schedule/Scheduler.h |
diffstat | 6 files changed, 34 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Cell/spe/CellScheduler.cc Thu Aug 06 22:40:52 2009 +0900 +++ b/TaskManager/Cell/spe/CellScheduler.cc Thu Aug 06 23:30:26 2009 +0900 @@ -6,10 +6,10 @@ // ユーザプログラムで定義 // なんだけど、それは微妙じゃね? -extern void task_init(void); +extern void task_init(); void -CellScheduler::init_impl(void) +CellScheduler::init_impl() { connector = new CellDmaManager; @@ -45,7 +45,7 @@ } void -CellScheduler::mainMem_wait(void) +CellScheduler::mainMem_wait() { uint32 id; uint32 addr; @@ -58,3 +58,25 @@ mainMemNum--; } } + +/* + dma channel を返す + 本来、SPU用に閉じているはず。ユーザが明示的に使うことはない。 + 良くわからないが、ある分だけcounterで廻せば良い。しかし、 + そのためには、全部で、get_tag()する必要があるはず。 + + */ + +#define TEX_LOAD1 0 +#define TEX_LOAD2 1 + +uint32 +CellScheduler::get_tag() +{ + static int count = 0; + int i = (count++ % 2); + return TEX_LOAD1*i + TEX_LOAD2*(1-i); +} + + +/* end */
--- a/TaskManager/Cell/spe/CellScheduler.h Thu Aug 06 22:40:52 2009 +0900 +++ b/TaskManager/Cell/spe/CellScheduler.h Thu Aug 06 23:30:26 2009 +0900 @@ -13,6 +13,7 @@ void *allocate(int size); void mainMem_alloc(int id, int size); void mainMem_wait(void); + uint32 get_tag(); private: int mainMemNum;
--- a/TaskManager/Test/test_render/chain.cpp Thu Aug 06 22:40:52 2009 +0900 +++ b/TaskManager/Test/test_render/chain.cpp Thu Aug 06 23:30:26 2009 +0900 @@ -1,4 +1,4 @@ -#include <iostream.h> +#include <iostream> #include <math.h> #include "SceneGraphRoot.h" #include "SGList.h"
--- a/TaskManager/kernel/memory/MemHash.cc Thu Aug 06 22:40:52 2009 +0900 +++ b/TaskManager/kernel/memory/MemHash.cc Thu Aug 06 23:30:26 2009 +0900 @@ -23,7 +23,7 @@ return value % hashSize; } -MemHash::MemHash(void) +MemHash::MemHash() { //hashSize = 263; //tableSize = sizeof(MemorySegmentPtr)*hashSize;
--- a/TaskManager/kernel/schedule/Scheduler.cc Thu Aug 06 22:40:52 2009 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.cc Thu Aug 06 23:30:26 2009 +0900 @@ -23,6 +23,7 @@ void Scheduler::init(void) { + hash = 0; init_impl(); for (int i = 0; i < 2; i++) { @@ -352,6 +353,10 @@ char* mseg = (char*)allocate(seg_size*count); MemList* mlist = new MemList((MemorySegment*)mseg); + if (!hash) { + hash = new MemHash(); + } + for(int i = 0; i < count; i++) { MemorySegment* next = (MemorySegment*)(mseg+seg_size*i); char* data = (char*)next+head_size;
--- a/TaskManager/kernel/schedule/Scheduler.h Thu Aug 06 22:40:52 2009 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.h Thu Aug 06 23:30:26 2009 +0900 @@ -138,13 +138,10 @@ void *mainMem_get(int id); MemorySegment * Scheduler::get_segment(memaddr addr, MemList *m); - uint32 Scheduler::get_tag(); + virtual uint32 Scheduler::get_tag(); void Scheduler::put_segment(MemorySegment *s); void Scheduler::wait_segment(MemorySegment *s); - - - /* DMA Transfer */ void dma_load(void *buf, uint32 addr, uint32 size, uint32 mask); void dma_store(void *buf,uint32 addr, uint32 size, uint32 mask);