Skip to content

Commit

Permalink
Remove #![feature(exposed_provenance)]
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Spinale <[email protected]>
  • Loading branch information
nspin committed Jan 8, 2024
1 parent 24548ca commit b24b91e
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
//

#![no_std]
#![feature(exposed_provenance)]
#![feature(slice_ptr_get)]

use core::alloc::Layout;
Expand Down Expand Up @@ -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();
Expand Down
9 changes: 4 additions & 5 deletions crates/private/support/sel4-simple-task/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#![no_std]
#![feature(core_intrinsics)]
#![feature(exposed_provenance)]
#![feature(lang_items)]
#![feature(linkage)]
#![feature(never_type)]
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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(),
)
}
Expand Down
4 changes: 1 addition & 3 deletions crates/sel4-capdl-initializer/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
//

#![no_std]
#![feature(exposed_provenance)]
#![feature(never_type)]
#![feature(pointer_is_aligned)]
#![feature(proc_macro_hygiene)]
Expand All @@ -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};
Expand Down Expand Up @@ -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::<u8>(self.copy_addr::<U>());
let dst_frame = self.copy_addr::<U>() as *mut u8;
let dst = unsafe { slice::from_raw_parts_mut(dst_frame.add(offset), length) };
match &entry.content {
FillEntryContent::Data(content_data) => {
Expand Down
4 changes: 1 addition & 3 deletions crates/sel4-capdl-initializer/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#![no_std]
#![no_main]
#![feature(exposed_provenance)]

extern crate alloc;

Expand Down Expand Up @@ -99,8 +98,7 @@ fn get_spec_with_sources<'a>() -> SpecWithSources<

fn user_image_bounds() -> Range<usize> {
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)
}
}

Expand Down
8 changes: 3 additions & 5 deletions crates/sel4-initialize-tls-on-stack/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
}

Expand Down Expand Up @@ -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::<usize>(tp).write(tp);
(tp as *mut usize).write(tp);
}

(args.cont_fn)(args.cont_arg)
Expand Down
3 changes: 1 addition & 2 deletions crates/sel4-kernel-loader/payload-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
//

#![no_std]
#![feature(exposed_provenance)]
#![deny(unsafe_op_in_unsafe_fn)]
#![allow(clippy::useless_conversion)]

Expand Down Expand Up @@ -129,7 +128,7 @@ impl<U: RegionContent, const N: usize> Payload<usize, U, N> {
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(),
Expand Down
2 changes: 1 addition & 1 deletion crates/sel4-kernel-loader/src/arch/aarch64/drivers/psci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<smccc::Smc>(
core_id.try_into().unwrap(),
start.try_into().unwrap(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
//

use core::arch::{asm, global_asm};
use core::ptr;
use core::sync::atomic::{AtomicUsize, Ordering};

#[used]
Expand All @@ -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");
Expand Down
1 change: 0 additions & 1 deletion crates/sel4-kernel-loader/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
3 changes: 1 addition & 2 deletions crates/sel4-kernel-loader/src/this_image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}

0 comments on commit b24b91e

Please sign in to comment.