Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
view VMS.c @ 34:609c7222e4a6
Added tag Pin2Core for changeset e69579a0e797
| author | Me |
|---|---|
| date | Wed, 01 Sep 2010 08:26:46 -0700 |
| parents | c8823e0bb2b4 |
| children | 17d20e5cf924 |
line source
1 /*
2 * Copyright 2010 OpenSourceCodeStewardshipFoundation
3 *
4 * Licensed under BSD
5 */
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <malloc.h>
11 #include "VMS.h"
12 #include "Queue_impl/BlockingQueue.h"
15 #define thdAttrs NULL
17 //===========================================================================
18 void
19 shutdownFn( void *dummy, VirtProcr *dummy2 );
21 SchedSlot **
22 create_sched_slots();
24 void
25 create_masterEnv();
27 void
28 create_the_coreLoop_OS_threads();
30 pthread_mutex_t suspendLock = PTHREAD_MUTEX_INITIALIZER;
31 pthread_cond_t suspend_cond = PTHREAD_COND_INITIALIZER;
33 //===========================================================================
35 /*Setup has two phases:
36 * 1) Semantic layer first calls init_VMS, which creates masterEnv, and puts
37 * the master virt procr into the work-queue, ready for first "call"
38 * 2) Semantic layer then does its own init, which creates the seed virt
39 * procr inside the semantic layer, ready to schedule it when
40 * asked by the first run of the masterLoop.
41 *
42 *This part is bit weird because VMS really wants to be "always there", and
43 * have applications attach and detach.. for now, this VMS is part of
44 * the app, so the VMS system starts up as part of running the app.
45 *
46 *The semantic layer is isolated from the VMS internals by making the
47 * semantic layer do setup to a state that it's ready with its
48 * initial virt procrs, ready to schedule them to slots when the masterLoop
49 * asks. Without this pattern, the semantic layer's setup would
50 * have to modify slots directly to assign the initial virt-procrs, and put
51 * them into the readyToAnimateQ itself, breaking the isolation completely.
52 *
53 *
54 *The semantic layer creates the initial virt procr(s), and adds its
55 * own environment to masterEnv, and fills in the pointers to
56 * the requestHandler and slaveScheduler plug-in functions
57 */
59 /*This allocates VMS data structures, populates the master VMSProc,
60 * and master environment, and returns the master environment to the semantic
61 * layer.
62 */
63 void
64 VMS__init()
65 {
66 create_masterEnv();
67 create_the_coreLoop_OS_threads();
68 }
70 /*To initialize the sequential version, just don't create the threads
71 */
72 void
73 VMS__init_Seq()
74 {
75 create_masterEnv();
76 }
78 void
79 create_masterEnv()
80 { MasterEnv *masterEnv;
81 SRSWQueueStruc **readyToAnimateQs;
82 int coreIdx;
83 VirtProcr **masterVPs;
84 SchedSlot ***allSchedSlots; //ptr to array of ptrs
86 //Make the master env, which holds everything else
87 _VMSMasterEnv = malloc( sizeof(MasterEnv) );
88 masterEnv = _VMSMasterEnv;
89 //Need to set start pt here 'cause used by seed procr, which is created
90 // before the first core loop starts up. -- not sure how yet..
91 // masterEnv->coreLoopStartPt = ;
92 // masterEnv->coreLoopEndPt = ;
94 //Make a readyToAnimateQ for each core loop
95 readyToAnimateQs = malloc( NUM_CORES * sizeof(SRSWQueueStruc *) );
96 masterVPs = malloc( NUM_CORES * sizeof(VirtProcr *) );
98 //One array for each core, 3 in array, core's masterVP scheds all
99 allSchedSlots = malloc( NUM_CORES * sizeof(SchedSlot *) );
101 for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ )
102 {
103 readyToAnimateQs[ coreIdx ] = makeSRSWQ();
105 //Q: should give masterVP core-specific into as its init data?
106 masterVPs[ coreIdx ] = VMS__create_procr( &masterLoop, masterEnv );
107 masterVPs[ coreIdx ]->coreAnimatedBy = coreIdx;
108 allSchedSlots[ coreIdx ] = create_sched_slots(); //makes for one core
109 }
110 _VMSMasterEnv->readyToAnimateQs = readyToAnimateQs;
111 _VMSMasterEnv->masterVPs = masterVPs;
112 _VMSMasterEnv->allSchedSlots = allSchedSlots;
116 //Aug 19, 2010: no longer need to place initial masterVP into queue
117 // because coreLoop now controls -- animates its masterVP when no work
120 //==================== malloc substitute ========================
121 //
122 //Testing whether malloc is using thread-local storage and therefore
123 // causing unreliable behavior.
124 //Just allocate a massive chunk of memory and roll own malloc/free and
125 // make app use VMS__malloc_to, which will suspend and perform malloc
126 // in the master, taking from this massive chunk.
128 // initFreeList();
129 }
131 /*
132 void
133 initMasterMalloc()
134 {
135 _VMSMasterEnv->mallocChunk = malloc( MASSIVE_MALLOC_SIZE );
137 //The free-list element is the first several locations of an
138 // allocated chunk -- the address given to the application is pre-
139 // pended with both the ownership structure and the free-list struc.
140 //So, write the values of these into the first locations of
141 // mallocChunk -- which marks it as free & puts in its size.
142 listElem = (FreeListElem *)_VMSMasterEnv->mallocChunk;
143 listElem->size = MASSIVE_MALLOC_SIZE - NUM_PREPEND_BYTES
144 listElem->next = NULL;
145 }
147 void
148 dissipateMasterMalloc()
149 {
150 //Just foo code -- to get going -- doing as if free list were link-list
151 currElem = _VMSMasterEnv->freeList;
152 while( currElem != NULL )
153 {
154 nextElem = currElem->next;
155 masterFree( currElem );
156 currElem = nextElem;
157 }
158 free( _VMSMasterEnv->freeList );
159 }
160 */
162 SchedSlot **
163 create_sched_slots()
164 { SchedSlot **schedSlots;
165 int i;
167 schedSlots = malloc( NUM_SCHED_SLOTS * sizeof(SchedSlot *) );
169 for( i = 0; i < NUM_SCHED_SLOTS; i++ )
170 {
171 schedSlots[i] = malloc( sizeof(SchedSlot) );
173 //Set state to mean "handling requests done, slot needs filling"
174 schedSlots[i]->workIsDone = FALSE;
175 schedSlots[i]->needsProcrAssigned = TRUE;
176 }
177 return schedSlots;
178 }
181 void
182 freeSchedSlots( SchedSlot **schedSlots )
183 { int i;
184 for( i = 0; i < NUM_SCHED_SLOTS; i++ )
185 {
186 free( schedSlots[i] );
187 }
188 free( schedSlots );
189 }
192 void
193 create_the_coreLoop_OS_threads()
194 {
195 //========================================================================
196 // Create the Threads
197 int coreIdx, retCode;
199 //Need the threads to be created suspended, and wait for a signal
200 // before proceeding -- gives time after creating to initialize other
201 // stuff before the coreLoops set off.
202 _VMSMasterEnv->setupComplete = 0;
204 //Make the threads that animate the core loops
205 for( coreIdx=0; coreIdx < NUM_CORES; coreIdx++ )
206 { coreLoopThdParams[coreIdx] = malloc( sizeof(ThdParams) );
207 coreLoopThdParams[coreIdx]->coreNum = coreIdx;
209 retCode =
210 pthread_create( &(coreLoopThdHandles[coreIdx]),
211 thdAttrs,
212 &coreLoop,
213 (void *)(coreLoopThdParams[coreIdx]) );
214 if(retCode){printf("ERROR creating thread: %d\n", retCode); exit(0);}
215 }
216 }
218 /*Semantic layer calls this when it want the system to start running..
219 *
220 *This starts the core loops running then waits for them to exit.
221 */
222 void
223 VMS__start_the_work_then_wait_until_done()
224 { int coreIdx;
225 //Start the core loops running
226 //===========================================================================
227 TSCount startCount, endCount;
228 unsigned long long count = 0, freq = 0;
229 double runTime;
231 startCount = getTSCount();
233 //tell the core loop threads that setup is complete
234 //get lock, to lock out any threads still starting up -- they'll see
235 // that setupComplete is true before entering while loop, and so never
236 // wait on the condition
237 pthread_mutex_lock( &suspendLock );
238 _VMSMasterEnv->setupComplete = 1;
239 pthread_mutex_unlock( &suspendLock );
240 pthread_cond_broadcast( &suspend_cond );
243 //wait for all to complete
244 for( coreIdx=0; coreIdx < NUM_CORES; coreIdx++ )
245 {
246 pthread_join( coreLoopThdHandles[coreIdx], NULL );
247 }
249 //NOTE: do not clean up VMS env here -- semantic layer has to have
250 // a chance to clean up its environment first, then do a call to free
251 // the Master env and rest of VMS locations
254 endCount = getTSCount();
255 count = endCount - startCount;
257 runTime = (double)count / (double)TSCOUNT_FREQ;
259 printf("\n Time startup to shutdown: %f\n", runTime); fflush( stdin );
260 }
262 /*Only difference between version with an OS thread pinned to each core and
263 * the sequential version of VMS is VMS__init_Seq, this, and coreLoop_Seq.
264 */
265 void
266 VMS__start_the_work_then_wait_until_done_Seq()
267 {
268 //Instead of un-suspending threads, just call the one and only
269 // core loop (sequential version), in the main thread.
270 coreLoop_Seq( NULL );
272 }
276 /*Create stack, then create __cdecl structure on it and put initialData and
277 * pointer to the new structure instance into the parameter positions on
278 * the stack
279 *Then put function pointer into nextInstrPt -- the stack is setup in std
280 * call structure, so jumping to function ptr is same as a GCC generated
281 * function call
282 *No need to save registers on old stack frame, because there's no old
283 * animator state to return to --
284 *
285 */
286 VirtProcr *
287 VMS__create_procr( VirtProcrFnPtr fnPtr, void *initialData )
288 { VirtProcr *newPr;
289 char *stackLocs, *stackPtr;
291 newPr = malloc( sizeof(VirtProcr) );
292 newPr->procrID = numProcrsCreated++;
293 newPr->nextInstrPt = fnPtr;
294 newPr->initialData = initialData;
295 newPr->requests = NULL;
296 // newPr->coreLoopStartPt = _VMSMasterEnv->coreLoopStartPt;
298 //fnPtr takes two params -- void *initData & void *animProcr
299 //alloc stack locations, make stackPtr be the highest addr minus room
300 // for 2 params + return addr. Return addr (NULL) is in loc pointed to
301 // by stackPtr, initData at stackPtr + 4 bytes, animatingPr just above
302 stackLocs = malloc( VIRT_PROCR_STACK_SIZE );
303 if(stackLocs == 0)
304 {perror("malloc stack"); exit(1);}
305 newPr->startOfStack = stackLocs;
306 stackPtr = ( (char *)stackLocs + VIRT_PROCR_STACK_SIZE - 0x10 );
307 //setup __cdecl on stack -- coreloop will switch to stackPtr before jmp
308 *( (int *)stackPtr + 2 ) = (int) newPr; //rightmost param -- 32bit pointer
309 *( (int *)stackPtr + 1 ) = (int) initialData; //next param to left
310 newPr->stackPtr = stackPtr; //core loop will switch to this, then
311 newPr->framePtr = stackPtr; //suspend loop will save new stack & frame ptr
313 return newPr;
314 }
317 /*there is a label inside this function -- save the addr of this label in
318 * the callingPr struc, as the pick-up point from which to start the next
319 * work-unit for that procr. If turns out have to save registers, then
320 * save them in the procr struc too. Then do assembly jump to the CoreLoop's
321 * "done with work-unit" label. The procr struc is in the request in the
322 * slave that animated the just-ended work-unit, so all the state is saved
323 * there, and will get passed along, inside the request handler, to the
324 * next work-unit for that procr.
325 */
326 void
327 VMS__suspend_procr( VirtProcr *callingPr )
328 { void *jmpPt, *stackPtrAddr, *framePtrAddr, *coreLoopStackPtr;
329 void *coreLoopFramePtr;
331 //The request to master will cause this suspended virt procr to get
332 // scheduled again at some future point -- to resume, core loop jumps
333 // to the resume point (below), which causes restore of saved regs and
334 // "return" from this call.
335 callingPr->nextInstrPt = &&ResumePt;
337 //return ownership of the virt procr and sched slot to Master virt pr
338 callingPr->schedSlot->workIsDone = TRUE;
339 // coreIdx = callingPr->coreAnimatedBy;
341 stackPtrAddr = &(callingPr->stackPtr);
342 framePtrAddr = &(callingPr->framePtr);
344 jmpPt = _VMSMasterEnv->coreLoopStartPt;
345 coreLoopFramePtr = callingPr->coreLoopFramePtr;//need this only
346 coreLoopStackPtr = callingPr->coreLoopStackPtr;//shouldn't need -- safety
348 //Eclipse's compilation sequence complains -- so break into two
349 // separate in-line assembly pieces
350 //Save the virt procr's stack and frame ptrs,
351 asm volatile("movl %0, %%eax; \
352 movl %%esp, (%%eax); \
353 movl %1, %%eax; \
354 movl %%ebp, (%%eax) "\
355 /* outputs */ : "=g" (stackPtrAddr), "=g" (framePtrAddr) \
356 /* inputs */ : \
357 /* clobber */ : "%eax" \
358 );
360 //restore coreloop's frame ptr, then jump back to "start" of core loop
361 //Note, GCC compiles to assembly that saves esp and ebp in the stack
362 // frame -- so have to explicitly do assembly that saves to memory
363 asm volatile("movl %0, %%eax; \
364 movl %1, %%esp; \
365 movl %2, %%ebp; \
366 jmp %%eax " \
367 /* outputs */ : \
368 /* inputs */ : "m" (jmpPt), "m"(coreLoopStackPtr), "m"(coreLoopFramePtr)\
369 /* clobber */ : "memory", "%eax", "%ebx", "%ecx", "%edx", "%edi","%esi" \
370 ); //list everything as clobbered to force GCC to save all
371 // live vars that are in regs on stack before this
372 // assembly, so that stack pointer is correct, before jmp
374 ResumePt:
375 return;
376 }
381 /*Not sure yet the form going to put "dissipate" in, so this is the third
382 * possibility -- the semantic layer can just make a macro that looks like
383 * a call to its name, then expands to a call to this.
384 *
385 *As of June 30, 2010 this looks like the top choice..
386 *
387 *This adds a request to dissipate, then suspends the processor so that the
388 * request handler will receive the request. The request handler is what
389 * does the work of freeing memory and removing the processor from the
390 * semantic environment's data structures.
391 *The request handler also is what figures out when to shutdown the VMS
392 * system -- which causes all the core loop threads to die, and returns from
393 * the call that started up VMS to perform the work.
394 *
395 *This form is a bit misleading to understand if one is trying to figure out
396 * how VMS works -- it looks like a normal function call, but inside it
397 * sends a request to the request handler and suspends the processor, which
398 * jumps out of the VMS__dissipate_procr function, and out of all nestings
399 * above it, transferring the work of dissipating to the request handler,
400 * which then does the actual work -- causing the processor that animated
401 * the call of this function to disappear and the "hanging" state of this
402 * function to just poof into thin air -- the virtual processor's trace
403 * never returns from this call, but instead the virtual processor's trace
404 * gets suspended in this call and all the virt processor's state disap-
405 * pears -- making that suspend the last thing in the virt procr's trace.
406 */
407 void
408 VMS__dissipate_procr( VirtProcr *procrToDissipate )
409 { VMSReqst *req;
411 req = malloc( sizeof(VMSReqst) );
412 // req->virtProcrFrom = callingPr;
413 req->reqType = dissipate;
414 req->nextReqst = procrToDissipate->requests;
415 procrToDissipate->requests = req;
417 VMS__suspend_procr( procrToDissipate );
418 }
421 /*This inserts the semantic-layer's request data into standard VMS carrier
422 */
423 inline void
424 VMS__add_sem_request( void *semReqData, VirtProcr *callingPr )
425 { VMSReqst *req;
427 req = malloc( sizeof(VMSReqst) );
428 // req->virtProcrFrom = callingPr;
429 req->reqType = semantic;
430 req->semReqData = semReqData;
431 req->nextReqst = callingPr->requests;
432 callingPr->requests = req;
433 }
437 //TODO: add a semantic-layer supplied "freer" for the semantic-data portion
438 // of a request -- IE call with both a virt procr and a fn-ptr to request
439 // freer (or maybe put request freer as a field in virt procr?)
440 void
441 VMS__remove_and_free_top_request( VirtProcr *procrWithReq )
442 { VMSReqst *req;
444 req = procrWithReq->requests;
445 if( req == NULL ) return;
446 procrWithReq->requests = procrWithReq->requests->nextReqst;
447 VMS__free_request( req );
448 }
451 //TODO: add a semantic-layer supplied "freer" for the semantic-data portion
452 // of a request -- IE call with both a virt procr and a fn-ptr to request
453 // freer (also maybe put sem request freer as a field in virt procr?)
454 //SSR relies right now on this only freeing VMS layer of request -- the
455 // semantic portion of request is alloc'd and freed by request handler
456 void
457 VMS__free_request( VMSReqst *req )
458 {
459 free( req );
460 }
462 VMSReqst *
463 VMS__take_top_request_from( VirtProcr *procrWithReq )
464 { VMSReqst *req;
466 req = procrWithReq->requests;
467 if( req == NULL ) return req;
469 procrWithReq->requests = procrWithReq->requests->nextReqst;
470 return req;
471 }
473 VMSReqst *
474 VMS__free_top_and_give_next_request_from( VirtProcr *procrWithReq )
475 { VMSReqst *req;
477 req = procrWithReq->requests;
478 if( req == NULL ) return req;
480 procrWithReq->requests = procrWithReq->requests->nextReqst;
481 VMS__free_request( req );
482 return procrWithReq->requests;
483 }
485 inline int
486 VMS__isSemanticReqst( VMSReqst *req )
487 {
488 return ( req->reqType == semantic );
489 }
492 inline void *
493 VMS__take_sem_reqst_from( VMSReqst *req )
494 {
495 return req->semReqData;
496 }
498 inline int
499 VMS__isDissipateReqst( VMSReqst *req )
500 {
501 return ( req->reqType == dissipate );
502 }
504 inline int
505 VMS__isCreateReqst( VMSReqst *req )
506 {
507 return ( req->reqType == regCreated );
508 }
510 void
511 VMS__send_register_new_procr_request(VirtProcr *newPr, VirtProcr *reqstingPr)
512 { VMSReqst *req;
514 req = malloc( sizeof(VMSReqst) );
515 req->reqType = regCreated;
516 req->semReqData = newPr;
517 req->nextReqst = reqstingPr->requests;
518 reqstingPr->requests = req;
520 VMS__suspend_procr( reqstingPr );
521 }
525 /*This must be called by the request handler plugin -- it cannot be called
526 * from the semantic library "dissipate processor" function -- instead, the
527 * semantic layer has to generate a request for the plug-in to call this
528 * function.
529 *The reason is that this frees the virtual processor's stack -- which is
530 * still in use inside semantic library calls!
531 *
532 *This frees or recycles all the state owned by and comprising the VMS
533 * portion of the animating virtual procr. The request handler must first
534 * free any semantic data created for the processor that didn't use the
535 * VMS_malloc mechanism. Then it calls this, which first asks the malloc
536 * system to disown any state that did use VMS_malloc, and then frees the
537 * statck and the processor-struct itself.
538 *If the dissipated processor is the sole (remaining) owner of VMS__malloc'd
539 * state, then that state gets freed (or sent to recycling) as a side-effect
540 * of dis-owning it.
541 */
542 void
543 VMS__handle_dissipate_reqst( VirtProcr *animatingPr )
544 {
545 //dis-own all locations owned by this processor, causing to be freed
546 // any locations that it is (was) sole owner of
547 //TODO: implement VMS__malloc system, including "give up ownership"
549 //The dissipate request might still be attached, so remove and free it
550 VMS__remove_and_free_top_request( animatingPr );
552 //NOTE: initialData was given to the processor, so should either have
553 // been alloc'd with VMS__malloc, or freed by the level above animPr.
554 //So, all that's left to free here is the stack and the VirtProcr struc
555 // itself
556 free( animatingPr->startOfStack );
557 free( animatingPr );
558 }
561 //TODO: re-architect so that have clean separation between request handler
562 // and master loop, for dissipate, create, shutdown, and other non-semantic
563 // requests. Issue is chain: one removes requests from AppVP, one dispatches
564 // on type of request, and one handles each type.. but some types require
565 // action from both request handler and master loop -- maybe just give the
566 // request handler calls like: VMS__handle_X_request_type
568 void
569 endOSThreadFn( void *initData, VirtProcr *animatingPr );
571 /*This is called by the semantic layer's request handler when it decides its
572 * time to shut down the VMS system. Calling this causes the core loop OS
573 * threads to exit, which unblocks the entry-point function that started up
574 * VMS, and allows it to grab the result and return to the original single-
575 * threaded application.
576 *
577 *The _VMSMasterEnv is needed by this shut down function, so the create-seed-
578 * and-wait function has to free a bunch of stuff after it detects the
579 * threads have all died: the masterEnv, the thread-related locations,
580 * masterVP any AppVPs that might still be allocated and sitting in the
581 * semantic environment, or have been orphaned in the _VMSWorkQ.
582 *
583 *NOTE: the semantic plug-in is expected to use VMS__malloc_to to get all the
584 * locations it needs, and give ownership to masterVP. Then, they will be
585 * automatically freed when the masterVP is dissipated. (This happens after
586 * the core loop threads have all exited)
587 *
588 *In here,create one core-loop shut-down processor for each core loop and put
589 * them all directly into the readyToAnimateQ.
590 *Note, this function can ONLY be called after the semantic environment no
591 * longer cares if AppVPs get animated after the point this is called. In
592 * other words, this can be used as an abort, or else it should only be
593 * called when all AppVPs have finished dissipate requests -- only at that
594 * point is it sure that all results have completed.
595 */
596 void
597 VMS__handle_shutdown_reqst( void *dummy, VirtProcr *animatingPr )
598 { int coreIdx;
599 VirtProcr *shutDownPr;
601 //create the shutdown processors, one for each core loop -- put them
602 // directly into the Q -- each core will die when gets one
603 for( coreIdx=0; coreIdx < NUM_CORES; coreIdx++ )
604 {
605 shutDownPr = VMS__create_procr( &endOSThreadFn, NULL );
606 writeSRSWQ( shutDownPr, _VMSMasterEnv->readyToAnimateQs[coreIdx] );
607 }
609 }
612 /*Am trying to be cute, avoiding IF statement in coreLoop that checks for
613 * a special shutdown procr. Ended up with extra-complex shutdown sequence.
614 *This function has the sole purpose of setting the stack and framePtr
615 * to the coreLoop's stack and framePtr.. it does that then jumps to the
616 * core loop's shutdown point -- might be able to just call Pthread_exit
617 * from here, but am going back to the pthread's stack and setting everything
618 * up just as if it never jumped out, before calling pthread_exit.
619 *The end-point of core loop will free the stack and so forth of the
620 * processor that animates this function, (this fn is transfering the
621 * animator of the AppVP that is in turn animating this function over
622 * to core loop function -- note that this slices out a level of virtual
623 * processors).
624 */
625 void
626 endOSThreadFn( void *initData, VirtProcr *animatingPr )
627 { void *jmpPt, *coreLoopStackPtr, *coreLoopFramePtr;
629 jmpPt = _VMSMasterEnv->coreLoopEndPt;
630 coreLoopStackPtr = animatingPr->coreLoopStackPtr;
631 coreLoopFramePtr = animatingPr->coreLoopFramePtr;
634 asm volatile("movl %0, %%eax; \
635 movl %1, %%esp; \
636 movl %2, %%ebp; \
637 jmp %%eax " \
638 /* outputs */ : \
639 /* inputs */ : "m" (jmpPt), "m"(coreLoopStackPtr), "m"(coreLoopFramePtr)\
640 /* clobber */ : "memory", "%eax", "%ebx", "%ecx", "%edx", "%edi","%esi" \
641 );
642 }
645 /*This is called after the threads have shut down and control has returned
646 * to the semantic layer, in the entry point function in the main thread.
647 * It has to free anything allocated during VMS_init, and any other alloc'd
648 * locations that might be left over.
649 */
650 void
651 VMS__cleanup_after_shutdown()
652 {
653 SRSWQueueStruc **readyToAnimateQs;
654 int coreIdx;
655 VirtProcr **masterVPs;
656 SchedSlot ***allSchedSlots; //ptr to array of ptrs
658 readyToAnimateQs = _VMSMasterEnv->readyToAnimateQs;
659 masterVPs = _VMSMasterEnv->masterVPs;
660 allSchedSlots = _VMSMasterEnv->allSchedSlots;
662 for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ )
663 {
664 freeSRSWQ( readyToAnimateQs[ coreIdx ] );
666 VMS__handle_dissipate_reqst( masterVPs[ coreIdx ] );
668 freeSchedSlots( allSchedSlots[ coreIdx ] );
669 }
671 free( _VMSMasterEnv->readyToAnimateQs );
672 free( _VMSMasterEnv->masterVPs );
673 free( _VMSMasterEnv->allSchedSlots );
675 free( _VMSMasterEnv );
676 }
679 //===========================================================================
681 inline TSCount getTSCount()
682 { unsigned int low, high;
683 TSCount out;
685 saveTimeStampCountInto( low, high );
686 out = high;
687 out = (out << 32) + low;
688 return out;
689 }
