use super::{VmiOs, impl_ops};
use crate::{Va, VmiDriver, VmiError, VmiVa};
impl_ops! {
pub struct ThreadId(pub u32);
}
impl_ops! {
pub struct ThreadObject(pub Va);
}
impl VmiVa for ThreadObject {
fn va(&self) -> Va {
self.0
}
}
impl ThreadObject {
pub fn is_null(&self) -> bool {
self.0.0 == 0
}
pub fn to_u64(&self) -> u64 {
self.0.0
}
}
pub trait VmiOsThread<'a, Driver>: VmiVa + 'a
where
Driver: VmiDriver,
{
type Os: VmiOs<Driver = Driver, Thread<'a> = Self>;
fn id(&self) -> Result<ThreadId, VmiError>;
fn object(&self) -> Result<ThreadObject, VmiError>;
}