Skip to content

Commit

Permalink
Merge pull request #1006 from mkroening/nightly-2023-12-15
Browse files Browse the repository at this point in the history
build: upgrade to nightly-2023-12-15
  • Loading branch information
mkroening authored Dec 15, 2023
2 parents 781c193 + 68d5d3a commit 342d51f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 24 deletions.
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "nightly-2023-12-01"
channel = "nightly-2023-12-15"
components = [
"llvm-tools",
"rust-src",
Expand Down
15 changes: 4 additions & 11 deletions src/drivers/virtio/transport/mmio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#![allow(dead_code)]

use core::convert::TryInto;
use core::intrinsics::unaligned_volatile_store;
use core::ptr::{read_volatile, write_volatile};
use core::result::Result;
use core::sync::atomic::{fence, Ordering};
Expand Down Expand Up @@ -297,22 +296,16 @@ impl NotifCtrl {
fence(Ordering::Acquire);

if self.f_notif_data {
let ptr = self.notif_addr;
let ptr = self.notif_addr as *mut [u8; 4];

unsafe {
unaligned_volatile_store(
ptr,
u32::from_ne_bytes(notif_data[0..4].try_into().unwrap()),
);
ptr.write_volatile(notif_data[0..4].try_into().unwrap());
}
} else {
let ptr = self.notif_addr as *mut u16;
let ptr = self.notif_addr as *mut [u8; 2];

unsafe {
unaligned_volatile_store(
ptr,
u16::from_ne_bytes(notif_data[0..2].try_into().unwrap()),
);
ptr.write_volatile(notif_data[0..2].try_into().unwrap());
}
}

Expand Down
15 changes: 4 additions & 11 deletions src/drivers/virtio/transport/pci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#![allow(dead_code)]

use alloc::vec::Vec;
use core::intrinsics::unaligned_volatile_store;
use core::result::Result;
use core::sync::atomic::{fence, Ordering};
use core::{mem, ptr};
Expand Down Expand Up @@ -720,22 +719,16 @@ impl NotifCtrl {
fence(Ordering::Acquire);

if self.f_notif_data {
let ptr = self.notif_addr as *mut u32;
let ptr = self.notif_addr as *mut [u8; 4];

unsafe {
unaligned_volatile_store(
ptr,
u32::from_ne_bytes(notif_data[0..4].try_into().unwrap()),
);
ptr.write_volatile(notif_data[0..4].try_into().unwrap());
}
} else {
let ptr = self.notif_addr as *mut u16;
let ptr = self.notif_addr as *mut [u8; 2];

unsafe {
unaligned_volatile_store(
ptr,
u16::from_ne_bytes(notif_data[0..2].try_into().unwrap()),
);
ptr.write_volatile(notif_data[0..2].try_into().unwrap());
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#![cfg_attr(target_arch = "riscv64", feature(offset_of))]
#![feature(allocator_api)]
#![feature(asm_const)]
#![feature(core_intrinsics)]
#![feature(exposed_provenance)]
#![feature(linked_list_cursors)]
#![feature(maybe_uninit_slice)]
#![feature(naked_functions)]
Expand Down

0 comments on commit 342d51f

Please sign in to comment.