Skip to main content

_drreg_options_t

Struct _drreg_options_t 

Source
#[repr(C)]
pub struct _drreg_options_t { pub struct_size: usize, pub num_spill_slots: uint, pub conservative: bool_, pub error_callback: Option<unsafe extern "C" fn(status: drreg_status_t) -> bool_>, pub do_not_sum_slots: bool_, }
Expand description

Specifies the options when initializing drreg.

Fields§

§struct_size: usize

Set this to the size of this structure.

§num_spill_slots: uint

The number of TLS spill slots to use. This many slots will be requested from DR via dr_raw_tls_calloc(). Any slots needed beyond this number will use DR’s base slots, which are not allowed to be used across application instructions. DR’s slots are also more expensive to access (beyond the first few). DR’s base slots may also be used by APIs like dr_save_reg()/dr_restore_reg() (and the corresponding dr_read_saved_reg()/dr_write_saved_reg()), which may cause correctness issues if there’s some slot usage conflict within the same client or with other clients/libraries. Therefore, all cooperating client components should use drreg. Also, clients should make sure to request sufficient dedicated slots from drreg. This number should be computed as one plus the number of simultaneously used general-purpose register spill slots, as drreg reserves one of the requested slots for arithmetic flag preservation.

For each simultaneous value that will be held in a register across application instructions, an additional slot must be requested for adjusting the saved application value with respect to application reads and writes.

When drreg_init() is called multiple times, the number of slots is summed from each call, unless \p do_not_sum_slots is specified for that call, in which case a maximum is used rather than a sum.

§conservative: bool_

By default, drreg assumes that the application will not rely on the particular value of a dead register when a fault happens. This allows drreg to reduce overhead. This flag can be set to request that drreg not make this assumption.

If multiple drreg_init() calls are made, this field is combined by logical OR.

XXX i#3801: If a fault occurs between two spills of a GPR or aflags, where the second spill is after an app write, the current drreg application state restoration logic does not restore the dead GPR/aflags even with this field set to true. It is difficult to do so without additional metadata passed to the state restoration callback.

§error_callback: Option<unsafe extern "C" fn(status: drreg_status_t) -> bool_>

Some drreg operations are performed during drmgr events where there is no direct return value to the user of drreg. When an error is encountered at these times, drreg will call this callback and pass the error value. If this callback is NULL, or if it returns false, drreg will call dr_abort().

If multiple drreg_init() calls are made, only the first callback is honored (thus, libraries generally should not set this).

§do_not_sum_slots: bool_

Generally, library routines should take in scratch registers directly, keeping drreg reservations in the end client. However, sometimes this model is not sufficient, and a library wants to directly reserve drreg registers or aflags. The library can ensure that drreg is initialized, without forcing the client to do so when the client is not directly using drreg already, by calling drreg_init() and setting \p do_not_sum_slots to true. This ensures that the total requested slots is at least \p num_spill_slots, but if the total is already higher than that, the total is left alone.. Thus, if clients invoke drreg_init() on their own, the library will not needlessly add to the number of simultaneous slots needed.

Trait Implementations§

Source§

impl Clone for _drreg_options_t

Source§

fn clone(&self) -> _drreg_options_t

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for _drreg_options_t

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for _drreg_options_t

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V