ER_UINT can_wup(ID tskid) { TCB *p_tcb; ER_UINT ercd; LOG_CAN_WUP_ENTER(tskid); CHECK_TSKCTX_UNL(); CHECK_TSKID_SELF(tskid); p_tcb = get_tcb_self(tskid); t_lock_cpu(); if (TSTAT_DORMANT(p_tcb->tstat)) { ercd = E_OBJ; } else { ercd = p_tcb->wupque ? 1 : 0; p_tcb->wupque = false; } t_unlock_cpu(); error_exit: LOG_CAN_WUP_LEAVE(ercd); return(ercd); }
ER wup_tsk(ID tskid) { TCB *p_tcb; ER ercd; LOG_WUP_TSK_ENTER(tskid); CHECK_TSKCTX_UNL(); CHECK_TSKID_SELF(tskid); p_tcb = get_tcb_self(tskid); t_lock_cpu(); if (TSTAT_DORMANT(p_tcb->tstat)) { ercd = E_OBJ; } else if (TSTAT_WAIT_SLP(p_tcb->tstat)) { if (wait_complete(p_tcb)) { dispatch(); } ercd = E_OK; } else if (!(p_tcb->wupque)) { p_tcb->wupque = true; ercd = E_OK; } else { ercd = E_QOVR; } t_unlock_cpu(); error_exit: LOG_WUP_TSK_LEAVE(ercd); return(ercd); }
SYSCALL ER get_pri(ID tskid, PRI *p_tskpri) { TCB *tcb; ER ercd; LOG_GET_PRI_ENTER(tskid, p_tskpri); CHECK_TSKCTX_UNL(); CHECK_TSKID_SELF(tskid); tcb = get_tcb_self(tskid); t_lock_cpu(); if (TSTAT_DORMANT(tcb->tstat)) { ercd = E_OBJ; } else { *p_tskpri = EXT_TSKPRI(tcb->priority); ercd = E_OK; } t_unlock_cpu(); exit: LOG_GET_PRI_LEAVE(ercd, *p_tskpri); return(ercd); }
/* * Send task event */ SYSCALL ER _tk_sig_tev( ID tskid, INT tskevt ) { UINT evtmsk; TCB *tcb; TSTAT state; ER ercd = E_OK; CHECK_TSKID_SELF(tskid); CHECK_PAR(tskevt >= 1 && tskevt <= 8); evtmsk = (UINT)(1 << (tskevt - 1)); tcb = get_tcb_self(tskid); BEGIN_CRITICAL_SECTION; state = (TSTAT)tcb->state; if ( !task_alive(state) ) { ercd = ( state == TS_NONEXIST )? E_NOEXS: E_OBJ; goto error_exit; } if ( (state & TS_WAIT) != 0 && (tcb->wspec->tskwait & toTTW(evtmsk)) != 0 ) { wait_release_ok_ercd(tcb, (ER)(tcb->tskevt | evtmsk)); } else { tcb->tskevt |= evtmsk; } error_exit: END_CRITICAL_SECTION; return ercd; }
ER chg_pri(ID tskid, PRI tskpri) { TCB *p_tcb; uint_t newpri; ER ercd; LOG_CHG_PRI_ENTER(tskid, tskpri); CHECK_TSKCTX_UNL(); CHECK_TSKID_SELF(tskid); CHECK_TPRI_INI(tskpri); p_tcb = get_tcb_self(tskid); newpri = (tskpri == TPRI_INI) ? p_tcb->p_tinib->ipriority : INT_PRIORITY(tskpri); t_lock_cpu(); if (TSTAT_DORMANT(p_tcb->tstat)) { ercd = E_OBJ; } else { if (change_priority(p_tcb, newpri)) { dispatch(); } ercd = E_OK; } t_unlock_cpu(); error_exit: LOG_CHG_PRI_LEAVE(ercd); return(ercd); }
ER ref_ovr(ID tskid, T_ROVR *pk_rovr) { TCB *p_tcb; ER ercd; LOG_REF_OVR_ENTER(tskid, pk_rovr); CHECK_TSKCTX_UNL(); CHECK_OBJ(ovrinib.ovrhdr != NULL); CHECK_TSKID_SELF(tskid); p_tcb = get_tcb_self(tskid); t_lock_cpu(); if (p_tcb->leftotm > 0U) { pk_rovr->ovrstat = TOVR_STA; if (p_tcb == p_runtsk) { pk_rovr->leftotm = target_ovrtimer_get_current(); } else { pk_rovr->leftotm = p_tcb->leftotm; } } else { pk_rovr->ovrstat = TOVR_STP; } ercd = E_OK; t_unlock_cpu(); error_exit: LOG_REF_OVR_LEAVE(ercd, pk_rovr); return(ercd); }
ER act_tsk(ID tskid) { TCB *p_tcb; ER ercd; LOG_ACT_TSK_ENTER(tskid); CHECK_TSKCTX_UNL(); CHECK_TSKID_SELF(tskid); p_tcb = get_tcb_self(tskid); t_lock_cpu(); if (TSTAT_DORMANT(p_tcb->tstat)) { if (make_active(p_tcb)) { dispatch(); } ercd = E_OK; } else if (!(p_tcb->actque)) { p_tcb->actque = true; ercd = E_OK; } else { ercd = E_QOVR; } t_unlock_cpu(); error_exit: LOG_ACT_TSK_LEAVE(ercd); return(ercd); }
ER stp_ovr(ID tskid) { TCB *p_tcb; ER ercd; LOG_STP_OVR_ENTER(tskid); CHECK_TSKCTX_UNL(); CHECK_OBJ(ovrinib.ovrhdr != NULL); CHECK_TSKID_SELF(tskid); p_tcb = get_tcb_self(tskid); t_lock_cpu(); if (p_tcb->leftotm > 0U) { if (p_tcb == p_runtsk) { (void) target_ovrtimer_stop(); ovrtimer_flag = false; } p_tcb->leftotm = 0U; } ercd = E_OK; t_unlock_cpu(); error_exit: LOG_STP_OVR_LEAVE(ercd); return(ercd); }
ER sta_ovr(ID tskid, OVRTIM ovrtim) { TCB *p_tcb; ER ercd; LOG_STA_OVR_ENTER(tskid, ovrtim); CHECK_TSKCTX_UNL(); CHECK_OBJ(ovrinib.ovrhdr != NULL); CHECK_TSKID_SELF(tskid); CHECK_PAR(0U < ovrtim && ovrtim <= TMAX_OVRTIM); p_tcb = get_tcb_self(tskid); t_lock_cpu(); if (p_tcb == p_runtsk) { if (p_tcb->leftotm > 0U) { (void) target_ovrtimer_stop(); } target_ovrtimer_start(ovrtim); ovrtimer_flag = true; } p_tcb->leftotm = ovrtim; ercd = E_OK; t_unlock_cpu(); error_exit: LOG_STA_OVR_LEAVE(ercd); return(ercd); }
ER act_tsk(ID tskid) { ER ercd; uint_t tskpri; LOG_ACT_TSK_ENTER(tskid); CHECK_TSKCTX_UNL(); CHECK_TSKID_SELF(tskid); tskpri = get_ipri_self(tskid); t_lock_cpu(); if (test_dormant(tskpri)) { if(make_active(tskpri)) { run_task(tskpri); } ercd = E_OK; } else { ercd = E_QOVR; } t_unlock_cpu(); error_exit: LOG_ACT_TSK_LEAVE(ercd); return(ercd); }
ER_UINT can_wup(ID tskid) { TCB *p_tcb; ER_UINT ercd; LOG_CAN_WUP_ENTER(tskid); CHECK_TSKCTX_UNL(); CHECK_TSKID_SELF(tskid); p_tcb = get_tcb_self(tskid); t_lock_cpu(); if (p_tcb->p_tinib->tskatr == TA_NOEXS) { ercd = E_NOEXS; } else if (VIOLATE_ACPTN(p_tcb->p_tinib->acvct.acptn1)) { ercd = E_OACV; } else if (TSTAT_DORMANT(p_tcb->tstat)) { ercd = E_OBJ; } else { ercd = p_tcb->wupque ? 1 : 0; p_tcb->wupque = false; } t_unlock_cpu(); error_exit: LOG_CAN_WUP_LEAVE(ercd); return(ercd); }
ER get_pri(ID tskid, PRI *p_tskpri) { TCB *p_tcb; ER ercd; PCB *p_pcb; LOG_GET_PRI_ENTER(tskid, p_tskpri); CHECK_TSKCTX_UNL(); CHECK_TSKID_SELF(tskid); t_lock_cpu(); p_tcb = get_tcb_self(tskid, get_my_p_pcb()); p_pcb = t_acquire_tsk_lock(p_tcb); if (TSTAT_DORMANT(p_tcb->tstat)) { ercd = E_OBJ; } else { *p_tskpri = EXT_TSKPRI(p_tcb->priority); ercd = E_OK; } release_tsk_lock(p_pcb); t_unlock_cpu(); error_exit: LOG_GET_PRI_LEAVE(ercd, *p_tskpri); return(ercd); }
ER stp_ovr(ID tskid) { TCB *p_tcb; ER ercd; LOG_STP_OVR_ENTER(tskid); CHECK_TSKCTX_UNL(); CHECK_OBJ(ovrinib.ovrhdr != NULL); CHECK_TSKID_SELF(tskid); p_tcb = get_tcb_self(tskid); t_lock_cpu(); if (p_tcb->p_tinib->tskatr == TA_NOEXS) { ercd = E_NOEXS; } else if (VIOLATE_ACPTN(p_tcb->p_tinib->acvct.acptn2)) { ercd = E_OACV; } else { if (p_tcb->leftotm > 0U) { if (p_tcb == p_runtsk) { (void) target_ovrtimer_stop(); ovrtimer_flag = false; } p_tcb->leftotm = 0U; } ercd = E_OK; } t_unlock_cpu(); error_exit: LOG_STP_OVR_LEAVE(ercd); return(ercd); }
SYSCALL ER_UINT can_wup(ID tskid) { TCB *tcb; ER_UINT ercd; LOG_CAN_WUP_ENTER(tskid); CHECK_TSKCTX_UNL(); CHECK_TSKID_SELF(tskid); tcb = get_tcb_self(tskid); t_lock_cpu(); if (TSTAT_DORMANT(tcb->tstat)) { ercd = E_OBJ; } else { ercd = tcb->wupcnt ? 1 : 0; tcb->wupcnt = FALSE; } t_unlock_cpu(); exit: LOG_CAN_WUP_LEAVE(ercd); return(ercd); }
ER ena_wai(ID tskid) { TCB *p_tcb; ER ercd; LOG_ENA_WAI_ENTER(tskid); CHECK_TSKCTX_UNL(); CHECK_TSKID_SELF(tskid); p_tcb = get_tcb_self(tskid); t_lock_cpu(); if (p_tcb->p_tinib->tskatr == TA_NOEXS) { ercd = E_NOEXS; } else if (VIOLATE_ACPTN(p_tcb->p_tinib->acvct.acptn2)) { ercd = E_OACV; } else if (TSTAT_DORMANT(p_tcb->tstat) || !(p_tcb->waifbd)) { ercd = E_OBJ; } else { p_tcb->waifbd = false; ercd = E_OK; } t_unlock_cpu(); error_exit: LOG_ENA_WAI_LEAVE(ercd); return(ercd); }
/* * Cancel wakeup request */ SYSCALL INT _tk_can_wup( ID tskid ) { TCB *tcb; ER ercd = E_OK; CHECK_TSKID_SELF(tskid); tcb = get_tcb_self(tskid); BEGIN_CRITICAL_SECTION; switch ( tcb->state ) { case TS_NONEXIST: ercd = E_NOEXS; break; case TS_DORMANT: ercd = E_OBJ; break; default: ercd = tcb->wupcnt; tcb->wupcnt = 0; } END_CRITICAL_SECTION; return ercd; }
SYSCALL ER wup_tsk(ID tskid) { TCB *tcb; UINT tstat; ER ercd; LOG_WUP_TSK_ENTER(tskid); CHECK_TSKCTX_UNL(); CHECK_TSKID_SELF(tskid); tcb = get_tcb_self(tskid); t_lock_cpu(); if (TSTAT_DORMANT(tstat = tcb->tstat)) { ercd = E_OBJ; } else if ((tstat & TS_WAIT_SLEEP) != 0) { if (wait_complete(tcb)) { dispatch(); } ercd = E_OK; } else if (!(tcb->wupcnt)) { tcb->wupcnt = TRUE; ercd = E_OK; } else { ercd = E_QOVR; } t_unlock_cpu(); exit: LOG_WUP_TSK_LEAVE(ercd); return(ercd); }
ER get_pri(ID tskid, PRI *p_tskpri) { TCB *p_tcb; ER ercd; LOG_GET_PRI_ENTER(tskid, p_tskpri); CHECK_TSKCTX_UNL(); CHECK_TSKID_SELF(tskid); CHECK_MACV_WRITE(p_tskpri, PRI); p_tcb = get_tcb_self(tskid); t_lock_cpu(); if (p_tcb->p_tinib->tskatr == TA_NOEXS) { ercd = E_NOEXS; } else if (VIOLATE_ACPTN(p_tcb->p_tinib->acvct.acptn4)) { ercd = E_OACV; } else if (TSTAT_DORMANT(p_tcb->tstat)) { ercd = E_OBJ; } else { *p_tskpri = EXT_TSKPRI(p_tcb->priority); ercd = E_OK; } t_unlock_cpu(); error_exit: LOG_GET_PRI_LEAVE(ercd, *p_tskpri); return(ercd); }
SYSCALL ER act_tsk(ID tskid) { TCB *tcb; ER ercd; LOG_ACT_TSK_ENTER(tskid); CHECK_TSKCTX_UNL(); CHECK_TSKID_SELF(tskid); tcb = get_tcb_self(tskid); t_lock_cpu(); if (TSTAT_DORMANT(tcb->tstat)) { if (make_active(tcb)) { dispatch(); } ercd = E_OK; } else if (!(tcb->actcnt)) { tcb->actcnt = TRUE; ercd = E_OK; } else { ercd = E_QOVR; } t_unlock_cpu(); exit: LOG_ACT_TSK_LEAVE(ercd); return(ercd); }
JSP_L1_CODE SYSCALL ER ras_tex(ID tskid, TEXPTN rasptn) { TCB *tcb; ER ercd; LOG_RAS_TEX_ENTER(tskid, rasptn); CHECK_TSKCTX_UNL(); CHECK_TSKID_SELF(tskid); CHECK_PAR(rasptn != 0); tcb = get_tcb_self(tskid); t_lock_cpu(); if (TSTAT_DORMANT(tcb->tstat) || tcb->tinib->texrtn == NULL) { ercd = E_OBJ; } else { tcb->texptn |= rasptn; if (tcb == runtsk && runtsk->enatex) { call_texrtn(); } ercd = E_OK; } t_unlock_cpu(); exit: LOG_RAS_TEX_LEAVE(ercd); return(ercd); }
SYSCALL INT _tk_dis_wai( ID tskid, UINT waitmask ) { TCB *tcb; UINT tskwait = 0; ER ercd = E_OK; CHECK_TSKID_SELF(tskid); CHECK_PAR(((waitmask & ~WAIT_PATTERN) == 0)&&((waitmask & WAIT_PATTERN) != 0)); tcb = get_tcb_self(tskid); BEGIN_CRITICAL_SECTION; if ( tcb->state == TS_NONEXIST ) { ercd = E_NOEXS; goto error_exit; } /* Update wait disable mask */ tcb->waitmask = waitmask; if ( (tcb->state & TS_WAIT) != 0 ) { tskwait = tcb->wspec->tskwait; if ( (tskwait & waitmask) != 0 && !tcb->nodiswai ) { /* Free wait */ wait_release_ng(tcb, E_DISWAI); tskwait = 0; } } error_exit: END_CRITICAL_SECTION; return ( ercd < E_OK )? (INT)ercd: (INT)tskwait; }
ER sus_tsk(ID tskid) { TCB *p_tcb; ER ercd; LOG_SUS_TSK_ENTER(tskid); CHECK_TSKCTX_UNL(); CHECK_TSKID_SELF(tskid); p_tcb = get_tcb_self(tskid); t_lock_cpu(); if (p_tcb == p_runtsk && !dspflg) { ercd = E_CTX; } else if (p_tcb->p_tinib->tskatr == TA_NOEXS) { ercd = E_NOEXS; } else if (VIOLATE_ACPTN(p_tcb->p_tinib->acvct.acptn2)) { ercd = E_OACV; } else if (TSTAT_DORMANT(p_tcb->tstat)) { ercd = E_OBJ; } else if (TSTAT_RUNNABLE(p_tcb->tstat)) { /* * 実行できる状態から強制待ち状態への遷移 */ p_tcb->tstat = TS_SUSPENDED; LOG_TSKSTAT(p_tcb); if (make_non_runnable(p_tcb)) { dispatch(); } ercd = E_OK; } else if (TSTAT_SUSPENDED(p_tcb->tstat)) { ercd = E_QOVR; } else { /* * 待ち状態から二重待ち状態への遷移 */ p_tcb->tstat |= TS_SUSPENDED; LOG_TSKSTAT(p_tcb); ercd = E_OK; } t_unlock_cpu(); error_exit: LOG_SUS_TSK_LEAVE(ercd); return(ercd); }
ER chg_pri(ID tskid, PRI tskpri) { TCB *p_tcb; uint_t newbpri; ER ercd; LOG_CHG_PRI_ENTER(tskid, tskpri); CHECK_TSKCTX_UNL(); CHECK_TSKID_SELF(tskid); CHECK_TPRI_INI(tskpri); p_tcb = get_tcb_self(tskid); t_lock_cpu(); if (p_tcb->p_tinib->tskatr == TA_NOEXS) { ercd = E_NOEXS; } else if (VIOLATE_ACPTN(p_tcb->p_tinib->acvct.acptn2)) { ercd = E_OACV; } else if (TSTAT_DORMANT(p_tcb->tstat)) { ercd = E_OBJ; } else { newbpri = (tskpri == TPRI_INI) ? p_tcb->p_tinib->ipriority : INT_PRIORITY(tskpri); if (!(newbpri >= p_runtsk->p_tinib->p_dominib->minpriority)) { ercd = E_ILUSE; } else if ((!queue_empty(&(p_tcb->mutex_queue)) || TSTAT_WAIT_MTX(p_tcb->tstat)) && !((*mtxhook_check_ceilpri)(p_tcb, newbpri))) { ercd = E_ILUSE; } else { p_tcb->bpriority = newbpri; if (queue_empty(&(p_tcb->mutex_queue)) || !((*mtxhook_scan_ceilmtx)(p_tcb))) { if (change_priority(p_tcb, newbpri, false)) { dispatch(); } } ercd = E_OK; } } t_unlock_cpu(); error_exit: LOG_CHG_PRI_LEAVE(ercd); return(ercd); }
SYSCALL ER _td_ref_tsk_u( ID tskid, TD_RTSK_U *pk_rtsk ) { TCB *tcb; TSTAT state; ER ercd = E_OK; CHECK_TSKID_SELF(tskid); tcb = get_tcb_self(tskid); MEMSET(pk_rtsk, 0, sizeof(*pk_rtsk)); BEGIN_DISABLE_INTERRUPT; state = (TSTAT)tcb->state; if ( state == TS_NONEXIST ) { ercd = E_NOEXS; } else { if ( ( state == TS_READY ) && ( tcb == ctxtsk ) ) { pk_rtsk->tskstat = TTS_RUN; } else { pk_rtsk->tskstat = (UINT)state << 1; } if ( (state & TS_WAIT) != 0 ) { pk_rtsk->tskwait = tcb->wspec->tskwait; pk_rtsk->wid = tcb->wid; if ( ctxtsk->nodiswai ) { pk_rtsk->tskstat |= TTS_NODISWAI; } } pk_rtsk->exinf = tcb->exinf; pk_rtsk->tskpri = ext_tskpri(tcb->priority); pk_rtsk->tskbpri = ext_tskpri(tcb->bpriority); pk_rtsk->wupcnt = tcb->wupcnt; pk_rtsk->suscnt = tcb->suscnt; pk_rtsk->slicetime_u = tcb->slicetime; pk_rtsk->waitmask = tcb->waitmask; pk_rtsk->texmask = tcb->texmask; pk_rtsk->tskevent = tcb->tskevt; pk_rtsk->task = tcb->task; pk_rtsk->stksz = tcb->stksz; pk_rtsk->sstksz = tcb->sstksz - RESERVE_SSTACK(tcb->tskatr); pk_rtsk->istack = tcb->istack; pk_rtsk->isstack = tcb->isstack; } END_DISABLE_INTERRUPT; return ercd; }
SYSCALL ER sus_tsk(ID tskid) { TCB *tcb; UINT tstat; ER ercd; LOG_SUS_TSK_ENTER(tskid); CHECK_TSKCTX_UNL(); CHECK_TSKID_SELF(tskid); tcb = get_tcb_self(tskid); t_lock_cpu(); if (tcb == runtsk && !(enadsp)) { ercd = E_CTX; } else if (TSTAT_DORMANT(tstat = tcb->tstat)) { ercd = E_OBJ; } else if (TSTAT_RUNNABLE(tstat)) { /* * 実行できる状態から強制待ち状態への遷移 */ tcb->tstat = TS_SUSPENDED; LOG_TSKSTAT(tcb); if (make_non_runnable(tcb)) { dispatch(); } ercd = E_OK; } else if (TSTAT_SUSPENDED(tstat)) { ercd = E_QOVR; } else { /* * 待ち状態から二重待ち状態への遷移 */ tcb->tstat |= TS_SUSPENDED; LOG_TSKSTAT(tcb); ercd = E_OK; } t_unlock_cpu(); exit: LOG_SUS_TSK_LEAVE(ercd); return(ercd); }
ER mact_tsk(ID tskid, ID prcid) { TCB *p_tcb; ER ercd; PCB *t_p_pcb; PCB *f_p_pcb; bool_t dspreq = false; LOG_MACT_TSK_ENTER(tskid, prcid); CHECK_TSKCTX_UNL(); CHECK_TSKID_SELF(tskid); CHECK_PRCID_INI(prcid); t_lock_cpu(); p_tcb = get_tcb_self(tskid, get_my_p_pcb()); prcid = (prcid == TPRC_INI)? p_tcb->p_tinib->iaffinity : prcid; T_CHECK_MIG(p_tcb->p_tinib->affinity_mask, prcid); /* 現在割り付けられているプロセッサと移動先のプロセッサのタスクロックを取得 */ t_acquire_dual_tsk_lock(p_tcb, prcid, &f_p_pcb, &t_p_pcb); if (TSTAT_DORMANT(p_tcb->tstat)) { LOG_TSKMIG(p_tcb, f_p_pcb->prcid, prcid); p_tcb->p_pcb = t_p_pcb; if (make_active(p_tcb)) { dspreq = dispatch_request(t_p_pcb); } ercd = E_OK; } else if (!(p_tcb->actque)) { p_tcb->actque = true; p_tcb->actprc = prcid; ercd = E_OK; } else { ercd = E_QOVR; } release_dual_tsk_lock(f_p_pcb, t_p_pcb); if (dspreq) { dispatch(); } t_unlock_cpu(); error_exit: LOG_MACT_TSK_LEAVE(ercd); return(ercd); }
/* * Change task priority */ SYSCALL ER _tk_chg_pri( ID tskid, PRI tskpri ) { TCB *tcb; INT priority; ER ercd; CHECK_TSKID_SELF(tskid); CHECK_PRI_INI(tskpri); tcb = get_tcb_self(tskid); BEGIN_CRITICAL_SECTION; if ( tcb->state == TS_NONEXIST ) { ercd = E_NOEXS; goto error_exit; } /* Conversion priority to internal expression */ if ( tskpri == TPRI_INI ) { priority = tcb->ipriority; } else { priority = int_priority(tskpri); } #ifdef NUM_MTXID /* Mutex priority change limit */ ercd = chg_pri_mutex(tcb, priority); if ( ercd < E_OK ) { goto error_exit; } tcb->bpriority = (UB)priority; priority = ercd; #else tcb->bpriority = priority; #endif /* Change priority */ change_task_priority(tcb, priority); ercd = E_OK; error_exit: END_CRITICAL_SECTION; return ercd; }
/* * Enable task wait */ SYSCALL ER _tk_ena_wai( ID tskid ) { TCB *tcb; ER ercd = E_OK; CHECK_TSKID_SELF(tskid); tcb = get_tcb_self(tskid); BEGIN_CRITICAL_SECTION; if ( tcb->state == TS_NONEXIST ) { ercd = E_NOEXS; } else { tcb->waitmask = 0; } END_CRITICAL_SECTION; return ercd; }
/* * Get task resource group */ SYSCALL ID _tk_get_rid( ID tskid ) { TCB *tcb; ER ercd; CHECK_TSKID_SELF(tskid); tcb = get_tcb_self(tskid); BEGIN_CRITICAL_SECTION; if ( tcb->state == TS_NONEXIST ) { ercd = E_NOEXS; } else { ercd = tcb->resid; } END_CRITICAL_SECTION; return ercd; }
SYSCALL ER _tk_chg_slt_u( ID tskid, RELTIM_U slicetime ) { TCB *tcb; ER ercd = E_OK; CHECK_TSKID_SELF(tskid); tcb = get_tcb_self(tskid); BEGIN_CRITICAL_SECTION; if ( tcb->state == TS_NONEXIST ) { ercd = E_NOEXS; } else { tcb->slicetime = slicetime; } END_CRITICAL_SECTION; return ercd; }