mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-28 04:43:23 +00:00
软中断&定时器重构 (#223)
* 软中断&定时器重构 Co-authored-by: houmkh<houjiaying@DragonOS.org> * 修改timer的clock() * 删除debug信息 --------- Co-authored-by: houmkh <1119644616@qq.com>
This commit is contained in:
@ -1,18 +1,12 @@
|
||||
use core::arch::asm;
|
||||
|
||||
use super::asm::current::current_pcb;
|
||||
|
||||
/// @brief 获取当前cpu的apic id
|
||||
#[inline]
|
||||
pub fn current_cpu_id() -> u8 {
|
||||
let cpuid_res: u32;
|
||||
unsafe {
|
||||
asm!(
|
||||
"mov eax, 1",
|
||||
"cpuid",
|
||||
"mov r15, rbx",
|
||||
lateout("r15") cpuid_res
|
||||
);
|
||||
}
|
||||
return ((cpuid_res >> 24) & 0xff) as u8;
|
||||
pub fn current_cpu_id() -> u32 {
|
||||
// TODO: apic重构后,使用apic id来设置这里
|
||||
current_pcb().cpu_id as u32
|
||||
}
|
||||
|
||||
/// @brief 通过pause指令,让cpu休息一会儿。降低空转功耗
|
||||
|
Reference in New Issue
Block a user