1 use crate::{ 2 arch::interrupt::TrapFrame, 3 process::ProcessManager, 4 smp::{core::smp_get_processor_id, cpu::ProcessorId}, 5 time::timer::run_local_timer, 6 }; 7 8 use super::timer::update_timer_jiffies; 9 10 /// # 函数的功能 11 /// 用于周期滴答的事件处理 tick_handle_periodic(trap_frame: &TrapFrame)12pub fn tick_handle_periodic(trap_frame: &TrapFrame) { 13 let cpu_id = smp_get_processor_id(); 14 15 tick_periodic(cpu_id, trap_frame); 16 } 17 tick_periodic(cpu_id: ProcessorId, trap_frame: &TrapFrame)18fn tick_periodic(cpu_id: ProcessorId, trap_frame: &TrapFrame) { 19 if cpu_id.data() == 0 { 20 update_timer_jiffies(1); 21 run_local_timer(); 22 } 23 24 ProcessManager::update_process_times(trap_frame.is_from_user()); 25 } 26