view ProcrContext.h @ 132:dbfc8382d546

distributed memory allocation interface - unfinished
author Merten Sach <msach@mailbox.tu-berlin.de>
date Fri, 16 Sep 2011 14:25:49 +0200
parents 521c75d64cef
children a9b72021f053
line source
1 /*
2 * Copyright 2009 OpenSourceStewardshipFoundation.org
3 * Licensed under GNU General Public License version 2
4 *
5 * Author: seanhalle@yahoo.com
6 *
7 */
8 #ifndef _ProcrContext_H
9 #define _ProcrContext_H
10 #define _GNU_SOURCE
12 #include "VMS.h"
14 typedef struct _SchedSlot SchedSlot;
15 typedef struct _VirtProcr VirtProcr;
17 /*WARNING: re-arranging this data structure could cause VP switching
18 * assembly code to fail -- hard-codes offsets of fields
19 */
20 struct _VirtProcr
21 { int procrID; //for debugging -- count up each time create
22 int coreAnimatedBy;
23 void *startOfStack;
24 void *stackPtr;
25 void *framePtr;
26 void *nextInstrPt;
28 void *coreLoopStartPt; //allows proto-runtime to be linked later
29 void *coreLoopFramePtr; //restore before jmp back to core loop
30 void *coreLoopStackPtr; //restore before jmp back to core loop
32 void *initialData;
34 SchedSlot *schedSlot;
35 VMSReqst *requests;
37 void *semanticData;
38 void *dataRetFromReq; //values returned from plugin to VP go here
40 //=========== MEASUREMENT STUFF ==========
41 #ifdef MEAS__TIME_STAMP_SUSP
42 unsigned int preSuspTSCLow;
43 unsigned int postSuspTSCLow;
44 #endif
45 #ifdef MEAS__TIME_MASTER /* in VirtProcr because multiple masterVPs*/
46 unsigned int startMasterTSCLow;USE_GNU
47 unsigned int endMasterTSCLow;
48 #endif
49 //========================================
51 float64 createPtInSecs; //have space but don't use on some configs
52 };
53 //VirtProcr
55 struct _SchedSlot
56 {
57 int workIsDone;
58 int needsProcrAssigned;
59 VirtProcr *procrAssignedToSlot;
60 };
62 void saveCoreLoopReturnAddr(void **returnAddress);
64 void switchToVP(VirtProcr *nextProcr);
66 void switchToCoreLoop(VirtProcr *nextProcr);
68 void masterSwitchToCoreLoop(VirtProcr *nextProcr);
70 void startVirtProcrFn();
72 void *asmTerminateCoreLoop(VirtProcr *currPr);
74 #define flushRegisters() \
75 asm volatile ("":::"%rbx", "%r12", "%r13","%r14","%r15")
77 inline VirtProcr *
78 create_procr_helper( VirtProcr *newPr, VirtProcrFnPtr fnPtr,
79 void *initialData, void *stackLocs );
81 #endif /* _ProcrContext_H */