Skip to main content

HandlePacket

Trait HandlePacket 

Source
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§

Source

type Error: Error

Custom error type

Required Methods§

Source

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§

Source

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.

Source

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.

Source

fn on_tip_packet( &mut self, context: &DecoderContext, ip_reconstruction_pattern: IpReconstructionPattern, ) -> Result<(), Self::Error>

Handle TIP packet

Source

fn on_tip_pgd_packet( &mut self, context: &DecoderContext, ip_reconstruction_pattern: IpReconstructionPattern, ) -> Result<(), Self::Error>

Handle TIP.PGD packet

Source

fn on_tip_pge_packet( &mut self, context: &DecoderContext, ip_reconstruction_pattern: IpReconstructionPattern, ) -> Result<(), Self::Error>

Handle TIP.PGE packet

Source

fn on_fup_packet( &mut self, context: &DecoderContext, ip_reconstruction_pattern: IpReconstructionPattern, ) -> Result<(), Self::Error>

Handle FUP packet

Source

fn on_pad_packet(&mut self, context: &DecoderContext) -> Result<(), Self::Error>

Handle PAD packet

Source

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

Source

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.

Source

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

Source

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

Source

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

Source

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]

Source

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)

Source

fn on_ovf_packet(&mut self, context: &DecoderContext) -> Result<(), Self::Error>

Handle OVF packet

Source

fn on_psb_packet(&mut self, context: &DecoderContext) -> Result<(), Self::Error>

Handle PSB packet

Source

fn on_psbend_packet( &mut self, context: &DecoderContext, ) -> Result<(), Self::Error>

Handle PSBEND packet

Source

fn on_trace_stop_packet( &mut self, context: &DecoderContext, ) -> Result<(), Self::Error>

Handle TraceStop packet

Source

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

Source

fn on_mnt_packet( &mut self, context: &DecoderContext, payload: u64, ) -> Result<(), Self::Error>

Handle MNT packet

payload is Payload[63:0]

Source

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

Source

fn on_exstop_packet( &mut self, context: &DecoderContext, ip_bit: bool, ) -> Result<(), Self::Error>

Handle EXSTOP packet

ip_bit is the IP bit

Source

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)

Source

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)

Source

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)

Source

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]

Source

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]

Source

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).

Source

fn on_bep_packet( &mut self, context: &DecoderContext, ip_bit: bool, ) -> Result<(), Self::Error>

Handle BEP packet

ip_bit is the IP bit.

Source

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§