mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-22 02:53:23 +00:00
@ -625,7 +625,7 @@ pub fn clocksource_resume() {
|
||||
match ele.resume() {
|
||||
Ok(_) => continue,
|
||||
Err(_) => {
|
||||
kdebug!("clocksource {:?} resume failed", data.name);
|
||||
kdebug!("clocksource {:?} resume failed", data.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -641,7 +641,7 @@ pub fn clocksource_suspend() {
|
||||
match ele.suspend() {
|
||||
Ok(_) => continue,
|
||||
Err(_) => {
|
||||
kdebug!("clocksource {:?} suspend failed", data.name);
|
||||
kdebug!("clocksource {:?} suspend failed", data.name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ use alloc::{
|
||||
sync::{Arc, Weak},
|
||||
};
|
||||
|
||||
use crate::{kerror, kinfo, libs::spinlock::SpinLock, syscall::SystemError};
|
||||
use crate::{kdebug, libs::spinlock::SpinLock, syscall::SystemError};
|
||||
|
||||
use super::{
|
||||
clocksource::{Clocksource, ClocksourceData, ClocksourceFlags, ClocksourceMask, CycleNum, HZ},
|
||||
@ -89,13 +89,9 @@ pub fn jiffies_init() {
|
||||
//注册jiffies
|
||||
let jiffies = clocksource_default_clock() as Arc<dyn Clocksource>;
|
||||
match jiffies.register() {
|
||||
Ok(_) => {
|
||||
kinfo!("jiffies_init sccessfully");
|
||||
}
|
||||
Err(_) => {
|
||||
kerror!("jiffies_init failed, no default clock running");
|
||||
}
|
||||
};
|
||||
Ok(_) => kdebug!("jiffies_init sccessfully"),
|
||||
Err(_) => kdebug!("jiffies_init failed, no default clock running"),
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
@ -4,6 +4,7 @@ use core::{
|
||||
};
|
||||
|
||||
use crate::{
|
||||
kdebug,
|
||||
syscall::{Syscall, SystemError},
|
||||
time::{sleep::nanosleep, TimeSpec},
|
||||
};
|
||||
@ -78,10 +79,10 @@ impl Syscall {
|
||||
|
||||
pub fn gettimeofday(
|
||||
tv: *mut PosixTimeval,
|
||||
timezone: *mut PosixTimeZone,
|
||||
_timezone: &PosixTimeZone,
|
||||
) -> Result<usize, SystemError> {
|
||||
// TODO; 处理时区信息
|
||||
// kdebug!("enter sys_do_gettimeofday");
|
||||
kdebug!("enter sys_do_gettimeofday");
|
||||
if tv == null_mut() {
|
||||
return Err(SystemError::EFAULT);
|
||||
}
|
||||
@ -90,13 +91,7 @@ impl Syscall {
|
||||
(*tv).tv_sec = posix_time.tv_sec;
|
||||
(*tv).tv_usec = posix_time.tv_usec;
|
||||
}
|
||||
|
||||
if !timezone.is_null() {
|
||||
unsafe {
|
||||
*timezone = SYS_TIMEZONE;
|
||||
}
|
||||
}
|
||||
// kdebug!("exit sys_do_gettimeofday");
|
||||
kdebug!("exit sys_do_gettimeofday");
|
||||
return Ok(0);
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ use x86_64::align_up;
|
||||
use crate::{
|
||||
arch::CurrentIrqArch,
|
||||
exception::InterruptArch,
|
||||
kdebug, kinfo,
|
||||
kdebug,
|
||||
libs::rwlock::RwLock,
|
||||
time::{jiffies::clocksource_default_clock, timekeep::ktime_get_real_ns, TimeSpec},
|
||||
};
|
||||
@ -118,7 +118,6 @@ impl Timekeeper {
|
||||
|
||||
timekeeper.cycle_interval = CycleNum(temp);
|
||||
timekeeper.xtime_interval = temp * clock_data.mult as u64;
|
||||
// 这里可能存在下界溢出问题,debug模式下会报错panic
|
||||
timekeeper.xtime_remainder = (ntpinterval - timekeeper.xtime_interval) as i64;
|
||||
timekeeper.raw_interval = (timekeeper.xtime_interval >> clock_data.shift) as i64;
|
||||
timekeeper.xtime_nsec = 0;
|
||||
@ -155,7 +154,7 @@ pub fn timekeeper_init() {
|
||||
///
|
||||
/// * 'TimeSpec' - 时间戳
|
||||
pub fn getnstimeofday() -> TimeSpec {
|
||||
// kdebug!("enter getnstimeofday");
|
||||
kdebug!("enter getnstimeofday");
|
||||
|
||||
// let mut nsecs: u64 = 0;0
|
||||
let mut _xtime = TimeSpec {
|
||||
@ -202,7 +201,6 @@ pub fn do_gettimeofday() -> PosixTimeval {
|
||||
|
||||
/// # 初始化timekeeping模块
|
||||
pub fn timekeeping_init() {
|
||||
kinfo!("Initializing timekeeping module...");
|
||||
let irq_guard = unsafe { CurrentIrqArch::save_and_disable_irq() };
|
||||
timekeeper_init();
|
||||
|
||||
@ -231,7 +229,7 @@ pub fn timekeeping_init() {
|
||||
__ADDED_SEC.store(0, Ordering::SeqCst);
|
||||
|
||||
drop(irq_guard);
|
||||
kinfo!("timekeeping_init successfully");
|
||||
kdebug!("timekeeping_init successfully");
|
||||
}
|
||||
|
||||
/// # 使用当前时钟源增加wall time
|
||||
|
@ -12,5 +12,4 @@ extern int64_t rs_timer_get_first_expire();
|
||||
extern uint64_t rs_timer_next_n_ms_jiffies(uint64_t expire_ms);
|
||||
extern int64_t rs_schedule_timeout(int64_t timeout);
|
||||
|
||||
extern uint64_t rs_clock();
|
||||
extern void rs_jiffies_init();
|
||||
extern uint64_t rs_clock();
|
@ -17,7 +17,7 @@ use crate::{
|
||||
InterruptArch,
|
||||
},
|
||||
include::bindings::bindings::{process_control_block, process_wakeup, PROC_RUNNING},
|
||||
kdebug, kerror, kinfo,
|
||||
kdebug, kerror,
|
||||
libs::spinlock::SpinLock,
|
||||
syscall::SystemError,
|
||||
};
|
||||
@ -105,6 +105,7 @@ impl Timer {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
let mut temp_list: LinkedList<Arc<Timer>> = timer_list.split_off(split_pos);
|
||||
timer_list.push_back(inner_guard.self_ref.upgrade().unwrap());
|
||||
timer_list.append(&mut temp_list);
|
||||
@ -215,7 +216,7 @@ pub fn timer_init() {
|
||||
softirq_vectors()
|
||||
.register_softirq(SoftirqNumber::TIMER, do_timer_softirq)
|
||||
.expect("Failed to register timer softirq");
|
||||
kinfo!("timer initialized successfully");
|
||||
kdebug!("timer initiated successfully");
|
||||
}
|
||||
|
||||
/// 计算接下来n毫秒对应的定时器时间片
|
||||
|
Reference in New Issue
Block a user