@@ -97,6 +97,12 @@ impl Processor {
97
97
format ! ( "{}" , c_str. to_string_lossy( ) )
98
98
}
99
99
100
+ pub fn disassemble_with_pc ( & self , pc : u64 ) -> String {
101
+ let bytes = unsafe { proc_disassemble_with_pc ( self . processor , pc) } ;
102
+ let c_str = unsafe { CStr :: from_ptr ( bytes as * mut c_char ) } ;
103
+ format ! ( "{}" , c_str. to_string_lossy( ) )
104
+ }
105
+
100
106
pub fn reset ( & self ) {
101
107
unsafe { proc_reset ( self . processor ) }
102
108
}
@@ -114,6 +120,10 @@ impl Processor {
114
120
unsafe { proc_get_insn ( self . processor ) as u32 }
115
121
}
116
122
123
+ pub fn get_insn_with_pc ( & self , pc : u64 ) -> u32 {
124
+ unsafe { proc_get_insn_with_pc ( self . processor , pc) as u32 }
125
+ }
126
+
117
127
pub fn get_vreg_data ( & self , idx : u32 , offset : u32 ) -> u8 {
118
128
unsafe { proc_get_vreg_data ( self . processor , idx, offset) }
119
129
}
@@ -122,14 +132,26 @@ impl Processor {
122
132
unsafe { proc_get_rs1 ( self . processor ) }
123
133
}
124
134
135
+ pub fn get_rs1_with_pc ( & self , pc : u64 ) -> u32 {
136
+ unsafe { proc_get_rs1_with_pc ( self . processor , pc) }
137
+ }
138
+
125
139
pub fn get_rs2 ( & self ) -> u32 {
126
140
unsafe { proc_get_rs2 ( self . processor ) }
127
141
}
128
142
143
+ pub fn get_rs2_with_pc ( & self , pc : u64 ) -> u32 {
144
+ unsafe { proc_get_rs2_with_pc ( self . processor , pc) }
145
+ }
146
+
129
147
pub fn get_rd ( & self ) -> u32 {
130
148
unsafe { proc_get_rd ( self . processor ) }
131
149
}
132
150
151
+ pub fn get_rd_with_pc ( & self , pc : u64 ) -> u32 {
152
+ unsafe { proc_get_rd_with_pc ( self . processor , pc) }
153
+ }
154
+
133
155
// vu
134
156
pub fn vu_get_vtype ( & self ) -> u32 {
135
157
unsafe { proc_vu_get_vtype ( self . processor ) as u32 }
@@ -249,14 +271,19 @@ extern "C" {
249
271
fn spike_get_proc ( spike : * mut ( ) ) -> * mut ( ) ;
250
272
fn spike_destruct ( spike : * mut ( ) ) ;
251
273
fn proc_disassemble ( proc : * mut ( ) ) -> * mut c_char ;
274
+ fn proc_disassemble_with_pc ( proc : * mut ( ) , pc : u64 ) -> * mut c_char ;
252
275
fn proc_reset ( proc : * mut ( ) ) ;
253
276
fn proc_get_state ( proc : * mut ( ) ) -> * mut ( ) ;
254
277
fn proc_func ( proc : * mut ( ) ) -> u64 ;
255
278
fn proc_get_insn ( proc : * mut ( ) ) -> u64 ;
279
+ fn proc_get_insn_with_pc ( proc : * mut ( ) , pc : u64 ) -> u64 ;
256
280
fn proc_get_vreg_data ( proc : * mut ( ) , vreg_idx : u32 , vreg_offset : u32 ) -> u8 ;
257
281
fn proc_get_rs1 ( proc : * mut ( ) ) -> u32 ;
282
+ fn proc_get_rs1_with_pc ( proc : * mut ( ) , pc : u64 ) -> u32 ;
258
283
fn proc_get_rs2 ( proc : * mut ( ) ) -> u32 ;
284
+ fn proc_get_rs2_with_pc ( proc : * mut ( ) , pc : u64 ) -> u32 ;
259
285
fn proc_get_rd ( proc : * mut ( ) ) -> u32 ;
286
+ fn proc_get_rd_with_pc ( proc : * mut ( ) , pc : u64 ) -> u32 ;
260
287
261
288
fn proc_vu_get_vtype ( proc : * mut ( ) ) -> u64 ;
262
289
fn proc_vu_get_vxrm ( proc : * mut ( ) ) -> u32 ;
0 commit comments