diff VMS.c @ 77:fe5ec83f1baf

separated hardware dependent code
author Merten Sach <msach@mailbox.tu-berlin.de>
date Wed, 22 Jun 2011 16:12:27 +0200
parents 9ddbb071142d
children 521c75d64cef
line diff
     1.1 --- a/VMS.c	Thu Jun 16 14:41:15 2011 +0200
     1.2 +++ b/VMS.c	Wed Jun 22 16:12:27 2011 +0200
     1.3 @@ -12,7 +12,7 @@
     1.4  #include <sys/time.h>
     1.5  
     1.6  #include "VMS.h"
     1.7 -#include "SwitchAnimators.h"
     1.8 +#include "ProcrContext.h"
     1.9  #include "Queue_impl/BlockingQueue.h"
    1.10  #include "Histogram/Histogram.h"
    1.11  
    1.12 @@ -282,65 +282,6 @@
    1.13   }
    1.14  #endif
    1.15  
    1.16 -/*Create stack, then create __cdecl structure on it and put initialData and
    1.17 - * pointer to the new structure instance into the parameter positions on
    1.18 - * the stack
    1.19 - *Then put function pointer into nextInstrPt -- the stack is setup in std
    1.20 - * call structure, so jumping to function ptr is same as a GCC generated
    1.21 - * function call
    1.22 - *No need to save registers on old stack frame, because there's no old
    1.23 - * animator state to return to --
    1.24 - *
    1.25 - */
    1.26 -inline VirtProcr *
    1.27 -create_procr_helper( VirtProcr *newPr,       VirtProcrFnPtr  fnPtr,
    1.28 -                     void      *initialData, void           *stackLocs )
    1.29 - {
    1.30 -   void  *stackPtr;
    1.31 -
    1.32 -   newPr->startOfStack = stackLocs;
    1.33 -   newPr->procrID      = _VMSMasterEnv->numProcrsCreated++;
    1.34 -   newPr->initialData  = initialData;
    1.35 -   newPr->requests     = NULL;
    1.36 -   newPr->schedSlot    = NULL;
    1.37 -
    1.38 -   /*
    1.39 -    * Hardware dependent part           
    1.40 -    */
    1.41 -   //instead of calling the function directly, call a wrapper function to fetch
    1.42 -   //arguments from stack
    1.43 -   newPr->nextInstrPt  = (VirtProcrFnPtr)&startVirtProcrFn;
    1.44 -   
    1.45 -    //fnPtr takes two params -- void *initData & void *animProcr
    1.46 -    //alloc stack locations, make stackPtr be the highest addr minus room
    1.47 -    // for 2 params + return addr.  Return addr (NULL) is in loc pointed to
    1.48 -    // by stackPtr, initData at stackPtr + 8 bytes, animatingPr just above
    1.49 -   stackPtr = ( (void *)stackLocs + VIRT_PROCR_STACK_SIZE - 4*sizeof(void*));
    1.50 -   
    1.51 -      //setup __cdecl on stack -- coreloop will switch to stackPtr before jmp
    1.52 -   *((VirtProcr**)stackPtr + 2 ) = newPr; //rightmost param
    1.53 -   *((void**)stackPtr + 1 ) = initialData;  //next  param to left
    1.54 -   *((void**)stackPtr) = (void*)fnPtr;
    1.55 -   
    1.56 -   /*
    1.57 -    * end of Hardware dependent part           
    1.58 -    */
    1.59 -   
    1.60 -   newPr->stackPtr = stackPtr; //core loop will switch to this, then
    1.61 -   newPr->framePtr = stackPtr; //suspend loop will save new stack & frame ptr
    1.62 -
    1.63 -   //============================= MEASUREMENT STUFF ========================
    1.64 -   #ifdef STATS__TURN_ON_PROBES
    1.65 -   struct timeval timeStamp;
    1.66 -   gettimeofday( &(timeStamp), NULL);
    1.67 -   newPr->createPtInSecs = timeStamp.tv_sec +(timeStamp.tv_usec/1000000.0) -
    1.68 -                                               _VMSMasterEnv->createPtInSecs;
    1.69 -   #endif
    1.70 -   //========================================================================
    1.71 -
    1.72 -   return newPr;
    1.73 - }
    1.74 -
    1.75  inline VirtProcr *
    1.76  VMS__create_procr( VirtProcrFnPtr fnPtr, void *initialData )
    1.77   { VirtProcr *newPr;