Skip to content

Commit 24fc1e4

Browse files
authored
Fix temporary references for volatile read (#12)
* Bump Rust toolchain version for CI to 1.64 * Fix temporary references for volatile read
1 parent 3a0063a commit 24fc1e4

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ environment:
1212
- host: i686-pc-windows-gnu
1313
channel: nightly
1414
- host: x86_64-pc-windows-gnu
15-
channel: 1.33.0
15+
channel: 1.64.0
1616
- host: i686-pc-windows-gnu
17-
channel: 1.33.0
17+
channel: 1.64.0
1818

1919
install:
2020
- appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe

src/ntexapi.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
use core::mem::uninitialized;
2+
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
3+
use core::ptr::addr_of;
24
use core::ptr::read_volatile;
35
#[cfg(target_arch = "x86")]
46
use core::sync::atomic::spin_loop_hint;
@@ -2780,7 +2782,7 @@ pub const USER_SHARED_DATA: *const KUSER_SHARED_DATA = 0x7ffe0000 as *const _;
27802782
pub unsafe fn NtGetTickCount64() -> ULONGLONG {
27812783
let mut tick_count: ULARGE_INTEGER = uninitialized();
27822784
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))] {
2783-
*tick_count.QuadPart_mut() = read_volatile(&(*USER_SHARED_DATA).u.TickCountQuad);
2785+
*tick_count.QuadPart_mut() = read_volatile(addr_of!((*USER_SHARED_DATA).u.TickCountQuad));
27842786
}
27852787
#[cfg(target_arch = "x86")] {
27862788
loop {
@@ -2804,7 +2806,7 @@ pub unsafe fn NtGetTickCount64() -> ULONGLONG {
28042806
#[inline]
28052807
pub unsafe fn NtGetTickCount() -> ULONG {
28062808
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))] {
2807-
((read_volatile(&(*USER_SHARED_DATA).u.TickCountQuad)
2809+
((read_volatile(addr_of!((*USER_SHARED_DATA).u.TickCountQuad))
28082810
* (*USER_SHARED_DATA).TickCountMultiplier as u64) >> 24) as u32
28092811
}
28102812
#[cfg(target_arch = "x86")] {

0 commit comments

Comments
 (0)