Fixed the simulator to get every subprocess except for the first in each process...

+- simulator.c
This commit is contained in:
Charles Descamps 2024-03-10 17:45:36 -07:00
parent 20a6731ee2
commit a4f9cd88fa
2 changed files with 6 additions and 5 deletions

Binary file not shown.

View file

@ -134,6 +134,7 @@ ProcessControlBlockLL *fillProcessList(ConfigDataType *configPtr, OpCodeType *me
// set the working pointer to the first part of the metadata pointer // set the working pointer to the first part of the metadata pointer
wkgMetaPtr = metadataPtr; wkgMetaPtr = metadataPtr;
wkgInsPtr = metadataPtr; wkgInsPtr = metadataPtr;
currentPCB.nextOpCode = wkgMetaPtr;
// set another working pointer to the first part of the PCB list // set another working pointer to the first part of the PCB list
wkgPCBPtr = headPointer->headPtr; wkgPCBPtr = headPointer->headPtr;
@ -146,10 +147,10 @@ ProcessControlBlockLL *fillProcessList(ConfigDataType *configPtr, OpCodeType *me
//integerArgumentTwo = wkgMetaPtr->intArg3; //integerArgumentTwo = wkgMetaPtr->intArg3;
// loop through the process list, until you hit a sys end. // 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; 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 app start,
if (compareString(command, "app") && compareString(argument, "start")) if (compareString(command, "app") && compareString(argument, "start"))
{ {
@ -160,6 +161,7 @@ ProcessControlBlockLL *fillProcessList(ConfigDataType *configPtr, OpCodeType *me
currentPCB.process_state = PROCESS_STATE_NEW; currentPCB.process_state = PROCESS_STATE_NEW;
// set the nextOpCode as a pointer to the first place metadataPtr started // set the nextOpCode as a pointer to the first place metadataPtr started
// currentPCB.nextOpCode = wkgMetaPtr->nextNode; // broken? // currentPCB.nextOpCode = wkgMetaPtr->nextNode; // broken?
currentPCB.nextOpCode = wkgInsPtr->nextNode;
} }
// count number of io cycles // count number of io cycles
if(compareString(command, "dev") == EQUIV) if(compareString(command, "dev") == EQUIV)
@ -193,8 +195,8 @@ ProcessControlBlockLL *fillProcessList(ConfigDataType *configPtr, OpCodeType *me
currentPCB.totalCycles = ioCycleCount + cpuCycleCount; currentPCB.totalCycles = ioCycleCount + cpuCycleCount;
// currentPCB must have the starting instruction from wkgInsPtr // 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) // set the time left from (ioCycles * ioCycleRate) + (cpuCycles * procCyclesRate)
// this gets the number of ms in the process. // this gets the number of ms in the process.
@ -224,7 +226,6 @@ ProcessControlBlockLL *fillProcessList(ConfigDataType *configPtr, OpCodeType *me
command = wkgMetaPtr->command; command = wkgMetaPtr->command;
argument = wkgMetaPtr->strArg1; argument = wkgMetaPtr->strArg1;
inOutArg = wkgMetaPtr->inOutArg; inOutArg = wkgMetaPtr->inOutArg;
wkgInsPtr = wkgMetaPtr;
} }
// return headPointer // return headPointer