Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
view 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 |
line source
1 /*
2 * This File contains all hardware dependent C code.
3 */
6 #include "VMS.h"
8 /*Create stack, then create __cdecl structure on it and put initialData and
9 * pointer to the new structure instance into the parameter positions on
10 * the stack
11 *Then put function pointer into nextInstrPt -- the stack is setup in std
12 * call structure, so jumping to function ptr is same as a GCC generated
13 * function call
14 *No need to save registers on old stack frame, because there's no old
15 * animator state to return to --
16 *
17 */
18 inline SlaveVP *
19 create_procr_helper( SlaveVP *newPr, VirtProcrFnPtr fnPtr,
20 void *initialData, void *stackLocs )
21 {
22 void *stackPtr;
24 newPr->startOfStack = stackLocs;
25 newPr->procrID = _VMSMasterEnv->numVPsCreated++;
26 newPr->initialData = initialData;
27 newPr->requests = NULL;
28 newPr->schedSlot = NULL;
30 /*
31 * Hardware dependent part
32 */
33 //instead of calling the function directly, call a wrapper function to fetch
34 //arguments from stack
35 newPr->nextInstrPt = (VirtProcrFnPtr)&startVPFn;
37 //fnPtr takes two params -- void *initData & void *animProcr
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
40 // by stackPtr, initData at stackPtr + 8 bytes, animatingPr just above
41 stackPtr = ( (void *)stackLocs + VIRT_PROCR_STACK_SIZE - 4*sizeof(void*));
43 //setup __cdecl on stack -- coreloop will switch to stackPtr before jmp
44 *((SlaveVP**)stackPtr + 2 ) = newPr; //rightmost param
45 *((void**)stackPtr + 1 ) = initialData; //next param to left
46 *((void**)stackPtr) = (void*)fnPtr;
48 /*
49 * end of Hardware dependent part
50 */
52 newPr->stackPtr = stackPtr; //core loop will switch to this, then
53 newPr->framePtr = stackPtr; //suspend loop will save new stack & frame ptr
55 //============================= MEASUREMENT STUFF ========================
56 #ifdef STATS__TURN_ON_PROBES
57 //struct timeval timeStamp;
58 //gettimeofday( &(timeStamp), NULL);
59 //newPr->createPtInSecs = timeStamp.tv_sec +(timeStamp.tv_usec/1000000.0) -
60 // _VMSMasterEnv->createPtInSecs;
61 #endif
62 //========================================================================
64 return newPr;
65 }
