@@ -16,8 +16,10 @@ const WAIT_FLAGS: wait::WaitPidFlag =
16
16
/// assuming nothing bigger than AVX-512 is available.
17
17
#[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
18
18
const ARCH_MAX_ACCESS_SIZE : usize = 64 ;
19
+ /// The largest arm64 simd instruction operates on 16 bytes.
19
20
#[ cfg( any( target_arch = "arm" , target_arch = "aarch64" ) ) ]
20
21
const ARCH_MAX_ACCESS_SIZE : usize = 16 ;
22
+ /// The max riscv vector instruction can access 8 consecutive 32-bit values.
21
23
#[ cfg( any( target_arch = "riscv32" , target_arch = "riscv64" ) ) ]
22
24
const ARCH_MAX_ACCESS_SIZE : usize = 32 ;
23
25
@@ -56,35 +58,47 @@ trait ArchIndependentRegs {
56
58
#[ expect( clippy:: as_conversions) ]
57
59
#[ rustfmt:: skip]
58
60
impl ArchIndependentRegs for libc:: user_regs_struct {
61
+ #[ inline]
59
62
fn ip ( & self ) -> usize { self . rip as _ }
63
+ #[ inline]
60
64
fn set_ip ( & mut self , ip : usize ) { self . rip = ip as _ }
65
+ #[ inline]
61
66
fn set_sp ( & mut self , sp : usize ) { self . rsp = sp as _ }
62
67
}
63
68
64
69
#[ cfg( target_arch = "x86" ) ]
65
70
#[ expect( clippy:: as_conversions) ]
66
71
#[ rustfmt:: skip]
67
72
impl ArchIndependentRegs for libc:: user_regs_struct {
73
+ #[ inline]
68
74
fn ip ( & self ) -> usize { self . eip as _ }
75
+ #[ inline]
69
76
fn set_ip ( & mut self , ip : usize ) { self . eip = ip as _ }
77
+ #[ inline]
70
78
fn set_sp ( & mut self , sp : usize ) { self . esp = sp as _ }
71
79
}
72
80
73
81
#[ cfg( target_arch = "aarch64" ) ]
74
82
#[ expect( clippy:: as_conversions) ]
75
83
#[ rustfmt:: skip]
76
84
impl ArchIndependentRegs for libc:: user_regs_struct {
85
+ #[ inline]
77
86
fn ip ( & self ) -> usize { self . pc as _ }
87
+ #[ inline]
78
88
fn set_ip ( & mut self , ip : usize ) { self . pc = ip as _ }
89
+ #[ inline]
79
90
fn set_sp ( & mut self , sp : usize ) { self . sp = sp as _ }
80
91
}
81
92
82
93
#[ cfg( any( target_arch = "riscv32" , target_arch = "riscv64" ) ) ]
83
94
#[ expect( clippy:: as_conversions) ]
84
95
#[ rustfmt:: skip]
85
96
impl ArchIndependentRegs for libc:: user_regs_struct {
97
+ #[ inline]
86
98
fn ip ( & self ) -> usize { self . pc as _ }
99
+ #[ inline]
87
100
fn set_ip ( & mut self , ip : usize ) { self . pc = ip as _ }
101
+ #[ inline]
88
102
fn set_sp ( & mut self , sp : usize ) { self . sp = sp as _ }
89
103
}
90
104
@@ -650,8 +664,8 @@ fn handle_segfault(
650
664
} ) ;
651
665
652
666
// 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
655
669
if capstone_disassemble ( & instr, addr, page_size, cs, acc_events) . is_err ( ) {
656
670
// Read goes first because we need to be pessimistic
657
671
acc_events. push ( AccessEvent :: Read ( addr..addr. strict_add ( ARCH_MAX_ACCESS_SIZE ) ) ) ;
0 commit comments