From b24b91e1c0737fc7df13380041d7157e5154a70c Mon Sep 17 00:00:00 2001 From: Nick Spinale Date: Mon, 8 Jan 2024 08:52:19 +0000 Subject: [PATCH] Remove #![feature(exposed_provenance)] Signed-off-by: Nick Spinale --- .../http-server/helpers/virtio-hal-impl/src/lib.rs | 3 +-- .../private/support/sel4-simple-task/runtime/src/lib.rs | 9 ++++----- crates/sel4-capdl-initializer/core/src/lib.rs | 4 +--- crates/sel4-capdl-initializer/src/main.rs | 4 +--- crates/sel4-initialize-tls-on-stack/src/lib.rs | 8 +++----- crates/sel4-kernel-loader/payload-types/src/lib.rs | 3 +-- .../sel4-kernel-loader/src/arch/aarch64/drivers/psci.rs | 2 +- .../src/arch/aarch64/drivers/spin_table.rs | 9 ++++----- crates/sel4-kernel-loader/src/main.rs | 1 - crates/sel4-kernel-loader/src/this_image.rs | 3 +-- 10 files changed, 17 insertions(+), 29 deletions(-) diff --git a/crates/examples/microkit/http-server/helpers/virtio-hal-impl/src/lib.rs b/crates/examples/microkit/http-server/helpers/virtio-hal-impl/src/lib.rs index 47d08e705..208ba83cc 100644 --- a/crates/examples/microkit/http-server/helpers/virtio-hal-impl/src/lib.rs +++ b/crates/examples/microkit/http-server/helpers/virtio-hal-impl/src/lib.rs @@ -5,7 +5,6 @@ // #![no_std] -#![feature(exposed_provenance)] #![feature(slice_ptr_get)] use core::alloc::Layout; @@ -42,7 +41,7 @@ pub struct HalImpl; impl HalImpl { pub fn init(dma_region_size: usize, dma_region_vaddr: usize, dma_region_paddr: usize) { let dma_region_ptr = NonNull::new(ptr::slice_from_raw_parts_mut( - ptr::from_exposed_addr_mut(dma_region_vaddr), + dma_region_vaddr as *mut _, dma_region_size, )) .unwrap(); diff --git a/crates/private/support/sel4-simple-task/runtime/src/lib.rs b/crates/private/support/sel4-simple-task/runtime/src/lib.rs index 239c57a31..816222ad4 100644 --- a/crates/private/support/sel4-simple-task/runtime/src/lib.rs +++ b/crates/private/support/sel4-simple-task/runtime/src/lib.rs @@ -6,7 +6,6 @@ #![no_std] #![feature(core_intrinsics)] -#![feature(exposed_provenance)] #![feature(lang_items)] #![feature(linkage)] #![feature(never_type)] @@ -80,9 +79,9 @@ pub unsafe extern "C" fn cont_fn(cont_arg: *mut c_void) -> ! { THREAD_INDEX.set(thread_index).unwrap(); - sel4::set_ipc_buffer(sel4::IPCBuffer::from_ptr(ptr::from_exposed_addr_mut( - thread_config.ipc_buffer_addr().try_into().unwrap(), - ))); + sel4::set_ipc_buffer(sel4::IPCBuffer::from_ptr( + usize::try_from(thread_config.ipc_buffer_addr()).unwrap() as *mut _, + )); if thread_index == 0 { CONFIG.set(config.clone()).unwrap(); @@ -142,7 +141,7 @@ fn panic_hook(info: &ExternalPanicInfo<'_>) { fn get_static_heap_bounds() -> *mut [u8] { let addrs = CONFIG.get().unwrap().static_heap().unwrap(); ptr::slice_from_raw_parts_mut( - ptr::from_exposed_addr_mut(addrs.start.try_into().unwrap()), + usize::try_from(addrs.start).unwrap() as *mut _, (addrs.end - addrs.start).try_into().unwrap(), ) } diff --git a/crates/sel4-capdl-initializer/core/src/lib.rs b/crates/sel4-capdl-initializer/core/src/lib.rs index 8a9dbd967..008bd043e 100644 --- a/crates/sel4-capdl-initializer/core/src/lib.rs +++ b/crates/sel4-capdl-initializer/core/src/lib.rs @@ -5,7 +5,6 @@ // #![no_std] -#![feature(exposed_provenance)] #![feature(never_type)] #![feature(pointer_is_aligned)] #![feature(proc_macro_hygiene)] @@ -14,7 +13,6 @@ use core::array; use core::borrow::BorrowMut; use core::ops::Range; -use core::ptr; use core::result; use core::slice; use core::sync::atomic::{self, Ordering}; @@ -465,7 +463,7 @@ impl<'a, N: ObjectName, D: Content, M: GetEmbeddedFrame, B: BorrowMut<[PerObject let offset = entry.range.start; let length = entry.range.end - entry.range.start; assert!(entry.range.end <= U::FRAME_SIZE.bytes()); - let dst_frame = ptr::from_exposed_addr_mut::(self.copy_addr::()); + let dst_frame = self.copy_addr::() as *mut u8; let dst = unsafe { slice::from_raw_parts_mut(dst_frame.add(offset), length) }; match &entry.content { FillEntryContent::Data(content_data) => { diff --git a/crates/sel4-capdl-initializer/src/main.rs b/crates/sel4-capdl-initializer/src/main.rs index 1d52e0e8d..c01140a35 100644 --- a/crates/sel4-capdl-initializer/src/main.rs +++ b/crates/sel4-capdl-initializer/src/main.rs @@ -6,7 +6,6 @@ #![no_std] #![no_main] -#![feature(exposed_provenance)] extern crate alloc; @@ -99,8 +98,7 @@ fn get_spec_with_sources<'a>() -> SpecWithSources< fn user_image_bounds() -> Range { unsafe { - sel4_capdl_initializer_image_start.expose_addr() - ..sel4_capdl_initializer_image_end.expose_addr() + (sel4_capdl_initializer_image_start as usize)..(sel4_capdl_initializer_image_end as usize) } } diff --git a/crates/sel4-initialize-tls-on-stack/src/lib.rs b/crates/sel4-initialize-tls-on-stack/src/lib.rs index 8780b4cca..5be251e69 100644 --- a/crates/sel4-initialize-tls-on-stack/src/lib.rs +++ b/crates/sel4-initialize-tls-on-stack/src/lib.rs @@ -5,11 +5,9 @@ // #![no_std] -#![feature(exposed_provenance)] use core::arch::{asm, global_asm}; use core::ffi::c_void; -use core::ptr; use core::slice; // NOTE @@ -68,14 +66,14 @@ impl TlsImage { unsafe fn init(&self, tp: usize) { let addr = self.tls_base_addr(tp); - let window = slice::from_raw_parts_mut(ptr::from_exposed_addr_mut(addr), self.memsz); + let window = slice::from_raw_parts_mut(addr as *mut _, self.memsz); let (tdata, tbss) = window.split_at_mut(self.filesz); tdata.copy_from_slice(self.data()); tbss.fill(0); } unsafe fn data(&self) -> &'static [u8] { - slice::from_raw_parts(ptr::from_exposed_addr_mut(self.vaddr), self.filesz) + slice::from_raw_parts(self.vaddr as *mut _, self.filesz) } } @@ -178,7 +176,7 @@ unsafe extern "C" fn continue_with(args: *const InternalContArgs, tp: usize) -> set_thread_pointer(tp); if cfg!(target_arch = "x86_64") { - ptr::from_exposed_addr_mut::(tp).write(tp); + (tp as *mut usize).write(tp); } (args.cont_fn)(args.cont_arg) diff --git a/crates/sel4-kernel-loader/payload-types/src/lib.rs b/crates/sel4-kernel-loader/payload-types/src/lib.rs index bb393519e..fef26f3f8 100644 --- a/crates/sel4-kernel-loader/payload-types/src/lib.rs +++ b/crates/sel4-kernel-loader/payload-types/src/lib.rs @@ -5,7 +5,6 @@ // #![no_std] -#![feature(exposed_provenance)] #![deny(unsafe_op_in_unsafe_fn)] #![allow(clippy::useless_conversion)] @@ -129,7 +128,7 @@ impl Payload { for region in self.data.iter() { let dst = unsafe { slice::from_raw_parts_mut( - ptr::from_exposed_addr_mut(region.phys_addr_range.start.try_into().unwrap()), + usize::try_from(region.phys_addr_range.start).unwrap() as *mut _, (region.phys_addr_range.end - region.phys_addr_range.start) .try_into() .unwrap(), diff --git a/crates/sel4-kernel-loader/src/arch/aarch64/drivers/psci.rs b/crates/sel4-kernel-loader/src/arch/aarch64/drivers/psci.rs index 3db2b0487..6498184f6 100644 --- a/crates/sel4-kernel-loader/src/arch/aarch64/drivers/psci.rs +++ b/crates/sel4-kernel-loader/src/arch/aarch64/drivers/psci.rs @@ -7,7 +7,7 @@ use core::arch::global_asm; pub(crate) fn start_secondary_core(core_id: usize, sp: usize) { - let start = (psci_secondary_entry as *const PsciSecondaryEntryFn).expose_addr(); + let start = psci_secondary_entry as *const PsciSecondaryEntryFn as usize; smccc::psci::cpu_on::( core_id.try_into().unwrap(), start.try_into().unwrap(), diff --git a/crates/sel4-kernel-loader/src/arch/aarch64/drivers/spin_table.rs b/crates/sel4-kernel-loader/src/arch/aarch64/drivers/spin_table.rs index a3f9e9d47..6ffd08dd2 100644 --- a/crates/sel4-kernel-loader/src/arch/aarch64/drivers/spin_table.rs +++ b/crates/sel4-kernel-loader/src/arch/aarch64/drivers/spin_table.rs @@ -5,7 +5,6 @@ // use core::arch::{asm, global_asm}; -use core::ptr; use core::sync::atomic::{AtomicUsize, Ordering}; #[used] @@ -16,15 +15,15 @@ pub(crate) fn start_secondary_core(spin_table: &[usize], core_id: usize, sp: usi unsafe { spin_table_secondary_stack_bottom = sp; - let start = (spin_table_secondary_entry as *const SpinTableSecondaryEntryFn).expose_addr(); - let start_ptr = ptr::from_exposed_addr_mut(spin_table[core_id]); + let start = spin_table_secondary_entry as *const SpinTableSecondaryEntryFn as usize; + let start_ptr = spin_table[core_id] as *mut _; // Emits strl instruction. Ensures jump address is observed by spinning // core only after stack address, without the need for an explicit barrier. AtomicUsize::from_ptr(start_ptr).store(start, Ordering::Release); - dc_cvac(start_ptr.expose_addr()); - dc_cvac((&spin_table_secondary_stack_bottom as *const usize).expose_addr()); + dc_cvac(start_ptr as usize); + dc_cvac(&spin_table_secondary_stack_bottom as *const _ as usize); // Barrier ensure both strl and dc cvac happen before sev asm!("dsb sy"); diff --git a/crates/sel4-kernel-loader/src/main.rs b/crates/sel4-kernel-loader/src/main.rs index 3eb4a5dd4..82468f5e2 100644 --- a/crates/sel4-kernel-loader/src/main.rs +++ b/crates/sel4-kernel-loader/src/main.rs @@ -7,7 +7,6 @@ #![no_std] #![no_main] #![feature(associated_type_bounds)] -#![feature(exposed_provenance)] #![feature(proc_macro_hygiene)] #![cfg_attr( any(target_arch = "riscv32", target_arch = "riscv64"), diff --git a/crates/sel4-kernel-loader/src/this_image.rs b/crates/sel4-kernel-loader/src/this_image.rs index 00514d725..86efaa300 100644 --- a/crates/sel4-kernel-loader/src/this_image.rs +++ b/crates/sel4-kernel-loader/src/this_image.rs @@ -95,8 +95,7 @@ pub(crate) mod stacks { SECONDARY_STACKS .0 .get() - .offset((core_id * SECONDARY_STACK_SIZE).try_into().unwrap()) - .expose_addr() + .offset((core_id * SECONDARY_STACK_SIZE).try_into().unwrap()) as usize } } }