Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
changeset 17:030fceb7e9b9
Kinda have test working -- assembly looks right for saving core loop frame and stack
and restoring them
But have a bug that looks timing-related, so thinking maybe some threads are going to
completion? The whole test isn't quite right yet -- it throws exception because the
suspended virtual processors never have a continuation put back into the workQ
(is this right? Is that why it throws exception?)
Want to move to full code to finish debugging
| author | Me |
|---|---|
| date | Tue, 22 Jun 2010 12:37:32 -0700 |
| parents | c3e6c3fda84e |
| children | 734c665500e4 |
| files | CoreLoop.c |
| diffstat | 1 files changed, 16 insertions(+), 9 deletions(-) [+] |
line diff
1.1 --- a/CoreLoop.c Tue Jun 22 11:53:32 2010 -0700 1.2 +++ b/CoreLoop.c Tue Jun 22 12:37:32 2010 -0700 1.3 @@ -69,11 +69,14 @@ 1.4 currPr->coreAnimatedBy = coreLoopThdParams->coreNum; 1.5 1.6 //switch to virt procr's stack and frame ptr then jump to virt procr 1.7 - void *stackPtr, *framePtr, *jmpPt, *jmpPt_saveForLater; 1.8 + void *stackPtr, *framePtr, *jmpPt, *coreLoopFramePtrAddr, \ 1.9 + *coreLoopStackPtrAddr; 1.10 1.11 stackPtr = currPr->stackPtr; 1.12 framePtr = currPr->framePtr; 1.13 jmpPt = currPr->nextInstrPt; 1.14 + coreLoopFramePtrAddr = &(currPr->coreLoopFramePtr); 1.15 + coreLoopStackPtrAddr = &(currPr->coreLoopStackPtr); 1.16 1.17 //Save the core loop's stack and frame pointers into virt procr struct 1.18 // then switch to stack ptr and frame ptr of virt procr & jmp to it 1.19 @@ -82,14 +85,18 @@ 1.20 // frame pointer, then tried to jump to an addr stored on stack, which 1.21 // it accessed as an offset from frame-ptr! (wrong frame-ptr now) 1.22 //Explicitly loading into eax before changing frame-ptr fixed it 1.23 - asm volatile("movl %%ebp, %0; \ 1.24 - movl %%esp, %1; \ 1.25 - movl %2, %%eax; \ 1.26 - movl %3, %%esp; \ 1.27 - movl %4, %%ebp; \ 1.28 - jmp %%eax" \ 1.29 - /* outputs */ : "=g"(currPr->coreLoopFramePtr), \ 1.30 - "=g"(currPr->coreLoopStackPtr) \ 1.31 + //Also, it turns "(currPr->coreLoopFramePtr)" into a temporary on the 1.32 + // stack, so "movl %%ebp, %0" saves to the temp, NOT the data-struc! 1.33 + asm volatile("movl %0, %%eax; \ 1.34 + movl %%esp, (%%eax); \ 1.35 + movl %1, %%eax; \ 1.36 + movl %%ebp, (%%eax); \ 1.37 + movl %2, %%eax; \ 1.38 + movl %3, %%esp; \ 1.39 + movl %4, %%ebp; \ 1.40 + jmp %%eax" \ 1.41 + /* outputs */ : "=g"(coreLoopStackPtrAddr), \ 1.42 + "=g"(coreLoopFramePtrAddr) \ 1.43 /* inputs */ : "g" (jmpPt), "g" (stackPtr), "g" (framePtr) \ 1.44 /* clobber */ : "memory", "%eax", "%ebx", "%ecx", "%edx", "%edi", "%esi" \ 1.45 );
