diff --git a/Sim02/sim02 b/Sim02/sim02 index 79de342..3e3186f 100755 Binary files a/Sim02/sim02 and b/Sim02/sim02 differ diff --git a/Sim02/simulator.c b/Sim02/simulator.c index bcb877f..96adc22 100644 --- a/Sim02/simulator.c +++ b/Sim02/simulator.c @@ -134,6 +134,7 @@ ProcessControlBlockLL *fillProcessList(ConfigDataType *configPtr, OpCodeType *me // set the working pointer to the first part of the metadata pointer wkgMetaPtr = metadataPtr; wkgInsPtr = metadataPtr; + currentPCB.nextOpCode = wkgMetaPtr; // set another working pointer to the first part of the PCB list wkgPCBPtr = headPointer->headPtr; @@ -146,10 +147,10 @@ ProcessControlBlockLL *fillProcessList(ConfigDataType *configPtr, OpCodeType *me //integerArgumentTwo = wkgMetaPtr->intArg3; // loop through the process list, until you hit a sys end. - while(wkgMetaPtr->nextNode != NULL && !(compareString(argument, "end") == EQUIV && compareString(command, "sys") == EQUIV)) + while(wkgMetaPtr != NULL && !(compareString(argument, "end") == EQUIV && compareString(command, "sys") == EQUIV)) { integerArgumentOne = wkgMetaPtr->intArg2; - // printf("%s command, %s argument, %d\n", command, argument, integerArgumentOne); + printf("%s command, %s argument, %d\n", command, argument, integerArgumentOne); // if app start, if (compareString(command, "app") && compareString(argument, "start")) { @@ -160,6 +161,7 @@ ProcessControlBlockLL *fillProcessList(ConfigDataType *configPtr, OpCodeType *me currentPCB.process_state = PROCESS_STATE_NEW; // set the nextOpCode as a pointer to the first place metadataPtr started // currentPCB.nextOpCode = wkgMetaPtr->nextNode; // broken? + currentPCB.nextOpCode = wkgInsPtr->nextNode; } // count number of io cycles if(compareString(command, "dev") == EQUIV) @@ -193,8 +195,8 @@ ProcessControlBlockLL *fillProcessList(ConfigDataType *configPtr, OpCodeType *me currentPCB.totalCycles = ioCycleCount + cpuCycleCount; // currentPCB must have the starting instruction from wkgInsPtr - currentPCB.nextOpCode = wkgInsPtr->nextNode; - + // currentPCB.nextOpCode = wkgInsPtr->nextNode; + wkgInsPtr = wkgMetaPtr; // set the time left from (ioCycles * ioCycleRate) + (cpuCycles * procCyclesRate) // this gets the number of ms in the process. @@ -224,7 +226,6 @@ ProcessControlBlockLL *fillProcessList(ConfigDataType *configPtr, OpCodeType *me command = wkgMetaPtr->command; argument = wkgMetaPtr->strArg1; inOutArg = wkgMetaPtr->inOutArg; - wkgInsPtr = wkgMetaPtr; } // return headPointer