diff --git a/bindings/rsbddisasm/bddisasm/src/lib.rs b/bindings/rsbddisasm/bddisasm/src/lib.rs index 515dfce..4139678 100644 --- a/bindings/rsbddisasm/bddisasm/src/lib.rs +++ b/bindings/rsbddisasm/bddisasm/src/lib.rs @@ -22,7 +22,7 @@ //! //! ```toml //! [dependencies] -//! bddisasm = "0.5.0" +//! bddisasm = "0.5.1" //! ``` //! //! # Examples @@ -186,7 +186,7 @@ //! # Feature Flags //! //! - `std` - adds a `std` dependency - the only visible difference when doing this is that [`DecodeError`] implements -//! the `Error` trait +//! the `Error` trait //! #![cfg_attr(all(not(test), not(feature = "std")), no_std)] @@ -205,6 +205,7 @@ pub mod isa_set; pub mod mnemonic; pub mod operand; pub mod rflags; +pub mod simd_exceptions; pub mod tuple; pub use crate::decode_error::DecodeError; diff --git a/bindings/rsbddisasm/bddisasm/src/simd_exceptions.rs b/bindings/rsbddisasm/bddisasm/src/simd_exceptions.rs new file mode 100644 index 0000000..facfe37 --- /dev/null +++ b/bindings/rsbddisasm/bddisasm/src/simd_exceptions.rs @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2024 Bitdefender + * SPDX-License-Identifier: Apache-2.0 + */ +//! Offers information about the SIMD exceptions that can be triggered by an instruction. + +#![allow(clippy::module_name_repetitions)] + +// TODO: maybe use something like the `bitflags` crate and have all these as flags? + +/// SIMD Floating-Point Exceptions. +#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] +pub struct SimdExceptions { + /// Invalid Operation Exception. + pub invalid_operation: bool, + + /// Denormal Exception. + pub denormal: bool, + + /// Divide-by-Zero Exception. + pub divide_by_zero: bool, + + /// Overflow Exception. + pub overflow: bool, + + /// Underflow Exception. + pub underflow: bool, + + /// Precision Exception. + pub precision: bool, +} + +#[doc(hidden)] +impl SimdExceptions { + pub(crate) fn from_raw(value: u8) -> Self { + let value = u32::from(value); + Self { + invalid_operation: (value & ffi::ND_SIMD_EXC_IE) != 0, + denormal: (value & ffi::ND_SIMD_EXC_DE) != 0, + divide_by_zero: (value & ffi::ND_SIMD_EXC_ZE) != 0, + overflow: (value & ffi::ND_SIMD_EXC_OE) != 0, + underflow: (value & ffi::ND_SIMD_EXC_UE) != 0, + precision: (value & ffi::ND_SIMD_EXC_PE) != 0, + } + } +}