ER vend_exc(void); ER vdis_fex(ID tskid, UINT fexcmsk); ER vena_fex(ID tskid, UINT fexcmsk); ER vdef_fex(ID tskid, FP fexchdr); ER vras_fex(ID tskid, INT fexcode); ER vdef_brk(FN s_fncd, FP brkhdr); ER vdis_wai(ID tskid, UINT waitptn, UINT *tskwait); ER vena_wai(ID tskid); ER vchg_slt(ID tskid, INT slicetime); ER vinf_tsk(T_INFTSK *pk_inftsk, ID tskid, BOOL clr); ER vset_tev(ID tskid, INT tskevt); ER vwai_tev(INT tevmsk, TMO tmout); ER veif_tsk(VP *oldinf, VP newinf, ID tskid); ER vref_svc(T_RSVC* pk_rsvc, FN s_fncd); ER vpget_bks(VP *p_bks, VP *p_grp, INT nblk, UINT atr); ER vrel_bks(VP *p_grp, VP bks); ER vatr_bks(UINT *p_atr, VP bks); ER vref_bks(T_RBKS *pk_rbks); ER vset_pow( UINT pwmode ); ER vget_otm(SYSTIME *pk_tim);
typedef struct t_rtsk { VP exinf; /* $B3HD%>pJs(B */ PRI tskpri; /* $B8=:_$NM%@hEY(B */ UINT tskstat; /* $B%?%9%/>uBV(B */ UINT tskwait; /* $BBT$AMW0x(B */ ID wid; /* $BBT$A%*%V%8%'%/%H(BID */ INT wupcnt; /* $B5/>2MW5a%-%e!<%$%s%0?t(B */ INT suscnt; /* SUSPEND$BMW5a%M%9%H?t(B */ $B"*(B UINT waitmask; /* $B6X;_BT$AMW0x(B */ $B"*(B INT slicetime; /* $B%9%i%$%9%?%$%`(B */ $B"*(B UINT fexcmsk; /* $B6/@)Nc30%S%C%H%^%9%/(B */ $B"*(B UINT tskevent; /* $B%?%9%/%$%Y%s%HH/@8>uBV(B */ } T_RTSK; $B"*(B TTW_EV1 0x01000000 /* $B%?%9%/%$%Y%s%H(B#1$BBT$A(B */ $B"*(B TTW_EV2 0x02000000 /* $B%?%9%/%$%Y%s%H(B#2$BBT$A(B */ $B"*(B TTW_EV3 0x04000000 /* $B%?%9%/%$%Y%s%H(B#3$BBT$A(B */ $B"*(B TTW_EV4 0x08000000 /* $B%?%9%/%$%Y%s%H(B#4$BBT$A(B */ $B"*(B TTW_EV5 0x10000000 /* $B%?%9%/%$%Y%s%H(B#5$BBT$A(B */ $B"*(B TTW_EV6 0x20000000 /* $B%?%9%/%$%Y%s%H(B#6$BBT$A(B */ $B"*(B TTW_EV7 0x40000000 /* $B%?%9%/%$%Y%s%H(B#7$BBT$A(B */ $B"*(B TTW_EV8 0x80000000 /* $B%?%9%/%$%Y%s%H(B#8$BBT$A(B */ $B"*(B typedef struct t_inftsk { $B"*(B UINT stime; /* $B%7%9%F%`%?%$%`%+%&%s%?(B */ $B"*(B UINT utime; /* $B%f!<%6%?%$%`%+%&%s%?(B */ $B"*(B } T_INFTSK; typedef struct t_rsem { VP exinf; /* $B3HD%>pJs(B */ BOOL_ID wtsk; /* $BBT$A%?%9%/$NM-L5(B */ INT semcnt; /* $B8=:_$N%;%^%U%)%+%&%s%HCM(B */ $B"*(B ID gtsk; /* $B%m%C%/7?%;%^%U%)3MF@%?%9%/(BID */ } T_RSEM; $B"*(B TA_LOCKSEM 0x00010000 /* $B%m%C%/7?%;%^%U%)$r;XDj(B */ typedef struct t_rsys { INT sysstat; /* $B%7%9%F%`>uBV(B */ ID runtskid; /* $BuBV$K$"$k%?%9%/$N(B ID */ ID schedtskid; /* $B uBV$K$9$Y$-%?%9%/$N(BID */ $B"*(B INT cpuload; /* $B%7%9%F%`$N%m!<%I(B(0-10000) */ } T_RSYS; $B"*(B typedef struct t_rcfg { $B"*(B INT timer_period; /* $B%?%$%^!<3d9~4V3V(B (ms) */ $B"*(B INT default_slice_time; /* $B%G%U%)%k%HO"B3 uBV$X0\9T(B */ $B"*(B #define TPW_DISLOWPOW 2 /* $BDc>CHqEENO%b!<%I@ZBX6X;_(B */ $B"*(B #define TPW_ENALOWPOW 3 /* $BDc>CHqEENO%b!<%I@ZBX5v2D(B */
$B"*(B EV_DISWAI (-226) /* $BBT$A6X;_$K$h$kBT$A2r=|(B */ $B"*(B EV_LOCKSEM (-227) /* $B%m%C%/7?%;%^%U%)$NIT@5A`:n(B */
$B3HD%(B SVC $B$N5!G=%3!<%I$N2<0L(B 8 $B%S%C%H$N$_$r3HD%(B SVC $BHV9f$H$9$k!#(B $B;D$j$N>e0L%S%C%H$OG$0U$K;HMQ$G$-$k!#(B $B$?$@$7!":G>e0L%S%C%H(B ( MSB ) $B$O(B 0 $B$G$J$1$l$P$J$i$J$$!#(B $B5!G=%3!<%I$r3HD%(B SVC $B%O%s%I%i$X$N%Q%i%a!<%?$H$7$FDI2C$9$k!#(B
i386 $B$N>l9g(B ER svchdr( VP para, FN s_fncd )
ER vref_svc(T_RSVC* pk_rsvc, FN s_fncd)
s_fncd
$B$G<($93HD%(BSVC$B$,Dj5A$5$l$F$$$l$P!"(B $B$=$NDj5A>pJs$r(B*pk_rsvc
$B$XJV$9!#(B
$BF10lM%@hEY$N%?%9%/$O%i%&%s%I%m%S%s%9%1%8%e!<%j%s%0$r9T$&!#(B
$B%?%9%/Kh$K@_Dj$5$l$k:GBg3d$jEv$F%?%$%`(B(slicetime
)$B$r7P2a$9$k$H!"(B
$B<+F0E*$K$=$NM%@hEY$N%l%G%#%-%e!<$N:G8e$K2s$5$l$k!#(B
$B%?%9%/@8@.;~$J$I5Y;_(B(DORMANT)$B>uBV$K$J$k$H$-!"(B
$B%G%U%)%k%HCM$H$7$F(B slicetime = 0
$B$,@_Dj$5$l$k!#(B
slicetime = 0
$B$N%?%9%/$O%i%&%s%I%m%S%s$H$J$i$:!"(B
FCFS(First Come First Service) $BJ}<0$G%9%1%8%e!<%j%s%0$5$l$k!#(B
ER vchg_slt(ID tskid, INT slicetime)
slicetime
($BC10L%_%jIC(B)$B$r@_Dj$9$k!#(Btskid : TSK_SELF $B2D(B slicetime : < 0 $B$O%(%i!<(B
ref_tsk()
$B$K$h$j8=:_$N(B slicetime
$B$,;2>H2DG=!#(B
(T_RTSK
$B$K(B slicetime
$B$rDI2C(B)
ref_cfg()
$B$K$h$j%G%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]$+$O!"(B
$B%$%s%W%j%a%s%H$K0MB8$9$k!#(B
$B%$%s%W%j%a%s%H$K$h$C$F$O!"(B
$B$=$N%$%s%W%j%a%s%H8GM-$N%(%s%H%j!<%k!<%A%s$r;}$DI,MW$,$"$k(B
($B3F(BCPU $B$N%$%s%W%j%a%s%H$K4X$9$k%I%-%e%a%s%H$r;2>H$N$3$H(B)$B!#(Btskid
$B$N%?%9%/$r@8@.(B(cre_tsk
)
$B$7$?;~$K;XDj$7$?%Y!<%9%"%I%l%9$,@_Dj$5$l$k!#(B
VOID fexchdr(INT fexcode)
{
/* fexcode : $BH/@8$7$?Nc30%3!<%I(B 0$B!A(B31 */
$B!'!'!'!'!'(B
/* $BNc30=hM}$N=*N;(B */
if ( fexcode == 0 ) {
ext_tsk() $B$^$?$O(B exd_tsk();
} else {
vend_exc();
return $B$^$?$O(B longjmp();
}
}
ER vdis_fex(ID tskid, UINT fexcmsk)
ER vena_fex(ID tskid, UINT fexcmsk)
fexcode : 0$B!A(B31
)
$B$r5v2D(B/$B6X;_$9$k!#(B
fexmask
$B$N(B1$B$N%S%C%H$KBP1~$9$k6/@)Nc30$rBP>]$H$9$k!#(BE_NOEXS
$B$N%(%i!<$H$J$k!#(Bref_tsk()
$B$Gfexcmsk
$B$rDI2C(B)$B!#(B
fexcmsk
$B$O(B $B%S%C%HC10L$N%^%9%/(B(0:LSB $B!A(B 31:MSB)
$B$G(B0$B$G6X;_!"(B1$B$G5v2D!#(B
ER vras_fex(ID tskid, INT fexcode)
fexcode
: 0$B!A(B31)$B$rH/@8$5$;$k!#(Bvend_exc()
$B$,
ER vend_exc()
vend_exc()
$B$r8F$S=P$9$3$H$O=PMh$J$$!#(B
$BNc30%3!<%I(B0$B$N6/@)Nc30%O%s%I%i$O!"(B
ext_tsk()
$B$^$?$O(B exd_tsk()
$B$K$h$C$F%?%9%/$r=*N;$7$J$1$l$P$J$i$J$$!#(B5.8 $B%?%9%/E}7W>pJs(B
ER vinf_tsk(T_INFTSK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%;%^%U%)$r3MF@$7$F$$$k%?%9%/$N(B ID $B$rCN$k$3$H$,$G$-$k!#(B
typedef struct t_rsem {
VP exinf; /* $B3HD%>pJs(B */
BOOL_ID wtsk; /* $BBT$A%?%9%/$NM-L5(B */
INT semcnt; /* $B8=:_$N%;%^%U%)%+%&%s%HCM(B */
ID gtsk; /* $B%m%C%/7?%;%^%U%)3MF@%?%9%/(B ID */
} T_RSEM;
gtsk
$B$O%m%C%/7?%;%^%U%)$N>l9g$N$_M-8z$G!"(B
$B$=$l0J30$N>l9g$O>o$K(B0$B$rJV$9!#(B5.12 $B%?%9%/3HD%>pJs$NJQ995!G=(B
exinf
)$B$rJQ99$9$k5!G=$G$"$k!#(B
ER veif_tsk(VP *oldinf, VP newinf, ID tskid)
exinf
$B$r(B *oldinf
$B$Knewinf
$B$NCM$KJQ99$9$k!#(B
oldinf == NADR $B$N;~$O
5.13 $B%"%i!<%`%O%s%I%i(B
vdef_alm()
$B$G$N<+F0E*$K3d$jIU$1$i$l$k(B
$B%"%i!<%`HV9f$N>WFM$rHr$1$k$?$a!"(B
$Bvdef_alm()
$B$GDj5A$7$?%"%i!<%`%O%s%I%i$O5.14 $B%V%m%C%/C10L$N%a%b%j!<4IM}(B
$B$3$N5!G=$O!"(BI-right/V $B$K$OAH$_9~$^$l$F$$$J$$!#(B
5.15 $B>JEENO%b!<%I@_Dj(B
ER vset_pow( UINT pwmode )
TPW_DOSUSPEND 1 $B%5%9%Z%s%I>uBV$X0\9T(B TPW_DISLOWPOW 2 $BDc>CHqEENO%b!<%I@ZBX6X;_(B TPW_ENALOWPOW 3 $BDc>CHqEENO%b!<%I@ZBX5v2D(B
low_pow
$B$r8F$S=P$5$J$$(B)$B!#(Blow_pow
$B$r8F$S=P$9(B)TPW_ENALOWPOW
) $B$H$J$k!#(B
TPW_DISLOWPOW
$B$,;XDj$5$l$?>l9g!"$=$NMW5a2s?t$,%+%&%s%H$5$l$k!#(B
TPW_DISLOWPOW
$B$,MW5a$5$l$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