# HG changeset patch # User Me # Date 1277000724 25200 # Node ID 09ff1aeb5d8d78aa3c70d900d73fe38da9f7a4bd # Parent a87d02855dee68649b3dc2ad0749acca38d88f32 Middle of testing core loop diff -r a87d02855dee -r 09ff1aeb5d8d CoreLoop.c --- a/CoreLoop.c Tue Jun 01 05:33:40 2010 -0700 +++ b/CoreLoop.c Sat Jun 19 19:25:24 2010 -0700 @@ -23,19 +23,19 @@ DWORD WINAPI coreLoop( LPVOID paramsIn ) { - ThdParams *thdParams; - VirtProcr *currPr; - QueueStruc *workQ; + ThdParams *coreLoopThdParams; + VirtProcr *currPr; + CASQueueStruc *workQ; // Get the communication queues out of the param passed in - thdParams = (ThdParams *)paramsIn; + coreLoopThdParams = (ThdParams *)paramsIn; //Winblows requires pinning thd to core inside thread-function //Designate a core by a 1 in bit-position corresponding to the core - SetThreadAffinityMask(GetCurrentThread(), 1 << thdParams->coreNum ); + SetThreadAffinityMask(GetCurrentThread(),1 << coreLoopThdParams->coreNum); //for non-gcc, can make macro that does asm that calls dummy that // pulls addr off the stack and stores it in pointed-to location. - thdParams->endThdPt = &&EndCoreLoop; + coreLoopThdParams->endThdPt = &&EndCoreLoop; //Core loop has no values live upon CoreLoopStartPt except workQ // every value in the code is defined by a statement in core loop, @@ -50,7 +50,7 @@ //_VMSWorkQ must be a global, static volatile var, so not kept in reg, // which forces reloading the pointer after each jmp to this point workQ = _VMSWorkQ; - currPr = (VirtProcr *) readQ( workQ ); + currPr = (VirtProcr *) readCASQ( workQ ); currPr->coreLoopStartPt = &&CoreLoopStartPt; //just to be sure.. //switch to virt procr's stack and frame ptr then jump to virt procr @@ -59,7 +59,10 @@ stackPtr = currPr->stackPtr; framePtr = currPr->framePtr; jmpPt = currPr->nextInstrPt; - + + //TODO: careful with this -- use printfs -- in test, thds 0 and 3 have + // SAME STACK PTR!! Might be a something going on -- each thd should + // have its own unique stack.. asm volatile("movl %0, %%esp; \ movl %1, %%ebp; \ jmp %2"