diff options
| author | Rusty Wagner <rusty.wagner@gmail.com> | 2024-04-26 18:22:11 -0400 |
|---|---|---|
| committer | Rusty Wagner <rusty.wagner@gmail.com> | 2024-04-30 13:12:21 -0400 |
| commit | e88d386127b751d17b9005b2e374150473f42729 (patch) | |
| tree | 2e067cf9867380fcfc179a2f9f45ae3fcea6dbc8 /rust/src | |
| parent | 62ce7de2bc288bb2716177b3fa86470f1e19d383 (diff) | |
Fill out int_arg_registers and float_arg_registers in the Rust API
Diffstat (limited to 'rust/src')
| -rw-r--r-- | rust/src/callingconvention.rs | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/rust/src/callingconvention.rs b/rust/src/callingconvention.rs index 815f4d42..57f76a11 100644 --- a/rust/src/callingconvention.rs +++ b/rust/src/callingconvention.rs @@ -569,11 +569,43 @@ impl<A: Architecture> CallingConventionBase for CallingConvention<A> { } fn int_arg_registers(&self) -> Vec<A::Register> { - Vec::new() + unsafe { + let mut count = 0; + let regs = BNGetIntegerArgumentRegisters(self.handle, &mut count); + let arch = self.arch_handle.borrow(); + + let res = slice::from_raw_parts(regs, count) + .iter() + .map(|&r| { + arch.register_from_id(r) + .expect("bad reg id from CallingConvention") + }) + .collect(); + + BNFreeRegisterList(regs); + + res + } } fn float_arg_registers(&self) -> Vec<A::Register> { - Vec::new() + unsafe { + let mut count = 0; + let regs = BNGetFloatArgumentRegisters(self.handle, &mut count); + let arch = self.arch_handle.borrow(); + + let res = slice::from_raw_parts(regs, count) + .iter() + .map(|&r| { + arch.register_from_id(r) + .expect("bad reg id from CallingConvention") + }) + .collect(); + + BNFreeRegisterList(regs); + + res + } } fn arg_registers_shared_index(&self) -> bool { |
