diff --git a/Cargo.toml b/Cargo.toml index 95b68f8ee7..5580d869da 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,4 +6,9 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + [dependencies] + +[features] +default = ["std"] +std = [] diff --git a/src/arch/mod.rs b/src/arch/mod.rs index 21a88f6368..e0559713d8 100644 --- a/src/arch/mod.rs +++ b/src/arch/mod.rs @@ -6,8 +6,13 @@ use crate::{ VirtualAddress, }; -pub mod emulate; -pub mod x86_64; +#[cfg(feature = "std")] +pub use self::emulate::EmulateArch; +pub use self::x86_64::X8664Arch; + +#[cfg(feature = "std")] +mod emulate; +mod x86_64; pub trait Arch { const PAGE_SHIFT: usize; diff --git a/src/lib.rs b/src/lib.rs index cbd5f79462..d72240bac5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,8 +1,8 @@ +#![cfg_attr(not(feature = "std"), no_std)] #![feature(asm)] pub use crate::{ - arch::Arch, - arch::emulate::*, + arch::*, page::{ PageEntry, PageTable