std: move time implementations to sys (small platforms)

Let's start with the easy ones:
* Motor just reexports its platform library
* The SGX code is just a trivial move
* Trusty, WASM and ZKVM are unsupported, this is very trivial. And we can get
  rid of some `#[path = ...]`s, yay!
This commit is contained in:
joboet 2026-01-15 14:38:41 +01:00
parent 814d902c50
commit 29b16c0a55
No known key found for this signature in database
GPG key ID: 704E0149B0194B3C
12 changed files with 16 additions and 12 deletions

View file

@ -1,7 +1,6 @@
#![allow(unsafe_op_in_unsafe_fn)]
pub mod os;
pub mod time;
pub use moto_rt::futex;

View file

@ -1 +0,0 @@
pub use moto_rt::time::{Instant, SystemTime, UNIX_EPOCH};

View file

@ -12,7 +12,6 @@ pub mod abi;
mod libunwind_integration;
pub mod os;
pub mod thread_parking;
pub mod time;
pub mod waitqueue;
// SAFETY: must be called only once during runtime initialization.

View file

@ -5,7 +5,5 @@
mod common;
#[path = "../unsupported/os.rs"]
pub mod os;
#[path = "../unsupported/time.rs"]
pub mod time;
pub use common::*;

View file

@ -1,7 +1,6 @@
#![deny(unsafe_op_in_unsafe_fn)]
pub mod os;
pub mod time;
mod common;
pub use common::*;

View file

@ -18,8 +18,6 @@
#[path = "../unsupported/os.rs"]
pub mod os;
#[path = "../unsupported/time.rs"]
pub mod time;
#[cfg(target_feature = "atomics")]
#[path = "atomics/futex.rs"]

View file

@ -1,7 +1,6 @@
#![forbid(unsafe_op_in_unsafe_fn)]
pub mod os;
pub mod time;
#[path = "../unsupported/common.rs"]
mod common;

View file

@ -12,8 +12,6 @@ pub const WORD_SIZE: usize = size_of::<u32>();
pub mod abi;
pub mod os;
#[path = "../unsupported/time.rs"]
pub mod time;
use crate::io as std_io;

View file

@ -1,4 +1,19 @@
cfg_select! {
target_os = "motor" => {
use moto_rt::time as imp;
}
all(target_vendor = "fortanix", target_env = "sgx") => {
mod sgx;
use sgx as imp;
}
target_os = "xous" => {
mod xous;
use xous as imp;
}
_ => {
mod unsupported;
use unsupported as imp;
}
}
pub use imp::{Instant, SystemTime, UNIX_EPOCH};

View file

@ -1,4 +1,4 @@
use super::abi::usercalls;
use crate::sys::pal::abi::usercalls;
use crate::time::Duration;
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]