Get main reverie crate compiling on aarch64

Reviewed By: wangbj

Differential Revision: D40577288

fbshipit-source-id: 0cf76ef1fdae1a5bcd0aaf046ec59ed7b7478d91
This commit is contained in:
Jason White 2022-10-21 12:09:36 -07:00 committed by Facebook GitHub Bot
parent eb92a00594
commit 5049415db6
3 changed files with 20 additions and 11 deletions

View file

@ -21,6 +21,7 @@ mod auxv;
mod backtrace;
mod error;
mod guest;
#[cfg(target_arch = "x86_64")]
mod rdtsc;
mod stack;
mod subscription;
@ -33,6 +34,7 @@ pub use error::*;
pub use guest::*;
pub use process::ExitStatus;
pub use process::Pid;
#[cfg(target_arch = "x86_64")]
pub use rdtsc::*;
pub use reverie_process as process;
pub use stack::*;

View file

@ -7,7 +7,8 @@
* LICENSE file in the root directory of this source tree.
*/
//! rdtsc/rdtscp helpers
//! rdtsc/rdtscp helpers. This only makes sense on x86_64 as it is the only
//! architecture where we can intercept these instructions.
use core::arch::x86_64::__rdtscp;
use core::arch::x86_64::_rdtsc;

View file

@ -14,8 +14,6 @@
//! same process.
use async_trait::async_trait;
use raw_cpuid::cpuid;
use raw_cpuid::CpuIdResult;
use reverie_syscalls::Syscall;
use serde::de::DeserializeOwned;
use serde::Serialize;
@ -23,7 +21,9 @@ use serde::Serialize;
use crate::error::Errno;
use crate::error::Error;
use crate::guest::Guest;
#[cfg(target_arch = "x86_64")]
use crate::rdtsc::Rdtsc;
#[cfg(target_arch = "x86_64")]
use crate::rdtsc::RdtscResult;
use crate::ExitStatus;
use crate::Pid;
@ -238,25 +238,31 @@ pub trait Tool: Serialize + DeserializeOwned + Send + Sync + Default {
guest.tail_inject(c).await
}
/// CPUID is trapped, the tool should implement this function to return [eax,
/// ebx, ecx, edx]
/// CPUID is trapped, the tool should implement this function to return
/// `[eax, ebx, ecx, edx]`.
///
/// NOTE: This is never called by default unless cpuid events are subscribed
/// to.
/// NOTE:
/// * This is never called by default unless cpuid events are subscribed
/// to.
/// * This is only available on x86_64.
#[cfg(target_arch = "x86_64")]
async fn handle_cpuid_event<T: Guest<Self>>(
&self,
_guest: &mut T,
eax: u32,
ecx: u32,
) -> Result<CpuIdResult, Errno> {
Ok(cpuid!(eax, ecx))
) -> Result<raw_cpuid::CpuIdResult, Errno> {
Ok(raw_cpuid::cpuid!(eax, ecx))
}
/// rdtsc/rdtscp is trapped, the tool should implement this function to
/// return the counter.
///
/// NOTE: This is never called by default unless rdtsc events are subscribed
/// to.
/// NOTE:
/// * This is never called by default unless rdtsc events are subscribed
/// to.
/// * This is only available on x86_64.
#[cfg(target_arch = "x86_64")]
async fn handle_rdtsc_event<T: Guest<Self>>(
&self,
_guest: &mut T,