Mercurial > hg > Members > kono > Cerium
changeset 369:03ae2929c931
change TaskManager.cc
author | aaa |
---|---|
date | Tue, 28 Jul 2009 19:42:59 +0900 |
parents | 126f90e8582c |
children | 4435c9990988 |
files | TaskManager/Makefile.def TaskManager/Makefile.fifo TaskManager/kernel/memory/MemList.cc TaskManager/kernel/memory/MemList.h TaskManager/kernel/memory/MemorySegment.h TaskManager/kernel/ppe/TaskManager.cc example/MemList/Makefile.macosx example/MemList/main.cc |
diffstat | 8 files changed, 39 insertions(+), 30 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Makefile.def Mon Jul 27 18:26:50 2009 +0900 +++ b/TaskManager/Makefile.def Tue Jul 28 19:42:59 2009 +0900 @@ -15,6 +15,9 @@ KERN_SYSTASK_SRCS = $(wildcard $(KERN_SYSTASK_DIR)/*.cc) KERN_SYSTASK_OBJS = $(KERN_SYSTASK_SRCS:.cc=.o) +KERN_MEM_DIR = $(KERN_DIR)/memory +KERN_MEM_SRCS = $(wildcard $(KERN_MEM_DIR)/*.cc) +KERN_MEM_OBJS = $(KERN_MEM_SRCS:.cc=.o) IMPL_FIFO_DIR = Fifo IMPL_FIFO_SRCS = $(wildcard $(IMPL_FIFO_DIR)/*.cc)
--- a/TaskManager/Makefile.fifo Mon Jul 27 18:26:50 2009 +0900 +++ b/TaskManager/Makefile.fifo Tue Jul 28 19:42:59 2009 +0900 @@ -12,7 +12,7 @@ all: default default: $(TARGET) -ALL_OBJS = $(KERN_MAIN_OBJS) $(KERN_PPE_OBJS) $(KERN_SCHED_OBJS) $(KERN_SYSTASK_OBJS) $(IMPL_FIFO_OBJS) +ALL_OBJS = $(KERN_MAIN_OBJS) $(KERN_PPE_OBJS) $(KERN_SCHED_OBJS) $(KERN_SYSTASK_OBJS) $(IMPL_FIFO_OBJS) $(KERN_MEM_OBJS) $(TARGET): $(ALL_OBJS) ar crus $@ $(ALL_OBJS)
--- a/TaskManager/kernel/memory/MemList.cc Mon Jul 27 18:26:50 2009 +0900 +++ b/TaskManager/kernel/memory/MemList.cc Tue Jul 28 19:42:59 2009 +0900 @@ -2,14 +2,14 @@ MemList は空にならない。最低1個は要素が入っていて 1個目は特別扱いする。getFirst すると first->next を返す */ - -#include "MemorySegment.h" +#include <stdio.h> +#include "MemList.h" /*! 最初の1個は特別扱いなので、それの後に追加していく */ void -addFirst(MemorySegment* e) +MemList::addFirst(MemorySegment* e) { e->prev = first; e->next = first->next; @@ -18,7 +18,7 @@ } void -addLast(MemorySegment* e) +MemList::addLast(MemorySegment* e) { e->next = first; e->prev = last; @@ -26,20 +26,20 @@ last = e; } -MemorySegment -getFirst() +MemorySegment* +MemList::getFirst() { return first->next; } -MemorySegment -getLast() +MemorySegment* +MemList::getLast() { return last; } int -remove(MemorySegment* e) +MemList::remove(MemorySegment* e) { e->prev->next = e->next; if (e->next != NULL) { @@ -52,7 +52,7 @@ } void -moveToFirst(MemorySegment* e) +MemList::moveToFirst(MemorySegment* e) { remove(e); addFirst(e);
--- a/TaskManager/kernel/memory/MemList.h Mon Jul 27 18:26:50 2009 +0900 +++ b/TaskManager/kernel/memory/MemList.h Tue Jul 28 19:42:59 2009 +0900 @@ -1,6 +1,10 @@ +#ifndef MEMLIST +#define MEMLIST + #include "MemorySegment.h" class MemList { +public: MemorySegment* first; MemorySegment* last; @@ -20,3 +24,4 @@ void moveToFirst(MemorySegment* e); // or use(); }; +#endif
--- a/TaskManager/kernel/memory/MemorySegment.h Mon Jul 27 18:26:50 2009 +0900 +++ b/TaskManager/kernel/memory/MemorySegment.h Tue Jul 28 19:42:59 2009 +0900 @@ -1,12 +1,14 @@ -#ifndef MEMLIST -#define MEMLIST +#ifndef MEMLSEG +#define MEMLSEG +#include "types.h" class MemorySegment { +public: MemorySegment* next; MemorySegment* prev; - uint64 size; - uint64 address; - uint64 dummy; + uint32 size; + uint32 address; + uint32 dummy; }; #endif
--- a/TaskManager/kernel/ppe/TaskManager.cc Mon Jul 27 18:26:50 2009 +0900 +++ b/TaskManager/kernel/ppe/TaskManager.cc Tue Jul 28 19:42:59 2009 +0900 @@ -93,16 +93,14 @@ */ MemList* -createMemList(uint32 size, uint32 count) +TaskManager::createMemList(uint32 size, uint32 count) { - uint32 head_size = - round_up16(sizeof(MemorySegment)); - uint32 seg_size = - round_up16(head_size+size); - void* mseg = m_impl->allocate(seg_size*count); + uint32 head_size = round_up16(sizeof(MemorySegment)); + uint32 seg_size = round_up16(head_size+size); + char* mseg = (char*)m_impl->allocate(seg_size*count); MemList* mlist = new MemList((MemorySegment*)mseg); - for(int i = 1; i < count; i++) { + for(uint32 i = 1; i < count; i++) { MemorySegment* next = (MemorySegment*)(mseg+seg_size*i); mlist->addLast(next); }
--- a/example/MemList/Makefile.macosx Mon Jul 27 18:26:50 2009 +0900 +++ b/example/MemList/Makefile.macosx Tue Jul 28 19:42:59 2009 +0900 @@ -3,7 +3,7 @@ SRCS_TMP = $(wildcard *.cc) SRCS_EXCLUDE = # ե SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP)) -OBJS = $(SRCS:.cc=.o) MemList.o MemorySegment.o +OBJS = $(SRCS:.cc=.o) TASK_DIR = ppe TASK_SRCS_TMP = $(wildcard $(TASK_DIR)/*.cc) @@ -20,10 +20,8 @@ all: $(TARGET) -MemList.o: ${CERIUM}/kernel/memory/MemList.cc - -MemorySegment.o: ${CERIUM}/kernel/memory/MemorySegment.cc - +#MemList.o: ${CERIUM}/kernel/memory/MemList.cc + $(TARGET): $(OBJS) $(TASK_OBJS) $(CC) -o $@ $(OBJS) $(TASK_OBJS) $(LIBS)
--- a/example/MemList/main.cc Mon Jul 27 18:26:50 2009 +0900 +++ b/example/MemList/main.cc Tue Jul 28 19:42:59 2009 +0900 @@ -19,11 +19,14 @@ int TMmain(int argc, char *argv[]) { + + printf("test\n"); uint32 size = 128; uint32 count = 64; - MemList* active = createMemList(size, 0); - MemList* freelist = createMemList(size, count); + + MemList* active = manager->createMemList(size, 0); + MemList* freelist = manager->createMemList(size, count); // 配列! MemorySegment* e;