# HG changeset patch # User Me # Date 1283355124 25200 # Node ID 65e5918731b845d0a05c806f646f621ffbd23286 # Parent c8823e0bb2b430713eeb99a088a8ea6d2e826a3f Bugfix: initialize request pointer to NULL in newly created VP diff -r c8823e0bb2b4 -r 65e5918731b8 VMS.c --- a/VMS.c Mon Aug 09 02:24:31 2010 -0700 +++ b/VMS.c Wed Sep 01 08:32:04 2010 -0700 @@ -267,14 +267,14 @@ newPr->procrID = numProcrsCreated++; newPr->nextInstrPt = fnPtr; newPr->initialData = initialData; + newPr->requests = NULL; //fnPtr takes two params -- void *initData & void *animProcr //alloc stack locations, make stackPtr be the highest addr minus room // for 2 params + return addr. Return addr (NULL) is in loc pointed to // by stackPtr, initData at stackPtr + 4 bytes, animatingPr just above stackLocs = malloc( VIRT_PROCR_STACK_SIZE ); - if(stackLocs == 0) - {perror("malloc stack"); exit(1);} + if(stackLocs == 0) {perror("malloc stack"); exit(1);} newPr->startOfStack = stackLocs; stackPtr = ( (char *)stackLocs + VIRT_PROCR_STACK_SIZE - 0x10 ); //setup __cdecl on stack -- coreloop will switch to stackPtr before jmp @@ -350,22 +350,6 @@ -/*This is equivalent to "jump back to core loop" -- it's mainly only used - * just after adding dissipate request to a processor -- so the semantic - * layer is the only place it will be seen and/or used. - * - *It does almost the same thing as suspend, except don't need to save the - * stack nor set the nextInstrPt - * - *As of June 30, 2010 just implementing as a call to suspend -- just sugar - */ -void -VMS__return_from_fn( VirtProcr *animatingPr ) - { - VMS__suspend_procr( animatingPr ); - } - - /*Not sure yet the form going to put "dissipate" in, so this is the third * possibility -- the semantic layer can just make a macro that looks like * a call to its name, then expands to a call to this. @@ -458,6 +442,19 @@ return req; } +VMSReqst * +VMS__free_top_and_give_next_request_from( VirtProcr *procrWithReq ) + { VMSReqst *req; + + req = procrWithReq->requests; + if( req == NULL ) return req; + + procrWithReq->requests = procrWithReq->requests->nextReqst; + VMS__free_request( req ); + return procrWithReq->requests; + } + + inline int VMS__isSemanticReqst( VMSReqst *req ) {