comparison VMS.h @ 13:4b58b9a2527b

Middle of testing core loop
author Me
date Sat, 19 Jun 2010 19:26:49 -0700
parents f96e4b3b35c7
children c3e6c3fda84e
comparison
equal deleted inserted replaced
2:b5e17705434e 3:b0496ae7a130
10 #define _VMS_H 10 #define _VMS_H
11 11
12 #include "VMS_primitive_data_types.h" 12 #include "VMS_primitive_data_types.h"
13 #include "Queue_impl/BlockingQueue.h" 13 #include "Queue_impl/BlockingQueue.h"
14 #include <windows.h> 14 #include <windows.h>
15 #include <winbase.h>
15 16
16 //This value is the number of hardware threads in the shared memory 17 //This value is the number of hardware threads in the shared memory
17 // machine -- make double that number scheduling slots, plus extra for master 18 // machine -- make double that number scheduling slots, plus extra for master
18 #define NUM_CORES 4 19 #define NUM_CORES 4
19 #define NUM_SCHED_SLOTS 9 20 #define NUM_SCHED_SLOTS 9
20 21
21 #define SUCCESS 0 22 #define SUCCESS 0
22 23
23 #define thdAttrs NULL 24 //#define thdAttrs NULL //For PThreads
24 25
25 typedef struct _WorkUnit WorkUnit; 26 typedef struct _WorkUnit WorkUnit;
26 typedef struct _VirtProcr VirtProcr; 27 typedef struct _VirtProcr VirtProcr;
27 typedef struct _SlaveReqst SlaveReqst; 28 typedef struct _SlaveReqst SlaveReqst;
28 typedef struct _SchedSlot SchedSlot; 29 typedef struct _SchedSlot SchedSlot;
46 VirtProcr *procrAssignedToSlot; 47 VirtProcr *procrAssignedToSlot;
47 }; 48 };
48 49
49 50
50 struct _VirtProcr 51 struct _VirtProcr
51 { 52 { int procrID; //for debugging -- count up each time create
52 void *stackPtr; 53 void *stackPtr;
53 void *framePtr; 54 void *framePtr;
54 void *nextInstrPt; 55 void *nextInstrPt;
55 void *coreLoopStartPt; //allows proto-runtime to be linked later 56 void *coreLoopStartPt; //allows proto-runtime to be linked later
56 57
100 101
101 102
102 //===================== Global Vars =================== 103 //===================== Global Vars ===================
103 104
104 105
105 HANDLE coreLoopThds[ NUM_CORES ]; //windows handle to thread 106 HANDLE coreLoopThdHandles[ NUM_CORES ]; //windows handle to thread
106 ThdParams *thdParams[ NUM_CORES ]; 107 ThdParams *coreLoopThdParams[ NUM_CORES ];
107 DWORD thdIds[ NUM_CORES ]; 108 DWORD coreLoopThdIds[ NUM_CORES ];
108 109
109 volatile MasterEnv *_VMSMasterEnv; 110 //TODO: Debug: figure out if need to be volatile or not
111 volatile MasterEnv *_VMSMasterEnv;
110 112
111 //workQ is global, static, and volatile so that core loop has its location 113 //workQ is global, static, and volatile so that core loop has its location
112 // hard coded, and reloads every time through the loop -- that way don't 114 // hard coded, and reloads every time through the loop -- that way don't
113 // need to save any regs used by core loop (will see if this really works) 115 // need to save any regs used by core loop (will see if this really works)
114 volatile QueueStruc *_VMSWorkQ; 116 volatile CASQueueStruc *_VMSWorkQ;
115 117
116 //========================== 118 //==========================
117 void 119 void
118 VMS__init(); 120 VMS__init();
119 121
127 VMS__send_sem_request( void *semReqData, VirtProcr *callingPr ); 129 VMS__send_sem_request( void *semReqData, VirtProcr *callingPr );
128 130
129 void 131 void
130 VMS__suspend_processor( VirtProcr *callingPr ); 132 VMS__suspend_processor( VirtProcr *callingPr );
131 133
134 //============================= Statistics ==================================
135
136 typedef unsigned long long TSCount;
137
138 #define saveTimeStampCountInto(low, high) \
139 asm volatile("RDTSC; \
140 movl %%eax, %0; \
141 movl %%edx, %1;" \
142 /* outputs */ : "=m" (low), "=m" (high)\
143 /* inputs */ : \
144 /* clobber */ : "%eax", "%edx" \
145 );
146
147 inline TSCount getTSCount();
148
149 int numProcrsCreated;
132 150
133 #endif /* _VMS_H */ 151 #endif /* _VMS_H */
134 152