//Sets up the PCB by setting the structure to the information necessary PCB *setupPCB(char* processName, int PCBclass, int priority){ PCB *newPCB = allocatePCB(); strcpy(newPCB->processName, processName); newPCB->PCBclass = PCBclass; newPCB->priority = priority; newPCB->suspended = 0; newPCB->state = 2; return newPCB; }
void createProcess (unsigned int ds,unsigned int ss, unsigned int stackTop, unsigned int cs , unsigned int processEntry) { unsigned int *st; st= (unsigned int *) stackTop; st=st-1; *st=0x0000; st=st-1; *st=cs; st=st-1; *st=processEntry; st = st - 1; *st = 0; //ebp st=st-1; *st=0; //esp st=st-1; *st=0; //edi st=st-1; *st=0; //esi st=st-1; *st=0; //edx st=st-1; *st=0; //ecx st=st-1; *st=0; // ebx st=st-1; *st=0; // eax st=st-1; *st=ds; //ds st=st-1; *st=ds; //es st=st-1; *st=ds; //fs st=st-1; *st=ds; //gs pcb=allocatePCB(); pcb->ss=ss; pcb->esp= (unsigned int) st; enqueue(pcb); }
void createProcess(uint32_t ds, uint32_t ss, uint32_t* stackTop, uint32_t cs, uint32_t processEntry){ uint32_t* sp = stackTop; // eflags *(sp--) = 0x200; // cs *(sp--) = cs; // entry *(sp--) = processEntry; //ebp *(sp--) = 0; //esp *(sp--) = 0; //edi *(sp--) = 0; //esi *(sp--) = 0; //edx *(sp--) = 0; //ecx *(sp--) = 0; //ebx *(sp--) = 0; //eax *(sp--) = 0; //ds *(sp--) = ds; //es - video *(sp--) = ds; //fs *(sp--) = ds; //gs *(sp) = ds; pcb_t* t = allocatePCB(); t->id = pcb_next; t->ss = ss; t->esp = (uint32_t) sp; curr = t; //enqueueQ(&mtest); enqueue(); curr = null; }