From d9959bb3f5f9d1e46391f9a021f42ed1ddb808eb Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Sun, 28 Aug 2022 10:09:45 -0600 Subject: [PATCH] Fix build on aarch64 --- Cargo.toml | 6 ++++-- src/main.rs | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index af1c79e..a5cfe11 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,8 @@ edition = "2018" [dependencies] libc = "0.2" redox_syscall = { git = "https://gitlab.redox-os.org/redox-os/syscall.git" } -strace = { git = "https://gitlab.redox-os.org/redox-os/strace-redox", default-features = false } -x86 = "0.47.0" +#strace = { git = "https://gitlab.redox-os.org/redox-os/strace-redox", default-features = false } #strace = { path = "../../strace/source", default-features = false } + +[target.'cfg(target_arch = "x86_64")'.dependencies] +x86 = "0.47.0" diff --git a/src/main.rs b/src/main.rs index c23a0d2..43cc217 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,6 +3,8 @@ mod clone_grant_using_fmap; +const PAGE_SIZE: usize = 4096; + fn e(error: Result) -> Result { error.map_err(|e| e.to_string()) } @@ -45,9 +47,6 @@ fn create_test() -> Result<(), String> { Ok(()) } -#[cfg(target_arch = "x86_64")] -const PAGE_SIZE: usize = 4096; - fn page_fault_test() -> Result<(), String> { use std::sync::atomic::{AtomicUsize, compiler_fence, Ordering}; @@ -114,6 +113,7 @@ fn page_fault_test() -> Result<(), String> { Ok(()) } +#[cfg(target_arch = "x86_64")] fn switch_test() -> Result<(), String> { use std::thread; use x86::time::rdtscp; @@ -246,6 +246,7 @@ fn main() { let mut tests: BTreeMap<&'static str, fn() -> Result<(), String>> = BTreeMap::new(); tests.insert("create_test", create_test); tests.insert("page_fault", page_fault_test); + #[cfg(target_arch = "x86_64")] tests.insert("switch", switch_test); tests.insert("tcp_fin", tcp_fin_test); tests.insert("thread", thread_test);