| rev |
line source |
|
Me@0
|
1 /*
|
|
Me@38
|
2 * Copyright 2010 OpenSourceStewardshipFoundation
|
|
Me@0
|
3 *
|
|
Me@0
|
4 * Licensed under BSD
|
|
Me@0
|
5 */
|
|
Me@0
|
6
|
|
Me@0
|
7 #include <stdio.h>
|
|
Me@0
|
8 #include <stdlib.h>
|
|
Me@50
|
9 #include <string.h>
|
|
Me@0
|
10 #include <malloc.h>
|
|
Me@50
|
11 #include <sys/time.h>
|
|
Me@0
|
12
|
|
Me@0
|
13 #include "VMS.h"
|
|
Me@0
|
14 #include "Queue_impl/BlockingQueue.h"
|
|
Me@38
|
15 #include "Histogram/Histogram.h"
|
|
Me@0
|
16
|
|
Me@0
|
17
|
|
Me@26
|
18 #define thdAttrs NULL
|
|
Me@26
|
19
|
|
Me@22
|
20 //===========================================================================
|
|
Me@22
|
21 void
|
|
Me@22
|
22 shutdownFn( void *dummy, VirtProcr *dummy2 );
|
|
Me@22
|
23
|
|
Me@31
|
24 SchedSlot **
|
|
Me@31
|
25 create_sched_slots();
|
|
Me@22
|
26
|
|
Me@28
|
27 void
|
|
Me@28
|
28 create_masterEnv();
|
|
Me@28
|
29
|
|
Me@28
|
30 void
|
|
Me@28
|
31 create_the_coreLoop_OS_threads();
|
|
Me@28
|
32
|
|
Me@50
|
33 MallocProlog *
|
|
Me@50
|
34 create_free_list();
|
|
Me@50
|
35
|
|
Me@53
|
36 void
|
|
Me@53
|
37 endOSThreadFn( void *initData, VirtProcr *animatingPr );
|
|
Me@50
|
38
|
|
Me@26
|
39 pthread_mutex_t suspendLock = PTHREAD_MUTEX_INITIALIZER;
|
|
Me@26
|
40 pthread_cond_t suspend_cond = PTHREAD_COND_INITIALIZER;
|
|
Me@26
|
41
|
|
Me@22
|
42 //===========================================================================
|
|
Me@22
|
43
|
|
Me@0
|
44 /*Setup has two phases:
|
|
Me@0
|
45 * 1) Semantic layer first calls init_VMS, which creates masterEnv, and puts
|
|
Me@8
|
46 * the master virt procr into the work-queue, ready for first "call"
|
|
Me@8
|
47 * 2) Semantic layer then does its own init, which creates the seed virt
|
|
Me@8
|
48 * procr inside the semantic layer, ready to schedule it when
|
|
Me@0
|
49 * asked by the first run of the masterLoop.
|
|
Me@0
|
50 *
|
|
Me@0
|
51 *This part is bit weird because VMS really wants to be "always there", and
|
|
Me@0
|
52 * have applications attach and detach.. for now, this VMS is part of
|
|
Me@0
|
53 * the app, so the VMS system starts up as part of running the app.
|
|
Me@0
|
54 *
|
|
Me@8
|
55 *The semantic layer is isolated from the VMS internals by making the
|
|
Me@8
|
56 * semantic layer do setup to a state that it's ready with its
|
|
Me@8
|
57 * initial virt procrs, ready to schedule them to slots when the masterLoop
|
|
Me@0
|
58 * asks. Without this pattern, the semantic layer's setup would
|
|
Me@8
|
59 * have to modify slots directly to assign the initial virt-procrs, and put
|
|
Me@31
|
60 * them into the readyToAnimateQ itself, breaking the isolation completely.
|
|
Me@0
|
61 *
|
|
Me@0
|
62 *
|
|
Me@8
|
63 *The semantic layer creates the initial virt procr(s), and adds its
|
|
Me@8
|
64 * own environment to masterEnv, and fills in the pointers to
|
|
Me@0
|
65 * the requestHandler and slaveScheduler plug-in functions
|
|
Me@8
|
66 */
|
|
Me@8
|
67
|
|
Me@8
|
68 /*This allocates VMS data structures, populates the master VMSProc,
|
|
Me@0
|
69 * and master environment, and returns the master environment to the semantic
|
|
Me@0
|
70 * layer.
|
|
Me@0
|
71 */
|
|
Me@8
|
72 void
|
|
Me@8
|
73 VMS__init()
|
|
Me@28
|
74 {
|
|
Me@28
|
75 create_masterEnv();
|
|
Me@28
|
76 create_the_coreLoop_OS_threads();
|
|
Me@28
|
77 }
|
|
Me@28
|
78
|
|
Me@28
|
79 /*To initialize the sequential version, just don't create the threads
|
|
Me@28
|
80 */
|
|
Me@28
|
81 void
|
|
Me@28
|
82 VMS__init_Seq()
|
|
Me@28
|
83 {
|
|
Me@28
|
84 create_masterEnv();
|
|
Me@28
|
85 }
|
|
Me@28
|
86
|
|
Me@28
|
87 void
|
|
Me@28
|
88 create_masterEnv()
|
|
Me@31
|
89 { MasterEnv *masterEnv;
|
|
Me@31
|
90 SRSWQueueStruc **readyToAnimateQs;
|
|
Me@31
|
91 int coreIdx;
|
|
Me@31
|
92 VirtProcr **masterVPs;
|
|
Me@31
|
93 SchedSlot ***allSchedSlots; //ptr to array of ptrs
|
|
Me@53
|
94
|
|
Me@53
|
95
|
|
Me@31
|
96 //Make the master env, which holds everything else
|
|
Me@1
|
97 _VMSMasterEnv = malloc( sizeof(MasterEnv) );
|
|
Me@53
|
98
|
|
Me@53
|
99 //Very first thing put into the master env is the free-list, seeded
|
|
Me@53
|
100 // with a massive initial chunk of memory.
|
|
Me@53
|
101 //After this, all other mallocs are VMS__malloc.
|
|
Me@53
|
102 _VMSMasterEnv->freeListHead = VMS_ext__create_free_list();
|
|
Me@53
|
103
|
|
Me@53
|
104 //===================== Only VMS__malloc after this ====================
|
|
Me@1
|
105 masterEnv = _VMSMasterEnv;
|
|
Me@31
|
106
|
|
Me@31
|
107 //Make a readyToAnimateQ for each core loop
|
|
Me@53
|
108 readyToAnimateQs = VMS__malloc( NUM_CORES * sizeof(SRSWQueueStruc *) );
|
|
Me@53
|
109 masterVPs = VMS__malloc( NUM_CORES * sizeof(VirtProcr *) );
|
|
Me@0
|
110
|
|
Me@31
|
111 //One array for each core, 3 in array, core's masterVP scheds all
|
|
Me@53
|
112 allSchedSlots = VMS__malloc( NUM_CORES * sizeof(SchedSlot *) );
|
|
Me@0
|
113
|
|
Me@53
|
114 _VMSMasterEnv->numProcrsCreated = 0; //used by create procr
|
|
Me@31
|
115 for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ )
|
|
Me@53
|
116 {
|
|
Me@31
|
117 readyToAnimateQs[ coreIdx ] = makeSRSWQ();
|
|
Me@31
|
118
|
|
Me@50
|
119 //Q: should give masterVP core-specific info as its init data?
|
|
Me@53
|
120 masterVPs[ coreIdx ] = VMS__create_procr( &masterLoop, masterEnv );
|
|
Me@31
|
121 masterVPs[ coreIdx ]->coreAnimatedBy = coreIdx;
|
|
Me@31
|
122 allSchedSlots[ coreIdx ] = create_sched_slots(); //makes for one core
|
|
Me@53
|
123 _VMSMasterEnv->numMasterInARow[ coreIdx ] = 0;
|
|
Me@31
|
124 }
|
|
Me@31
|
125 _VMSMasterEnv->readyToAnimateQs = readyToAnimateQs;
|
|
Me@31
|
126 _VMSMasterEnv->masterVPs = masterVPs;
|
|
Me@50
|
127 _VMSMasterEnv->masterLock = UNLOCKED;
|
|
Me@31
|
128 _VMSMasterEnv->allSchedSlots = allSchedSlots;
|
|
Me@28
|
129
|
|
Me@12
|
130
|
|
Me@31
|
131 //Aug 19, 2010: no longer need to place initial masterVP into queue
|
|
Me@31
|
132 // because coreLoop now controls -- animates its masterVP when no work
|
|
Me@31
|
133
|
|
Me@30
|
134
|
|
Me@50
|
135 //============================= MEASUREMENT STUFF ========================
|
|
Me@50
|
136 #ifdef STATS__TURN_ON_PROBES
|
|
Me@50
|
137 _VMSMasterEnv->dynIntervalProbesInfo =
|
|
Me@53
|
138 makePrivDynArrayOfSize( &(_VMSMasterEnv->intervalProbes), 200);
|
|
Me@30
|
139
|
|
Me@53
|
140 _VMSMasterEnv->probeNameHashTbl = makeHashTable( 1000, &VMS__free );
|
|
Me@53
|
141
|
|
Me@53
|
142 //put creation time directly into master env, for fast retrieval
|
|
Me@50
|
143 struct timeval timeStamp;
|
|
Me@50
|
144 gettimeofday( &(timeStamp), NULL);
|
|
Me@50
|
145 _VMSMasterEnv->createPtInSecs =
|
|
Me@50
|
146 timeStamp.tv_sec +(timeStamp.tv_usec/1000000.0);
|
|
Me@50
|
147 #endif
|
|
Me@50
|
148 //========================================================================
|
|
Me@38
|
149
|
|
Me@0
|
150 }
|
|
Me@0
|
151
|
|
Me@31
|
152 SchedSlot **
|
|
Me@31
|
153 create_sched_slots()
|
|
Me@31
|
154 { SchedSlot **schedSlots;
|
|
Me@0
|
155 int i;
|
|
Me@0
|
156
|
|
Me@53
|
157 schedSlots = VMS__malloc( NUM_SCHED_SLOTS * sizeof(SchedSlot *) );
|
|
Me@8
|
158
|
|
Me@1
|
159 for( i = 0; i < NUM_SCHED_SLOTS; i++ )
|
|
Me@0
|
160 {
|
|
Me@53
|
161 schedSlots[i] = VMS__malloc( sizeof(SchedSlot) );
|
|
Me@8
|
162
|
|
Me@1
|
163 //Set state to mean "handling requests done, slot needs filling"
|
|
Me@8
|
164 schedSlots[i]->workIsDone = FALSE;
|
|
Me@8
|
165 schedSlots[i]->needsProcrAssigned = TRUE;
|
|
Me@0
|
166 }
|
|
Me@31
|
167 return schedSlots;
|
|
Me@31
|
168 }
|
|
Me@31
|
169
|
|
Me@31
|
170
|
|
Me@31
|
171 void
|
|
Me@31
|
172 freeSchedSlots( SchedSlot **schedSlots )
|
|
Me@31
|
173 { int i;
|
|
Me@31
|
174 for( i = 0; i < NUM_SCHED_SLOTS; i++ )
|
|
Me@31
|
175 {
|
|
Me@53
|
176 VMS__free( schedSlots[i] );
|
|
Me@31
|
177 }
|
|
Me@53
|
178 VMS__free( schedSlots );
|
|
Me@0
|
179 }
|
|
Me@0
|
180
|
|
Me@8
|
181
|
|
Me@28
|
182 void
|
|
Me@28
|
183 create_the_coreLoop_OS_threads()
|
|
Me@28
|
184 {
|
|
Me@28
|
185 //========================================================================
|
|
Me@28
|
186 // Create the Threads
|
|
Me@28
|
187 int coreIdx, retCode;
|
|
Me@28
|
188
|
|
Me@28
|
189 //Need the threads to be created suspended, and wait for a signal
|
|
Me@28
|
190 // before proceeding -- gives time after creating to initialize other
|
|
Me@28
|
191 // stuff before the coreLoops set off.
|
|
Me@28
|
192 _VMSMasterEnv->setupComplete = 0;
|
|
Me@28
|
193
|
|
Me@28
|
194 //Make the threads that animate the core loops
|
|
Me@28
|
195 for( coreIdx=0; coreIdx < NUM_CORES; coreIdx++ )
|
|
Me@53
|
196 { coreLoopThdParams[coreIdx] = VMS__malloc( sizeof(ThdParams) );
|
|
Me@28
|
197 coreLoopThdParams[coreIdx]->coreNum = coreIdx;
|
|
Me@28
|
198
|
|
Me@28
|
199 retCode =
|
|
Me@28
|
200 pthread_create( &(coreLoopThdHandles[coreIdx]),
|
|
Me@28
|
201 thdAttrs,
|
|
Me@28
|
202 &coreLoop,
|
|
Me@28
|
203 (void *)(coreLoopThdParams[coreIdx]) );
|
|
Me@50
|
204 if(retCode){printf("ERROR creating thread: %d\n", retCode); exit(1);}
|
|
Me@28
|
205 }
|
|
Me@28
|
206 }
|
|
Me@28
|
207
|
|
Me@0
|
208 /*Semantic layer calls this when it want the system to start running..
|
|
Me@0
|
209 *
|
|
Me@24
|
210 *This starts the core loops running then waits for them to exit.
|
|
Me@0
|
211 */
|
|
Me@12
|
212 void
|
|
Me@24
|
213 VMS__start_the_work_then_wait_until_done()
|
|
Me@12
|
214 { int coreIdx;
|
|
Me@24
|
215 //Start the core loops running
|
|
Me@25
|
216
|
|
Me@25
|
217 //tell the core loop threads that setup is complete
|
|
Me@25
|
218 //get lock, to lock out any threads still starting up -- they'll see
|
|
Me@25
|
219 // that setupComplete is true before entering while loop, and so never
|
|
Me@25
|
220 // wait on the condition
|
|
Me@26
|
221 pthread_mutex_lock( &suspendLock );
|
|
Me@25
|
222 _VMSMasterEnv->setupComplete = 1;
|
|
Me@26
|
223 pthread_mutex_unlock( &suspendLock );
|
|
Me@26
|
224 pthread_cond_broadcast( &suspend_cond );
|
|
Me@25
|
225
|
|
Me@25
|
226
|
|
Me@24
|
227 //wait for all to complete
|
|
Me@8
|
228 for( coreIdx=0; coreIdx < NUM_CORES; coreIdx++ )
|
|
Me@8
|
229 {
|
|
Me@25
|
230 pthread_join( coreLoopThdHandles[coreIdx], NULL );
|
|
Me@24
|
231 }
|
|
Me@25
|
232
|
|
Me@24
|
233 //NOTE: do not clean up VMS env here -- semantic layer has to have
|
|
Me@24
|
234 // a chance to clean up its environment first, then do a call to free
|
|
Me@24
|
235 // the Master env and rest of VMS locations
|
|
Me@8
|
236 }
|
|
Me@0
|
237
|
|
Me@28
|
238 /*Only difference between version with an OS thread pinned to each core and
|
|
Me@28
|
239 * the sequential version of VMS is VMS__init_Seq, this, and coreLoop_Seq.
|
|
Me@28
|
240 */
|
|
Me@28
|
241 void
|
|
Me@28
|
242 VMS__start_the_work_then_wait_until_done_Seq()
|
|
Me@28
|
243 {
|
|
Me@28
|
244 //Instead of un-suspending threads, just call the one and only
|
|
Me@28
|
245 // core loop (sequential version), in the main thread.
|
|
Me@28
|
246 coreLoop_Seq( NULL );
|
|
Me@28
|
247
|
|
Me@28
|
248 }
|
|
Me@28
|
249
|
|
Me@0
|
250
|
|
Me@0
|
251
|
|
Me@8
|
252 /*Create stack, then create __cdecl structure on it and put initialData and
|
|
Me@8
|
253 * pointer to the new structure instance into the parameter positions on
|
|
Me@8
|
254 * the stack
|
|
Me@8
|
255 *Then put function pointer into nextInstrPt -- the stack is setup in std
|
|
Me@8
|
256 * call structure, so jumping to function ptr is same as a GCC generated
|
|
Me@8
|
257 * function call
|
|
Me@8
|
258 *No need to save registers on old stack frame, because there's no old
|
|
Me@8
|
259 * animator state to return to --
|
|
Me@8
|
260 *
|
|
Me@8
|
261 */
|
|
Me@50
|
262 inline VirtProcr *
|
|
Me@50
|
263 create_procr_helper( VirtProcr *newPr, VirtProcrFnPtr fnPtr,
|
|
Me@50
|
264 void *initialData, char *stackLocs )
|
|
Me@50
|
265 {
|
|
Me@50
|
266 char *stackPtr;
|
|
Me@8
|
267
|
|
Me@53
|
268 newPr->startOfStack = stackLocs;
|
|
Me@53
|
269 newPr->procrID = _VMSMasterEnv->numProcrsCreated++;
|
|
Me@53
|
270 newPr->nextInstrPt = fnPtr;
|
|
Me@53
|
271 newPr->initialData = initialData;
|
|
Me@53
|
272 newPr->requests = NULL;
|
|
Me@53
|
273 newPr->schedSlot = NULL;
|
|
Me@8
|
274
|
|
Me@14
|
275 //fnPtr takes two params -- void *initData & void *animProcr
|
|
Me@8
|
276 //alloc stack locations, make stackPtr be the highest addr minus room
|
|
Me@14
|
277 // for 2 params + return addr. Return addr (NULL) is in loc pointed to
|
|
Me@14
|
278 // by stackPtr, initData at stackPtr + 4 bytes, animatingPr just above
|
|
Me@22
|
279 stackPtr = ( (char *)stackLocs + VIRT_PROCR_STACK_SIZE - 0x10 );
|
|
Me@50
|
280
|
|
Me@8
|
281 //setup __cdecl on stack -- coreloop will switch to stackPtr before jmp
|
|
Me@22
|
282 *( (int *)stackPtr + 2 ) = (int) newPr; //rightmost param -- 32bit pointer
|
|
Me@14
|
283 *( (int *)stackPtr + 1 ) = (int) initialData; //next param to left
|
|
Me@8
|
284 newPr->stackPtr = stackPtr; //core loop will switch to this, then
|
|
Me@8
|
285 newPr->framePtr = stackPtr; //suspend loop will save new stack & frame ptr
|
|
Me@8
|
286
|
|
Me@50
|
287 //============================= MEASUREMENT STUFF ========================
|
|
Me@50
|
288 #ifdef STATS__TURN_ON_PROBES
|
|
Me@50
|
289 struct timeval timeStamp;
|
|
Me@50
|
290 gettimeofday( &(timeStamp), NULL);
|
|
Me@54
|
291 newPr->createPtInSecs = timeStamp.tv_sec +(timeStamp.tv_usec/1000000.0) -
|
|
Me@54
|
292 _VMSMasterEnv->createPtInSecs;
|
|
Me@50
|
293 #endif
|
|
Me@50
|
294 //========================================================================
|
|
Me@50
|
295
|
|
Me@8
|
296 return newPr;
|
|
Me@8
|
297 }
|
|
Me@8
|
298
|
|
Me@50
|
299 inline VirtProcr *
|
|
Me@50
|
300 VMS__create_procr( VirtProcrFnPtr fnPtr, void *initialData )
|
|
Me@50
|
301 { VirtProcr *newPr;
|
|
Me@50
|
302 char *stackLocs;
|
|
Me@50
|
303
|
|
Me@50
|
304 newPr = VMS__malloc( sizeof(VirtProcr) );
|
|
Me@50
|
305 stackLocs = VMS__malloc( VIRT_PROCR_STACK_SIZE );
|
|
Me@50
|
306 if( stackLocs == 0 )
|
|
Me@50
|
307 { perror("VMS__malloc stack"); exit(1); }
|
|
Me@50
|
308
|
|
Me@50
|
309 return create_procr_helper( newPr, fnPtr, initialData, stackLocs );
|
|
Me@50
|
310 }
|
|
Me@50
|
311
|
|
Me@50
|
312 /* "ext" designates that it's for use outside the VMS system -- should only
|
|
Me@50
|
313 * be called from main thread or other thread -- never from code animated by
|
|
Me@50
|
314 * a VMS virtual processor.
|
|
Me@50
|
315 */
|
|
Me@50
|
316 inline VirtProcr *
|
|
Me@50
|
317 VMS_ext__create_procr( VirtProcrFnPtr fnPtr, void *initialData )
|
|
Me@50
|
318 { VirtProcr *newPr;
|
|
Me@50
|
319 char *stackLocs;
|
|
Me@50
|
320
|
|
Me@50
|
321 newPr = malloc( sizeof(VirtProcr) );
|
|
Me@50
|
322 stackLocs = malloc( VIRT_PROCR_STACK_SIZE );
|
|
Me@50
|
323 if( stackLocs == 0 )
|
|
Me@50
|
324 { perror("malloc stack"); exit(1); }
|
|
Me@50
|
325
|
|
Me@50
|
326 return create_procr_helper( newPr, fnPtr, initialData, stackLocs );
|
|
Me@50
|
327 }
|
|
Me@50
|
328
|
|
Me@8
|
329
|
|
Me@26
|
330 /*there is a label inside this function -- save the addr of this label in
|
|
Me@0
|
331 * the callingPr struc, as the pick-up point from which to start the next
|
|
Me@0
|
332 * work-unit for that procr. If turns out have to save registers, then
|
|
Me@0
|
333 * save them in the procr struc too. Then do assembly jump to the CoreLoop's
|
|
Me@0
|
334 * "done with work-unit" label. The procr struc is in the request in the
|
|
Me@0
|
335 * slave that animated the just-ended work-unit, so all the state is saved
|
|
Me@0
|
336 * there, and will get passed along, inside the request handler, to the
|
|
Me@0
|
337 * next work-unit for that procr.
|
|
Me@0
|
338 */
|
|
Me@8
|
339 void
|
|
Me@38
|
340 VMS__suspend_procr( VirtProcr *animatingPr )
|
|
Me@14
|
341 { void *jmpPt, *stackPtrAddr, *framePtrAddr, *coreLoopStackPtr;
|
|
Me@14
|
342 void *coreLoopFramePtr;
|
|
Me@0
|
343
|
|
Me@14
|
344 //The request to master will cause this suspended virt procr to get
|
|
Me@14
|
345 // scheduled again at some future point -- to resume, core loop jumps
|
|
Me@14
|
346 // to the resume point (below), which causes restore of saved regs and
|
|
Me@14
|
347 // "return" from this call.
|
|
Me@38
|
348 animatingPr->nextInstrPt = &&ResumePt;
|
|
Me@1
|
349
|
|
Me@1
|
350 //return ownership of the virt procr and sched slot to Master virt pr
|
|
Me@38
|
351 animatingPr->schedSlot->workIsDone = TRUE;
|
|
Me@1
|
352
|
|
Me@38
|
353 stackPtrAddr = &(animatingPr->stackPtr);
|
|
Me@38
|
354 framePtrAddr = &(animatingPr->framePtr);
|
|
Me@26
|
355
|
|
Me@31
|
356 jmpPt = _VMSMasterEnv->coreLoopStartPt;
|
|
Me@38
|
357 coreLoopFramePtr = animatingPr->coreLoopFramePtr;//need this only
|
|
Me@38
|
358 coreLoopStackPtr = animatingPr->coreLoopStackPtr;//safety
|
|
Me@1
|
359
|
|
Me@26
|
360 //Save the virt procr's stack and frame ptrs,
|
|
Me@18
|
361 asm volatile("movl %0, %%eax; \
|
|
Me@18
|
362 movl %%esp, (%%eax); \
|
|
Me@18
|
363 movl %1, %%eax; \
|
|
Me@26
|
364 movl %%ebp, (%%eax) "\
|
|
Me@26
|
365 /* outputs */ : "=g" (stackPtrAddr), "=g" (framePtrAddr) \
|
|
Me@26
|
366 /* inputs */ : \
|
|
Me@26
|
367 /* clobber */ : "%eax" \
|
|
Me@26
|
368 );
|
|
Me@26
|
369
|
|
Me@41
|
370 //=========================== Measurement stuff ========================
|
|
Me@38
|
371 #ifdef MEAS__TIME_STAMP_SUSP
|
|
Me@41
|
372 //record time stamp: compare to time-stamp recorded below
|
|
Me@38
|
373 saveLowTimeStampCountInto( animatingPr->preSuspTSCLow );
|
|
Me@38
|
374 #endif
|
|
Me@41
|
375 //=======================================================================
|
|
Me@38
|
376
|
|
Me@26
|
377 //restore coreloop's frame ptr, then jump back to "start" of core loop
|
|
Me@26
|
378 //Note, GCC compiles to assembly that saves esp and ebp in the stack
|
|
Me@26
|
379 // frame -- so have to explicitly do assembly that saves to memory
|
|
Me@26
|
380 asm volatile("movl %0, %%eax; \
|
|
Me@26
|
381 movl %1, %%esp; \
|
|
Me@26
|
382 movl %2, %%ebp; \
|
|
Me@18
|
383 jmp %%eax " \
|
|
Me@26
|
384 /* outputs */ : \
|
|
Me@26
|
385 /* inputs */ : "m" (jmpPt), "m"(coreLoopStackPtr), "m"(coreLoopFramePtr)\
|
|
Me@18
|
386 /* clobber */ : "memory", "%eax", "%ebx", "%ecx", "%edx", "%edi","%esi" \
|
|
Me@12
|
387 ); //list everything as clobbered to force GCC to save all
|
|
Me@12
|
388 // live vars that are in regs on stack before this
|
|
Me@12
|
389 // assembly, so that stack pointer is correct, before jmp
|
|
Me@1
|
390
|
|
Me@1
|
391 ResumePt:
|
|
Me@38
|
392 #ifdef MEAS__TIME_STAMP_SUSP
|
|
Me@41
|
393 //NOTE: only take low part of count -- do sanity check when take diff
|
|
Me@38
|
394 saveLowTimeStampCountInto( animatingPr->postSuspTSCLow );
|
|
Me@38
|
395 #endif
|
|
Me@38
|
396
|
|
Me@0
|
397 return;
|
|
Me@0
|
398 }
|
|
Me@0
|
399
|
|
Me@22
|
400
|
|
Me@22
|
401
|
|
Me@50
|
402 /*For this implementation of VMS, it may not make much sense to have the
|
|
Me@50
|
403 * system of requests for creating a new processor done this way.. but over
|
|
Me@50
|
404 * the scope of single-master, multi-master, mult-tasking, OS-implementing,
|
|
Me@50
|
405 * distributed-memory, and so on, this gives VMS implementation a chance to
|
|
Me@50
|
406 * do stuff before suspend, in the AppVP, and in the Master before the plugin
|
|
Me@50
|
407 * is called, as well as in the lang-lib before this is called, and in the
|
|
Me@50
|
408 * plugin. So, this gives both VMS and language implementations a chance to
|
|
Me@50
|
409 * intercept at various points and do order-dependent stuff.
|
|
Me@50
|
410 *Having a standard VMSNewPrReqData struc allows the language to create and
|
|
Me@50
|
411 * free the struc, while VMS knows how to get the newPr if it wants it, and
|
|
Me@50
|
412 * it lets the lang have lang-specific data related to creation transported
|
|
Me@50
|
413 * to the plugin.
|
|
Me@50
|
414 */
|
|
Me@50
|
415 void
|
|
Me@50
|
416 VMS__send_create_procr_req( void *semReqData, VirtProcr *reqstingPr )
|
|
Me@50
|
417 { VMSReqst req;
|
|
Me@50
|
418
|
|
Me@50
|
419 req.reqType = createReq;
|
|
Me@50
|
420 req.semReqData = semReqData;
|
|
Me@50
|
421 req.nextReqst = reqstingPr->requests;
|
|
Me@50
|
422 reqstingPr->requests = &req;
|
|
Me@50
|
423
|
|
Me@50
|
424 VMS__suspend_procr( reqstingPr );
|
|
Me@50
|
425 }
|
|
Me@50
|
426
|
|
Me@22
|
427
|
|
Me@38
|
428 /*
|
|
Me@22
|
429 *This adds a request to dissipate, then suspends the processor so that the
|
|
Me@22
|
430 * request handler will receive the request. The request handler is what
|
|
Me@22
|
431 * does the work of freeing memory and removing the processor from the
|
|
Me@22
|
432 * semantic environment's data structures.
|
|
Me@22
|
433 *The request handler also is what figures out when to shutdown the VMS
|
|
Me@22
|
434 * system -- which causes all the core loop threads to die, and returns from
|
|
Me@22
|
435 * the call that started up VMS to perform the work.
|
|
Me@22
|
436 *
|
|
Me@22
|
437 *This form is a bit misleading to understand if one is trying to figure out
|
|
Me@22
|
438 * how VMS works -- it looks like a normal function call, but inside it
|
|
Me@22
|
439 * sends a request to the request handler and suspends the processor, which
|
|
Me@22
|
440 * jumps out of the VMS__dissipate_procr function, and out of all nestings
|
|
Me@22
|
441 * above it, transferring the work of dissipating to the request handler,
|
|
Me@22
|
442 * which then does the actual work -- causing the processor that animated
|
|
Me@22
|
443 * the call of this function to disappear and the "hanging" state of this
|
|
Me@22
|
444 * function to just poof into thin air -- the virtual processor's trace
|
|
Me@22
|
445 * never returns from this call, but instead the virtual processor's trace
|
|
Me@22
|
446 * gets suspended in this call and all the virt processor's state disap-
|
|
Me@22
|
447 * pears -- making that suspend the last thing in the virt procr's trace.
|
|
Me@8
|
448 */
|
|
Me@8
|
449 void
|
|
Me@53
|
450 VMS__send_dissipate_req( VirtProcr *procrToDissipate )
|
|
Me@50
|
451 { VMSReqst req;
|
|
Me@22
|
452
|
|
Me@50
|
453 req.reqType = dissipate;
|
|
Me@50
|
454 req.nextReqst = procrToDissipate->requests;
|
|
Me@50
|
455 procrToDissipate->requests = &req;
|
|
Me@50
|
456
|
|
Me@22
|
457 VMS__suspend_procr( procrToDissipate );
|
|
Me@50
|
458 }
|
|
Me@50
|
459
|
|
Me@50
|
460
|
|
Me@50
|
461 /* "ext" designates that it's for use outside the VMS system -- should only
|
|
Me@50
|
462 * be called from main thread or other thread -- never from code animated by
|
|
Me@50
|
463 * a VMS virtual processor.
|
|
Me@50
|
464 *
|
|
Me@50
|
465 *Use this version to dissipate VPs created outside the VMS system.
|
|
Me@50
|
466 */
|
|
Me@50
|
467 void
|
|
Me@50
|
468 VMS_ext__dissipate_procr( VirtProcr *procrToDissipate )
|
|
Me@50
|
469 {
|
|
Me@50
|
470 //NOTE: initialData was given to the processor, so should either have
|
|
Me@50
|
471 // been alloc'd with VMS__malloc, or freed by the level above animPr.
|
|
Me@50
|
472 //So, all that's left to free here is the stack and the VirtProcr struc
|
|
Me@50
|
473 // itself
|
|
Me@50
|
474 //Note, should not stack-allocate initial data -- no guarantee, in
|
|
Me@50
|
475 // general that creating processor will outlive ones it creates.
|
|
Me@50
|
476 free( procrToDissipate->startOfStack );
|
|
Me@50
|
477 free( procrToDissipate );
|
|
Me@50
|
478 }
|
|
Me@50
|
479
|
|
Me@22
|
480
|
|
Me@22
|
481
|
|
Me@53
|
482 /*This call's name indicates that request is malloc'd -- so req handler
|
|
Me@53
|
483 * has to free any extra requests tacked on before a send, using this.
|
|
Me@53
|
484 *
|
|
Me@53
|
485 * This inserts the semantic-layer's request data into standard VMS carrier
|
|
Me@53
|
486 * request data-struct that is mallocd. The sem request doesn't need to
|
|
Me@53
|
487 * be malloc'd if this is called inside the same call chain before the
|
|
Me@53
|
488 * send of the last request is called.
|
|
Me@53
|
489 *
|
|
Me@53
|
490 *The request handler has to call VMS__free_VMSReq for any of these
|
|
Me@22
|
491 */
|
|
Me@22
|
492 inline void
|
|
Me@53
|
493 VMS__add_sem_request_in_mallocd_VMSReqst( void *semReqData,
|
|
Me@53
|
494 VirtProcr *callingPr )
|
|
Me@53
|
495 { VMSReqst *req;
|
|
Me@22
|
496
|
|
Me@53
|
497 req = VMS__malloc( sizeof(VMSReqst) );
|
|
Me@53
|
498 req->reqType = semantic;
|
|
Me@53
|
499 req->semReqData = semReqData;
|
|
Me@53
|
500 req->nextReqst = callingPr->requests;
|
|
Me@53
|
501 callingPr->requests = req;
|
|
Me@22
|
502 }
|
|
Me@22
|
503
|
|
Me@50
|
504 /*This inserts the semantic-layer's request data into standard VMS carrier
|
|
Me@50
|
505 * request data-struct is allocated on stack of this call & ptr to it sent
|
|
Me@50
|
506 * to plugin
|
|
Me@50
|
507 *Then it does suspend, to cause request to be sent.
|
|
Me@50
|
508 */
|
|
Me@50
|
509 inline void
|
|
Me@50
|
510 VMS__send_sem_request( void *semReqData, VirtProcr *callingPr )
|
|
Me@50
|
511 { VMSReqst req;
|
|
Me@22
|
512
|
|
Me@50
|
513 req.reqType = semantic;
|
|
Me@50
|
514 req.semReqData = semReqData;
|
|
Me@50
|
515 req.nextReqst = callingPr->requests;
|
|
Me@50
|
516 callingPr->requests = &req;
|
|
Me@50
|
517
|
|
Me@50
|
518 VMS__suspend_procr( callingPr );
|
|
Me@50
|
519 }
|
|
Me@50
|
520
|
|
Me@50
|
521
|
|
Me@50
|
522 inline void
|
|
Me@50
|
523 VMS__send_VMSSem_request( void *semReqData, VirtProcr *callingPr )
|
|
Me@50
|
524 { VMSReqst req;
|
|
Me@50
|
525
|
|
Me@50
|
526 req.reqType = VMSSemantic;
|
|
Me@50
|
527 req.semReqData = semReqData;
|
|
Me@50
|
528 req.nextReqst = callingPr->requests; //gab any other preceeding
|
|
Me@50
|
529 callingPr->requests = &req;
|
|
Me@50
|
530
|
|
Me@50
|
531 VMS__suspend_procr( callingPr );
|
|
Me@50
|
532 }
|
|
Me@50
|
533
|
|
Me@50
|
534
|
|
Me@50
|
535 /*
|
|
Me@38
|
536 */
|
|
Me@24
|
537 VMSReqst *
|
|
Me@50
|
538 VMS__take_next_request_out_of( VirtProcr *procrWithReq )
|
|
Me@31
|
539 { VMSReqst *req;
|
|
Me@31
|
540
|
|
Me@31
|
541 req = procrWithReq->requests;
|
|
Me@38
|
542 if( req == NULL ) return NULL;
|
|
Me@31
|
543
|
|
Me@31
|
544 procrWithReq->requests = procrWithReq->requests->nextReqst;
|
|
Me@50
|
545 return req;
|
|
Me@24
|
546 }
|
|
Me@22
|
547
|
|
Me@24
|
548
|
|
Me@24
|
549 inline void *
|
|
Me@24
|
550 VMS__take_sem_reqst_from( VMSReqst *req )
|
|
Me@24
|
551 {
|
|
Me@24
|
552 return req->semReqData;
|
|
Me@24
|
553 }
|
|
Me@24
|
554
|
|
Me@24
|
555
|
|
Me@24
|
556
|
|
Me@50
|
557 /* This is for OS requests and VMS infrastructure requests, such as to create
|
|
Me@50
|
558 * a probe -- a probe is inside the heart of VMS-core, it's not part of any
|
|
Me@50
|
559 * language -- but it's also a semantic thing that's triggered from and used
|
|
Me@50
|
560 * in the application.. so it crosses abstractions.. so, need some special
|
|
Me@50
|
561 * pattern here for handling such requests.
|
|
Me@52
|
562 * Doing this just like it were a second language sharing VMS-core.
|
|
Me@52
|
563 *
|
|
Me@50
|
564 * This is called from the language's request handler when it sees a request
|
|
Me@50
|
565 * of type VMSSemReq
|
|
Me@52
|
566 *
|
|
Me@52
|
567 * TODO: Later change this, to give probes their own separate plugin & have
|
|
Me@52
|
568 * VMS-core steer the request to appropriate plugin
|
|
Me@52
|
569 * Do the same for OS calls -- look later at it..
|
|
Me@50
|
570 */
|
|
Me@50
|
571 void inline
|
|
Me@50
|
572 VMS__handle_VMSSemReq( VMSReqst *req, VirtProcr *requestingPr, void *semEnv,
|
|
Me@50
|
573 ResumePrFnPtr resumePrFnPtr )
|
|
Me@50
|
574 { VMSSemReq *semReq;
|
|
Me@50
|
575 IntervalProbe *newProbe;
|
|
Me@50
|
576 int32 nameLen;
|
|
Me@24
|
577
|
|
Me@50
|
578 semReq = req->semReqData;
|
|
Me@24
|
579
|
|
Me@50
|
580 newProbe = VMS__malloc( sizeof(IntervalProbe) );
|
|
Me@50
|
581 nameLen = strlen( semReq->nameStr );
|
|
Me@50
|
582 newProbe->nameStr = VMS__malloc( nameLen );
|
|
Me@50
|
583 memcpy( newProbe->nameStr, semReq->nameStr, nameLen );
|
|
Me@50
|
584 newProbe->hist = NULL;
|
|
Me@50
|
585 newProbe->schedChoiceWasRecorded = FALSE;
|
|
Me@53
|
586
|
|
Me@53
|
587 //This runs in masterVP, so no race-condition worries
|
|
Me@50
|
588 newProbe->probeID =
|
|
Me@50
|
589 addToDynArray( newProbe, _VMSMasterEnv->dynIntervalProbesInfo );
|
|
Me@50
|
590
|
|
Me@53
|
591 requestingPr->dataRetFromReq = newProbe;
|
|
Me@50
|
592
|
|
Me@50
|
593 (*resumePrFnPtr)( requestingPr, semEnv );
|
|
Me@22
|
594 }
|
|
Me@22
|
595
|
|
Me@22
|
596
|
|
Me@22
|
597
|
|
Me@24
|
598 /*This must be called by the request handler plugin -- it cannot be called
|
|
Me@24
|
599 * from the semantic library "dissipate processor" function -- instead, the
|
|
Me@50
|
600 * semantic layer has to generate a request, and the plug-in calls this
|
|
Me@24
|
601 * function.
|
|
Me@24
|
602 *The reason is that this frees the virtual processor's stack -- which is
|
|
Me@24
|
603 * still in use inside semantic library calls!
|
|
Me@24
|
604 *
|
|
Me@24
|
605 *This frees or recycles all the state owned by and comprising the VMS
|
|
Me@24
|
606 * portion of the animating virtual procr. The request handler must first
|
|
Me@24
|
607 * free any semantic data created for the processor that didn't use the
|
|
Me@24
|
608 * VMS_malloc mechanism. Then it calls this, which first asks the malloc
|
|
Me@24
|
609 * system to disown any state that did use VMS_malloc, and then frees the
|
|
Me@24
|
610 * statck and the processor-struct itself.
|
|
Me@24
|
611 *If the dissipated processor is the sole (remaining) owner of VMS__malloc'd
|
|
Me@24
|
612 * state, then that state gets freed (or sent to recycling) as a side-effect
|
|
Me@24
|
613 * of dis-owning it.
|
|
Me@24
|
614 */
|
|
Me@24
|
615 void
|
|
Me@53
|
616 VMS__dissipate_procr( VirtProcr *animatingPr )
|
|
Me@24
|
617 {
|
|
Me@24
|
618 //dis-own all locations owned by this processor, causing to be freed
|
|
Me@24
|
619 // any locations that it is (was) sole owner of
|
|
Me@29
|
620 //TODO: implement VMS__malloc system, including "give up ownership"
|
|
Me@24
|
621
|
|
Me@24
|
622
|
|
Me@24
|
623 //NOTE: initialData was given to the processor, so should either have
|
|
Me@24
|
624 // been alloc'd with VMS__malloc, or freed by the level above animPr.
|
|
Me@24
|
625 //So, all that's left to free here is the stack and the VirtProcr struc
|
|
Me@24
|
626 // itself
|
|
Me@50
|
627 //Note, should not stack-allocate initial data -- no guarantee, in
|
|
Me@50
|
628 // general that creating processor will outlive ones it creates.
|
|
Me@50
|
629 VMS__free( animatingPr->startOfStack );
|
|
Me@50
|
630 VMS__free( animatingPr );
|
|
Me@24
|
631 }
|
|
Me@24
|
632
|
|
Me@24
|
633
|
|
Me@53
|
634 //TODO: look at architecting cleanest separation between request handler
|
|
Me@29
|
635 // and master loop, for dissipate, create, shutdown, and other non-semantic
|
|
Me@29
|
636 // requests. Issue is chain: one removes requests from AppVP, one dispatches
|
|
Me@29
|
637 // on type of request, and one handles each type.. but some types require
|
|
Me@29
|
638 // action from both request handler and master loop -- maybe just give the
|
|
Me@29
|
639 // request handler calls like: VMS__handle_X_request_type
|
|
Me@24
|
640
|
|
Me@29
|
641
|
|
Me@29
|
642 /*This is called by the semantic layer's request handler when it decides its
|
|
Me@29
|
643 * time to shut down the VMS system. Calling this causes the core loop OS
|
|
Me@29
|
644 * threads to exit, which unblocks the entry-point function that started up
|
|
Me@29
|
645 * VMS, and allows it to grab the result and return to the original single-
|
|
Me@29
|
646 * threaded application.
|
|
Me@22
|
647 *
|
|
Me@29
|
648 *The _VMSMasterEnv is needed by this shut down function, so the create-seed-
|
|
Me@29
|
649 * and-wait function has to free a bunch of stuff after it detects the
|
|
Me@29
|
650 * threads have all died: the masterEnv, the thread-related locations,
|
|
Me@29
|
651 * masterVP any AppVPs that might still be allocated and sitting in the
|
|
Me@29
|
652 * semantic environment, or have been orphaned in the _VMSWorkQ.
|
|
Me@29
|
653 *
|
|
Me@53
|
654 *NOTE: the semantic plug-in is expected to use VMS__malloc to get all the
|
|
Me@29
|
655 * locations it needs, and give ownership to masterVP. Then, they will be
|
|
Me@53
|
656 * automatically freed.
|
|
Me@22
|
657 *
|
|
Me@29
|
658 *In here,create one core-loop shut-down processor for each core loop and put
|
|
Me@31
|
659 * them all directly into the readyToAnimateQ.
|
|
Me@29
|
660 *Note, this function can ONLY be called after the semantic environment no
|
|
Me@29
|
661 * longer cares if AppVPs get animated after the point this is called. In
|
|
Me@29
|
662 * other words, this can be used as an abort, or else it should only be
|
|
Me@29
|
663 * called when all AppVPs have finished dissipate requests -- only at that
|
|
Me@29
|
664 * point is it sure that all results have completed.
|
|
Me@22
|
665 */
|
|
Me@22
|
666 void
|
|
Me@53
|
667 VMS__shutdown()
|
|
Me@8
|
668 { int coreIdx;
|
|
Me@14
|
669 VirtProcr *shutDownPr;
|
|
Me@22
|
670
|
|
Me@29
|
671 //create the shutdown processors, one for each core loop -- put them
|
|
Me@31
|
672 // directly into the Q -- each core will die when gets one
|
|
Me@8
|
673 for( coreIdx=0; coreIdx < NUM_CORES; coreIdx++ )
|
|
Me@50
|
674 { //Note, this is running in the master
|
|
Me@29
|
675 shutDownPr = VMS__create_procr( &endOSThreadFn, NULL );
|
|
Me@31
|
676 writeSRSWQ( shutDownPr, _VMSMasterEnv->readyToAnimateQs[coreIdx] );
|
|
Me@8
|
677 }
|
|
Me@22
|
678
|
|
Me@12
|
679 }
|
|
Me@12
|
680
|
|
Me@12
|
681
|
|
Me@29
|
682 /*Am trying to be cute, avoiding IF statement in coreLoop that checks for
|
|
Me@29
|
683 * a special shutdown procr. Ended up with extra-complex shutdown sequence.
|
|
Me@29
|
684 *This function has the sole purpose of setting the stack and framePtr
|
|
Me@29
|
685 * to the coreLoop's stack and framePtr.. it does that then jumps to the
|
|
Me@29
|
686 * core loop's shutdown point -- might be able to just call Pthread_exit
|
|
Me@30
|
687 * from here, but am going back to the pthread's stack and setting everything
|
|
Me@29
|
688 * up just as if it never jumped out, before calling pthread_exit.
|
|
Me@29
|
689 *The end-point of core loop will free the stack and so forth of the
|
|
Me@29
|
690 * processor that animates this function, (this fn is transfering the
|
|
Me@29
|
691 * animator of the AppVP that is in turn animating this function over
|
|
Me@29
|
692 * to core loop function -- note that this slices out a level of virtual
|
|
Me@29
|
693 * processors).
|
|
Me@29
|
694 */
|
|
Me@29
|
695 void
|
|
Me@29
|
696 endOSThreadFn( void *initData, VirtProcr *animatingPr )
|
|
Me@29
|
697 { void *jmpPt, *coreLoopStackPtr, *coreLoopFramePtr;
|
|
Me@29
|
698
|
|
Me@29
|
699 jmpPt = _VMSMasterEnv->coreLoopEndPt;
|
|
Me@29
|
700 coreLoopStackPtr = animatingPr->coreLoopStackPtr;
|
|
Me@29
|
701 coreLoopFramePtr = animatingPr->coreLoopFramePtr;
|
|
Me@29
|
702
|
|
Me@29
|
703
|
|
Me@29
|
704 asm volatile("movl %0, %%eax; \
|
|
Me@29
|
705 movl %1, %%esp; \
|
|
Me@29
|
706 movl %2, %%ebp; \
|
|
Me@29
|
707 jmp %%eax " \
|
|
Me@29
|
708 /* outputs */ : \
|
|
Me@29
|
709 /* inputs */ : "m" (jmpPt), "m"(coreLoopStackPtr), "m"(coreLoopFramePtr)\
|
|
Me@29
|
710 /* clobber */ : "memory", "%eax", "%ebx", "%ecx", "%edx", "%edi","%esi" \
|
|
Me@29
|
711 );
|
|
Me@29
|
712 }
|
|
Me@29
|
713
|
|
Me@29
|
714
|
|
Me@53
|
715 /*This is called from the startup & shutdown
|
|
Me@24
|
716 */
|
|
Me@24
|
717 void
|
|
Me@53
|
718 VMS__cleanup_at_end_of_shutdown()
|
|
Me@31
|
719 {
|
|
Me@31
|
720 SRSWQueueStruc **readyToAnimateQs;
|
|
Me@31
|
721 int coreIdx;
|
|
Me@31
|
722 VirtProcr **masterVPs;
|
|
Me@31
|
723 SchedSlot ***allSchedSlots; //ptr to array of ptrs
|
|
Me@31
|
724
|
|
Me@53
|
725 //All the environment data has been allocated with VMS__malloc, so just
|
|
Me@53
|
726 // free its internal big-chunk and all inside it disappear.
|
|
Me@53
|
727 /*
|
|
Me@31
|
728 readyToAnimateQs = _VMSMasterEnv->readyToAnimateQs;
|
|
Me@31
|
729 masterVPs = _VMSMasterEnv->masterVPs;
|
|
Me@31
|
730 allSchedSlots = _VMSMasterEnv->allSchedSlots;
|
|
Me@31
|
731
|
|
Me@31
|
732 for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ )
|
|
Me@24
|
733 {
|
|
Me@31
|
734 freeSRSWQ( readyToAnimateQs[ coreIdx ] );
|
|
Me@50
|
735 //master VPs were created external to VMS, so use external free
|
|
Me@53
|
736 VMS__dissipate_procr( masterVPs[ coreIdx ] );
|
|
Me@31
|
737
|
|
Me@31
|
738 freeSchedSlots( allSchedSlots[ coreIdx ] );
|
|
Me@24
|
739 }
|
|
Me@31
|
740
|
|
Me@53
|
741 VMS__free( _VMSMasterEnv->readyToAnimateQs );
|
|
Me@53
|
742 VMS__free( _VMSMasterEnv->masterVPs );
|
|
Me@53
|
743 VMS__free( _VMSMasterEnv->allSchedSlots );
|
|
Me@50
|
744
|
|
Me@50
|
745 //============================= MEASUREMENT STUFF ========================
|
|
Me@50
|
746 #ifdef STATS__TURN_ON_PROBES
|
|
Me@53
|
747 freeDynArrayDeep( _VMSMasterEnv->dynIntervalProbesInfo, &VMS__free_probe);
|
|
Me@50
|
748 #endif
|
|
Me@50
|
749 //========================================================================
|
|
Me@53
|
750 */
|
|
Me@53
|
751 //These are the only two that use system free
|
|
Me@53
|
752 VMS_ext__free_free_list( _VMSMasterEnv->freeListHead );
|
|
Me@53
|
753 free( (void *)_VMSMasterEnv );
|
|
Me@24
|
754 }
|
|
Me@24
|
755
|
|
Me@54
|
756
|
|
Me@54
|
757 //================================
|
|
Me@54
|
758
|
|
Me@54
|
759
|
|
Me@54
|
760 /*Later, improve this -- for now, just exits the application after printing
|
|
Me@54
|
761 * the error message.
|
|
Me@54
|
762 */
|
|
Me@54
|
763 void
|
|
Me@54
|
764 VMS__throw_exception( char *msgStr, VirtProcr *reqstPr, VMSExcp *excpData )
|
|
Me@54
|
765 {
|
|
Me@54
|
766 printf(msgStr);
|
|
Me@54
|
767 fflush(stdin);
|
|
Me@54
|
768 exit(1);
|
|
Me@54
|
769 }
|
|
Me@54
|
770
|
|
Me@54
|
771
|
|
Me@54
|
772
|