Exemplo n.º 1
0
u32int* sys_call(context *registers) {
  if (cop == NULL) {
    copContext = registers;
  }
  else {
    if (params.op_code == IDLE) {
      cop->stackTop = (u32int*)registers;
      cop->readyState = 0;
      addReady(cop);
      cop = NULL;
    }
    else if (params.op_code == EXIT) {
      FreePCB(cop);
      cop = NULL;
    }
  }
  PCB* readyUnsuspendedProcess = getNextUnsuspended();
  if (readyUnsuspendedProcess != NULL) {
    cop = readyUnsuspendedProcess;
    cop->readyState = 1;
    //serial_println(cop->name);
    return cop->stackTop;
  } else {
    return (u32int*)copContext;
  }
}
Exemplo n.º 2
0
void insertPCB(PCB* proc)
{
  if(proc->readyState == 0) //Check if ready
  {
    addReady(proc);
  }
  else
    addBlocked(proc);
  
}
void HelloWorld::goReady(){
	m_pStart->setVisible(false);
	m_pTop->setVisible(false);
	//m_pRate->setVisible(false);
	//m_pFlappyBird->setVisible(false);
	m_pScore->setVisible(false);
	m_pGameOver->setVisible(false);
	addHand();
	addLeftTap();
	addRightTap();
	addUp();
	addGBird();
	addReady();
	//计分板
	addNumberNode();
	float fupx=m_pLeftTap->boundingBox().getMinX();
	float fupy=m_pUp->boundingBox().getMaxY();
	mBird->setPosition(ccp(fupx,fupy));

}
Exemplo n.º 4
0
u32int* sys_call(context *registers) {
  if (cop == NULL) {
    copContext = registers;
  }
  else {
    if (params.op_code == IDLE) {
      cop->stackTop = (u32int*)registers;
      cop->readyState = 0;
      addReady(cop);
      cop = NULL;
    }
    else if (params.op_code == EXIT) {
      FreePCB(cop);
      cop = NULL;
    }
  }
  if (peekReady() != NULL) {
    cop = pollReady();
    cop->readyState = 1;
    return cop->stackTop;
  } else {
    return (u32int*)copContext;
  }
}
Exemplo n.º 5
0
int main(void)
{
	/************* INIZIALIZZAZIONE DEL SISTEMA */
	/* Inizializzazione del vettore dei lock a PASS */
	initLock();
	/* Inizializzo le new (e old) area di tutte le CPU */
	initAreas(pnew_old_areas, NUM_CPU);
	/* Inizializzo le strutture dati di Phase1 */
	initPcbs();
	initASL();
	/* Inizializzo le strutture dello scheduler */
	initReadyQueues();
	
	
	/************* CARICAMENTO DEI PROCESSI NELLE READY QUEUE */
	
		/* Test phase2 */
		//pcb_t *phase2 = allocPcb();
		//STST(&(phase2->p_s));
		//phase2->p_s.status = getSTATUS();
		//phase2->p_s.pc_epc = phase2->p_s.reg_t9 = (memaddr)p2test;
		//phase2->p_s.reg_sp = PFRAMES_START;
		//addReady(phase2);
		
		/* Test di alcuni processi di prova */
		pcb_t *test1 = allocPcb();
		STST(&(test1->p_s));
		test1->p_s.status = getSTATUS();
		(test1->p_s).pc_epc = (test1->p_s).reg_t9 = (memaddr)print1;
		test1->p_s.reg_sp = PFRAMES_START;
		addReady(test1);
		
		/* Test di alcuni processi di prova */
		pcb_t *test2 = allocPcb();
		STST(&(test2->p_s));
		test2->p_s.status = getSTATUS();
		test2->p_s.pc_epc = test2->p_s.reg_t9 = (memaddr)print2;
		test2->p_s.reg_sp = test1->p_s.reg_sp-FRAME_SIZE;
		addReady(test2);
		
		pcb_t *test3 = allocPcb();
		STST(&(test3->p_s));
		test3->p_s.status = getSTATUS();
		test3->p_s.pc_epc = test3->p_s.reg_t9 = (memaddr)print3;
		test3->p_s.reg_sp = test2->p_s.reg_sp-FRAME_SIZE;
		addReady(test3);

		pcb_t *test4 = allocPcb();
		STST(&(test4->p_s));
		test4->p_s.status = getSTATUS();
		test4->p_s.pc_epc = test4->p_s.reg_t9 = (memaddr)print4;
		test4->p_s.reg_sp = test3->p_s.reg_sp-FRAME_SIZE;
		addReady(test4);
	
	/************* ESECUZIONE DEI PROCESSI */
	/* Inizializzo la Interrupt Routing Table dinamica */
	/* initIRT(); */
	/* Inizializzo le altre CPU e faccio partire lo scheduler */
	initCpus();
	return 0;
}