comparison VMS.c @ 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 65c8fb2821ee
children 1dbc7f6e3e67
comparison
equal deleted inserted replaced
4:b21e0df42f17 5:e76b9b55566c
198 198
199 //return ownership of the virt procr and sched slot to Master virt pr 199 //return ownership of the virt procr and sched slot to Master virt pr
200 callingPr->schedSlot->workIsDone = TRUE; 200 callingPr->schedSlot->workIsDone = TRUE;
201 // coreIdx = callingPr->coreAnimatedBy; 201 // coreIdx = callingPr->coreAnimatedBy;
202 202
203 // stackPtrAddr = &(callingPr->stackPtr); 203 stackPtrAddr = &(callingPr->stackPtr);
204 // framePtrAddr = &(callingPr->framePtr); 204 framePtrAddr = &(callingPr->framePtr);
205 205
206 jmpPt = callingPr->coreLoopStartPt; 206 jmpPt = callingPr->coreLoopStartPt;
207 coreLoopFramePtr = callingPr->coreLoopFramePtr;//need this only 207 coreLoopFramePtr = callingPr->coreLoopFramePtr;//need this only
208 coreLoopStackPtr = callingPr->coreLoopStackPtr; 208 coreLoopStackPtr = callingPr->coreLoopStackPtr;//shouldn't need -- safety
209 // coreLoopStackPtr = coreLoopThdParams[ coreIdx ]->stackPtr;//prob dont need
210 209
211 //Save the virt procr's stack and frame ptrs, restore coreloop's frame 210 //Save the virt procr's stack and frame ptrs, restore coreloop's frame
212 // ptr, then jump back to "start" of core loop 211 // ptr, then jump back to "start" of core loop
213 asm volatile("movl %%esp, %0; \ 212 asm volatile("movl %0, %%eax; \
214 movl %%ebp, %1; \ 213 movl %%esp, (%%eax); \
215 movl %3, %%eax; \ 214 movl %1, %%eax; \
216 movl %2, %%ebp; \ 215 movl %%ebp, (%%eax); \
217 jmp %%eax " \ 216 movl %2, %%eax; \
218 /* outputs */ : "=g" (callingPr->stackPtr), "=g" (callingPr->framePtr) \ 217 movl %3, %%esp; \
219 /* inputs */ : "g"(coreLoopFramePtr), "g" (jmpPt) \ 218 movl %4, %%ebp; \
220 /* clobber */ : "memory", "%eax", "%ebx", "%ecx", "%edx", "%edi","%esi" \ 219 jmp %%eax " \
220 /* outputs */ : "=g" (stackPtrAddr), "=g" (framePtrAddr) \
221 /* inputs */ : "g" (jmpPt), "g"(coreLoopStackPtr), "g"(coreLoopFramePtr)\
222 /* clobber */ : "memory", "%eax", "%ebx", "%ecx", "%edx", "%edi","%esi" \
221 ); //list everything as clobbered to force GCC to save all 223 ); //list everything as clobbered to force GCC to save all
222 // live vars that are in regs on stack before this 224 // live vars that are in regs on stack before this
223 // assembly, so that stack pointer is correct, before jmp 225 // assembly, so that stack pointer is correct, before jmp
224 226
225 ResumePt: 227 ResumePt: