pub struct CoreCallingConvention { /* private fields */ }Implementations§
Source§impl CoreCallingConvention
impl CoreCallingConvention
pub fn name(&self) -> String
pub fn arch(&self) -> CoreArchitecture
pub fn default_incoming_variable_for_parameter_variable( &self, var: &Variable, ) -> Variable
pub fn default_parameter_variable_for_incoming_variable( &self, var: &Variable, ) -> Variable
pub fn default_is_return_type_register_compatible(&self, ty: &Type) -> bool
pub fn default_indirect_return_value_location(&self) -> Variable
pub fn default_is_argument_type_register_compatible(&self, ty: &Type) -> bool
pub fn default_call_layout( &self, view: Option<&BinaryView>, return_value: &ReturnValue, params: &[FunctionParameter], permitted_registers: Option<&[RegisterId]>, ) -> CallLayout
pub fn default_return_value_location( &self, view: Option<&BinaryView>, return_value: &ReturnValue, ) -> ValueLocation
pub fn default_parameter_locations( &self, view: Option<&BinaryView>, return_value: Option<&ValueLocation>, params: &[FunctionParameter], permitted_registers: Option<&[RegisterId]>, ) -> Vec<ValueLocation>
pub fn default_parameter_ordering_for_variables( &self, params: &[(Variable, Ref<Type>)], ) -> Vec<Variable>
pub fn default_stack_adjustment_for_locations( &self, return_value: Option<&ValueLocation>, params: &[(ValueLocation, Ref<Type>)], ) -> i64
pub fn default_register_stack_adjustments( &self, return_value: Option<&ValueLocation>, params: &[ValueLocation], ) -> BTreeMap<RegisterId, i32>
Trait Implementations§
Source§impl AsRef<CoreCallingConvention> for CoreCallingConvention
impl AsRef<CoreCallingConvention> for CoreCallingConvention
Source§fn as_ref(&self) -> &CoreCallingConvention
fn as_ref(&self) -> &CoreCallingConvention
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl CallingConvention for CoreCallingConvention
impl CallingConvention for CoreCallingConvention
Source§fn global_pointer_reg(&self) -> Option<RegisterId>
fn global_pointer_reg(&self) -> Option<RegisterId>
Deprecated. Use CallingConvention::global_pointer_regs instead.
Source§fn caller_saved_registers(&self) -> Vec<RegisterId>
fn caller_saved_registers(&self) -> Vec<RegisterId>
Gets the list of registers that are not preserved across a call
(caller-saved / volatile registers).
Source§fn callee_saved_registers(&self) -> Vec<RegisterId>
fn callee_saved_registers(&self) -> Vec<RegisterId>
Gets the list of registers that a callee must preserve across a call
(callee-saved / non-volatile registers).
Source§fn int_arg_registers(&self) -> Vec<RegisterId>
fn int_arg_registers(&self) -> Vec<RegisterId>
Gets the registers used to pass integer and pointer arguments, in the order they are used.
Source§fn float_arg_registers(&self) -> Vec<RegisterId>
fn float_arg_registers(&self) -> Vec<RegisterId>
Gets the registers used to pass floating point arguments, in the order they are used.
Source§fn required_argument_registers(&self) -> Vec<RegisterId>
fn required_argument_registers(&self) -> Vec<RegisterId>
Gets the set of registers that must be arguments for heuristic calling convention
detection to consider this calling convention as a valid option.
Source§fn required_clobbered_registers(&self) -> Vec<RegisterId>
fn required_clobbered_registers(&self) -> Vec<RegisterId>
Gets the set of registers that must be clobbered for heuristic calling convention
detection to consider this calling convention as a valid option.
Whether the integer and floating point argument registers share a single argument index. Read more
Source§fn reserved_stack_space_for_arg_registers(&self) -> bool
fn reserved_stack_space_for_arg_registers(&self) -> bool
Whether stack space is reserved by the caller for the register arguments (for example,
the shadow/home space used by the Windows x64 calling convention).
Source§fn stack_adjusted_on_return(&self) -> bool
fn stack_adjusted_on_return(&self) -> bool
Whether the callee adjusts the stack to remove the arguments before returning (as in
stdcall), rather than leaving the caller to clean up the stack (as in cdecl).
Source§fn is_eligible_for_heuristics(&self) -> bool
fn is_eligible_for_heuristics(&self) -> bool
Whether this calling convention may be selected by heuristic calling convention detection.
Source§fn return_int_reg(&self) -> Option<RegisterId>
fn return_int_reg(&self) -> Option<RegisterId>
Gets the register that holds the integer return value.
Source§fn return_hi_int_reg(&self) -> Option<RegisterId>
fn return_hi_int_reg(&self) -> Option<RegisterId>
Gets the register that holds the high part of an integer return value that is too large
to fit in a single register.
Source§fn return_float_reg(&self) -> Option<RegisterId>
fn return_float_reg(&self) -> Option<RegisterId>
Gets the register that holds the floating point return value.
fn global_pointer_regs(&self) -> Vec<RegisterId>
Source§fn implicitly_defined_registers(&self) -> Vec<RegisterId>
fn implicitly_defined_registers(&self) -> Vec<RegisterId>
Gets the registers that are implicitly given a known value on function entry by this
calling convention.
Source§fn are_argument_registers_used_for_var_args(&self) -> bool
fn are_argument_registers_used_for_var_args(&self) -> bool
Whether argument registers are used to pass variadic arguments.
Source§fn incoming_register_value(
&self,
reg: RegisterId,
func: Option<&Function>,
) -> RegisterValue
fn incoming_register_value( &self, reg: RegisterId, func: Option<&Function>, ) -> RegisterValue
The known value of a register on entry to a function. The default implementation models the
top of a register stack (such as the x87 floating point stack) as the constant zero and
leaves all other registers undetermined.
Source§fn incoming_flag_value(
&self,
flag: FlagId,
func: Option<&Function>,
) -> RegisterValue
fn incoming_flag_value( &self, flag: FlagId, func: Option<&Function>, ) -> RegisterValue
The known value of a flag on entry to a function. The default implementation leaves all
flags undetermined.
Source§fn incoming_variable_for_parameter_variable(
&self,
var: &Variable,
func: Option<&Function>,
) -> Variable
fn incoming_variable_for_parameter_variable( &self, var: &Variable, func: Option<&Function>, ) -> Variable
The incoming variable used to pass the given parameter variable.
Source§fn parameter_variable_for_incoming_variable(
&self,
var: &Variable,
func: Option<&Function>,
) -> Variable
fn parameter_variable_for_incoming_variable( &self, var: &Variable, func: Option<&Function>, ) -> Variable
The parameter variable corresponding to the given incoming variable.
Source§fn is_return_type_register_compatible(
&self,
view: Option<&BinaryView>,
ty: &Type,
) -> bool
fn is_return_type_register_compatible( &self, view: Option<&BinaryView>, ty: &Type, ) -> bool
Whether a value of the given type can be returned in registers, as opposed to being
returned indirectly through memory. The default implementation allows register returns
for types that fit in a single register, have a size equal to two registers when
CallingConvention::return_hi_int_reg is a valid register, or are a floating point
type when CallingConvention::return_float_reg is a valid register.Source§fn indirect_return_value_location(&self) -> Variable
fn indirect_return_value_location(&self) -> Variable
The location used to pass the hidden pointer argument for return values that are returned
indirectly through memory. The default location is the first integer argument register,
or the first stack slot if there are no integer argument registers.
Source§fn returned_indirect_return_value_pointer(&self) -> Option<Variable>
fn returned_indirect_return_value_pointer(&self) -> Option<Variable>
The location in which the hidden indirect return value pointer is returned to the caller,
for calling conventions that return it.
Source§fn is_argument_type_register_compatible(
&self,
view: Option<&BinaryView>,
ty: &Type,
) -> bool
fn is_argument_type_register_compatible( &self, view: Option<&BinaryView>, ty: &Type, ) -> bool
Whether a value of the given type can be passed as an argument in registers. The default
implementation allows register arguments for types that fit in a single register, or are
a floating point type when
CallingConvention::float_arg_registers has valid registers.Source§fn is_non_register_argument_indirect(
&self,
view: Option<&BinaryView>,
ty: &Type,
) -> bool
fn is_non_register_argument_indirect( &self, view: Option<&BinaryView>, ty: &Type, ) -> bool
Whether an argument that cannot be passed in registers is passed indirectly by pointer, as
opposed to being passed directly on the stack.
Source§fn are_stack_arguments_naturally_aligned(&self) -> bool
fn are_stack_arguments_naturally_aligned(&self) -> bool
Whether arguments passed on the stack are aligned to their natural alignment. If false,
arguments are aligned to the address size.
Source§fn are_stack_arguments_pushed_left_to_right(&self) -> bool
fn are_stack_arguments_pushed_left_to_right(&self) -> bool
Whether arguments passed on the stack are pushed left-to-right, as opposed to the more
common right-to-left order.
Source§fn call_layout(
&self,
view: Option<&BinaryView>,
return_value: &ReturnValue,
params: &[FunctionParameter],
permitted_registers: Option<&[RegisterId]>,
) -> CallLayout
fn call_layout( &self, view: Option<&BinaryView>, return_value: &ReturnValue, params: &[FunctionParameter], permitted_registers: Option<&[RegisterId]>, ) -> CallLayout
Computes the complete call layout (parameter locations, return value location, and stack
adjustments) for a call with the given return value and parameters. The default
implementation uses
CallingConvention::return_value_location,
CallingConvention::parameter_locations, CallingConvention::stack_adjustment_for_locations,
and CallingConvention::stack_adjustment_for_locations to compute the layout. Read moreSource§fn return_value_location(
&self,
view: Option<&BinaryView>,
return_value: &ReturnValue,
) -> ValueLocation
fn return_value_location( &self, view: Option<&BinaryView>, return_value: &ReturnValue, ) -> ValueLocation
Computes the location of the return value for the given return value type. The default
implementation checks
CallingConvention::is_return_type_register_compatible and places
the return value in registers if it can, or uses an indirect return by pointer if not. If
an indirect return is required, then CallingConvention::indirect_return_value_location
and CallingConvention::returned_indirect_return_value_pointer are used to provide the
location of the indirect return value.Source§fn parameter_locations(
&self,
view: Option<&BinaryView>,
return_value: Option<&ValueLocation>,
params: &[FunctionParameter],
permitted_registers: Option<&[RegisterId]>,
) -> Vec<ValueLocation>
fn parameter_locations( &self, view: Option<&BinaryView>, return_value: Option<&ValueLocation>, params: &[FunctionParameter], permitted_registers: Option<&[RegisterId]>, ) -> Vec<ValueLocation>
Computes the locations of the parameters for a call with the given return value and
parameters. The default implementation uses
CallingConvention::int_arg_registers,
CallingConvention::float_arg_registers, CallingConvention::arg_registers_shared_index,
CallingConvention::reserved_stack_space_for_arg_registers,
CallingConvention::is_argument_type_register_compatible,
CallingConvention::is_non_register_argument_indirect,
CallingConvention::are_stack_arguments_naturally_aligned, and
CallingConvention::are_stack_arguments_pushed_left_to_right to compute the parameter
layout. Read moreSource§fn parameter_ordering_for_variables(
&self,
view: Option<&BinaryView>,
params: &[(Variable, Ref<Type>)],
) -> Vec<Variable>
fn parameter_ordering_for_variables( &self, view: Option<&BinaryView>, params: &[(Variable, Ref<Type>)], ) -> Vec<Variable>
Computes the order in which the given parameter variables are passed. The default
implementation first checks
CallingConvention::arg_registers_shared_index to see if the
parameter ordering is well defined. If the arguments do not share an index, it places all
integer arguments before the floating point arguments. Arguments that are not passed in a
normal location are placed last.Source§fn stack_adjustment_for_locations(
&self,
view: Option<&BinaryView>,
return_value: Option<&ValueLocation>,
params: &[(ValueLocation, Ref<Type>)],
) -> i64
fn stack_adjustment_for_locations( &self, view: Option<&BinaryView>, return_value: Option<&ValueLocation>, params: &[(ValueLocation, Ref<Type>)], ) -> i64
Computes the stack adjustment applied on return for a call with the given return value and
parameter locations. The default implementation first checks
CallingConvention::stack_adjusted_on_return, and returns zero if that returns false.
Otherwise, it checks the stack parameter locations and
CallingConvention::are_stack_arguments_naturally_aligned to compute the stack
adjustment necessary to cover all parameters.Source§fn register_stack_adjustments(
&self,
view: Option<&BinaryView>,
return_value: Option<&ValueLocation>,
params: &[ValueLocation],
) -> BTreeMap<RegisterId, i32>
fn register_stack_adjustments( &self, view: Option<&BinaryView>, return_value: Option<&ValueLocation>, params: &[ValueLocation], ) -> BTreeMap<RegisterId, i32>
Computes the per-register-stack adjustments (for architectures with register stacks, such
as the x87 floating point stack) for a call with the given return value and parameter
locations. The default implementation compares the register stack slots used by the
parameters and the return value to compute the adjustments.
Source§impl CoreArrayProvider for CoreCallingConvention
impl CoreArrayProvider for CoreCallingConvention
type Raw = *mut BNCallingConvention
type Context = CoreArchitecture
type Wrapped<'a> = Guard<'a, CoreCallingConvention>
Source§impl Debug for CoreCallingConvention
impl Debug for CoreCallingConvention
Source§impl Hash for CoreCallingConvention
impl Hash for CoreCallingConvention
Source§impl PartialEq for CoreCallingConvention
impl PartialEq for CoreCallingConvention
Source§impl ToOwned for CoreCallingConvention
impl ToOwned for CoreCallingConvention
Source§type Owned = Ref<CoreCallingConvention>
type Owned = Ref<CoreCallingConvention>
The resulting type after obtaining ownership.
Source§fn to_owned(&self) -> Self::Owned
fn to_owned(&self) -> Self::Owned
Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · Source§fn clone_into(&self, target: &mut Self::Owned)
fn clone_into(&self, target: &mut Self::Owned)
Uses borrowed data to replace owned data, usually by cloning. Read more
impl Eq for CoreCallingConvention
impl Send for CoreCallingConvention
impl Sync for CoreCallingConvention
Auto Trait Implementations§
impl Freeze for CoreCallingConvention
impl RefUnwindSafe for CoreCallingConvention
impl Unpin for CoreCallingConvention
impl UnwindSafe for CoreCallingConvention
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more