From: jzhou Date: Thu, 17 Jul 2008 01:56:10 +0000 (+0000) Subject: fix up interruption related bug in RAW version. Use our own interruption setup codes... X-Git-Tag: preEdgeChange~61 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=239617d8fad868fa854c6c540126fd22a343d57d;p=IRC.git fix up interruption related bug in RAW version. Use our own interruption setup codes instead of using libints which is out of date. --- diff --git a/Robust/src/Makefile.raw.1 b/Robust/src/Makefile.raw.1 index 13c961e1..beb104ed 100644 --- a/Robust/src/Makefile.raw.1 +++ b/Robust/src/Makefile.raw.1 @@ -2,18 +2,17 @@ TOPDIR=/home/jzhou/starsearch include $(TOPDIR)/Makefile.include RGCCFLAGS += -O2 -RGCCFLAGS += -DTASK -DMULTICORE -DRAW +RGCCFLAGS += -DTASK -DMULTICORE -DRAW -DY1 SIM-CYCLES = 10000 ATTRIBUTES += HWIC TILE_PATTERN = 4x1 -#INCLUDES += -I. OBJECT_FILES_COMMON = multicoretask.o multicoreruntime.o Queue.o file.o math.o object.o \ GenericHashtable.o SimpleHash.o ObjectHash.o socket.o checkpoint.o\ - taskdefs.o methods.o raw_dataCache.o mem.o + taskdefs.o methods.o mem.o raw_dataCache.o raw_interrupt.o # this is for a multi-tile test include $(COMMONDIR)/Makefile.all diff --git a/Robust/src/Makefile.raw.2 b/Robust/src/Makefile.raw.2 index 07161357..d063a413 100644 --- a/Robust/src/Makefile.raw.2 +++ b/Robust/src/Makefile.raw.2 @@ -2,18 +2,17 @@ TOPDIR=/home/jzhou/starsearch include $(TOPDIR)/Makefile.include RGCCFLAGS += -O2 -RGCCFLAGS += -DTASK -DMULTICORE -DRAW +RGCCFLAGS += -DTASK -DMULTICORE -DRAW -DY2 SIM-CYCLES = 10000 ATTRIBUTES += HWIC TILE_PATTERN = 4x2 -#INCLUDES += -I. OBJECT_FILES_COMMON = multicoretask.o multicoreruntime.o Queue.o file.o math.o object.o \ - GenericHashtable.o SimpleHash.o ObjectHash.o socket.o checkpoint.o\ - taskdefs.o methods.o raw_dataCache.o mem.o + GenericHashtable.o SimpleHash.o ObjectHash.o socket.o checkpoint.o\ + taskdefs.o methods.o mem.o raw_dataCache.o raw_interrupt.o # this is for a multi-tile test include $(COMMONDIR)/Makefile.all diff --git a/Robust/src/Makefile.raw.4 b/Robust/src/Makefile.raw.4 index 07f53da9..0bf349bb 100644 --- a/Robust/src/Makefile.raw.4 +++ b/Robust/src/Makefile.raw.4 @@ -2,18 +2,17 @@ TOPDIR=/home/jzhou/starsearch include $(TOPDIR)/Makefile.include RGCCFLAGS += -O2 -RGCCFLAGS += -DTASK -DMULTICORE -DRAW +RGCCFLAGS += -DTASK -DMULTICORE -DRAW -DY4 SIM-CYCLES = 10000 ATTRIBUTES += HWIC TILE_PATTERN = 4x4 -#INCLUDES += -I. OBJECT_FILES_COMMON = multicoretask.o multicoreruntime.o Queue.o file.o math.o object.o \ GenericHashtable.o SimpleHash.o ObjectHash.o socket.o checkpoint.o\ - taskdefs.o methods.o raw_dataCache.o mem.o + taskdefs.o methods.o mem.o raw_dataCache.o raw_interrupt.o # this is for a multi-tile test include $(COMMONDIR)/Makefile.all diff --git a/Robust/src/Makefile.raw.i.1 b/Robust/src/Makefile.raw.i.1 index 1196a51e..fe4c9f8f 100644 --- a/Robust/src/Makefile.raw.i.1 +++ b/Robust/src/Makefile.raw.i.1 @@ -2,18 +2,17 @@ TOPDIR=/home/jzhou/starsearch include $(TOPDIR)/Makefile.include RGCCFLAGS += -O2 -RGCCFLAGS += -DTASK -DMULTICORE -DRAW -DINTERRUPT +RGCCFLAGS += -DTASK -DMULTICORE -DRAW -DINTERRUPT -DY1 SIM-CYCLES = 10000 ATTRIBUTES += HWIC TILE_PATTERN = 4x1 -#INCLUDES += -I. OBJECT_FILES_COMMON = multicoretask.o multicoreruntime.o Queue.o file.o math.o object.o \ GenericHashtable.o SimpleHash.o ObjectHash.o socket.o checkpoint.o\ - taskdefs.o methods.o raw_dataCache.o mem.o + taskdefs.o methods.o mem.o raw_dataCache.o raw_interrupt.o # this is for a multi-tile test include $(COMMONDIR)/Makefile.all diff --git a/Robust/src/Makefile.raw.i.2 b/Robust/src/Makefile.raw.i.2 index 231ebb3b..4e557a1d 100644 --- a/Robust/src/Makefile.raw.i.2 +++ b/Robust/src/Makefile.raw.i.2 @@ -2,18 +2,17 @@ TOPDIR=/home/jzhou/starsearch include $(TOPDIR)/Makefile.include RGCCFLAGS += -O2 -RGCCFLAGS += -DTASK -DMULTICORE -DRAW -DINTERRUPT +RGCCFLAGS += -DTASK -DMULTICORE -DRAW -DINTERRUPT -DY2 SIM-CYCLES = 10000 ATTRIBUTES += HWIC TILE_PATTERN = 4x2 -#INCLUDES += -I. OBJECT_FILES_COMMON = multicoretask.o multicoreruntime.o Queue.o file.o math.o object.o \ GenericHashtable.o SimpleHash.o ObjectHash.o socket.o checkpoint.o\ - taskdefs.o methods.o raw_dataCache.o mem.o + taskdefs.o methods.o mem.o raw_dataCache.o raw_interrupt.o # this is for a multi-tile test include $(COMMONDIR)/Makefile.all diff --git a/Robust/src/Makefile.raw.i.4 b/Robust/src/Makefile.raw.i.4 index 3cc5b593..a2e5180b 100644 --- a/Robust/src/Makefile.raw.i.4 +++ b/Robust/src/Makefile.raw.i.4 @@ -2,18 +2,17 @@ TOPDIR=/home/jzhou/starsearch include $(TOPDIR)/Makefile.include RGCCFLAGS += -O2 -RGCCFLAGS += -DTASK -DMULTICORE -DRAW -DINTERRUPT +RGCCFLAGS += -DTASK -DMULTICORE -DRAW -DINTERRUPT -DY4 SIM-CYCLES = 10000 ATTRIBUTES += HWIC TILE_PATTERN = 4x4 -#INCLUDES += -I. OBJECT_FILES_COMMON = multicoretask.o multicoreruntime.o Queue.o file.o math.o object.o \ GenericHashtable.o SimpleHash.o ObjectHash.o socket.o checkpoint.o\ - taskdefs.o methods.o raw_dataCache.o mem.o + taskdefs.o methods.o mem.o raw_dataCache.o raw_interrupt.o # this is for a multi-tile test include $(COMMONDIR)/Makefile.all diff --git a/Robust/src/Runtime/mem.c b/Robust/src/Runtime/mem.c new file mode 100644 index 00000000..2de0dc97 --- /dev/null +++ b/Robust/src/Runtime/mem.c @@ -0,0 +1,50 @@ +#include "mem.h" + +#ifdef RAW +#include "runtime.h" +#include + +/*void * m_calloc(int m, int size) { + void * p = malloc(m*size); + int i = 0; + for(i = 0; i < size; ++i) { + *(char *)(p+i) = 0; + } + return p; +}*/ + +void * mycalloc(int m, int size) { + void * p = NULL; + int isize = 2*kCacheLineSize-4+(size-1)&(~kCacheLineMask); + raw_test_pass(0xdd00); +#ifdef INTERRUPT + // shut down interrupt + raw_user_interrupts_off(); +#endif + p = calloc(m, isize); + //p = m_calloc(m, isize); + raw_test_pass_reg(p); + raw_test_pass_reg((kCacheLineSize+((int)p-1)&(~kCacheLineMask))); +#ifdef INTERRUPT + // re-open interruption + raw_user_interrupts_on(); +#endif + return (void *)(kCacheLineSize+((int)p-1)&(~kCacheLineMask)); +} + +void * mycalloc_i(int m, int size) { + void * p = NULL; + int isize = 2*kCacheLineSize-4+(size-1)&(~kCacheLineMask); + raw_test_pass(0xdd00); + p = calloc(m, isize); + //p = m_calloc(m, isize); + raw_test_pass_reg(p); + raw_test_pass_reg((kCacheLineSize+((int)p-1)&(~kCacheLineMask))); + return (void *)(kCacheLineSize+((int)p-1)&(~kCacheLineMask)); +} + +void myfree(void * ptr) { + return; +} + +#endif diff --git a/Robust/src/Runtime/multicoretask.c b/Robust/src/Runtime/multicoretask.c index 6542bdd2..e00c5e4f 100644 --- a/Robust/src/Runtime/multicoretask.c +++ b/Robust/src/Runtime/multicoretask.c @@ -18,7 +18,7 @@ #ifdef RAW #include #include -#include +//#include #elif defined THREADSIMULATE // use POSIX message queue // for each core, its message queue named as @@ -201,8 +201,9 @@ int main(int argc, char **argv) { #ifdef INTERRUPT if (corenum < NUMCORES) { // set up interrupts - setup_interrupts(); - start_gdn_avail_ints(recvMsg); + setup_ints(); + //setup_interrupts(); + //start_gdn_avail_ints(recvMsg); raw_user_interrupts_on(); raw_test_pass(0xee04); } diff --git a/Robust/src/Runtime/raw_dataCache.s b/Robust/src/Runtime/raw_dataCache.s new file mode 100644 index 00000000..97230fad --- /dev/null +++ b/Robust/src/Runtime/raw_dataCache.s @@ -0,0 +1,31 @@ +.text +.global flushAddr +.global invalidateAddr +.global flushCacheline + + +flushAddr: +# arguments come in on $4 and $5 +# $4 has the address +# $5 has the length, eventually + + afl $4, 0 + jr $31 + + +invalidateAddr: +# arguments come in on $4 and $5 +# $4 has the address +# $5 has the length, eventually + + ainv $4, 0 + jr $31 + + +flushCacheline: +# arguments come in on $4 +# $4 has the base tag address + + tagfl $4 + jr $31 + diff --git a/Robust/src/Runtime/raw_interrupt.s b/Robust/src/Runtime/raw_interrupt.s new file mode 100644 index 00000000..1581b4e4 --- /dev/null +++ b/Robust/src/Runtime/raw_interrupt.s @@ -0,0 +1,82 @@ +#include + + .text + .align 2 + .globl setup_ints + .ent setup_ints +setup_ints: + # run main program + # set up switch +# mtsri SW_FREEZE, 1 +# la $8, __sw_main +# mtsr SW_PC, $8 +# nop +# mtsri SW_FREEZE, 0 + + # set up dynamic network + uintoff + intoff + + # set gdn_cfg +# la $8, ((XSIZE-1)<<27)|((YSIZE-1)<<22)|(XOFF<<17)|(YOFF<<12)|(LOG_XSIZE<<9) + xor $8,$8,$8 +#ifdef Y1 + aui $8,$8,(3<<11)|(0 <<6)|(0 <<1) + ori $8, (0 <<12)|(2<<9) +#elif defined Y2 + aui $8,$8,(3<<11)|(1 <<6)|(0 <<1) + ori $8, (0 <<12)|(2<<9) +#elif defined Y4 + aui $8,$8,(3<<11)|(3 <<6)|(0 <<1) + ori $8, (0 <<12)|(2<<9) +#else + aui $8,$8,(3<<11)|(3 <<6)|(0 <<1) + ori $8, (0 <<12)|(2<<9) +#endif + mtsr GDN_CFG,$8 +# mtsr PASS,$8 + + # set exception vector + la $3, interrupt_table +# mtsri PASS, 0xaaa +# mtsr PASS, $3 + mtsr EX_BASE_ADDR, $3 + + # set EX_MASK + mfsr $8,EX_MASK + ori $8,$8,0x20 # 1 << kVEC_GDN_AVAIL + mtsr EX_MASK,$8 + + inton + uinton + + .end setup_ints + + +.macro empty_vec fail_code + mtsri FAIL, \fail_code +1: b 1b + nop + nop +.endm + +interrupt_table: + +vec_gdn_refill: + empty_vec 0x2300 +vec_gdn_complete: + empty_vec 0x2301 +vec_trace: + empty_vec 0x2302 +vec_extern: + empty_vec 0x2303 +vec_timer: + empty_vec 0x2304 +vec_gdn_avail: + sw $2,-8($sp) +# la $2,gdn_avail_handler +# jr $2 + jal recvMsg +vec_event_counters: + empty_vec 0x2306 +