pub trait HandlePacket {
type Error: Error;
Show 31 methods
// Required method
fn at_decode_begin(&mut self) -> Result<(), Self::Error>;
// Provided methods
fn on_short_tnt_packet(
&mut self,
context: &DecoderContext,
packet_byte: NonZero<u8>,
highest_bit: u32,
) -> Result<(), Self::Error> { ... }
fn on_long_tnt_packet(
&mut self,
context: &DecoderContext,
packet_bytes: NonZero<u64>,
highest_bit: u32,
) -> Result<(), Self::Error> { ... }
fn on_tip_packet(
&mut self,
context: &DecoderContext,
ip_reconstruction_pattern: IpReconstructionPattern,
) -> Result<(), Self::Error> { ... }
fn on_tip_pgd_packet(
&mut self,
context: &DecoderContext,
ip_reconstruction_pattern: IpReconstructionPattern,
) -> Result<(), Self::Error> { ... }
fn on_tip_pge_packet(
&mut self,
context: &DecoderContext,
ip_reconstruction_pattern: IpReconstructionPattern,
) -> Result<(), Self::Error> { ... }
fn on_fup_packet(
&mut self,
context: &DecoderContext,
ip_reconstruction_pattern: IpReconstructionPattern,
) -> Result<(), Self::Error> { ... }
fn on_pad_packet(
&mut self,
context: &DecoderContext,
) -> Result<(), Self::Error> { ... }
fn on_cyc_packet(
&mut self,
context: &DecoderContext,
cyc_packet: &[u8],
) -> Result<(), Self::Error> { ... }
fn on_mode_packet(
&mut self,
context: &DecoderContext,
leaf_id: u8,
mode: u8,
) -> Result<(), Self::Error> { ... }
fn on_mtc_packet(
&mut self,
context: &DecoderContext,
ctc_payload: u8,
) -> Result<(), Self::Error> { ... }
fn on_tsc_packet(
&mut self,
context: &DecoderContext,
tsc_value: u64,
) -> Result<(), Self::Error> { ... }
fn on_cbr_packet(
&mut self,
context: &DecoderContext,
core_bus_ratio: u8,
) -> Result<(), Self::Error> { ... }
fn on_tma_packet(
&mut self,
context: &DecoderContext,
ctc: u16,
fast_counter: u8,
fc8: bool,
) -> Result<(), Self::Error> { ... }
fn on_vmcs_packet(
&mut self,
context: &DecoderContext,
vmcs_pointer: u64,
) -> Result<(), Self::Error> { ... }
fn on_ovf_packet(
&mut self,
context: &DecoderContext,
) -> Result<(), Self::Error> { ... }
fn on_psb_packet(
&mut self,
context: &DecoderContext,
) -> Result<(), Self::Error> { ... }
fn on_psbend_packet(
&mut self,
context: &DecoderContext,
) -> Result<(), Self::Error> { ... }
fn on_trace_stop_packet(
&mut self,
context: &DecoderContext,
) -> Result<(), Self::Error> { ... }
fn on_pip_packet(
&mut self,
context: &DecoderContext,
cr3: u64,
rsvd_nr: bool,
) -> Result<(), Self::Error> { ... }
fn on_mnt_packet(
&mut self,
context: &DecoderContext,
payload: u64,
) -> Result<(), Self::Error> { ... }
fn on_ptw_packet(
&mut self,
context: &DecoderContext,
ip_bit: bool,
payload: PtwPayload,
) -> Result<(), Self::Error> { ... }
fn on_exstop_packet(
&mut self,
context: &DecoderContext,
ip_bit: bool,
) -> Result<(), Self::Error> { ... }
fn on_mwait_packet(
&mut self,
context: &DecoderContext,
mwait_hints: u8,
ext: u8,
) -> Result<(), Self::Error> { ... }
fn on_pwre_packet(
&mut self,
context: &DecoderContext,
hw: bool,
resolved_thread_c_state: u8,
resolved_thread_sub_c_state: u8,
) -> Result<(), Self::Error> { ... }
fn on_pwrx_packet(
&mut self,
context: &DecoderContext,
last_core_c_state: u8,
deepest_core_c_state: u8,
wake_reason: u8,
) -> Result<(), Self::Error> { ... }
fn on_evd_packet(
&mut self,
context: &DecoderContext,
type: u8,
payload: u64,
) -> Result<(), Self::Error> { ... }
fn on_cfe_packet(
&mut self,
context: &DecoderContext,
ip_bit: bool,
type: u8,
vector: u8,
) -> Result<(), Self::Error> { ... }
fn on_bbp_packet(
&mut self,
context: &DecoderContext,
sz_bit: bool,
type: u8,
) -> Result<(), Self::Error> { ... }
fn on_bep_packet(
&mut self,
context: &DecoderContext,
ip_bit: bool,
) -> Result<(), Self::Error> { ... }
fn on_bip_packet(
&mut self,
context: &DecoderContext,
id: u8,
payload: &[u8],
bbp_type: u8,
) -> Result<(), Self::Error> { ... }
}Expand description
Packet handler trait
The default implementations of all packet handlers are nops.
Required Associated Types§
Required Methods§
Sourcefn at_decode_begin(&mut self) -> Result<(), Self::Error>
fn at_decode_begin(&mut self) -> Result<(), Self::Error>
Callback at begin of decoding.
This is useful when using the same handler to process multiple Intel PT traces
Provided Methods§
Sourcefn on_short_tnt_packet(
&mut self,
context: &DecoderContext,
packet_byte: NonZero<u8>,
highest_bit: u32,
) -> Result<(), Self::Error>
fn on_short_tnt_packet( &mut self, context: &DecoderContext, packet_byte: NonZero<u8>, highest_bit: u32, ) -> Result<(), Self::Error>
Handle short TNT packet
packet_byte is the whole byte of short TNT packet. highest_bit
is the index of highest bit that represents a valid Taken/Not-taken bit,
guaranteed to be in range 0..=6
If highest_bit is 0, this means there is no Taken/Not-taken bits.
Sourcefn on_long_tnt_packet(
&mut self,
context: &DecoderContext,
packet_bytes: NonZero<u64>,
highest_bit: u32,
) -> Result<(), Self::Error>
fn on_long_tnt_packet( &mut self, context: &DecoderContext, packet_bytes: NonZero<u64>, highest_bit: u32, ) -> Result<(), Self::Error>
Handle short TNT packet
packet_bytes is the whole 6 bytes of long TNT packet payload. The
upper 2 bytes are guaranteed to be cleared.
highest_bit is the index of highest bit that represents a valid
Taken/Not-taken bit, guaranteed to be in range 0..=46 or u32::MAX
If highest_bit is u32::MAX, this means there is no Taken/Not-taken bits.
Sourcefn on_tip_packet(
&mut self,
context: &DecoderContext,
ip_reconstruction_pattern: IpReconstructionPattern,
) -> Result<(), Self::Error>
fn on_tip_packet( &mut self, context: &DecoderContext, ip_reconstruction_pattern: IpReconstructionPattern, ) -> Result<(), Self::Error>
Handle TIP packet
Sourcefn on_tip_pgd_packet(
&mut self,
context: &DecoderContext,
ip_reconstruction_pattern: IpReconstructionPattern,
) -> Result<(), Self::Error>
fn on_tip_pgd_packet( &mut self, context: &DecoderContext, ip_reconstruction_pattern: IpReconstructionPattern, ) -> Result<(), Self::Error>
Handle TIP.PGD packet
Sourcefn on_tip_pge_packet(
&mut self,
context: &DecoderContext,
ip_reconstruction_pattern: IpReconstructionPattern,
) -> Result<(), Self::Error>
fn on_tip_pge_packet( &mut self, context: &DecoderContext, ip_reconstruction_pattern: IpReconstructionPattern, ) -> Result<(), Self::Error>
Handle TIP.PGE packet
Sourcefn on_fup_packet(
&mut self,
context: &DecoderContext,
ip_reconstruction_pattern: IpReconstructionPattern,
) -> Result<(), Self::Error>
fn on_fup_packet( &mut self, context: &DecoderContext, ip_reconstruction_pattern: IpReconstructionPattern, ) -> Result<(), Self::Error>
Handle FUP packet
Sourcefn on_pad_packet(&mut self, context: &DecoderContext) -> Result<(), Self::Error>
fn on_pad_packet(&mut self, context: &DecoderContext) -> Result<(), Self::Error>
Handle PAD packet
Sourcefn on_cyc_packet(
&mut self,
context: &DecoderContext,
cyc_packet: &[u8],
) -> Result<(), Self::Error>
fn on_cyc_packet( &mut self, context: &DecoderContext, cyc_packet: &[u8], ) -> Result<(), Self::Error>
Handle CYC packet
cyc_packet is the total content of the CYC packet
Sourcefn on_mode_packet(
&mut self,
context: &DecoderContext,
leaf_id: u8,
mode: u8,
) -> Result<(), Self::Error>
fn on_mode_packet( &mut self, context: &DecoderContext, leaf_id: u8, mode: u8, ) -> Result<(), Self::Error>
Handle MODE packet
leaf_id and mode is the leaf ID and mode of MODE packet.
Sourcefn on_mtc_packet(
&mut self,
context: &DecoderContext,
ctc_payload: u8,
) -> Result<(), Self::Error>
fn on_mtc_packet( &mut self, context: &DecoderContext, ctc_payload: u8, ) -> Result<(), Self::Error>
Handle MTC packet
ctc_payload is the 8-bit CTC payload value
Sourcefn on_tsc_packet(
&mut self,
context: &DecoderContext,
tsc_value: u64,
) -> Result<(), Self::Error>
fn on_tsc_packet( &mut self, context: &DecoderContext, tsc_value: u64, ) -> Result<(), Self::Error>
Handle TSC packet
tsc_value is the lower 7 bytes of current TSC value
Sourcefn on_cbr_packet(
&mut self,
context: &DecoderContext,
core_bus_ratio: u8,
) -> Result<(), Self::Error>
fn on_cbr_packet( &mut self, context: &DecoderContext, core_bus_ratio: u8, ) -> Result<(), Self::Error>
Handle CBR packet
core_bus_ratio is Core:Bus Ratio
Sourcefn on_tma_packet(
&mut self,
context: &DecoderContext,
ctc: u16,
fast_counter: u8,
fc8: bool,
) -> Result<(), Self::Error>
fn on_tma_packet( &mut self, context: &DecoderContext, ctc: u16, fast_counter: u8, fc8: bool, ) -> Result<(), Self::Error>
Handle TMA packet
ctc is CTC[15:0], fast_counter is FastCounter[7:0], fc8 is FC[8]
Sourcefn on_vmcs_packet(
&mut self,
context: &DecoderContext,
vmcs_pointer: u64,
) -> Result<(), Self::Error>
fn on_vmcs_packet( &mut self, context: &DecoderContext, vmcs_pointer: u64, ) -> Result<(), Self::Error>
Handle VMCS packet
vmcs_pointer’s 12..=51 bits are VMCS pointer [51:12] (other bits guaranteed cleared)
Sourcefn on_ovf_packet(&mut self, context: &DecoderContext) -> Result<(), Self::Error>
fn on_ovf_packet(&mut self, context: &DecoderContext) -> Result<(), Self::Error>
Handle OVF packet
Sourcefn on_psb_packet(&mut self, context: &DecoderContext) -> Result<(), Self::Error>
fn on_psb_packet(&mut self, context: &DecoderContext) -> Result<(), Self::Error>
Handle PSB packet
Sourcefn on_psbend_packet(
&mut self,
context: &DecoderContext,
) -> Result<(), Self::Error>
fn on_psbend_packet( &mut self, context: &DecoderContext, ) -> Result<(), Self::Error>
Handle PSBEND packet
Sourcefn on_trace_stop_packet(
&mut self,
context: &DecoderContext,
) -> Result<(), Self::Error>
fn on_trace_stop_packet( &mut self, context: &DecoderContext, ) -> Result<(), Self::Error>
Handle TraceStop packet
Sourcefn on_pip_packet(
&mut self,
context: &DecoderContext,
cr3: u64,
rsvd_nr: bool,
) -> Result<(), Self::Error>
fn on_pip_packet( &mut self, context: &DecoderContext, cr3: u64, rsvd_nr: bool, ) -> Result<(), Self::Error>
Handle PIP packet
cr3’s 5..=51 bits are CR3[51:5] (other bits guaranteed cleared),
rsvd_nr is RSVD/NR
Sourcefn on_mnt_packet(
&mut self,
context: &DecoderContext,
payload: u64,
) -> Result<(), Self::Error>
fn on_mnt_packet( &mut self, context: &DecoderContext, payload: u64, ) -> Result<(), Self::Error>
Handle MNT packet
payload is Payload[63:0]
Sourcefn on_ptw_packet(
&mut self,
context: &DecoderContext,
ip_bit: bool,
payload: PtwPayload,
) -> Result<(), Self::Error>
fn on_ptw_packet( &mut self, context: &DecoderContext, ip_bit: bool, payload: PtwPayload, ) -> Result<(), Self::Error>
Handle PTW packet
ip_bit is the IP bit, payload is either 4 bytes or 8 bytes
Sourcefn on_exstop_packet(
&mut self,
context: &DecoderContext,
ip_bit: bool,
) -> Result<(), Self::Error>
fn on_exstop_packet( &mut self, context: &DecoderContext, ip_bit: bool, ) -> Result<(), Self::Error>
Handle EXSTOP packet
ip_bit is the IP bit
Sourcefn on_mwait_packet(
&mut self,
context: &DecoderContext,
mwait_hints: u8,
ext: u8,
) -> Result<(), Self::Error>
fn on_mwait_packet( &mut self, context: &DecoderContext, mwait_hints: u8, ext: u8, ) -> Result<(), Self::Error>
Handle MWAIT packet
mwait_hints is MWAIT Hints[7:0], ext is EXT[1:0] (upper 6 bits guaranteed cleared)
Sourcefn on_pwre_packet(
&mut self,
context: &DecoderContext,
hw: bool,
resolved_thread_c_state: u8,
resolved_thread_sub_c_state: u8,
) -> Result<(), Self::Error>
fn on_pwre_packet( &mut self, context: &DecoderContext, hw: bool, resolved_thread_c_state: u8, resolved_thread_sub_c_state: u8, ) -> Result<(), Self::Error>
Handle PWRE packet
hw is HW, resolved_thread_c_state is Resolved Thread C-State (upper 4 bits guaranteed cleared),
resolved_thread_sub_c_state is Resolved Thread Sub C-State (upper 4 bits guaranteed cleared)
Sourcefn on_pwrx_packet(
&mut self,
context: &DecoderContext,
last_core_c_state: u8,
deepest_core_c_state: u8,
wake_reason: u8,
) -> Result<(), Self::Error>
fn on_pwrx_packet( &mut self, context: &DecoderContext, last_core_c_state: u8, deepest_core_c_state: u8, wake_reason: u8, ) -> Result<(), Self::Error>
Handle PWRX packet
last_core_c_state is Last Core C-State (upper 4 bits guaranteed cleared),
deepest_core_c_state is Deepest Core C-State (upper 4 bits guaranteed cleared),
wake_reason is Wake Reason (upper 4 bits guaranteed cleared)
Sourcefn on_evd_packet(
&mut self,
context: &DecoderContext,
type: u8,
payload: u64,
) -> Result<(), Self::Error>
fn on_evd_packet( &mut self, context: &DecoderContext, type: u8, payload: u64, ) -> Result<(), Self::Error>
Handle EVD packet
r#type is Type[5:0] (upper 2 bits guaranteed cleared), payload is Payload[63:0]
Sourcefn on_cfe_packet(
&mut self,
context: &DecoderContext,
ip_bit: bool,
type: u8,
vector: u8,
) -> Result<(), Self::Error>
fn on_cfe_packet( &mut self, context: &DecoderContext, ip_bit: bool, type: u8, vector: u8, ) -> Result<(), Self::Error>
Handle CFE packet
ip_bit is the IP bit, r#type is Type[4:0] (upper 3 bits guaranteed cleared),
vector is the Vector[7:0]
Sourcefn on_bbp_packet(
&mut self,
context: &DecoderContext,
sz_bit: bool,
type: u8,
) -> Result<(), Self::Error>
fn on_bbp_packet( &mut self, context: &DecoderContext, sz_bit: bool, type: u8, ) -> Result<(), Self::Error>
Handle BBP packet
sz_bit is the SZ bit, r#type is Type[4:0] (upper 3 bits guaranteed cleared).
Sourcefn on_bep_packet(
&mut self,
context: &DecoderContext,
ip_bit: bool,
) -> Result<(), Self::Error>
fn on_bep_packet( &mut self, context: &DecoderContext, ip_bit: bool, ) -> Result<(), Self::Error>
Handle BEP packet
ip_bit is the IP bit.
Sourcefn on_bip_packet(
&mut self,
context: &DecoderContext,
id: u8,
payload: &[u8],
bbp_type: u8,
) -> Result<(), Self::Error>
fn on_bip_packet( &mut self, context: &DecoderContext, id: u8, payload: &[u8], bbp_type: u8, ) -> Result<(), Self::Error>
Handle BIP packet
id is ID[5:0], payload’s size is 4 or 8 according to
the SZ bit in BBP packet. bbp_type is the type field
of the preceding BBP packet.
Implementors§
Source§impl HandlePacket for PacketHandlerRawLogger
Available on crate feature log_handler only.
impl HandlePacket for PacketHandlerRawLogger
log_handler only.