#include "prc_insn.h"
データ構造 | |
struct | task_context_block |
struct | exc_vector_entry |
マクロ定義 | |
#define | EXT_IPM(iipm) (-CAST(PRI, (iipm) >> 8)) |
#define | INT_IPM(ipm) (CAST(uint16_t, -(ipm)) << 8) |
#define | IIPM_LOCK INT_IPM(TIPM_LOCK) |
#define | IIPM_ENAALL INT_IPM(TIPM_ENAALL) |
#define | t_lock_cpu() x_lock_cpu() |
#define | i_lock_cpu() x_lock_cpu() |
#define | t_unlock_cpu() x_unlock_cpu() |
#define | i_unlock_cpu() x_unlock_cpu() |
#define | t_sense_lock() x_sense_lock() |
#define | i_sense_lock() x_sense_lock() |
#define | VALID_INTPRI_CHGIPM(intpri) ((-6 <= (intpri) && (intpri) <= TIPM_ENAALL)) |
#define | t_set_ipm(intpri) x_set_ipm(intpri) |
#define | i_set_ipm(intpri) x_set_ipm(intpri) |
#define | t_get_ipm() x_get_ipm() |
#define | i_get_ipm() x_get_ipm() |
#define | activate_context(p_tcb) |
#define | OMIT_CALLTEX |
#define | VALID_INHNO_DEFINH(inhno) |
#define | VALID_EXCNO_DEFEXC(excno) |
#define | INT_ENTRY(inhno, inthdr) _kernel_##inthdr##_##inhno |
#define | CALL_LOG_INH_ENTER(inhno_num) |
#define | INTHDR_ENTRY(inhno, inhno_num, inthdr) |
#define | EXC_ENTRY(excno, exchdr) _kernel_##exchdr##_##excno |
#define | CALL_LOG_EXC_ENTER(excno_num) |
#define | EXCHDR_ENTRY(excno, excno_num, exchdr) |
型定義 | |
typedef struct task_context_block | CTXB |
typedef struct exc_vector_entry | EXCVE |
関数 | |
Inline uint16_t | current_iipm (void) |
Inline void | set_iipm (uint16_t iipm) |
Inline bool_t | sense_context (void) |
Inline void | x_lock_cpu (void) |
Inline void | x_unlock_cpu (void) |
Inline bool_t | x_sense_lock (void) |
Inline void | x_set_ipm (PRI intpri) |
Inline PRI | x_get_ipm (void) |
void | dispatch (void) |
void | start_dispatch (void) NoReturn |
void | exit_and_dispatch (void) NoReturn |
void | call_exit_kernel (void) NoReturn |
void | start_r (void) |
Inline void | x_define_inh (INHNO inhno, FP int_entry) |
Inline void | x_define_exc (EXCNO excno, FP exc_entry) |
Inline bool_t | exc_sense_context (void *p_excinf) |
Inline uint16_t | exc_get_iipm (void *p_excinf) |
Inline bool_t | exc_sense_intmask (void *p_excinf) |
Inline bool_t | exc_sense_unlock (void *p_excinf) |
void | prc_initialize (void) |
void | prc_terminate (void) |
Inline void | call_atexit (void) |
変数 | |
volatile bool_t | lock_flag |
volatile uint16_t | saved_iipm |
#define activate_context | ( | p_tcb | ) |
値:
{ \ (p_tcb)->tskctxb.msp = (void *)((char *)((p_tcb)->p_tinib->stk) \ + (p_tcb)->p_tinib->stksz); \ (p_tcb)->tskctxb.pc = (void *) start_r; \ }
prc_config.h の 371 行で定義されています。
参照元 make_active().
#define CALL_LOG_EXC_ENTER | ( | excno_num | ) |
prc_config.h の 546 行で定義されています。
#define CALL_LOG_INH_ENTER | ( | inhno_num | ) |
prc_config.h の 470 行で定義されています。
#define EXC_ENTRY | ( | excno, | |||
exchdr | ) | _kernel_##exchdr##_##excno |
prc_config.h の 531 行で定義されています。
#define EXCHDR_ENTRY | ( | excno, | |||
excno_num, | |||||
exchdr | ) |
値:
extern void _kernel_##exchdr##_##excno(void *sp); \ asm(".text \n" \ "_kernel_" #exchdr "_" #excno ": \n" \ " movem.l %d0-%d1/%a0-%a1, -(%sp) \n" /* å쥸¸ */ \ " lea.l 16(%sp), %a0 \n" /* 㳰ե졼ƬA0 */ \ " move.w %sr, %d0 \n" /* SRD0 */ \ " and.w #~0x1000, %sr \n" /* ߥ⡼ɡʥåڴ*/ \ " move.l %d0, -(%sp) \n" /* SRå¸ */ \ " move.l _kernel_lock_flag, %d0 \n" /* lock_flagå¸ */ \ " move.l %d0, -(%sp) \n" \ " move.l %a0, -(%sp) \n" /* A0ѥȤϤ */ \ CALL_LOG_EXC_ENTER(excno_num) \ " move.l #_kernel_ret_exc, -(%sp) \n" /* ϤåѤ */ \ " jmp " #exchdr " \n");
prc_config.h の 590 行で定義されています。
#define EXT_IPM | ( | iipm | ) | (-CAST(PRI, (iipm) >> 8)) |
#define i_get_ipm | ( | ) | x_get_ipm() |
#define i_lock_cpu | ( | ) | x_lock_cpu() |
prc_config.h の 225 行で定義されています。
参照元 call_almhdr(), call_cychdr(), iact_tsk(), ifsnd_dtq(), iget_tid(), iloc_cpu(), ipsnd_dtq(), ipsnd_pdq(), iras_tex(), irel_wai(), irot_rdq(), iset_flg(), isig_sem(), ista_alm(), istp_alm(), iwup_tsk(), signal_time(), wait_tmout(), と wait_tmout_ok().
#define i_sense_lock | ( | ) | x_sense_lock() |
prc_config.h の 257 行で定義されています。
参照元 call_almhdr(), call_cychdr(), iloc_cpu(), iunl_cpu(), と signal_time().
#define i_set_ipm | ( | intpri | ) | x_set_ipm(intpri) |
#define i_unlock_cpu | ( | ) | x_unlock_cpu() |
prc_config.h の 245 行で定義されています。
参照元 call_almhdr(), call_cychdr(), iact_tsk(), ifsnd_dtq(), iget_tid(), ipsnd_dtq(), ipsnd_pdq(), iras_tex(), irel_wai(), irot_rdq(), iset_flg(), isig_sem(), ista_alm(), istp_alm(), iunl_cpu(), iwup_tsk(), signal_time(), wait_tmout(), と wait_tmout_ok().
#define IIPM_ENAALL INT_IPM(TIPM_ENAALL) |
#define IIPM_LOCK INT_IPM(TIPM_LOCK) |
#define INT_ENTRY | ( | inhno, | |||
inthdr | ) | _kernel_##inthdr##_##inhno |
prc_config.h の 455 行で定義されています。
#define INT_IPM | ( | ipm | ) | (CAST(uint16_t, -(ipm)) << 8) |
#define INTHDR_ENTRY | ( | inhno, | |||
inhno_num, | |||||
inthdr | ) |
値:
extern void _kernel_##inthdr##_##inhno(void); \ asm(".text \n" \ "_kernel_" #inthdr "_" #inhno ": \n" \ " movem.l %d0-%d1/%a0-%a1, -(%sp) \n" /* å쥸¸ */ \ CALL_LOG_INH_ENTER(inhno_num) \ " move.l #_kernel_ret_int, -(%sp) \n" /* ϤåѤ */ \ " jmp " #inthdr " \n");
prc_config.h の 507 行で定義されています。
#define OMIT_CALLTEX |
prc_config.h の 381 行で定義されています。
#define t_get_ipm | ( | ) | x_get_ipm() |
#define t_lock_cpu | ( | ) | x_lock_cpu() |
prc_config.h の 224 行で定義されています。
参照元 act_tsk(), call_texrtn(), can_act(), can_wup(), chg_ipm(), chg_pri(), clr_flg(), dis_dsp(), dis_tex(), dly_tsk(), ena_dsp(), ena_tex(), ext_tsk(), fsnd_dtq(), get_inf(), get_ipm(), get_mpf(), get_pri(), get_tid(), get_tim(), ini_dtq(), ini_flg(), ini_mbx(), ini_mpf(), ini_pdq(), ini_sem(), loc_cpu(), pget_mpf(), pol_flg(), pol_sem(), prcv_dtq(), prcv_mbx(), prcv_pdq(), psnd_dtq(), psnd_pdq(), ras_tex(), rcv_dtq(), rcv_mbx(), rcv_pdq(), ref_alm(), ref_cyc(), ref_dtq(), ref_flg(), ref_mbx(), ref_mpf(), ref_pdq(), ref_sem(), ref_tex(), ref_tsk(), rel_mpf(), rel_wai(), rot_rdq(), rsm_tsk(), set_flg(), sig_sem(), slp_tsk(), snd_dtq(), snd_mbx(), snd_pdq(), sta_alm(), sta_cyc(), stp_alm(), stp_cyc(), sus_tsk(), ter_tsk(), tget_mpf(), trcv_dtq(), trcv_mbx(), trcv_pdq(), tslp_tsk(), tsnd_dtq(), tsnd_pdq(), twai_flg(), twai_sem(), wai_flg(), wai_sem(), と wup_tsk().
#define t_sense_lock | ( | ) | x_sense_lock() |
prc_config.h の 256 行で定義されています。
参照元 call_texrtn(), chg_ipm(), ext_tsk(), get_ipm(), loc_cpu(), sns_dpn(), と unl_cpu().
#define t_set_ipm | ( | intpri | ) | x_set_ipm(intpri) |
#define t_unlock_cpu | ( | ) | x_unlock_cpu() |
prc_config.h の 244 行で定義されています。
参照元 act_tsk(), call_texrtn(), can_act(), can_wup(), chg_ipm(), chg_pri(), clr_flg(), dis_dsp(), dis_tex(), dly_tsk(), ena_dsp(), ena_tex(), fsnd_dtq(), get_inf(), get_ipm(), get_mpf(), get_pri(), get_tid(), get_tim(), ini_dtq(), ini_flg(), ini_mbx(), ini_mpf(), ini_pdq(), ini_sem(), pget_mpf(), pol_flg(), pol_sem(), prcv_dtq(), prcv_mbx(), prcv_pdq(), psnd_dtq(), psnd_pdq(), ras_tex(), rcv_dtq(), rcv_mbx(), rcv_pdq(), ref_alm(), ref_cyc(), ref_dtq(), ref_flg(), ref_mbx(), ref_mpf(), ref_pdq(), ref_sem(), ref_tex(), ref_tsk(), rel_mpf(), rel_wai(), rot_rdq(), rsm_tsk(), set_flg(), sig_sem(), slp_tsk(), snd_dtq(), snd_mbx(), snd_pdq(), sta_alm(), sta_cyc(), stp_alm(), stp_cyc(), sus_tsk(), ter_tsk(), tget_mpf(), trcv_dtq(), trcv_mbx(), trcv_pdq(), tslp_tsk(), tsnd_dtq(), tsnd_pdq(), twai_flg(), twai_sem(), unl_cpu(), wai_flg(), wai_sem(), と wup_tsk().
#define VALID_EXCNO_DEFEXC | ( | excno | ) |
値:
((0x02U <= (excno) && (excno) <= 0x0fU) \ || (0x20U <= (excno) && (excno) <= 0x3fU))
prc_config.h の 395 行で定義されています。
参照元 x_define_exc().
#define VALID_INHNO_DEFINH | ( | inhno | ) |
値:
((0x10U <= (inhno) && (inhno) <= 0x1fU) \ || (0x40U <= (inhno) && (inhno) <= 0xffU))
prc_config.h の 393 行で定義されています。
参照元 x_define_inh().
#define VALID_INTPRI_CHGIPM | ( | intpri | ) | ((-6 <= (intpri) && (intpri) <= TIPM_ENAALL)) |
prc_config.h の 265 行で定義されています。
typedef struct task_context_block CTXB |
typedef struct exc_vector_entry EXCVE |
Inline void call_atexit | ( | void | ) |
prc_config.h の 691 行で定義されています。
参照元 exit_kernel().
00692 { 00693 extern void software_term_hook(void); 00694 void (*volatile fp)(void) = software_term_hook; 00695 00696 /* 00697 * software_term_hookへのポインタを,一旦volatile指定のあるfpに代 00698 * 入してから使うのは,0との比較が最適化で削除されないようにするた 00699 * めである. 00700 */ 00701 if (fp != 0) { 00702 (*fp)(); 00703 } 00704 }
void call_exit_kernel | ( | void | ) |
Inline uint16_t current_iipm | ( | void | ) |
prc_config.h の 95 行で定義されています。
参照先 current_sr().
参照元 x_get_ipm(), と x_lock_cpu().
00096 { 00097 return(current_sr() & 0x0700U); 00098 }
void dispatch | ( | void | ) |
Inline uint16_t exc_get_iipm | ( | void * | p_excinf | ) |
Inline bool_t exc_sense_context | ( | void * | p_excinf | ) |
Inline bool_t exc_sense_intmask | ( | void * | p_excinf | ) |
prc_config.h の 647 行で定義されています。
参照先 exc_get_iipm(), exc_sense_context(), と IIPM_ENAALL.
参照元 xsns_dpn().
00648 { 00649 return(!exc_sense_context(p_excinf) 00650 && exc_get_iipm(p_excinf) == IIPM_ENAALL); 00651 }
Inline bool_t exc_sense_unlock | ( | void * | p_excinf | ) |
prc_config.h の 671 行で定義されています。
参照先 exc_get_iipm(), exc_sense_context(), と IIPM_LOCK.
参照元 xsns_xpn().
00672 { 00673 return(!exc_sense_context(p_excinf) 00674 && exc_get_iipm(p_excinf) < IIPM_LOCK); 00675 }
void exit_and_dispatch | ( | void | ) |
void prc_initialize | ( | void | ) |
prc_config.c の 61 行で定義されています。
参照先 IIPM_ENAALL, lock_flag, saved_iipm, と set_vbr().
00062 { 00063 /* 00064 * CPUロックフラグ実現のための変数の初期化 00065 */ 00066 lock_flag = true; 00067 saved_iipm = IIPM_ENAALL; 00068 00069 /* 00070 * 例外ベクタテーブルの初期化 00071 */ 00072 #ifdef EXCVT_KERNEL 00073 memcpy(EXCVT_KERNEL, EXCVT_ORIG, EXCVT_LEN); 00074 set_vbr(EXCVT_KERNEL); 00075 #endif /* EXCVT_KERNEL */ 00076 }
void prc_terminate | ( | void | ) |
prc_config.c の 82 行で定義されています。
参照先 set_vbr().
00083 { 00084 #ifdef EXCVT_KERNEL 00085 set_vbr(EXCVT_ORIG); 00086 #endif /* EXCVT_KERNEL */ 00087 }
Inline bool_t sense_context | ( | void | ) |
prc_config.h の 141 行で定義されています。
参照先 current_sr().
参照元 signal_time(), sns_ctx(), と sns_dpn().
00142 { 00143 return((current_sr() & 0x1000U) == 0U); 00144 }
Inline void set_iipm | ( | uint16_t | iipm | ) |
prc_config.h の 104 行で定義されています。
参照先 current_sr(), と set_sr().
参照元 x_lock_cpu(), x_set_ipm(), と x_unlock_cpu().
00105 { 00106 set_sr((current_sr() & ~0x0700U) | iipm); 00107 }
void start_dispatch | ( | void | ) |
void start_r | ( | void | ) |
prc_config.h の 430 行で定義されています。
参照先 assert, current_vbr(), exc_vector_entry::exc_handler, と VALID_EXCNO_DEFEXC.
00431 { 00432 EXCVE *excvt; 00433 00434 assert(VALID_EXCNO_DEFEXC(excno)); 00435 00436 #ifdef EXCVT_KERNEL 00437 /* 00438 * EXCVT_KERNELが定義されている時は,初期化処理の中でVBRを 00439 * EXCVT_KERNELに設定するので,EXCVT_KERNELを使う. 00440 */ 00441 excvt = (EXCVE *) EXCVT_KERNEL; 00442 #else /* EXCVT_KERNEL */ 00443 excvt = (EXCVE *) current_vbr(); 00444 #endif /* EXCVT_KERNEL */ 00445 excvt[excno].exc_handler = exc_entry; 00446 }
prc_config.h の 405 行で定義されています。
参照先 assert, current_vbr(), exc_vector_entry::exc_handler, と VALID_INHNO_DEFINH.
00406 { 00407 EXCVE *excvt; 00408 00409 assert(VALID_INHNO_DEFINH(inhno)); 00410 00411 #ifdef EXCVT_KERNEL 00412 /* 00413 * EXCVT_KERNELが定義されている時は,初期化処理の中でVBRを 00414 * EXCVT_KERNELに設定するので,EXCVT_KERNELを使う. 00415 */ 00416 excvt = (EXCVE *) EXCVT_KERNEL; 00417 #else /* EXCVT_KERNEL */ 00418 excvt = (EXCVE *) current_vbr(); 00419 #endif /* EXCVT_KERNEL */ 00420 excvt[inhno].exc_handler = int_entry; 00421 }
Inline PRI x_get_ipm | ( | void | ) |
prc_config.h の 307 行で定義されています。
参照先 current_iipm(), EXT_IPM, lock_flag, と saved_iipm.
00308 { 00309 uint16_t iipm; 00310 00311 if (!lock_flag) { 00312 iipm = current_iipm(); 00313 } 00314 else { 00315 iipm = saved_iipm; 00316 } 00317 return(EXT_IPM(iipm)); 00318 }
Inline void x_lock_cpu | ( | void | ) |
prc_config.h の 201 行で定義されています。
参照先 Asm, current_iipm(), disint(), IIPM_LOCK, lock_flag, saved_iipm, と set_iipm().
00202 { 00203 uint16_t iipm; 00204 00205 /* 00206 * current_iipm()の返り値を直接saved_iipmに保存せず,一時変数iipm 00207 * を用いているのは,current_iipm()を呼んだ直後に割込みが発生し, 00208 * 起動された割込み処理でsaved_iipmが変更される可能性があるためで 00209 * ある. 00210 */ 00211 iipm = current_iipm(); 00212 #if TIPM_LOCK == -7 00213 disint(); 00214 #else /* TIPM_LOCK == -7 */ 00215 if (IIPM_LOCK > iipm) { 00216 set_iipm(IIPM_LOCK); 00217 } 00218 #endif /* TIPM_LOCK == -7 */ 00219 saved_iipm = iipm; 00220 lock_flag = true; 00221 Asm("":::"memory"); 00222 }
Inline bool_t x_sense_lock | ( | void | ) |
prc_config.h の 251 行で定義されています。
参照先 lock_flag.
参照元 sns_loc().
00252 { 00253 return(lock_flag); 00254 }
Inline void x_set_ipm | ( | PRI | intpri | ) |
prc_config.h の 277 行で定義されています。
参照先 IIPM_LOCK, INT_IPM, lock_flag, saved_iipm, と set_iipm().
00278 { 00279 uint16_t iipm = INT_IPM(intpri); 00280 00281 if (!lock_flag) { 00282 set_iipm(iipm); 00283 } 00284 else { 00285 saved_iipm = iipm; 00286 #if TIPM_LOCK == -7 00287 /* 00288 * TIPM_LOCKが-7の場合には,この時点でハードウェアの割込み優先 00289 * 度マスクが必ず7に設定されているため,設定しなおす必要がない. 00290 */ 00291 #else /* TIPM_LOCK == -7 */ 00292 set_iipm(iipm > IIPM_LOCK ? iipm : IIPM_LOCK); 00293 #endif /* TIPM_LOCK == -7 */ 00294 } 00295 }
Inline void x_unlock_cpu | ( | void | ) |
prc_config.h の 237 行で定義されています。
参照先 Asm, lock_flag, saved_iipm, と set_iipm().
00238 { 00239 Asm("":::"memory"); 00240 lock_flag = false; 00241 set_iipm(saved_iipm); 00242 }
prc_config.c の 54 行で定義されています。
volatile uint16_t saved_iipm |
prc_config.c の 55 行で定義されています。
Copyright © 2008 by Kijineko Inc.