@@ -16,8 +16,10 @@ const WAIT_FLAGS: wait::WaitPidFlag =
1616/// assuming nothing bigger than AVX-512 is available.
1717#[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
1818const ARCH_MAX_ACCESS_SIZE : usize = 64 ;
19+ /// The largest arm64 simd instruction operates on 16 bytes.
1920#[ cfg( any( target_arch = "arm" , target_arch = "aarch64" ) ) ]
2021const ARCH_MAX_ACCESS_SIZE : usize = 16 ;
22+ /// The max riscv vector instruction can access 8 consecutive 32-bit values.
2123#[ cfg( any( target_arch = "riscv32" , target_arch = "riscv64" ) ) ]
2224const ARCH_MAX_ACCESS_SIZE : usize = 32 ;
2325
@@ -56,35 +58,47 @@ trait ArchIndependentRegs {
5658#[ expect( clippy:: as_conversions) ]
5759#[ rustfmt:: skip]
5860impl ArchIndependentRegs for libc:: user_regs_struct {
61+ #[ inline]
5962 fn ip ( & self ) -> usize { self . rip as _ }
63+ #[ inline]
6064 fn set_ip ( & mut self , ip : usize ) { self . rip = ip as _ }
65+ #[ inline]
6166 fn set_sp ( & mut self , sp : usize ) { self . rsp = sp as _ }
6267}
6368
6469#[ cfg( target_arch = "x86" ) ]
6570#[ expect( clippy:: as_conversions) ]
6671#[ rustfmt:: skip]
6772impl ArchIndependentRegs for libc:: user_regs_struct {
73+ #[ inline]
6874 fn ip ( & self ) -> usize { self . eip as _ }
75+ #[ inline]
6976 fn set_ip ( & mut self , ip : usize ) { self . eip = ip as _ }
77+ #[ inline]
7078 fn set_sp ( & mut self , sp : usize ) { self . esp = sp as _ }
7179}
7280
7381#[ cfg( target_arch = "aarch64" ) ]
7482#[ expect( clippy:: as_conversions) ]
7583#[ rustfmt:: skip]
7684impl ArchIndependentRegs for libc:: user_regs_struct {
85+ #[ inline]
7786 fn ip ( & self ) -> usize { self . pc as _ }
87+ #[ inline]
7888 fn set_ip ( & mut self , ip : usize ) { self . pc = ip as _ }
89+ #[ inline]
7990 fn set_sp ( & mut self , sp : usize ) { self . sp = sp as _ }
8091}
8192
8293#[ cfg( any( target_arch = "riscv32" , target_arch = "riscv64" ) ) ]
8394#[ expect( clippy:: as_conversions) ]
8495#[ rustfmt:: skip]
8596impl ArchIndependentRegs for libc:: user_regs_struct {
97+ #[ inline]
8698 fn ip ( & self ) -> usize { self . pc as _ }
99+ #[ inline]
87100 fn set_ip ( & mut self , ip : usize ) { self . pc = ip as _ }
101+ #[ inline]
88102 fn set_sp ( & mut self , sp : usize ) { self . sp = sp as _ }
89103}
90104
@@ -650,8 +664,8 @@ fn handle_segfault(
650664 } ) ;
651665
652666 // Now figure out the size + type of access and log it down
653- // For now this will mark down e.g. the same area being read multiple
654- // times, but that 's still correct even if a bit inefficient
667+ // This will mark down e.g. the same area being read multiple times,
668+ // since it 's more efficient to compress the accesses at the end
655669 if capstone_disassemble ( & instr, addr, page_size, cs, acc_events) . is_err ( ) {
656670 // Read goes first because we need to be pessimistic
657671 acc_events. push ( AccessEvent :: Read ( addr..addr. strict_add ( ARCH_MAX_ACCESS_SIZE ) ) ) ;
0 commit comments