changeset 10:09ff1aeb5d8d

Middle of testing core loop
author Me
date Sat, 19 Jun 2010 19:25:24 -0700
parents a87d02855dee
children e2de204909bf
files CoreLoop.c
diffstat 1 files changed, 11 insertions(+), 8 deletions(-) [+]
line diff
     1.1 --- a/CoreLoop.c	Tue Jun 01 05:33:40 2010 -0700
     1.2 +++ b/CoreLoop.c	Sat Jun 19 19:25:24 2010 -0700
     1.3 @@ -23,19 +23,19 @@
     1.4  DWORD WINAPI
     1.5  coreLoop( LPVOID paramsIn )
     1.6   {   
     1.7 -   ThdParams   *thdParams;
     1.8 -   VirtProcr   *currPr;
     1.9 -   QueueStruc  *workQ;
    1.10 +   ThdParams      *coreLoopThdParams;
    1.11 +   VirtProcr      *currPr;
    1.12 +   CASQueueStruc  *workQ;
    1.13     
    1.14        // Get the communication queues out of the param passed in
    1.15 -   thdParams = (ThdParams *)paramsIn;
    1.16 +   coreLoopThdParams = (ThdParams *)paramsIn;
    1.17        //Winblows requires pinning thd to core inside thread-function
    1.18        //Designate a core by a 1 in bit-position corresponding to the core
    1.19 -   SetThreadAffinityMask(GetCurrentThread(), 1 << thdParams->coreNum );
    1.20 +   SetThreadAffinityMask(GetCurrentThread(),1 << coreLoopThdParams->coreNum);
    1.21  
    1.22        //for non-gcc, can make macro that does asm that calls dummy that
    1.23        // pulls addr off the stack and stores it in pointed-to location.
    1.24 -   thdParams->endThdPt = &&EndCoreLoop;
    1.25 +   coreLoopThdParams->endThdPt = &&EndCoreLoop;
    1.26     
    1.27        //Core loop has no values live upon CoreLoopStartPt except workQ
    1.28        // every value in the code is defined by a statement in core loop,
    1.29 @@ -50,7 +50,7 @@
    1.30        //_VMSWorkQ must be a global, static volatile var, so not kept in reg,
    1.31        // which forces reloading the pointer after each jmp to this point
    1.32     workQ  = _VMSWorkQ;
    1.33 -   currPr = (VirtProcr *) readQ( workQ );
    1.34 +   currPr = (VirtProcr *) readCASQ( workQ );
    1.35     currPr->coreLoopStartPt = &&CoreLoopStartPt;  //just to be sure..
    1.36  
    1.37        //switch to virt procr's stack and frame ptr then jump to virt procr
    1.38 @@ -59,7 +59,10 @@
    1.39     stackPtr = currPr->stackPtr;
    1.40     framePtr = currPr->framePtr;
    1.41     jmpPt    = currPr->nextInstrPt;
    1.42 -   
    1.43 +
    1.44 +      //TODO: careful with this -- use printfs -- in test, thds 0 and 3 have
    1.45 +      // SAME STACK PTR!!  Might be a something going on -- each thd should
    1.46 +      // have its own unique stack..
    1.47     asm volatile("movl %0, %%esp; \
    1.48                   movl %1, %%ebp; \
    1.49                   jmp  %2"