changeset 18:734c665500e4

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:43 -0700
parents 030fceb7e9b9
children 345d14338769
files VMS.c
diffstat 1 files changed, 14 insertions(+), 12 deletions(-) [+]
line diff
     1.1 --- a/VMS.c	Tue Jun 22 12:37:32 2010 -0700
     1.2 +++ b/VMS.c	Tue Jun 22 12:37:43 2010 -0700
     1.3 @@ -200,24 +200,26 @@
     1.4     callingPr->schedSlot->workIsDone = TRUE;
     1.5  //   coreIdx = callingPr->coreAnimatedBy;
     1.6  
     1.7 -//   stackPtrAddr      = &(callingPr->stackPtr);
     1.8 -//   framePtrAddr      = &(callingPr->framePtr);
     1.9 +   stackPtrAddr      = &(callingPr->stackPtr);
    1.10 +   framePtrAddr      = &(callingPr->framePtr);
    1.11     
    1.12     jmpPt             = callingPr->coreLoopStartPt;
    1.13     coreLoopFramePtr  = callingPr->coreLoopFramePtr;//need this only
    1.14 -   coreLoopStackPtr  = callingPr->coreLoopStackPtr;
    1.15 -//   coreLoopStackPtr  = coreLoopThdParams[ coreIdx ]->stackPtr;//prob dont need
    1.16 +   coreLoopStackPtr  = callingPr->coreLoopStackPtr;//shouldn't need -- safety
    1.17  
    1.18        //Save the virt procr's stack and frame ptrs, restore coreloop's frame
    1.19        // ptr, then jump back to "start" of core loop
    1.20 -   asm volatile("movl %%esp, %0; \
    1.21 -                 movl %%ebp, %1; \
    1.22 -                 movl %3, %%eax; \
    1.23 -                 movl %2, %%ebp; \
    1.24 -                 jmp  %%eax    " \
    1.25 -   /* outputs */ : "=g" (callingPr->stackPtr), "=g" (callingPr->framePtr) \
    1.26 -   /* inputs  */ : "g"(coreLoopFramePtr), "g" (jmpPt) \
    1.27 -   /* clobber */ : "memory", "%eax", "%ebx", "%ecx", "%edx", "%edi","%esi" \
    1.28 +   asm volatile("movl %0,     %%eax;  \
    1.29 +                 movl %%esp, (%%eax); \
    1.30 +                 movl %1,     %%eax;  \
    1.31 +                 movl %%ebp, (%%eax); \
    1.32 +                 movl %2, %%eax;      \
    1.33 +                 movl %3, %%esp;      \
    1.34 +                 movl %4, %%ebp;      \
    1.35 +                 jmp  %%eax    "      \
    1.36 +   /* outputs */ : "=g" (stackPtrAddr), "=g" (framePtrAddr) \
    1.37 +   /* inputs  */ : "g" (jmpPt), "g"(coreLoopStackPtr), "g"(coreLoopFramePtr)\
    1.38 +   /* clobber */ : "memory", "%eax", "%ebx", "%ecx", "%edx", "%edi","%esi"  \
    1.39                  ); //list everything as clobbered to force GCC to save all
    1.40                     // live vars that are in regs on stack before this
    1.41                     // assembly, so that stack pointer is correct, before jmp