Remove get
prefix from frida functions (#93)
* more docs * more docs: * more docu * more docu * finished docs * cleaned up markup * must_use tags added * more docs * cleanup get
This commit is contained in:
parent
8bb061fa22
commit
7f06e36e2e
@ -612,7 +612,7 @@ pub extern "C" fn asan_mallinfo() -> *mut c_void {
|
|||||||
|
|
||||||
/// Get the current thread's TLS address
|
/// Get the current thread's TLS address
|
||||||
extern "C" {
|
extern "C" {
|
||||||
fn get_tls_ptr() -> *const c_void;
|
fn tls_ptr() -> *const c_void;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The frida address sanitizer runtime, providing address sanitization.
|
/// The frida address sanitizer runtime, providing address sanitization.
|
||||||
@ -892,7 +892,7 @@ impl AsanRuntime {
|
|||||||
|
|
||||||
/// Determine the tls start, end for the currently running thread
|
/// Determine the tls start, end for the currently running thread
|
||||||
fn current_tls() -> (usize, usize) {
|
fn current_tls() -> (usize, usize) {
|
||||||
let tls_address = unsafe { get_tls_ptr() } as usize;
|
let tls_address = unsafe { tls_ptr() } as usize;
|
||||||
// we need to mask off the highest byte, due to 'High Byte Ignore"
|
// we need to mask off the highest byte, due to 'High Byte Ignore"
|
||||||
#[cfg(target_os = "android")]
|
#[cfg(target_os = "android")]
|
||||||
let tls_address = tls_address & 0xffffffffffffff;
|
let tls_address = tls_address & 0xffffffffffffff;
|
||||||
|
@ -4,6 +4,6 @@ __declspec( thread ) int i = 0;
|
|||||||
__thread int i = 0;
|
__thread int i = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void * get_tls_ptr() {
|
void * tls_ptr() {
|
||||||
return (void*)&i;
|
return (void*)&i;
|
||||||
}
|
}
|
||||||
|
@ -193,12 +193,12 @@ const MAYBE_LOG_CODE: [u8; 60] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
#[cfg(target_arch = "aarch64")]
|
#[cfg(target_arch = "aarch64")]
|
||||||
fn get_pc(context: &CpuContext) -> usize {
|
fn pc(context: &CpuContext) -> usize {
|
||||||
context.pc() as usize
|
context.pc() as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
fn get_pc(context: &CpuContext) -> usize {
|
fn pc(context: &CpuContext) -> usize {
|
||||||
context.rip() as usize
|
context.rip() as usize
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,10 +284,10 @@ impl<'a> FridaInstrumentationHelper<'a> {
|
|||||||
let real_address = match helper
|
let real_address = match helper
|
||||||
.asan_runtime
|
.asan_runtime
|
||||||
.borrow()
|
.borrow()
|
||||||
.real_address_for_stalked(get_pc(&context))
|
.real_address_for_stalked(pc(&context))
|
||||||
{
|
{
|
||||||
Some(address) => *address,
|
Some(address) => *address,
|
||||||
None => get_pc(&context),
|
None => pc(&context),
|
||||||
};
|
};
|
||||||
//let (range, (id, name)) = helper.ranges.get_key_value(&real_address).unwrap();
|
//let (range, (id, name)) = helper.ranges.get_key_value(&real_address).unwrap();
|
||||||
//println!("{}:0x{:016x}", name, real_address - range.start);
|
//println!("{}:0x{:016x}", name, real_address - range.start);
|
||||||
@ -341,7 +341,7 @@ impl<'a> FridaInstrumentationHelper<'a> {
|
|||||||
}
|
}
|
||||||
#[cfg(target_arch = "aarch64")]
|
#[cfg(target_arch = "aarch64")]
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_writer_register(&self, reg: capstone::RegId) -> Aarch64Register {
|
fn writer_register(&self, reg: capstone::RegId) -> Aarch64Register {
|
||||||
let regint: u16 = reg.0;
|
let regint: u16 = reg.0;
|
||||||
Aarch64Register::from_u32(regint as u32).unwrap()
|
Aarch64Register::from_u32(regint as u32).unwrap()
|
||||||
}
|
}
|
||||||
@ -361,9 +361,9 @@ impl<'a> FridaInstrumentationHelper<'a> {
|
|||||||
) {
|
) {
|
||||||
let writer = output.writer();
|
let writer = output.writer();
|
||||||
|
|
||||||
let basereg = self.get_writer_register(basereg);
|
let basereg = self.writer_register(basereg);
|
||||||
let indexreg = if indexreg.0 != 0 {
|
let indexreg = if indexreg.0 != 0 {
|
||||||
Some(self.get_writer_register(indexreg))
|
Some(self.writer_register(indexreg))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
@ -556,7 +556,7 @@ impl<'a> FridaInstrumentationHelper<'a> {
|
|||||||
|
|
||||||
#[cfg(target_arch = "aarch64")]
|
#[cfg(target_arch = "aarch64")]
|
||||||
#[inline]
|
#[inline]
|
||||||
fn get_instruction_width(&self, instr: &Insn, operands: &Vec<arch::ArchOperand>) -> u32 {
|
fn instruction_width(&self, instr: &Insn, operands: &Vec<arch::ArchOperand>) -> u32 {
|
||||||
use capstone::arch::arm64::Arm64Insn as I;
|
use capstone::arch::arm64::Arm64Insn as I;
|
||||||
use capstone::arch::arm64::Arm64Reg as R;
|
use capstone::arch::arm64::Arm64Reg as R;
|
||||||
use capstone::arch::arm64::Arm64Vas as V;
|
use capstone::arch::arm64::Arm64Vas as V;
|
||||||
@ -662,7 +662,7 @@ impl<'a> FridaInstrumentationHelper<'a> {
|
|||||||
opmem.base(),
|
opmem.base(),
|
||||||
opmem.index(),
|
opmem.index(),
|
||||||
opmem.disp(),
|
opmem.disp(),
|
||||||
self.get_instruction_width(instr, &operands),
|
self.instruction_width(instr, &operands),
|
||||||
arm64operand.shift,
|
arm64operand.shift,
|
||||||
arm64operand.ext,
|
arm64operand.ext,
|
||||||
));
|
));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user