動作ログをコメントしてみました。
run
starting from entry point: ffc020
kozos boot succeed!
■kz_startでスレッド登録
CALL kz_start
●スタートスレッドをディスパッチ
CALL thread_run
--- CHANGE CURRENT ---
idle
CALL putcurrent : readyque.tail change to current.
--- CHANGE CURRENT ---
idle
--- DISPATCH CURRENT---
CALL thread_init
●kz_runでtest09_1をレディーキューに登録
CALL kz_run
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
CALL thread_run
CALL putcurrent : readyque.tail change to current.
--- CHANGE CURRENT ---
test09_1
CALL putcurrent : readyque.tail change to current.
CALL schedule
--- CHANGE CURRENT ---
idle
--- DISPATCH CURRENT---
●kz_runでtest09_2をレディーキューに登録
CALL kz_run
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
CALL thread_run
CALL putcurrent : readyque.tail change to current.
--- CHANGE CURRENT ---
test09_2
CALL putcurrent : readyque.tail change to current.
CALL schedule
--- CHANGE CURRENT ---
idle
--- DISPATCH CURRENT---
●kz_runでtest09_3をレディーキューに登録
CALL kz_run
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
CALL thread_run
CALL putcurrent : readyque.tail change to current.
--- CHANGE CURRENT ---
test09_3
CALL putcurrent : readyque.tail change to current.
CALL schedule
--- CHANGE CURRENT ---
idle
--- DISPATCH CURRENT---
●スタートスレッドのプライオリティを15に下げる。
CALL kz_chpri
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
CALL thread_chpri
★putcurrentするので優先度を下げてレディーキューに留まる。
CALL putcurrent : readyque.tail change to current.
CALL schedule
--- CHANGE CURRENT ---
test09_1
--- DISPATCH CURRENT---
■test09_1にディスパッチを実施する。(プライオリティ:1)
CALL thread_init
test09_1 started.
test09_1 sleep in.
CALL kz_sleep
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
CALL thread_sleep
★putcurrentしないのでレディーキューから外れるためschedule時のdispatch対象から外れる。
CALL schedule
--- CHANGE CURRENT ---
test09_2
--- DISPATCH CURRENT---
■test09_2にディスパッチを実施する。(プライオリティ:2)
CALL thread_init
test09_2 started.
test09_2 sleep in.
CALL kz_sleep
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
CALL thread_sleep
★putcurrentしないのでレディーキューから外れるためschedule時のdispatch対象から外れる。
CALL schedule
--- CHANGE CURRENT ---
test09_3
--- DISPATCH CURRENT---
■test09_3にディスパッチを実施する。(プライオリティ:3)
CALL thread_init
test09_3 started.
test09_3 wakeup in (test09_1).
CALL kz_wakeup
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
CALL thread_wakeup
★test09_1をsleep状態からウェイクアップさせる
CALL putcurrent : readyque.tail change to current.
★test09_3はレディキューに戻るのでschedule時のdispatch対象になる。
--- CHANGE CURRENT ---
test09_1
CALL putcurrent : readyque.tail change to current.
CALL schedule
--- CHANGE CURRENT ---
test09_1
--- DISPATCH CURRENT---
■test09_1にディスパッチを実施する。(プライオリティ:1)
★スタートスレッドのプライオリティは15と低い。
★プライオリティとしても1と高いのでこれがscheduleされている。
★test09_1で前回sleepでスレッド変更したがその続きをディスパッチして実施している。
test09_1 sleep out.
test09_1 chpri in.
CALL kz_chpri
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
CALL thread_chpri
★test09_3のプライオリティを3に下げる。
CALL putcurrent : readyque.tail change to current.
CALL schedule
--- CHANGE CURRENT ---
test09_3
--- DISPATCH CURRENT---
■test09_3にディスパッチを実施する。(プライオリティ:3)
★test09_1はプライオリティを3に下げtest09_3のあとにスケジューリングされるようになった。
★test09_3で前回sleepでスレッド変更したがその続きをディスパッチして実施している。
test09_3 wakeup out.
test09_3 wakeup in (test09_2).
CALL kz_wakeup
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
CALL thread_wakeup
★test09_2をsleep状態からウェイクアップさせる
★test09_2は一番プライオリティの高い2になっている
CALL putcurrent : readyque.tail change to current.
--- CHANGE CURRENT ---
test09_2
CALL putcurrent : readyque.tail change to current.
CALL schedule
--- CHANGE CURRENT ---
test09_2
--- DISPATCH CURRENT---
■test09_2にディスパッチを実施する。(プライオリティ:2)
test09_2 sleep out.
test09_2 chpri in.
CALL kz_chpri
CALL kz_syscdall asm volatile trapa
★asm volatile trapa("trapa #1")を実施すると割込みベクタの9番目の登録関数が実施される。
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
CALL thread_chpri
★スレッドの優先度変更★
★test09_2はプライオリティを3に下げtest09_1とtest09_3のあとにスケジューリングされるようになった。
CALL putcurrent : readyque.tail change to current.
CALL schedule
--- CHANGE CURRENT ---
test09_1
--- DISPATCH CURRENT---
■test09_1にディスパッチを実施する。(プライオリティ:3)
test09_1 chpri out.
test09_1 wait in.
CALL kz_wait
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
CALL thread_wait
★test09_1をcurrentから外してレディーキューに接続し直す。
CALL putcurrent : readyque.tail change to current.
CALL schedule
--- CHANGE CURRENT ---
test09_3
--- DISPATCH CURRENT---
■test09_3にディスパッチを実施する。(プライオリティ:3)
test09_3 wakeup out.
test09_3 wait in.
CALL kz_wait
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
CALL thread_wait
★test09_3をcurrentから外してレディーキューに接続し直す。
CALL putcurrent : readyque.tail change to current.
CALL schedule
--- CHANGE CURRENT ---
test09_2
--- DISPATCH CURRENT---
■test09_2にディスパッチを実施する。(プライオリティ:3)
test09_2 chpri out.
test09_2 wait in.
CALL kz_wait
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
CALL thread_wait
★test09_2をcurrentから外してレディーキューに接続し直す。
CALL putcurrent : readyque.tail change to current.
CALL schedule
--- CHANGE CURRENT ---
test09_1
--- DISPATCH CURRENT---
■test09_1にディスパッチを実施する。(プライオリティ:3)
test09_1 wait out.
test09_1 trap in.
CALL thread_intr
test09_1 DOWN.
CALL getcurrent : readyque.head change to current->next.
test09_1 EXIT.
★test09_1はsofterr_intr関数がトラップでたたかれる。
CALL schedule
--- CHANGE CURRENT ---
test09_3
--- DISPATCH CURRENT---
■test09_3にディスパッチを実施する。(プライオリティ:3)
test09_3 wait out.
test09_3 exit in.
CALL kz_exit
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
test09_3 EXIT.
★終了。
CALL schedule
--- CHANGE CURRENT ---
test09_2
--- DISPATCH CURRENT---
■test09_2にディスパッチを実施する。(プライオリティ:3)
test09_2 wait out.
test09_2 exit.
■thread_init関数が実施。
★スタートスレッドの終了としてここに帰ってくるようだ。
★詳細はソースでは追っていない。
back func and call thread_end
CALL thread_end
CALL kz_exit
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
test09_2 EXIT.
CALL schedule
--- CHANGE CURRENT ---
idle
--- DISPATCH CURRENT---
run
starting from entry point: ffc020
kozos boot succeed!
■kz_startでスレッド登録
CALL kz_start
●スタートスレッドをディスパッチ
CALL thread_run
--- CHANGE CURRENT ---
idle
CALL putcurrent : readyque.tail change to current.
--- CHANGE CURRENT ---
idle
--- DISPATCH CURRENT---
CALL thread_init
●kz_runでtest09_1をレディーキューに登録
CALL kz_run
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
CALL thread_run
CALL putcurrent : readyque.tail change to current.
--- CHANGE CURRENT ---
test09_1
CALL putcurrent : readyque.tail change to current.
CALL schedule
--- CHANGE CURRENT ---
idle
--- DISPATCH CURRENT---
●kz_runでtest09_2をレディーキューに登録
CALL kz_run
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
CALL thread_run
CALL putcurrent : readyque.tail change to current.
--- CHANGE CURRENT ---
test09_2
CALL putcurrent : readyque.tail change to current.
CALL schedule
--- CHANGE CURRENT ---
idle
--- DISPATCH CURRENT---
●kz_runでtest09_3をレディーキューに登録
CALL kz_run
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
CALL thread_run
CALL putcurrent : readyque.tail change to current.
--- CHANGE CURRENT ---
test09_3
CALL putcurrent : readyque.tail change to current.
CALL schedule
--- CHANGE CURRENT ---
idle
--- DISPATCH CURRENT---
●スタートスレッドのプライオリティを15に下げる。
CALL kz_chpri
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
CALL thread_chpri
★putcurrentするので優先度を下げてレディーキューに留まる。
CALL putcurrent : readyque.tail change to current.
CALL schedule
--- CHANGE CURRENT ---
test09_1
--- DISPATCH CURRENT---
■test09_1にディスパッチを実施する。(プライオリティ:1)
CALL thread_init
test09_1 started.
test09_1 sleep in.
CALL kz_sleep
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
CALL thread_sleep
★putcurrentしないのでレディーキューから外れるためschedule時のdispatch対象から外れる。
CALL schedule
--- CHANGE CURRENT ---
test09_2
--- DISPATCH CURRENT---
■test09_2にディスパッチを実施する。(プライオリティ:2)
CALL thread_init
test09_2 started.
test09_2 sleep in.
CALL kz_sleep
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
CALL thread_sleep
★putcurrentしないのでレディーキューから外れるためschedule時のdispatch対象から外れる。
CALL schedule
--- CHANGE CURRENT ---
test09_3
--- DISPATCH CURRENT---
■test09_3にディスパッチを実施する。(プライオリティ:3)
CALL thread_init
test09_3 started.
test09_3 wakeup in (test09_1).
CALL kz_wakeup
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
CALL thread_wakeup
★test09_1をsleep状態からウェイクアップさせる
CALL putcurrent : readyque.tail change to current.
★test09_3はレディキューに戻るのでschedule時のdispatch対象になる。
--- CHANGE CURRENT ---
test09_1
CALL putcurrent : readyque.tail change to current.
CALL schedule
--- CHANGE CURRENT ---
test09_1
--- DISPATCH CURRENT---
■test09_1にディスパッチを実施する。(プライオリティ:1)
★スタートスレッドのプライオリティは15と低い。
★プライオリティとしても1と高いのでこれがscheduleされている。
★test09_1で前回sleepでスレッド変更したがその続きをディスパッチして実施している。
test09_1 sleep out.
test09_1 chpri in.
CALL kz_chpri
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
CALL thread_chpri
★test09_3のプライオリティを3に下げる。
CALL putcurrent : readyque.tail change to current.
CALL schedule
--- CHANGE CURRENT ---
test09_3
--- DISPATCH CURRENT---
■test09_3にディスパッチを実施する。(プライオリティ:3)
★test09_1はプライオリティを3に下げtest09_3のあとにスケジューリングされるようになった。
★test09_3で前回sleepでスレッド変更したがその続きをディスパッチして実施している。
test09_3 wakeup out.
test09_3 wakeup in (test09_2).
CALL kz_wakeup
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
CALL thread_wakeup
★test09_2をsleep状態からウェイクアップさせる
★test09_2は一番プライオリティの高い2になっている
CALL putcurrent : readyque.tail change to current.
--- CHANGE CURRENT ---
test09_2
CALL putcurrent : readyque.tail change to current.
CALL schedule
--- CHANGE CURRENT ---
test09_2
--- DISPATCH CURRENT---
■test09_2にディスパッチを実施する。(プライオリティ:2)
test09_2 sleep out.
test09_2 chpri in.
CALL kz_chpri
CALL kz_syscdall asm volatile trapa
★asm volatile trapa("trapa #1")を実施すると割込みベクタの9番目の登録関数が実施される。
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
CALL thread_chpri
★スレッドの優先度変更★
★test09_2はプライオリティを3に下げtest09_1とtest09_3のあとにスケジューリングされるようになった。
CALL putcurrent : readyque.tail change to current.
CALL schedule
--- CHANGE CURRENT ---
test09_1
--- DISPATCH CURRENT---
■test09_1にディスパッチを実施する。(プライオリティ:3)
test09_1 chpri out.
test09_1 wait in.
CALL kz_wait
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
CALL thread_wait
★test09_1をcurrentから外してレディーキューに接続し直す。
CALL putcurrent : readyque.tail change to current.
CALL schedule
--- CHANGE CURRENT ---
test09_3
--- DISPATCH CURRENT---
■test09_3にディスパッチを実施する。(プライオリティ:3)
test09_3 wakeup out.
test09_3 wait in.
CALL kz_wait
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
CALL thread_wait
★test09_3をcurrentから外してレディーキューに接続し直す。
CALL putcurrent : readyque.tail change to current.
CALL schedule
--- CHANGE CURRENT ---
test09_2
--- DISPATCH CURRENT---
■test09_2にディスパッチを実施する。(プライオリティ:3)
test09_2 chpri out.
test09_2 wait in.
CALL kz_wait
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
CALL thread_wait
★test09_2をcurrentから外してレディーキューに接続し直す。
CALL putcurrent : readyque.tail change to current.
CALL schedule
--- CHANGE CURRENT ---
test09_1
--- DISPATCH CURRENT---
■test09_1にディスパッチを実施する。(プライオリティ:3)
test09_1 wait out.
test09_1 trap in.
CALL thread_intr
test09_1 DOWN.
CALL getcurrent : readyque.head change to current->next.
test09_1 EXIT.
★test09_1はsofterr_intr関数がトラップでたたかれる。
CALL schedule
--- CHANGE CURRENT ---
test09_3
--- DISPATCH CURRENT---
■test09_3にディスパッチを実施する。(プライオリティ:3)
test09_3 wait out.
test09_3 exit in.
CALL kz_exit
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
test09_3 EXIT.
★終了。
CALL schedule
--- CHANGE CURRENT ---
test09_2
--- DISPATCH CURRENT---
■test09_2にディスパッチを実施する。(プライオリティ:3)
test09_2 wait out.
test09_2 exit.
■thread_init関数が実施。
★スタートスレッドの終了としてここに帰ってくるようだ。
★詳細はソースでは追っていない。
back func and call thread_end
CALL thread_end
CALL kz_exit
CALL kz_syscdall asm volatile trapa
CALL thread_intr
CALL syscall_intr
CALL syscdall_proc
CALL getcurrent : readyque.head change to current->next.
CALL call_functions
test09_2 EXIT.
CALL schedule
--- CHANGE CURRENT ---
idle
--- DISPATCH CURRENT---