comparison ProcrContext.c @ 200:6db9e4898978

VMS name chgs -- added "WL" "PI" and "int" and split vms.h up
author Me@portablequad
date Sun, 12 Feb 2012 01:49:33 -0800
parents 521c75d64cef
children
comparison
equal deleted inserted replaced
1:6d46f19f50e5 13:2c57913348d8
13 * function call 13 * function call
14 *No need to save registers on old stack frame, because there's no old 14 *No need to save registers on old stack frame, because there's no old
15 * animator state to return to -- 15 * animator state to return to --
16 * 16 *
17 */ 17 */
18 inline VirtProcr * 18 inline SlaveVP *
19 create_procr_helper( VirtProcr *newPr, VirtProcrFnPtr fnPtr, 19 create_procr_helper( SlaveVP *newPr, VirtProcrFnPtr fnPtr,
20 void *initialData, void *stackLocs ) 20 void *initialData, void *stackLocs )
21 { 21 {
22 void *stackPtr; 22 void *stackPtr;
23 23
24 newPr->startOfStack = stackLocs; 24 newPr->startOfStack = stackLocs;
25 newPr->procrID = _VMSMasterEnv->numProcrsCreated++; 25 newPr->procrID = _VMSMasterEnv->numVPsCreated++;
26 newPr->initialData = initialData; 26 newPr->initialData = initialData;
27 newPr->requests = NULL; 27 newPr->requests = NULL;
28 newPr->schedSlot = NULL; 28 newPr->schedSlot = NULL;
29 29
30 /* 30 /*
31 * Hardware dependent part 31 * Hardware dependent part
32 */ 32 */
33 //instead of calling the function directly, call a wrapper function to fetch 33 //instead of calling the function directly, call a wrapper function to fetch
34 //arguments from stack 34 //arguments from stack
35 newPr->nextInstrPt = (VirtProcrFnPtr)&startVirtProcrFn; 35 newPr->nextInstrPt = (VirtProcrFnPtr)&startVPFn;
36 36
37 //fnPtr takes two params -- void *initData & void *animProcr 37 //fnPtr takes two params -- void *initData & void *animProcr
38 //alloc stack locations, make stackPtr be the highest addr minus room 38 //alloc stack locations, make stackPtr be the highest addr minus room
39 // for 2 params + return addr. Return addr (NULL) is in loc pointed to 39 // for 2 params + return addr. Return addr (NULL) is in loc pointed to
40 // by stackPtr, initData at stackPtr + 8 bytes, animatingPr just above 40 // by stackPtr, initData at stackPtr + 8 bytes, animatingPr just above
41 stackPtr = ( (void *)stackLocs + VIRT_PROCR_STACK_SIZE - 4*sizeof(void*)); 41 stackPtr = ( (void *)stackLocs + VIRT_PROCR_STACK_SIZE - 4*sizeof(void*));
42 42
43 //setup __cdecl on stack -- coreloop will switch to stackPtr before jmp 43 //setup __cdecl on stack -- coreloop will switch to stackPtr before jmp
44 *((VirtProcr**)stackPtr + 2 ) = newPr; //rightmost param 44 *((SlaveVP**)stackPtr + 2 ) = newPr; //rightmost param
45 *((void**)stackPtr + 1 ) = initialData; //next param to left 45 *((void**)stackPtr + 1 ) = initialData; //next param to left
46 *((void**)stackPtr) = (void*)fnPtr; 46 *((void**)stackPtr) = (void*)fnPtr;
47 47
48 /* 48 /*
49 * end of Hardware dependent part 49 * end of Hardware dependent part