diff options
Diffstat (limited to 'src/bits64')
-rw-r--r-- | src/bits64/mod.rs | 1 | ||||
-rw-r--r-- | src/bits64/time.rs | 45 |
2 files changed, 0 insertions, 46 deletions
diff --git a/src/bits64/mod.rs b/src/bits64/mod.rs index 1fcb17e..7409435 100644 --- a/src/bits64/mod.rs +++ b/src/bits64/mod.rs @@ -15,7 +15,6 @@ macro_rules! check_flag { ) } -pub mod time; pub mod irq; pub mod paging; pub mod segmentation; diff --git a/src/bits64/time.rs b/src/bits64/time.rs deleted file mode 100644 index eff567d..0000000 --- a/src/bits64/time.rs +++ /dev/null @@ -1,45 +0,0 @@ -//! Functions to read time stamp counters on x86. - -/// Read the time stamp counter. -/// -/// The RDTSC instruction is not a serializing instruction. -/// It does not necessarily wait until all previous instructions -/// have been executed before reading the counter. Similarly, -/// subsequent instructions may begin execution before the -/// read operation is performed. If software requires RDTSC to be -/// executed only after all previous instructions have completed locally, -/// it can either use RDTSCP or execute the sequence LFENCE;RDTSC. -/// -/// # Safety -/// * Causes a GP fault if the TSD flag in register CR4 is set and the CPL -/// is greater than 0. -#[allow(unused_mut)] -pub unsafe fn rdtsc() -> u64 { - let mut low: u32; - let mut high: u32; - - asm!("rdtsc" : "={eax}" (low), "={edx}" (high)); - ((high as u64) << 32) | (low as u64) -} - -/// Read the time stamp counter. -/// -/// The RDTSCP instruction waits until all previous instructions -/// have been executed before reading the counter. -/// However, subsequent instructions may begin execution -/// before the read operation is performed. -/// -/// Volatile is used here because the function may be used to act as -/// an instruction barrier. -/// -/// # Safety -/// * Causes a GP fault if the TSD flag in register CR4 is set and the -/// CPL is greater than 0. -#[allow(unused_mut)] -pub unsafe fn rdtscp() -> u64 { - let mut low: u32; - let mut high: u32; - - asm!("rdtscp" : "={eax}" (low), "={edx}" (high) ::: "volatile"); - ((high as u64) << 32) | (low as u64) -} |