Skip to content

Commit 2cfffc3

Browse files
committed
Add instruction/block decoder resync
behind fature libipt_master until next release of libipt
1 parent fdfb47e commit 2cfffc3

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/block/decoder.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ use crate::image::Image;
66
use crate::status::Status;
77

88
use crate::enc_dec_builder::{EncoderDecoderBuilder, PtEncoderDecoder};
9+
#[cfg(feature = "libipt_master")]
10+
use libipt_sys::pt_blk_resync;
911
use libipt_sys::{
1012
pt_asid, pt_blk_alloc_decoder, pt_blk_asid, pt_blk_core_bus_ratio, pt_blk_event,
1113
pt_blk_free_decoder, pt_blk_get_config, pt_blk_get_image, pt_blk_get_offset,
@@ -152,6 +154,11 @@ impl BlockDecoder<'_> {
152154
Ok((Block(unsafe { blk.assume_init() }), status))
153155
}
154156

157+
#[cfg(feature = "libipt_master")]
158+
pub fn resync(&mut self) -> Result<Status, PtError> {
159+
extract_status_or_pterr(unsafe { pt_blk_resync(self.inner.as_ptr()) })
160+
}
161+
155162
pub fn sync_backward(&mut self) -> Result<Status, PtError> {
156163
extract_status_or_pterr(unsafe { pt_blk_sync_backward(self.inner.as_ptr()) })
157164
}

src/insn/decoder.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ use crate::event::Event;
77
use crate::image::Image;
88
use crate::status::Status;
99

10+
#[cfg(feature = "libipt_master")]
11+
use libipt_sys::pt_insn_resync;
1012
use libipt_sys::{
1113
pt_asid, pt_event, pt_insn, pt_insn_alloc_decoder, pt_insn_asid, pt_insn_core_bus_ratio,
1214
pt_insn_decoder, pt_insn_event, pt_insn_free_decoder, pt_insn_get_config, pt_insn_get_image,
@@ -168,6 +170,11 @@ impl<'a> InsnDecoder<'a> {
168170
Ok(())
169171
}
170172

173+
#[cfg(feature = "libipt_master")]
174+
pub fn resync(&mut self) -> Result<Status, PtError> {
175+
extract_status_or_pterr(unsafe { pt_insn_resync(self.inner.as_ptr()) })
176+
}
177+
171178
pub fn sync_backward(&mut self) -> Result<Status, PtError> {
172179
extract_status_or_pterr(unsafe { pt_insn_sync_backward(self.inner.as_ptr()) })
173180
}

0 commit comments

Comments
 (0)