From f469bfcffc5b58458a1d13644bf7a9fae4d3a2cc Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Fri, 14 Aug 2020 19:53:33 +0800 Subject: [PATCH] xous-rs: remove `baremetal` cfg We now check if `target_os = "none"`. Signed-off-by: Sean Cross --- xous-rs/src/arch/hosted.rs | 6 ------ xous-rs/src/arch/mod.rs | 8 ++++---- xous-rs/src/lib.rs | 4 ++-- xous-rs/src/syscall.rs | 6 +++--- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/xous-rs/src/arch/hosted.rs b/xous-rs/src/arch/hosted.rs index 313e1ea98..5d109717b 100644 --- a/xous-rs/src/arch/hosted.rs +++ b/xous-rs/src/arch/hosted.rs @@ -28,13 +28,11 @@ pub struct ProcessInit { pub key: ProcessKey, } -#[cfg(not(baremetal))] pub struct ProcessArgsAsThread { main: F, name: String, } -#[cfg(not(baremetal))] impl ProcessArgsAsThread where F: FnOnce(), @@ -46,12 +44,10 @@ where } } } -#[cfg(not(baremetal))] pub struct ProcessHandleAsThread(std::thread::JoinHandle<()>); /// If no connection exists, create a new connection to the server. This means /// our parent PID will be PID1. Otherwise, reuse the same connection. -#[cfg(not(baremetal))] pub fn create_process_pre_as_thread( _args: &ProcessArgsAsThread, ) -> core::result::Result @@ -70,7 +66,6 @@ where }) } -#[cfg(not(baremetal))] pub fn create_process_post_as_thread( args: ProcessArgsAsThread, init: ProcessInit, @@ -109,7 +104,6 @@ where Ok(ProcessHandleAsThread(thread_main.0)) } -#[cfg(not(baremetal))] pub fn wait_process_as_thread(joiner: ProcessHandleAsThread) -> crate::SysCallResult { joiner.0.join().map(|_| Result::Ok).map_err(|_x| { // panic!("wait error: {:?}", x); diff --git a/xous-rs/src/arch/mod.rs b/xous-rs/src/arch/mod.rs index d4d658e1d..481135b2e 100644 --- a/xous-rs/src/arch/mod.rs +++ b/xous-rs/src/arch/mod.rs @@ -1,9 +1,9 @@ -#[cfg(baremetal)] +#[cfg(target_os = "none")] pub mod native; -#[cfg(baremetal)] +#[cfg(target_os = "none")] pub use native::*; -#[cfg(any(windows,unix))] +#[cfg(not(target_os = "none"))] pub mod hosted; -#[cfg(any(windows,unix))] +#[cfg(not(target_os = "none"))] pub use hosted::*; diff --git a/xous-rs/src/lib.rs b/xous-rs/src/lib.rs index 7fd160ed5..2dac2d9c2 100644 --- a/xous-rs/src/lib.rs +++ b/xous-rs/src/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(baremetal, no_std)] +#![cfg_attr(target_os = "none", no_std)] #[macro_use] extern crate bitflags; @@ -19,7 +19,7 @@ pub use definitions::*; pub use messages::*; pub use syscall::*; -#[cfg(not(baremetal))] +#[cfg(not(target_os = "none"))] pub use arch::ProcessArgsAsThread; /// Convert a four-letter string into a 32-bit int. diff --git a/xous-rs/src/syscall.rs b/xous-rs/src/syscall.rs index 2fe1ed8f3..3a6f8b1b4 100644 --- a/xous-rs/src/syscall.rs +++ b/xous-rs/src/syscall.rs @@ -6,7 +6,7 @@ use crate::{ // use num_derive::FromPrimitive; // use num_traits::FromPrimitive; -#[cfg(not(baremetal))] +#[cfg(not(target_os = "none"))] use crate::ProcessArgsAsThread; #[derive(Debug, PartialEq)] @@ -888,7 +888,7 @@ pub fn wait_thread(joiner: crate::arch::WaitHandle) -> SysCallResult { } /// Create a new process by running it in its own thread -#[cfg(not(baremetal))] +#[cfg(not(target_os = "none"))] pub fn create_process_as_thread( args: ProcessArgsAsThread, ) -> core::result::Result @@ -906,7 +906,7 @@ where } /// Wait for a thread to finish -#[cfg(not(baremetal))] +#[cfg(not(target_os = "none"))] pub fn wait_process_as_thread(joiner: crate::arch::ProcessHandleAsThread) -> SysCallResult { crate::arch::wait_process_as_thread(joiner) }