We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a822194 commit e4f99aeCopy full SHA for e4f99ae
src/delay.rs
@@ -16,10 +16,12 @@ unsafe fn rdtsc() -> u64 {
16
_rdtsc()
17
}
18
19
-#[cfg(not(target_arch = "x86_64"))]
+#[cfg(target_arch = "aarch64")]
20
#[inline]
21
unsafe fn rdtsc() -> u64 {
22
- 0
+ let value: u64;
23
+ asm!("mrs {}, cntvct_el0", out(reg) value);
24
+ value
25
26
27
#[cfg(target_arch = "x86_64")]
@@ -28,9 +30,11 @@ unsafe fn pause() {
28
30
asm!("pause");
29
31
32
33
34
-unsafe fn pause() {}
35
+unsafe fn pause() {
36
+ asm!("yield");
37
+}
38
39
pub fn ndelay(ns: u64) {
40
let delta = ns * CPU_KHZ_DEFAULT / NSECS_PER_SEC;
0 commit comments