Ejemplo n.º 1
0
/**
@brief This function handles a system call request coming from a process running in Kernel Mode.
@return Void.
*/
HIDDEN void syscallKernelMode()
{
	/* Identify and handle the system call */
	switch (SYSBP_Old->a1)
	{
		case CREATEPROCESS:
			CurrentProcess->p_s.a1 = createProcess((state_t *) SYSBP_Old->a2);
			break;

		case TERMINATEPROCESS:
			terminateProcess();
			break;

		case VERHOGEN:
			verhogen((int *) SYSBP_Old->a2);
			break;

		case PASSEREN:
			passeren((int *) SYSBP_Old->a2);
			break;

		case GETCPUTIME:
			CurrentProcess->p_s.a1 = getCPUTime();
			break;

		case WAITCLOCK:
			waitClock();
			break;

		case WAITIO:
			CurrentProcess->p_s.a1 = waitIO((int) SYSBP_Old->a2, (int) SYSBP_Old->a3, (int) SYSBP_Old->a4);
			break;

		case SPECTRAPVEC:
			specTrapVec((int) SYSBP_Old->a2, (state_t *) SYSBP_Old->a3, (state_t *) SYSBP_Old->a4);
			break;

		default:
			/* Distinguish whether SYS5 has been invoked or not */
			checkSYS5(SYSBK_EXCEPTION, SYSBP_Old);
	}

	/* Call the scheduler */
	scheduler();
}
Ejemplo n.º 2
0
int
main (
  int			argc,
  char			**argv
)
{
  pwr_tStatus           sts;
  time_tClock		wait_clock;
  qcom_sQid	        my_q = qcom_cNQid;
  qcom_sGet	        get;
  int                   tmo_ms = 0;

  // mcheck(memCheck);
  
  init();

  if (!qcom_CreateQ(&sts, &my_q, NULL, "events")) {
    exit(sts);
  }
  if (!qcom_Bind(&sts, &my_q, &qcom_cQini)) {
    exit(-1);
  }

  gdbroot->db->log.b.tmon = 0;

  for (wait_clock = 0;;) {

    if (wait_clock != 0) {
      waitClock(wait_clock, &tmo_ms);
    }
    else {
      tmo_ms = 0;
    }

#if defined OS_POSIX
    aproc_TimeStamp( ((float)tmo_ms)/1000, 5);

    get.data = NULL;
    qcom_Get(&sts, &my_q, &get, tmo_ms);
    if (sts != QCOM__TMO && sts != QCOM__QEMPTY) {
      if (get.type.b == qcom_eBtype_event) {
        event(&get);
      }
      qcom_Free(&sts, get.data);
    }      
#endif

    now_clock = time_Clock(NULL, NULL);
    if (now_clock < last_clock) { 
      errh_Info("The uptime clock has wrapped");
      toggleWrapped();
      executeExpired(&wrap_lh, 1);
    }

    getNewTimers();
    executeExpired(&timer_lh, 0);

    last_clock = now_clock;
    now_clock = time_Clock(NULL, NULL);

    getWaitClock(&wait_clock, last_clock);
    
  }
}