# HG changeset patch # User Nina Engelhardt # Date 1314618148 -7200 # Node ID 9abe1ac89aca28786e39593b80b12d886fe94fdf # Parent cd2d0a81e3f79b595f5d14e15ecb9c4535ddb44e Update assembler code to 64bit diff -r cd2d0a81e3f7 -r 9abe1ac89aca SSR.s --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SSR.s Mon Aug 29 13:42:28 2011 +0200 @@ -0,0 +1,21 @@ + +//Assembly code takes the return addr off the stack and saves +// into the singleton. The first field in the singleton is the +// "endInstrAddr" field, and the return addr is at 0x4(%ebp) +.globl asm_save_ret_to_singleton +asm_save_ret_to_singleton: + movq 0x8(%rbp), %rax #get ret address, ebp is the same as in the calling function + movq %rax, (%rdi) #write ret addr to endInstrAddr field + ret + + +//Assembly code changes the return addr on the stack to the one +// saved into the singleton by the end-singleton-fn +//The stack's return addr is at 0x4(%%ebp) +.globl asm_write_ret_from_singleton +asm_write_ret_from_singleton: + movq (%rdi), %rax #get endInstrAddr field + movq %rax, 0x8(%rbp) #write return addr to the stack of the caller + ret + + diff -r cd2d0a81e3f7 -r 9abe1ac89aca SSR_PluginFns.c --- a/SSR_PluginFns.c Thu Jun 02 14:35:03 2011 +0200 +++ b/SSR_PluginFns.c Mon Aug 29 13:42:28 2011 +0200 @@ -33,6 +33,8 @@ * to the slave -- return FALSE to let Master loop know scheduling that * slave failed. */ +char __Scheduler[] = "FIFO Scheduler"; //Gobal variable for name in saved histogram + VirtProcr * SSR__schedule_virt_procr( void *_semEnv, int coreNum ) { VirtProcr *schedPr; diff -r cd2d0a81e3f7 -r 9abe1ac89aca SSR_lib.c --- a/SSR_lib.c Thu Jun 02 14:35:03 2011 +0200 +++ b/SSR_lib.c Mon Aug 29 13:42:28 2011 +0200 @@ -494,6 +494,10 @@ * trying to get the data through from different cores. */ +/*asm function declarations*/ +void asm_save_ret_to_singleton(SSRSingleton *singletonPtrAddr); +void asm_write_ret_from_singleton(SSRSingleton *singletonPtrAddr); + /*Fn singleton uses ID as index into array of singleton structs held in the * semantic environment. */ @@ -509,12 +513,8 @@ VMS__send_sem_request( &reqData, animPr ); if( animPr->dataRetFromReq ) //will be 0 or addr of label in end singleton { - asm volatile("movl %0, %%eax; \ - jmp *%%eax" \ - /* outputs */ : \ - /* inputs */ : "g"(animPr->dataRetFromReq) \ - /* clobber */ : "memory", "%eax", "%ebx", "%ecx", "%edx","%edi","%esi"\ - ); + SSRSemEnv *semEnv = VMS__give_sem_env_for( animPr ); + asm_write_ret_from_singleton(&(semEnv->fnSingletons[ singletonID])); } } @@ -527,7 +527,8 @@ { SSRSemReq reqData; - if( *singletonAddr && (*singletonAddr)->hasFinished ) goto JmpToEndSingleton; + if( *singletonAddr && (*singletonAddr)->hasFinished ) + goto JmpToEndSingleton; reqData.reqType = singleton_data_start; reqData.singletonPtrAddr = singletonAddr; @@ -537,15 +538,8 @@ { //Assembly code changes the return addr on the stack to the one // saved into the singleton by the end-singleton-fn //The return addr is at 0x4(%%ebp) - JmpToEndSingleton: - asm volatile("movl %0, %%eax; \ - movl (%%eax), %%ebx; \ - movl (%%ebx), %%eax; \ - movl %%eax, 0x4(%%ebp);" \ - /* outputs */ : \ - /* inputs */ : "m"(singletonAddr) \ - /* clobber */ : "memory", "%eax", "%ebx", "%ecx", "%edx","%edi","%esi"\ - ); + JmpToEndSingleton: + asm_write_ret_from_singleton(*singletonAddr); } //now, simply return //will exit either from the start singleton call or the end-singleton call @@ -565,7 +559,7 @@ //don't need this addr until after at least one singleton has reached // this function SSRSemEnv *semEnv = VMS__give_sem_env_for( animPr ); - semEnv->fnSingletons[ singletonID].endInstrAddr = &&EndSingletonInstrAddr; + asm_write_ret_from_singleton(&(semEnv->fnSingletons[ singletonID])); reqData.reqType = singleton_fn_end; reqData.singletonID = singletonID; @@ -589,17 +583,8 @@ // function in different places for different data-singletons. // (*(singletonAddr))->endInstrAddr = &&EndDataSingletonInstrAddr; - //Assembly code takes the return addr off the stack and saves - // into the singleton. The first field in the singleton is the - // "endInstrAddr" field, and the return addr is at 0x4(%%ebp) - asm volatile("movl 0x4(%%ebp), %%eax; \ - movl %0, %%ebx; \ - movl (%%ebx), %%ecx; \ - movl %%eax, (%%ecx);" \ - /* outputs */ : \ - /* inputs */ : "m"(singletonPtrAddr) \ - /* clobber */ : "memory", "%eax", "%ebx", "%ecx", "%edx","%edi","%esi"\ - ); + + asm_save_ret_to_singleton(*singletonPtrAddr); reqData.reqType = singleton_data_end; reqData.singletonPtrAddr = singletonPtrAddr;