Mercurial > hg > Game > Cerium
changeset 461:009a2db963de draft
overlay worked.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 29 Sep 2009 13:01:22 +0900 |
parents | 433892ba596b |
children | ca987c0beb11 |
files | TaskManager/kernel/schedule/Scheduler.cc example/get_segment/.gdbinit example/get_segment/spe/Makefile example/get_segment/spe/ovly_table.pl |
diffstat | 4 files changed, 53 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/kernel/schedule/Scheduler.cc Tue Sep 29 11:51:25 2009 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.cc Tue Sep 29 13:01:22 2009 +0900 @@ -338,12 +338,17 @@ static void load_task(Scheduler *m, int task_id) { - fprintf(stderr,"loadng task id %d\n",task_id); MemorySegment *s = m->get_segment( task_list[task_id].location, m->code_segment_pool, task_list[task_id].end-task_list[task_id].location); task_list[task_id].segment = s; + + fprintf(stderr,"loadng task id %d at 0x%x entry 0x%x\n",task_id, + (unsigned int)(task_list[task_id].segment->data ), + (unsigned int)( + (char*)task_list[task_id].segment->data + + task_list[task_id].entry_offset)); } static void
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/example/get_segment/.gdbinit Tue Sep 29 13:01:22 2009 +0900 @@ -0,0 +1,16 @@ +set spu stop-on-load +run +overlay auto +define regs +end +define si +stepi +regs +x/1i $pc +end +define ni +nexti +regs +x/1i $pc +end +
--- a/example/get_segment/spe/Makefile Tue Sep 29 11:51:25 2009 +0900 +++ b/example/get_segment/spe/Makefile Tue Sep 29 13:01:22 2009 +0900 @@ -6,11 +6,13 @@ # SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP)) SPEOBJS = $(SRCS:.cc=.o) OVLOBJS = Hello.o Hello1.o +OLEVEL = 0 CC = spu-g++ INCLUDE = -I../${CERIUM}/include/TaskManager -I. -I.. -CFLAGS1 = $(INCLUDE) -O1 -g -Wall -fno-exceptions -fno-rtti #-DDEBUG -CFLAGS = -DNO_OVERLAY=1 $(CFLAGS1) +CFLAGS1 = $(INCLUDE) -O$(OLEVEL) -g -Wall -fno-exceptions -fno-rtti #-DDEBUG +# CFLAGS = -DNO_OVERLAY=1 $(CFLAGS1) +CFLAGS = $(CFLAGS1) LIBS = -L../${CERIUM}/TaskManager -lspemanager -Wl,--gc-sections SPELIBS = -Wl,-T,$(LDSCRIPT) -Wl,-N $(LIBS) @@ -25,13 +27,13 @@ .SUFFIXES: .cc .o -$(OFFSET_H) : $(OVLOBJS:.o=.cc) ovly_table.pl - perl ovly_table.pl $(TARGET) $(OVLOBJS:.o=.cc) > $(OFFSET_H) +$(OFFSET_H) $(LDSCRIPT_ED): $(OVLOBJS:.o=.cc) ovly_table.pl + perl ovly_table.pl $(TARGET) $(OVLOBJS:.o=.cc) $(SPEOBJS): %.o : %.cc $(OFFSET_H) $(CC) $(CFLAGS) -c $< -o $@ -$(OVLOBJS): %.o : %.cc +$(OVLOBJS): %.o : %.cc $(OFFSET_H) $(CC) $(CFLAGS) -c $< -S -o $(<:.cc=.s) perl fixpic.pl $(<:.cc=.s) | $(CC) $(SPECFLAGS) -x assembler -c -o $@ -
--- a/example/get_segment/spe/ovly_table.pl Tue Sep 29 11:51:25 2009 +0900 +++ b/example/get_segment/spe/ovly_table.pl Tue Sep 29 13:01:22 2009 +0900 @@ -97,6 +97,9 @@ my $base = $elf->segment(".segment0")->{addr}; +my @ldfiles; +my $ldsegment = ""; + open(H,">createTask_offset.h"); for my $header (@ARGV) { open(HD,"<$header") or die("Can't open $header"); @@ -106,9 +109,30 @@ my $segment = $2; my $entry = $elf->symbol("createTask_$class")->{value}; print H "#define createTask_${class}_offset (0x$entry-0x$base)\n"; + my $ofile = $header; + $ofile =~ s/\.cc/.o/; + push(@ldfiles,$ofile); + $ldsegment .= " .segment$segment { $ofile(.text) }\n"; last; } } } +my $ld_script = <<"EOFEOF"; +/ \\.text / +/\\\*\(\\.text/ +s/\\\*\(\\.text/\*\( EXCLUDE_FILE(@ldfiles) .text/ +/} =0/ +a + OVERLAY : + { +$ldsegment + } +. +w +EOFEOF + +open(H,">ldscript.ed"); +print H $ld_script; + # end