Mercurial > hg > Game > Cerium
changeset 1414:94ac6d8e73aa draft
fix free inifite loop
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 19 Feb 2012 10:38:05 +0900 |
parents | 5b024efa2429 |
children | 774ea7a71b0f |
files | Renderer/Engine/Makefile.cell TaskManager/Fifo/PreRefDmaManager.cc TaskManager/Fifo/PreRefDmaManager.h TaskManager/Fifo/ReferencedDmaManager.cc TaskManager/Fifo/ReferencedDmaManager.h TaskManager/kernel/ppe/DmaBuffer.cc TaskManager/kernel/ppe/DmaBuffer.h TaskManager/kernel/schedule/DmaManager.h TaskManager/kernel/schedule/SchedTask.cc TaskManager/kernel/schedule/SchedTaskArray.cc TaskManager/kernel/schedule/SchedTaskArrayNop.cc |
diffstat | 11 files changed, 11 insertions(+), 75 deletions(-) [+] |
line wrap: on
line diff
--- a/Renderer/Engine/Makefile.cell Sun Feb 19 10:07:27 2012 +0900 +++ b/Renderer/Engine/Makefile.cell Sun Feb 19 10:38:05 2012 +0900 @@ -39,7 +39,7 @@ CELL_SPE_SCHEDULE_OBJ = $(CELL_SPE_SCHEDULE_SRC:.cc=.o) $(CELL_SPE_SCHEDULE_SRC): task/*.cc task/*.h - cp task/*.cc task/*.h $(CELL_SPE_DIR)/ + cp task/*.cc task/*.h $(CELL_SPE_DIR)/ LIBS += -lCellManager -lspe2 -lpthread
--- a/TaskManager/Fifo/PreRefDmaManager.cc Sun Feb 19 10:07:27 2012 +0900 +++ b/TaskManager/Fifo/PreRefDmaManager.cc Sun Feb 19 10:38:05 2012 +0900 @@ -20,5 +20,5 @@ } void -PreRefDmaManager::free(void *buf) { +PreRefDmaManager::free_(void *buf) { }
--- a/TaskManager/Fifo/PreRefDmaManager.h Sun Feb 19 10:07:27 2012 +0900 +++ b/TaskManager/Fifo/PreRefDmaManager.h Sun Feb 19 10:38:05 2012 +0900 @@ -8,7 +8,7 @@ public: /* functions */ virtual void *dma_load(Scheduler *s, void *buf, memaddr addr, uint32 size, uint32 mask); - virtual void free(void *buf); + virtual void free_(void *buf); } ; #endif/* PRE_REFERENCED_DMA_MANAGER */
--- a/TaskManager/Fifo/ReferencedDmaManager.cc Sun Feb 19 10:07:27 2012 +0900 +++ b/TaskManager/Fifo/ReferencedDmaManager.cc Sun Feb 19 10:38:05 2012 +0900 @@ -31,7 +31,7 @@ } void -ReferencedDmaManager::free(void *buf) { +ReferencedDmaManager::free_(void *buf) { }
--- a/TaskManager/Fifo/ReferencedDmaManager.h Sun Feb 19 10:07:27 2012 +0900 +++ b/TaskManager/Fifo/ReferencedDmaManager.h Sun Feb 19 10:38:05 2012 +0900 @@ -9,7 +9,7 @@ /* functions */ virtual void *dma_load(Scheduler *s, void *buf, memaddr addr, uint32 size, uint32 mask); virtual void *dma_loadList(Scheduler *s, ListDataPtr list, void *buff, uint32 mask); - virtual void free(void *buff); + virtual void free_(void *buff); } ; #endif/* REFERENCED_DMA_MANAGER */
--- a/TaskManager/kernel/ppe/DmaBuffer.cc Sun Feb 19 10:07:27 2012 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include "types.h" -#include "DmaBuffer.h" - -#define ALIGN_DOWN(v, align) ((v)&(-align)) -#define ALIGN_UP(v, align) ALIGN_DOWN((v)+((align)-1), align) - - -DmaBuffer::DmaBuffer(int size) -{ -#ifndef HAS_POSIX_MEMALIGN - buffer[0] = malloc(size); - buffer[1] = malloc(size); -#else - posix_memalign(&buffer[0],64,size); - posix_memalign(&buffer[1],64,size); -#endif - flag = 0; -} - -DmaBuffer::~DmaBuffer(void) -{ - free(buffer[0]); - free(buffer[1]); -} - -void -DmaBuffer::swap_buffer(void) -{ - flag ^= 1; -} - -void -DmaBuffer::get_buffer(void *_dst) -{ - void **dst = (void**)_dst; - *dst = buffer[flag]; -}
--- a/TaskManager/kernel/ppe/DmaBuffer.h Sun Feb 19 10:07:27 2012 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -#ifndef INCLUDED_DMA_BUFFER -#define INCLUDED_DMA_BUFFER - -#include "base.h" - -class DmaBuffer { -public: - /* constructor */ - DmaBuffer(int size = 4); - ~DmaBuffer(void); - - BASE_NEW_DELETE(DmaBuffer); - - /* variables */ - void *buffer[2]; - int flag; // variable that select buffer[0 or 1] - - /* functions */ - void swap_buffer(void); - void get_buffer(void*); -} ; - -#endif
--- a/TaskManager/kernel/schedule/DmaManager.h Sun Feb 19 10:07:27 2012 +0900 +++ b/TaskManager/kernel/schedule/DmaManager.h Sun Feb 19 10:38:05 2012 +0900 @@ -25,7 +25,7 @@ // API for DMA transfer virtual void *dma_load(Scheduler *s, void *buf, memaddr addr, uint32 size, uint32 mask) { return 0; } virtual void *dma_store(void *buf,memaddr addr, uint32 size, uint32 mask) { return 0; } - virtual void free(void *buf) { free(buf); } + virtual void free_(void *buf) { free(buf); } virtual void *get_writebuf(Scheduler *s, memaddr addr, uint32 size) { return 0; } virtual void dma_wait(uint32 mask) {} virtual void dma_wait(uint32 mask, int cmd) {}
--- a/TaskManager/kernel/schedule/SchedTask.cc Sun Feb 19 10:07:27 2012 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.cc Sun Feb 19 10:38:05 2012 +0900 @@ -95,7 +95,7 @@ } connector->dma_wait(DMA_READ + this->tag); run(this, readbuf, writebuf); - connector->free(readbuf); + connector->free_(readbuf); // 書き込む領域がなければ無視 @@ -110,7 +110,7 @@ __debug("[SchedTask:%s]\n", __FUNCTION__); connector->dma_wait(DMA_WRITE); - connector->free(writebuf); + connector->free_(writebuf); #ifdef TASK_LIST_MAIL if (!(cur_index < list->length) ) connector->mail_write(waiter);
--- a/TaskManager/kernel/schedule/SchedTaskArray.cc Sun Feb 19 10:07:27 2012 +0900 +++ b/TaskManager/kernel/schedule/SchedTaskArray.cc Sun Feb 19 10:38:05 2012 +0900 @@ -104,8 +104,6 @@ free(outListData.bound); outListData.bound = (int*)manager->allocate(outListData.length*sizeof(int)); connector->bound(&outListData); - - // connector->free(writebuf); what?! writebuf = connector->get_writebuf(scheduler, &outListData, outListData.size); //if (outListData.element == inListData.element ) { // printf("bad %x\n",outListData.element); @@ -126,7 +124,7 @@ } connector->dma_wait((DMA_READ + this->tag)); run(this, get_input(readbuf, 0), get_output(writebuf, 0)); - connector->free(readbuf); + connector->free_(readbuf); // 書き込む領域がなければ無視 // User 側で作る方法が必要... @@ -146,7 +144,7 @@ { connector->dma_wait(DMA_WRITE); - connector->free(writebuf); + connector->free_(writebuf); free(inListData.bound); free(outListData.bound); }