Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
comparison MasterLoop.c @ 75:f6990e1ba998
new sequential version
| author | Merten Sach <msach@mailbox.tu-berlin.de> |
|---|---|
| date | Thu, 02 Jun 2011 13:55:51 +0200 |
| parents | 11bfe9d136ed |
| children | fe5ec83f1baf |
comparison
equal
deleted
inserted
replaced
| 21:da2284d25a80 | 23:a1782f1a475e |
|---|---|
| 8 | 8 |
| 9 #include <stdio.h> | 9 #include <stdio.h> |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| 11 | 11 |
| 12 #include "VMS.h" | 12 #include "VMS.h" |
| 13 #include "SwitchAnimators.h" | |
| 13 | 14 |
| 14 | 15 |
| 15 //=========================================================================== | 16 //=========================================================================== |
| 16 void inline | 17 void inline |
| 17 stealWorkInto( SchedSlot *currSlot, VMSQueueStruc *readyToAnimateQ, | 18 stealWorkInto( SchedSlot *currSlot, VMSQueueStruc *readyToAnimateQ, |
| 91 | 92 |
| 92 //First animation of each MasterVP will in turn animate this part | 93 //First animation of each MasterVP will in turn animate this part |
| 93 // of setup code.. (VP creator sets up the stack as if this function | 94 // of setup code.. (VP creator sets up the stack as if this function |
| 94 // was called normally, but actually get here by jmp) | 95 // was called normally, but actually get here by jmp) |
| 95 //So, setup values about stack ptr, jmp pt and all that | 96 //So, setup values about stack ptr, jmp pt and all that |
| 96 masterPr->nextInstrPt = &&masterLoopStartPt; | 97 //masterPr->nextInstrPt = &&masterLoopStartPt; |
| 97 | 98 |
| 98 | 99 |
| 99 //Note, got rid of writing the stack and frame ptr up here, because | 100 //Note, got rid of writing the stack and frame ptr up here, because |
| 100 // only one | 101 // only one |
| 101 // core can ever animate a given MasterVP, so don't need to communicate | 102 // core can ever animate a given MasterVP, so don't need to communicate |
| 102 // new frame and stack ptr to the MasterVP storage before a second | 103 // new frame and stack ptr to the MasterVP storage before a second |
| 103 // version of that MasterVP can get animated on a different core. | 104 // version of that MasterVP can get animated on a different core. |
| 104 //Also got rid of the busy-wait. | 105 //Also got rid of the busy-wait. |
| 105 | 106 |
| 106 | 107 |
| 107 masterLoopStartPt: | 108 //masterLoopStartPt: |
| 109 while(1){ | |
| 110 | |
| 108 //============================= MEASUREMENT STUFF ======================== | 111 //============================= MEASUREMENT STUFF ======================== |
| 109 #ifdef MEAS__TIME_MASTER | 112 #ifdef MEAS__TIME_MASTER |
| 110 //Total Master time includes one coreloop time -- just assume the core | 113 //Total Master time includes one coreloop time -- just assume the core |
| 111 // loop time is same for Master as for AppVPs, even though it may be | 114 // loop time is same for Master as for AppVPs, even though it may be |
| 112 // smaller due to higher predictability of the fixed jmp. | 115 // smaller due to higher predictability of the fixed jmp. |
| 183 | 186 |
| 184 #ifdef MEAS__TIME_MASTER | 187 #ifdef MEAS__TIME_MASTER |
| 185 saveLowTimeStampCountInto( masterPr->endMasterTSCLow ); | 188 saveLowTimeStampCountInto( masterPr->endMasterTSCLow ); |
| 186 #endif | 189 #endif |
| 187 | 190 |
| 188 | 191 masterSwitchToCoreLoop(animatingPr); |
| 189 | 192 flushRegisters(); |
| 190 /* VirtProcr offsets: | 193 }//MasterLoop |
| 191 * 0xc stackPtr | 194 |
| 192 * 0x10 framePtr | |
| 193 * 0x14 nextInstrPt | |
| 194 * 0x1c coreLoopFramePtr | |
| 195 * 0x20 coreLoopStackPtr | |
| 196 * | |
| 197 * _VMSMasterEnv offsets: | |
| 198 * 0x24 coreLoopStartPt | |
| 199 * 0x28 coreLoopEndPt | |
| 200 * 0x30 masterLock | |
| 201 */ | |
| 202 // masterSwitchToCoreLoop( masterPr ) | |
| 203 asm volatile("movl %0, %%ebx; \ | |
| 204 movl %1, %%ecx; \ | |
| 205 movl %%esp, 0x0c(%%ecx); \ | |
| 206 movl %%ebp, 0x10(%%ecx); \ | |
| 207 movl 0x24(%%ebx), %%eax; \ | |
| 208 movl 0x20(%%ecx), %%esp; \ | |
| 209 movl 0x1c(%%ecx), %%ebp; \ | |
| 210 movl $0x0, 0x30(%%ebx); \ | |
| 211 jmp %%eax" \ | |
| 212 /* outputs */ : \ | |
| 213 /* inputs */ : "g"(_VMSMasterEnv), "g"(masterPr) \ | |
| 214 /* clobber */ : "memory", "%eax", "%ebx", "%ecx", "%edx", "%edi", "%esi" \ | |
| 215 ); | |
| 216 | 195 |
| 217 } | 196 } |
| 218 | 197 |
| 219 | 198 |
| 220 | 199 |
