Started Memory operations on simulator
+- simulator.c
This commit is contained in:
parent
ee95d19bfe
commit
d5705e42a4
4 changed files with 97 additions and 1 deletions
|
|
@ -1,5 +1,20 @@
|
|||
#include "simulator.h"
|
||||
|
||||
/*
|
||||
Name: accessMemory
|
||||
Process: checks offset from the PCB
|
||||
Function Input/Parameters: source PCB (ProcessControlBlock *), offset (int), size (int)
|
||||
Function Output/Parameters: none
|
||||
Function Output/Returned: none?
|
||||
Device Input/Device: none
|
||||
Device Output/Device: none
|
||||
Dependencies: ???
|
||||
*/
|
||||
void accessMemory(ProcessControlBlock *singlePCB, int offset, int size)
|
||||
{
|
||||
// no return, void (temp)
|
||||
}
|
||||
|
||||
/*
|
||||
Name: addProcess
|
||||
Process: allocates the memory for the pcb, grabs the data from the created PCB,
|
||||
|
|
@ -31,6 +46,21 @@ ProcessControlBlock *addProcess(const ProcessControlBlock source)
|
|||
return workingNode;
|
||||
}
|
||||
|
||||
/*
|
||||
Name: allocMemory
|
||||
Process: 'allocates' memory within the PCB, stores offset and size within it's PCB
|
||||
Function Input/Parameters: source PCB (ProcessControlBlock *), offset (int), size (int)
|
||||
Function Output/Parameters: none
|
||||
Function Output/Returned: none?
|
||||
Device Input/Device: none
|
||||
Device Output/Device: none
|
||||
Dependencies: ???
|
||||
*/
|
||||
void allocMemory(ProcessControlBlock *singlePCB, int offset, int size)
|
||||
{
|
||||
// no return, void (temp)
|
||||
}
|
||||
|
||||
/*
|
||||
Name: createProcessList
|
||||
Process: reads through the opcode struct to fill out the linked list of PCBs
|
||||
|
|
@ -52,6 +82,21 @@ ProcessControlBlockLL *createProcessList()
|
|||
return headBlock;
|
||||
}
|
||||
|
||||
/*
|
||||
Name: deallocMemory
|
||||
Process: 'deallocates' memory within the PCB, removes offset and size within it's PCB
|
||||
Function Input/Parameters: source PCB (ProcessControlBlock *), offset (int), size (int)
|
||||
Function Output/Parameters: none
|
||||
Function Output/Returned: none?
|
||||
Device Input/Device: none
|
||||
Device Output/Device: none
|
||||
Dependencies: ???
|
||||
*/
|
||||
void deallocMemory(ProcessControlBlock *singlePCB, int offset, int size)
|
||||
{
|
||||
// no return, void (temp)
|
||||
}
|
||||
|
||||
/*
|
||||
Name: destroyProcessList
|
||||
Process: deallocates memory used for the linked list struct
|
||||
|
|
@ -304,6 +349,46 @@ void logOutput(ConfigDataType *configPtr, char *logStr, bool isEnd)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Name: memManager
|
||||
Process: checks to make sure an allocate will be successful,
|
||||
makes sure that an access will not segfault (or return segfault if it does),
|
||||
and initializes memory and deallocates memory
|
||||
Function Input/Parameters: PCBList (ProcessControlBlockLL *), memory code (MEMORY_SIGNALS),
|
||||
offset (int), size (int), configuration data (ConfigDataType *)
|
||||
Function Output/Parameters: none
|
||||
Function Output/Returned: none?
|
||||
Device Input/Device: none
|
||||
Device Output/Device: none
|
||||
Dependencies: ???
|
||||
*/
|
||||
void memManager(ProcessControlBlockLL *pcbList, MEMORY_SIGNALS memCode, int offset, int size, ConfigDataType *configPtr)
|
||||
{
|
||||
// switch case for each memory code
|
||||
switch (memCode)
|
||||
{
|
||||
case MEMORY_INITIALIZE:
|
||||
/* code */
|
||||
break;
|
||||
|
||||
case MEMORY_ALLOCATE:
|
||||
/* code */
|
||||
break;
|
||||
|
||||
case MEMORY_ACCESS:
|
||||
/* code */
|
||||
break;
|
||||
|
||||
case MEMORY_DEALLOCATE:
|
||||
/* code */
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// no return, void (temp)
|
||||
}
|
||||
|
||||
/*
|
||||
Name: runCPU
|
||||
Process: runs the CPU operations for however long it takes
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue