use super::*;
#[cfg(feature = "serialization")]
use serde::{Deserialize, Serialize};
#[repr(C)]
pub struct RegisterContext {
pub values: [u64; REGISTER_MAX_VALUE + 1],
}
#[cfg_attr(feature = "serialization", derive(Deserialize, Serialize))]
#[derive(Clone, Debug, Eq, PartialEq)]
#[repr(C)]
pub struct InstructionSegments {
pub count: u8,
pub segments: [InstructionSegmentsElement; MAX_INSTRUCTION_SEGMENT_COUNT],
}
impl<'a> IntoIterator for &'a InstructionSegments {
type IntoIter = slice::Iter<'a, InstructionSegmentsElement>;
type Item = &'a InstructionSegmentsElement;
fn into_iter(self) -> Self::IntoIter {
self.segments[..self.count as usize].iter()
}
}
#[cfg_attr(feature = "serialization", derive(Deserialize, Serialize))]
#[derive(Clone, Debug, Eq, PartialEq)]
#[repr(C)]
pub struct InstructionSegmentsElement {
pub ty: InstructionSegment,
pub offset: u8,
pub size: u8,
}
extern "C" {
pub fn ZydisCalcAbsoluteAddress(
instruction: *const DecodedInstruction,
operand: *const DecodedOperand,
runtime_address: u64,
result_address: *mut u64,
) -> Status;
pub fn ZydisCalcAbsoluteAddressEx(
instruction: *const DecodedInstruction,
operand: *const DecodedOperand,
runtime_address: u64,
register_context: *const RegisterContext,
result_address: *mut u64,
) -> Status;
pub fn ZydisGetInstructionSegments(
instruction: *const DecodedInstruction,
segments: *mut InstructionSegments,
) -> Status;
}