Mercurial > hg > Members > kono > Cerium
changeset 609:6b865e046710
merge
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 07 Nov 2009 18:07:28 +0900 |
parents | 541ee8de2dca (current diff) 32a7260fad2f (diff) |
children | 529188ae604d |
files | TaskManager/Makefile |
diffstat | 36 files changed, 150 insertions(+), 157 deletions(-) [+] |
line wrap: on
line diff
--- a/Renderer/Engine/Makefile.def Fri Nov 06 22:06:11 2009 +0900 +++ b/Renderer/Engine/Makefile.def Sat Nov 07 18:07:28 2009 +0900 @@ -2,8 +2,9 @@ CERIUM = ../.. +ABI = -m32 CC = g++ -CFLAGS = -g -Wall -DUSE_MEMLIST=1 -DUSE_MEMHASH=1 # -O9 -DDEBUG +CFLAGS = -g -Wall $(ABI) # -O9 -DDEBUG INCLUDE = -I$(CERIUM)/include/TaskManager -I. -LIBS = -L$(CERIUM)/TaskManager +LIBS = -L$(CERIUM)/TaskManager $(ABI)
--- a/Renderer/Engine/Makefile.macosx Fri Nov 06 22:06:11 2009 +0900 +++ b/Renderer/Engine/Makefile.macosx Sat Nov 07 18:07:28 2009 +0900 @@ -13,8 +13,8 @@ LIBS += -lFifoManager -CFLAGS += `sdl-config --cflags` `xml2-config --cflags` -LIBS += `sdl-config --libs` `xml2-config --libs` -lSDL_image -Wl,-framework,OpenGL +CFLAGS += `sdl-config --cflags` `xml2-config --cflags` +LIBS += `sdl-config --libs` `xml2-config --libs` -lSDL_image -Wl,-framework,OpenGL .SUFFIXES: .cc .o
--- a/Renderer/Engine/Tapestry.h Fri Nov 06 22:06:11 2009 +0900 +++ b/Renderer/Engine/Tapestry.h Sat Nov 07 18:07:28 2009 +0900 @@ -71,15 +71,7 @@ }; -#ifdef USE_MEMLIST typedef MemorySegment Tile, *TilePtr; -#else -typedef struct { - uint32 data[TEXTURE_BLOCK_SIZE]; // 8*8 - uint32 *address; - int pad[3]; -} Tile, *TilePtr; -#endif #define MAX_TILE 128 @@ -88,7 +80,6 @@ * これは汎用のサイズ別 freelist に置き換える * freelist は double linked list で、LRU をサポートする */ -#ifdef USE_MEMLIST class TileList : public MemList { TileList(MemorySegment* ms) : MemList(ms) {} @@ -96,41 +87,6 @@ 中身は同じ */ }; -#else -class TileList { -public: - int curIndex; - int pad[3]; - Tile tile[MAX_TILE]; - - TileList(void) { - curIndex = 0; - } - - /** - * 次に扱う tile を取得する - * - * @return tile - * - * tile[] をリングバスっぽく扱うことで - * FIFO を実現することに。 - */ - TilePtr nextTile(void) { - TilePtr t = &tile[curIndex]; - curIndex = (curIndex + 1) % MAX_TILE; - return t; - } - - /** - * TileList のクリア - * //tile 自体は clear する必要は無い - * あるかもしれない - */ - void clear(void) { - curIndex = 0; - } -}; -#endif typedef TileList* TileListPtr;
--- a/Renderer/Engine/lindaapi.cc Fri Nov 06 22:06:11 2009 +0900 +++ b/Renderer/Engine/lindaapi.cc Sat Nov 07 18:07:28 2009 +0900 @@ -42,7 +42,7 @@ /* Static Functions */ static void unix_chkserv(int ps); void psx_free(void *); -static int psx_queue(unsigned int tspace_id, unsigned int id, +static long psx_queue(unsigned int tspace_id, unsigned int id, unsigned int size, unsigned char *data, char mode, void(*callback)(unsigned char *,void *),void * obj); @@ -314,10 +314,10 @@ 返り値: シーケンス番号 /-------------------------------------------------------------------*/ -int +long psx_out(unsigned int tspace_id, unsigned int id, unsigned char *data, unsigned int size){ - int r; + long r; if ((r = psx_queue(tspace_id, id, size, data, 'o', NULL, NULL)) == FAIL) { return(FAIL); } @@ -343,10 +343,10 @@ 返り値: psx_queue内でmallocされたREPLY構造体へのポインタ /-------------------------------------------------------------------*/ -int +long psx_ld(unsigned int tspace_id, unsigned int id, char mode, void(*callback)(unsigned char *,void *), void * obj){ - int r; + long r; if ((r = psx_queue(tspace_id, id, 0, NULL, mode, callback, obj)) == FAIL) { return(FAIL); } @@ -471,7 +471,7 @@ 0が返る。 失敗した場合 - FAIL(-1)が返る。 /-------------------------------------------------------------------*/ -static int +static long psx_queue(unsigned int tspace_id, unsigned int id, unsigned int size, unsigned char *data, char mode, void(*callback)(unsigned char *,void *), void * obj){ @@ -517,7 +517,7 @@ p = r_end->next; r_end = p; p->next = NULL; } p->mode = '?'; - p->seq = (int)p; // 構造体のアドレスで識別 + p->seq = (long)p; // 構造体のアドレスで識別 p->callback = callback; p->obj = obj; PSX_Debug(("psx_queue: seq %d reply %x p %x r_end %x",seq,reply,p,r_end)); @@ -529,10 +529,10 @@ q_end->command[LINDA_ID_OFFSET] = id >> 8; q_end->command[LINDA_ID_OFFSET+1] = id & 0xff; - q_end->command[LINDA_SEQ_OFFSET] = ((int)p>>24) & 0xff; - q_end->command[LINDA_SEQ_OFFSET+1] = ((int)p>>16) & 0xff; - q_end->command[LINDA_SEQ_OFFSET+2] = ((int)p>>8) & 0xff; - q_end->command[LINDA_SEQ_OFFSET+3] = ((int)p) & 0xff; + q_end->command[LINDA_SEQ_OFFSET] = ((long)p>>24) & 0xff; + q_end->command[LINDA_SEQ_OFFSET+1] = ((long)p>>16) & 0xff; + q_end->command[LINDA_SEQ_OFFSET+2] = ((long)p>>8) & 0xff; + q_end->command[LINDA_SEQ_OFFSET+3] = ((long)p) & 0xff; q_end->command[LINDA_DATA_LENGTH_OFFSET] = (size>>24) & 0xff; q_end->command[LINDA_DATA_LENGTH_OFFSET+1] = (size>>16) & 0xff; @@ -545,7 +545,7 @@ qsize++; if (data && size>0) memcpy(q_end->command+LINDA_HEADER_SIZE, data, size); - return((int)p); + return((long)p); } /*-------------------------------------------------------------------/
--- a/Renderer/Engine/lindaapi.h Fri Nov 06 22:06:11 2009 +0900 +++ b/Renderer/Engine/lindaapi.h Sat Nov 07 18:07:28 2009 +0900 @@ -2,6 +2,8 @@ #define _LINDAAPI_H 1 +#include "types.h" + #ifdef __cplusplus extern "C" { #endif @@ -75,9 +77,9 @@ extern unsigned char psx_get_mode(unsigned char *); extern unsigned char * psx_get_data(unsigned char *); -extern int psx_out(unsigned int tspace_id, unsigned int id, +extern long psx_out(unsigned int tspace_id, unsigned int id, unsigned char *data, unsigned int size); -extern int psx_ld(unsigned int tspace_id, unsigned int id, +extern long psx_ld(unsigned int tspace_id, unsigned int id, char mode, void(*callback)(unsigned char *,void *),void * obj); #define psx_in(tid, id) psx_ld(tid, id, 'i', NULL, NULL)
--- a/Renderer/Engine/main.cc Fri Nov 06 22:06:11 2009 +0900 +++ b/Renderer/Engine/main.cc Sat Nov 07 18:07:28 2009 +0900 @@ -6,7 +6,6 @@ /* prototype */ extern int init(TaskManager *manager, int argc, char *argv[]); -static void TMend(TaskManager *manager); extern void task_initialize(); extern Application *application(); @@ -79,6 +78,9 @@ } #if 0 + +// These are defined in Application + int TMmain(TaskManager *manager, int argc, char *argv[]) { @@ -95,3 +97,5 @@ } #endif + +/* end */
--- a/Renderer/Engine/task/CreatePolygon.cc Fri Nov 06 22:06:11 2009 +0900 +++ b/Renderer/Engine/task/CreatePolygon.cc Sat Nov 07 18:07:28 2009 +0900 @@ -63,7 +63,7 @@ do { if (sgp->next != NULL) { - smanager->dma_load(next_sgp, (uint32)sgp->next, + smanager->dma_load(next_sgp, (memaddr)sgp->next, sizeof(SceneGraphPack), SG_PACK_LOAD); } else { next_sgp = NULL; @@ -74,7 +74,7 @@ do { if (node->next != NULL) { - smanager->dma_load(next_node, (uint32)node->next, + smanager->dma_load(next_node, (memaddr)node->next, sizeof(SceneGraphNode), SG_NODE_LOAD); } else { next_node = NULL; @@ -96,13 +96,13 @@ send_pp = tmp_pp; smanager->dma_wait(PP_STORE); - smanager->dma_store(send_pp, (uint32)pp_addr, + smanager->dma_store(send_pp, (memaddr)pp_addr, sizeof(PolygonPack), PP_STORE); pp_addr = next; smanager->dma_wait(PP_LOAD); - smanager->dma_load(pp, (uint32)pp_addr, + smanager->dma_load(pp, (memaddr)pp_addr, sizeof(PolygonPack), PP_LOAD); smanager->dma_wait(PP_LOAD); pp->init(); @@ -175,7 +175,7 @@ } while (sgp); smanager->dma_wait(PP_STORE); - smanager->dma_store(pp, (uint32)pp_addr, + smanager->dma_store(pp, (memaddr)pp_addr, sizeof(PolygonPack), PP_STORE); smanager->dma_wait(PP_STORE);
--- a/Renderer/Engine/task/CreatePolygonFromSceneGraph.cc Fri Nov 06 22:06:11 2009 +0900 +++ b/Renderer/Engine/task/CreatePolygonFromSceneGraph.cc Sat Nov 07 18:07:28 2009 +0900 @@ -112,13 +112,13 @@ send_pp = tmp_pp; smanager->dma_wait(PP_STORE); - smanager->dma_store(send_pp, (uint32)pp_addr, + smanager->dma_store(send_pp, (memaddr)pp_addr, sizeof(PolygonPack), PP_STORE); pp_addr = next; smanager->dma_wait(PP_LOAD); - smanager->dma_load(pp, (uint32)pp_addr, + smanager->dma_load(pp, (memaddr)pp_addr, sizeof(PolygonPack), PP_LOAD); smanager->dma_wait(PP_LOAD); pp->init(); @@ -234,7 +234,7 @@ } smanager->dma_wait(PP_STORE); - smanager->dma_store(pp, (uint32)pp_addr, + smanager->dma_store(pp, (memaddr)pp_addr, sizeof(PolygonPack), PP_STORE); smanager->dma_wait(PP_STORE);
--- a/Renderer/Engine/task/CreateSpan.cc Fri Nov 06 22:06:11 2009 +0900 +++ b/Renderer/Engine/task/CreateSpan.cc Sat Nov 07 18:07:28 2009 +0900 @@ -280,10 +280,10 @@ send_spack = tmp_spack; smanager->dma_wait(SPAN_PACK_STORE); - smanager->dma_store(send_spack, (uint32)spackList[prev_index], + smanager->dma_store(send_spack, (memaddr)spackList[prev_index], sizeof(SpanPack), SPAN_PACK_STORE); - smanager->dma_load(spack, (uint32)spackList[index], + smanager->dma_load(spack, (memaddr)spackList[index], sizeof(SpanPack), SPAN_PACK_LOAD); prev_index = index; smanager->dma_wait(SPAN_PACK_LOAD); @@ -308,12 +308,12 @@ send_spack = tmp_spack; smanager->dma_wait(SPAN_PACK_STORE); - smanager->dma_store(send_spack, (uint32)spackList[index], + smanager->dma_store(send_spack, (memaddr)spackList[index], sizeof(SpanPack), SPAN_PACK_STORE); spackList[index] = next; - smanager->dma_load(spack, (uint32)spackList[index], + smanager->dma_load(spack, (memaddr)spackList[index], sizeof(SpanPack), SPAN_PACK_LOAD); smanager->dma_wait(SPAN_PACK_LOAD); spack->init((index+1)*split_screen_h); @@ -446,7 +446,7 @@ do { if (pp->next != NULL) { - smanager->dma_load(next_pp, (uint32)pp->next, + smanager->dma_load(next_pp, (memaddr)pp->next, sizeof(PolygonPack), POLYGON_PACK_LOAD); } else { next_pp = NULL; @@ -498,7 +498,7 @@ } while (pp); smanager->dma_wait(SPAN_PACK_STORE); - smanager->dma_store(spack, (uint32)spackList[prev_index], + smanager->dma_store(spack, (memaddr)spackList[prev_index], sizeof(SpanPack), SPAN_PACK_STORE); smanager->dma_wait(SPAN_PACK_STORE);
--- a/Renderer/Engine/task/DrawSpan.cc Fri Nov 06 22:06:11 2009 +0900 +++ b/Renderer/Engine/task/DrawSpan.cc Sat Nov 07 18:07:28 2009 +0900 @@ -21,7 +21,10 @@ { Gptr g = (Gptr)s->get_param(0); s->dma_wait(FB_STORE); - free((void*)((int)g->linebuf*g->doneWrite)); + + if (!g->doneWrite) { + free(g->linebuf); + } free(g); return 0; } @@ -418,7 +421,7 @@ * 次の SpanPack の DMA 転送を行う */ if (spack->next != NULL) { - smanager->dma_load(next_spack, (uint32)spack->next, + smanager->dma_load(next_spack, (memaddr)spack->next, sizeof(SpanPack), SPAN_PACK_LOAD); } else { next_spack = NULL; @@ -479,7 +482,7 @@ free(free_spack); TaskPtr nextTask = smanager->create_task(TASK_DRAW_SPAN_END); - nextTask->add_param((int)g); + nextTask->add_param((memaddr)g); smanager->wait_task(nextTask); return 0;
--- a/Renderer/Engine/task/Set_Texture.cc Fri Nov 06 22:06:11 2009 +0900 +++ b/Renderer/Engine/task/Set_Texture.cc Sat Nov 07 18:07:28 2009 +0900 @@ -23,9 +23,9 @@ void *data = s->global_alloc(TEXTURE_ID, MAX_LOAD_SIZE*4); memcpy(data, src[0], MAX_LOAD_SIZE); - memcpy((void*)((int)data + MAX_LOAD_SIZE), src[1], MAX_LOAD_SIZE); - memcpy((void*)((int)data + MAX_LOAD_SIZE*2), src[2], MAX_LOAD_SIZE); - memcpy((void*)((int)data + MAX_LOAD_SIZE*3), src[3], MAX_LOAD_SIZE); + memcpy((void*)((memaddr)data + MAX_LOAD_SIZE), src[1], MAX_LOAD_SIZE); + memcpy((void*)((memaddr)data + MAX_LOAD_SIZE*2), src[2], MAX_LOAD_SIZE); + memcpy((void*)((memaddr)data + MAX_LOAD_SIZE*3), src[3], MAX_LOAD_SIZE); } return 0;
--- a/Renderer/Engine/viewer.cc Fri Nov 06 22:06:11 2009 +0900 +++ b/Renderer/Engine/viewer.cc Sat Nov 07 18:07:28 2009 +0900 @@ -452,8 +452,8 @@ // SceneGraph(木構造) -> PolygonPack - task_create_pp->add_param((uint32)sgroot->getDrawSceneGraph()); - task_create_pp->add_param((uint32)ppack); + task_create_pp->add_param((memaddr)sgroot->getDrawSceneGraph()); + task_create_pp->add_param((memaddr)ppack); task_next->wait_for(task_create_pp); @@ -522,7 +522,7 @@ task_draw->add_inData(spack, sizeof(SpanPack)); task_draw->add_param( - (uint32)&pixels[(startx-1) + this->width*(starty-1)]); + (memaddr)&pixels[(startx-1) + this->width*(starty-1)]); task_draw->add_param(this->width); } else { // 7.7.3 SL1 Data Cache Range Set to Zero コマンド
--- a/Renderer/Test/Makefile.def Fri Nov 06 22:06:11 2009 +0900 +++ b/Renderer/Test/Makefile.def Sat Nov 07 18:07:28 2009 +0900 @@ -1,9 +1,10 @@ CERIUM = ../.. +ABI = -m32 CC = g++ -CFLAGS = -g -Wall # -O -DDEBUG +CFLAGS = -g -Wall $(ABI) # -O -DDEBUG INCLUDE = -I$(CERIUM)/include/TaskManager -I. -I$(CERIUM)/include/Cerium -LIBS = -L$(CERIUM)/TaskManager -L$(CERIUM)/Renderer/Engine +LIBS = -L$(CERIUM)/TaskManager -L$(CERIUM)/Renderer/Engine $(ABI) TOOL = $(CERIUM)/bin
--- a/Renderer/Test/Makefile.macosx Fri Nov 06 22:06:11 2009 +0900 +++ b/Renderer/Test/Makefile.macosx Sat Nov 07 18:07:28 2009 +0900 @@ -1,9 +1,9 @@ include ./Makefile.def -LIBS += -lFifoManager -lCerium +LIBS += -lCerium -lFifoManager -CFLAGS += `sdl-config --cflags` `xml2-config --cflags` $(INCLUDE) -LIBS += `sdl-config --libs` `xml2-config --libs` -lSDL_image -Wl,-framework,OpenGL +CFLAGS += `sdl-config --cflags` `xml2-config --cflags` $(INCLUDE) +LIBS += `sdl-config --libs` `xml2-config --libs` -lSDL_image -Wl,-framework,OpenGL .SUFFIXES: .cc .o .xml .xml.h .xml.cc
--- a/TaskManager/Cell/SpeThreads.cc Fri Nov 06 22:06:11 2009 +0900 +++ b/TaskManager/Cell/SpeThreads.cc Sat Nov 07 18:07:28 2009 +0900 @@ -116,21 +116,29 @@ * @return Received 32-bit mailbox messages * if ([ret] < 0) no data read */ -int +memaddr SpeThreads::get_mail(int speid, int count, unsigned int* ret) { - return spe_out_mbox_read(spe_ctx[speid], ret, count); + memaddr mail = spe_out_mbox_read(spe_ctx[speid], ret, 1); + if (sizeof(memaddr)>4) { + mail += spe_out_mbox_read(spe_ctx[speid], ret, 1)<<4; + } + return mail; } -int +memaddr SpeThreads::check_mail(int speid, int count, unsigned int* ret) { /* * spe_out_mbox_status return only 1, waiting for multiple length * does not work. */ - if (spe_out_mbox_status(spe_ctx[speid]) >= count) { - return spe_out_mbox_read(spe_ctx[speid], ret, count); + if (spe_out_mbox_status(spe_ctx[speid]) >= 1) { + memaddr mail = spe_out_mbox_read(spe_ctx[speid], ret, 1); + if (sizeof(memaddr)>4) { + mail += spe_out_mbox_read(spe_ctx[speid], ret, 1)<<4; + } + return mail; } else { return 0; } @@ -151,9 +159,12 @@ * @param [num] The number of messages */ void -SpeThreads::send_mail(int speid, int num, unsigned int *data) +SpeThreads::send_mail(int speid, int num, memaddr *data) { spe_in_mbox_write(spe_ctx[speid], data, num, SPE_MBOX_ALL_BLOCKING); + if (sizeof(memaddr)>4) { + spe_in_mbox_write(spe_ctx[speid], data>>4, num, SPE_MBOX_ALL_BLOCKING); + } } void @@ -167,3 +178,5 @@ */ } + +/* end */
--- a/TaskManager/Cell/SpeThreads.h Fri Nov 06 22:06:11 2009 +0900 +++ b/TaskManager/Cell/SpeThreads.h Sat Nov 07 18:07:28 2009 +0900 @@ -19,9 +19,9 @@ /* functions */ void init(void); - int get_mail(int speid, int count, unsigned int* ret); // BLOCKING - int check_mail(int speid, int count, unsigned int* ret); // NONBLOCK - void send_mail(int speid, int num, unsigned int *data); // BLOCKING + memaddr get_mail(int speid, int count, unsigned int* ret); // BLOCKING + memaddr check_mail(int speid, int count, unsigned int* ret); // NONBLOCK + void send_mail(int speid, int num, memaddr *data); // BLOCKING static void *spe_thread_run(void *arg); static void *frontend_thread_run(void *arg); void add_output_tasklist(int command, unsigned int buff, int alloc_size);
--- a/TaskManager/Cell/spe/CellDmaManager.cc Fri Nov 06 22:06:11 2009 +0900 +++ b/TaskManager/Cell/spe/CellDmaManager.cc Sat Nov 07 18:07:28 2009 +0900 @@ -78,15 +78,19 @@ } void -CellDmaManager::mail_write(uint32 data) +CellDmaManager::mail_write(memaddr data) { - spu_write_out_mbox(data); + spu_write_out_mbox((uint32)data); + if (sizeof(memaddr)>4) + spu_write_out_mbox(data>>4); } -unsigned int -CellDmaManager::mail_read(void) +memaddr +CellDmaManager::mail_read() { - unsigned int mail = spu_read_in_mbox(); + memaddr mail = spu_read_in_mbox(); + if (sizeof(memaddr)>4) + mail += (spu_read_in_mbox()<<4); return mail; } @@ -103,3 +107,5 @@ mfc_putl(buff, 0, list->element, sizeof(mfc_list_element_t)*list->length, mask, 0, 0); } + +/* end */
--- a/TaskManager/Fifo/FifoDmaManager.cc Fri Nov 06 22:06:11 2009 +0900 +++ b/TaskManager/Fifo/FifoDmaManager.cc Sat Nov 07 18:07:28 2009 +0900 @@ -4,14 +4,14 @@ #include "FifoDmaManager.h" void -FifoDmaManager::dma_load(void *buf, uint32 addr, uint32 size, uint32 mask) +FifoDmaManager::dma_load(void *buf, memaddr addr, uint32 size, uint32 mask) { if (size == 0) return; memcpy(buf, (void*)addr, size); } void -FifoDmaManager::dma_store(void *buf, uint32 addr, uint32 size, uint32 mask) +FifoDmaManager::dma_store(void *buf, memaddr addr, uint32 size, uint32 mask) { if (size == 0) return; memcpy((void*)addr, buf, size); @@ -28,18 +28,18 @@ } void -FifoDmaManager::mail_write(uint32 data) +FifoDmaManager::mail_write(memaddr data) { mail_sendQueue = MailManager::append_mailQueue(mail_sendQueue, mailManager->create(data)); } -unsigned int -FifoDmaManager::mail_read(void) +memaddr +FifoDmaManager::mail_read() { MailQueuePtr q; - uint32 ret; + memaddr ret; q = mail_recvQueue; @@ -59,9 +59,9 @@ FifoDmaManager::dma_loadList(ListDataPtr list, void *buff, uint32 mask) { int list_size = list->length; - int bound; + long bound; - bound = (int)(buff); + bound = (long)(buff); for (int i = 0; i < list_size; i++) { ListElementPtr elm = &list->element[i]; @@ -100,9 +100,9 @@ FifoDmaManager::dma_storeList(ListDataPtr list, void *buff, uint32 mask) { int list_size = list->length; - int bound; + memaddr bound; - bound = (int)(buff); + bound = (memaddr)(buff); for (int i = 0; i < list_size; i++) { ListElementPtr elm = &list->element[i];
--- a/TaskManager/Fifo/FifoDmaManager.h Fri Nov 06 22:06:11 2009 +0900 +++ b/TaskManager/Fifo/FifoDmaManager.h Sat Nov 07 18:07:28 2009 +0900 @@ -15,12 +15,12 @@ MailQueuePtr mail_sendQueue; /* functions */ - void dma_load(void *buf, uint32 addr, uint32 size, uint32 mask); - void dma_store(void *buf, uint32 addr, uint32 size, uint32 mask); + void dma_load(void *buf, memaddr addr, uint32 size, uint32 mask); + void dma_store(void *buf, memaddr addr, uint32 size, uint32 mask); void dma_wait(uint32 mask) ; - void mail_write(uint32 data); - uint32 mail_read(void); + void mail_write(memaddr data); + memaddr mail_read(void); void dma_loadList(ListDataPtr list, void *buff, uint32 mask); void dma_storeList(ListDataPtr, void *buff, uint32 mask);
--- a/TaskManager/Fifo/FifoTaskManagerImpl.cc Fri Nov 06 22:06:11 2009 +0900 +++ b/TaskManager/Fifo/FifoTaskManagerImpl.cc Sat Nov 07 18:07:28 2009 +0900 @@ -167,7 +167,7 @@ MailQueuePtr out_mail_list = NULL; // TaskList のアドレス - list_mail = mailManager->create((unsigned int)list); + list_mail = mailManager->create((memaddr)list); in_mail_list = MailManager::append_mailQueue(in_mail_list, list_mail); // EXIT_COMMAND (番兵的な意味で)
--- a/TaskManager/Makefile Fri Nov 06 22:06:11 2009 +0900 +++ b/TaskManager/Makefile Sat Nov 07 18:07:28 2009 +0900 @@ -30,6 +30,7 @@ cd $(KERN_SCHED_DIR); rm -f *~ \#* cd $(KERN_MEM_DIR); rm -f *~ \#* cd $(KERN_SYSTASK_DIR); rm -f *~ \#* + cd $(KERN_MEM_DIR); rm -f *~ \#* cd $(IMPL_FIFO_DIR); rm -f *~ \#* cd $(IMPL_CELL_DIR); rm -f *~ \#* rm -f $(KERN_MAIN_OBJS) $(KERN_PPE_OBJS) $(KERN_SPE_OBJS) \
--- a/TaskManager/Makefile.def Fri Nov 06 22:06:11 2009 +0900 +++ b/TaskManager/Makefile.def Sat Nov 07 18:07:28 2009 +0900 @@ -27,8 +27,10 @@ IMPL_CELL_SRCS = $(IMPL_FIFO_SRCS) $(wildcard $(IMPL_CELL_DIR)/*.cc) IMPL_CELL_OBJS = $(IMPL_CELL_SRCS:.cc=.o) +ABI = -m32 + CC = g++ -CFLAGS = -Wall `sdl-config --cflags` -g # -O9 +CFLAGS = -Wall `sdl-config --cflags` -g $(ABI) # -O9 LIBS = INCLUDE = -I../include/TaskManager
--- a/TaskManager/Makefile.fifo Fri Nov 06 22:06:11 2009 +0900 +++ b/TaskManager/Makefile.fifo Sat Nov 07 18:07:28 2009 +0900 @@ -20,4 +20,4 @@ fifodistclean: fifoclean rm -f $(TARGET) -fifoclean: \ No newline at end of file +fifoclean:
--- a/TaskManager/include/types.h Fri Nov 06 22:06:11 2009 +0900 +++ b/TaskManager/include/types.h Sat Nov 07 18:07:28 2009 +0900 @@ -7,13 +7,14 @@ typedef uint32_t uint32; typedef uint64_t uint64; -#ifdef SPU +#if SPU // ifdef SPU typedef uint64_t memaddr; #else #ifdef MODE64 typedef uint64_t memaddr; #else -typedef uint32_t memaddr; +// In LP64, sizeof(unsigned long)==8 +typedef unsigned long memaddr; #endif #endif
--- a/TaskManager/kernel/ppe/DmaBuffer.cc Fri Nov 06 22:06:11 2009 +0900 +++ b/TaskManager/kernel/ppe/DmaBuffer.cc Sat Nov 07 18:07:28 2009 +0900 @@ -13,7 +13,7 @@ char *align; nonalign = new char[size + sizeof(void*) + alignment - 1]; - align = (char*)(ALIGN_UP((unsigned int)nonalign+sizeof(void*),alignment)); + align = (char*)(ALIGN_UP((memaddr)nonalign+sizeof(void*),alignment)); *((void**)align - 1) = (void*)nonalign; return align;
--- a/TaskManager/kernel/ppe/HTaskInfo.cc Fri Nov 06 22:06:11 2009 +0900 +++ b/TaskManager/kernel/ppe/HTaskInfo.cc Sat Nov 07 18:07:28 2009 +0900 @@ -66,7 +66,7 @@ q->command = cmd; q->inData.clear(); q->outData.clear(); - q->self = (int) q; + q->self = (memaddr) q; q->param_size = 0; q->post_func = NULL;
--- a/TaskManager/kernel/ppe/MailManager.cc Fri Nov 06 22:06:11 2009 +0900 +++ b/TaskManager/kernel/ppe/MailManager.cc Sat Nov 07 18:07:28 2009 +0900 @@ -40,7 +40,7 @@ } MailQueuePtr -MailManager::create(unsigned int data) +MailManager::create(memaddr data) { MailQueuePtr q;
--- a/TaskManager/kernel/ppe/MailManager.h Fri Nov 06 22:06:11 2009 +0900 +++ b/TaskManager/kernel/ppe/MailManager.h Sat Nov 07 18:07:28 2009 +0900 @@ -1,20 +1,22 @@ #ifndef INCLUDED_MAIL_MANAGER #define INCLUDED_MAIL_MANAGER +#include "types.h" + typedef struct mail_queue { - unsigned int data; + memaddr data; struct mail_queue *next; } MailQueue, *MailQueuePtr; class MailManager { public: /* constructor */ - MailManager(void); - ~MailManager(void); + MailManager(); + ~MailManager(); /* functions */ int init(int num); - MailQueuePtr create(unsigned int data); + MailQueuePtr create(memaddr data); void free(MailQueuePtr q); static MailQueuePtr append_mailQueue(MailQueuePtr list, MailQueuePtr q); @@ -25,7 +27,7 @@ /* functions */ int extend_pool(int num); - void destroy(void); + void destroy(); }; #endif
--- a/TaskManager/kernel/ppe/Task.cc Fri Nov 06 22:06:11 2009 +0900 +++ b/TaskManager/kernel/ppe/Task.cc Sat Nov 07 18:07:28 2009 +0900 @@ -9,7 +9,7 @@ * @return if ([ret] == 0) ? success : failuer; */ int -Task::add_inData_t(unsigned int addr, int size) +Task::add_inData_t(memaddr addr, int size) { return add_data(inData, addr, size); } @@ -23,7 +23,7 @@ * @return if ([ret] == 0) ? success : failuer; */ int -Task::add_outData_t(unsigned int addr, int size) +Task::add_outData_t(memaddr addr, int size) { return add_data(outData, addr, size); } @@ -37,7 +37,7 @@ * そのアドレスは メインメモリでアロケートされた int の集合。 */ int -Task::add_param(int _param) +Task::add_param(memaddr _param) { if (param_size >= MAX_PARAMS) return -1; @@ -50,7 +50,7 @@ * perror みたいにしたほうがわかりやすいかな。 */ int -Task::add_data(ListData& list, uint32 addr, int size) +Task::add_data(ListData& list, memaddr addr, int size) { if (list.length >= MAX_LIST_DMA_SIZE) return -1;
--- a/TaskManager/kernel/ppe/Task.h Fri Nov 06 22:06:11 2009 +0900 +++ b/TaskManager/kernel/ppe/Task.h Sat Nov 07 18:07:28 2009 +0900 @@ -15,23 +15,23 @@ BASE_NEW_DELETE(Task); int command; // 4 byte - int self; // 4 byte + memaddr self; // 4 byte (or 8byte on 64bit mode) int param_size; // 4 byte - int param[MAX_PARAMS]; // 4*MAX_PARAMS byte + memaddr param[MAX_PARAMS]; // 4*MAX_PARAMS byte ListData inData __attribute__ ((aligned (DEFAULT_ALIGNMENT))); // 4 byte 64bit であるべき ListData outData __attribute__ ((aligned (DEFAULT_ALIGNMENT))); // 4 byte 64bit であるべき public: // functions - int add_inData_t(unsigned int addr, int size); // unsigned int ではなく 64bit - int add_outData_t(unsigned int addr, int size); // unsigned int ではなく 64bit - int add_data(ListData &list, unsigned int addr, int size); - int add_param(int param); + int add_inData_t(memaddr addr, int size); // unsigned int ではなく 64bit + int add_outData_t(memaddr addr, int size); // unsigned int ではなく 64bit + int add_data(ListData &list, memaddr addr, int size); + int add_param(memaddr param); #define add_inData(addr, size) \ - add_inData_t((unsigned int)(addr), (size)); + add_inData_t((memaddr)(addr), (size)); #define add_outData(addr, size) \ - add_outData_t((unsigned int)(addr), (size)); + add_outData_t((memaddr)(addr), (size)); }; typedef Task* TaskPtr;
--- a/TaskManager/kernel/schedule/DmaManager.h Fri Nov 06 22:06:11 2009 +0900 +++ b/TaskManager/kernel/schedule/DmaManager.h Sat Nov 07 18:07:28 2009 +0900 @@ -15,19 +15,19 @@ class DmaManager { public: - virtual ~DmaManager(void) {}; + virtual ~DmaManager() {}; BASE_NEW_DELETE(DmaManager); // API for DMA transfer - virtual void dma_load(void *buf, uint32 addr, uint32 size, uint32 mask) {} - virtual void dma_store(void *buf,uint32 addr, uint32 size, uint32 mask) {} + virtual void dma_load(void *buf, memaddr addr, uint32 size, uint32 mask) {} + virtual void dma_store(void *buf,memaddr addr, uint32 size, uint32 mask) {} virtual void dma_wait(uint32 mask) {} virtual void show_dma_wait(int cpu) {} // API for SPU inbound/outbound mailbox - virtual void mail_write(uint32 data) {} - virtual uint32 mail_read(void) {return 0;} + virtual void mail_write(memaddr data) {} + virtual memaddr mail_read() {return 0;} // API for MFC list DMA transfer virtual void dma_loadList(ListDataPtr list, void *,uint32 mask) {}
--- a/TaskManager/kernel/schedule/ListData.h Fri Nov 06 22:06:11 2009 +0900 +++ b/TaskManager/kernel/schedule/ListData.h Sat Nov 07 18:07:28 2009 +0900 @@ -2,6 +2,7 @@ #define INCLUDED_LIST_DATA #include "base.h" +#include "types.h" #define MAX_LIST_DMA_SIZE 8 @@ -10,7 +11,7 @@ BASE_NEW_DELETE(ListElement); int size; - unsigned int addr; + memaddr addr; }; typedef ListElement* ListElementPtr;
--- a/TaskManager/kernel/schedule/SchedTask.cc Fri Nov 06 22:06:11 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.cc Sat Nov 07 18:07:28 2009 +0900 @@ -356,7 +356,7 @@ return nextSched; } } else { - uint32 nextList = (uint32)list->next; + memaddr nextList = (memaddr)list->next; if (nextList == 0) { return new SchedNop2Ready(scheduler); @@ -435,7 +435,7 @@ SchedTask::get_input(void *buff, int index) { if (buff != NULL) { - return (void*)((int)buff + inListData->bound[index]); + return (void*)((memaddr)buff + inListData->bound[index]); } else { return NULL; } @@ -466,7 +466,7 @@ SchedTask::get_output(void *buff, int index) { if (buff != NULL) { - return (void*)((int)buff + outListData->bound[index]); + return (void*)((memaddr)buff + outListData->bound[index]); } else { return NULL; } @@ -523,7 +523,7 @@ void SchedTask::wait_task(TaskPtr waitTask) { - waitTask->self = (int)taskGroup; + waitTask->self = (memaddr)taskGroup; scheduler->add_groupTask(taskGroup, waitTask);
--- a/TaskManager/kernel/schedule/SchedTaskList.cc Fri Nov 06 22:06:11 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTaskList.cc Sat Nov 07 18:07:28 2009 +0900 @@ -16,7 +16,7 @@ * 0: メインメモリ, 1: SPE */ SchedTaskList* -createSchedTaskList(uint32 next_list, Scheduler* scheduler, int renew_flag) +createSchedTaskList(memaddr next_list, Scheduler* scheduler, int renew_flag) { SchedTaskList* sched = new SchedTaskList(next_list, scheduler); sched->flag_renewTaskList = renew_flag;
--- a/TaskManager/kernel/schedule/SchedTaskList.h Fri Nov 06 22:06:11 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTaskList.h Sat Nov 07 18:07:28 2009 +0900 @@ -37,7 +37,7 @@ const int SCHED_TASKLIST_NORMAL = 0; const int SCHED_TASKLIST_RENEW = 1; -extern SchedTaskList* createSchedTaskList(uint32, Scheduler*, int); +extern SchedTaskList* createSchedTaskList(memaddr, Scheduler*, int); #endif
--- a/TaskManager/kernel/schedule/Scheduler.cc Fri Nov 06 22:06:11 2009 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.cc Sat Nov 07 18:07:28 2009 +0900 @@ -168,7 +168,7 @@ list->next = NULL; SchedTaskList *sched - = createSchedTaskList((uint32)list, this, SCHED_TASKLIST_RENEW); + = createSchedTaskList((memaddr)list, this, SCHED_TASKLIST_RENEW); return sched; } else { return NULL;