Skip to content

Commit

Permalink
Update inline assembly for x86 to support new syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
jlb6740 committed Jul 26, 2020
1 parent 0cc0312 commit 0a94c63
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/cpucounter.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
uint64_t cpucounter(void)
{
uint64_t low, high;
__asm__ __volatile__ ("rdtscp" : "=a" (low), "=d" (high) : : "%ecx");
__asm__ __volatile__("rdtscp"
: "=a"(low), "=d"(high)
:
: "%ecx");
return (high << 32) | low;
}
2 changes: 1 addition & 1 deletion src/cpucounter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pub(crate) struct CPUCounter;
#[inline]
unsafe fn cpucounter() -> u64 {
let (low, high): (u64, u64);
asm!("rdtscp" : "={eax}" (low), "={edx}" (high) : : "ecx");
asm!("rdtscp", out("eax") low, out("edx") high, out("ecx") _);
(high << 32) | low
}

Expand Down

0 comments on commit 0a94c63

Please sign in to comment.