tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c
Source file repositories/reference/linux-study-clean/tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/util/intel-pt-decoder/intel-pt-insn-decoder.c- Extension
.c- Size
- 7836 bytes
- Lines
- 319
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hstdio.hstring.hendian.hbyteswap.h../../../arch/x86/include/asm/insn.hevent.hintel-pt-insn-decoder.hdump-insn.hutil/sample.h
Detected Declarations
function Copyrightfunction intel_pt_get_insnfunction arch_is_uncond_branchfunction intel_pt_insn_descfunction intel_pt_insn_type
Annotated Snippet
switch (insn->opcode.bytes[1]) {
case 0x01:
switch (insn->modrm.bytes[0]) {
case 0xc2: /* vmlaunch */
case 0xc3: /* vmresume */
op = INTEL_PT_OP_VMENTRY;
branch = INTEL_PT_BR_INDIRECT;
break;
case 0xca:
switch (insn->prefixes.bytes[3]) {
case 0xf2: /* erets */
op = INTEL_PT_OP_ERETS;
branch = INTEL_PT_BR_INDIRECT;
break;
case 0xf3: /* eretu */
op = INTEL_PT_OP_ERETU;
branch = INTEL_PT_BR_INDIRECT;
break;
default:
break;
}
break;
default:
break;
}
break;
case 0x05: /* syscall */
case 0x34: /* sysenter */
op = INTEL_PT_OP_SYSCALL;
branch = INTEL_PT_BR_INDIRECT;
break;
case 0x07: /* sysret */
case 0x35: /* sysexit */
op = INTEL_PT_OP_SYSRET;
branch = INTEL_PT_BR_INDIRECT;
break;
case 0x80 ... 0x8f: /* jcc */
op = INTEL_PT_OP_JCC;
branch = INTEL_PT_BR_CONDITIONAL;
break;
default:
break;
}
break;
case 0x70 ... 0x7f: /* jcc */
op = INTEL_PT_OP_JCC;
branch = INTEL_PT_BR_CONDITIONAL;
break;
case 0xa1:
if (insn_is_rex2(insn)) { /* jmpabs */
intel_pt_insn->op = INTEL_PT_OP_JMP;
/* jmpabs causes a TIP packet like an indirect branch */
intel_pt_insn->branch = INTEL_PT_BR_INDIRECT;
intel_pt_insn->length = insn->length;
return;
}
break;
case 0xc2: /* near ret */
case 0xc3: /* near ret */
case 0xca: /* far ret */
case 0xcb: /* far ret */
op = INTEL_PT_OP_RET;
branch = INTEL_PT_BR_INDIRECT;
break;
case 0xcf: /* iret */
op = INTEL_PT_OP_IRET;
branch = INTEL_PT_BR_INDIRECT;
break;
case 0xcc ... 0xce: /* int */
op = INTEL_PT_OP_INT;
branch = INTEL_PT_BR_INDIRECT;
break;
case 0xe8: /* call near rel */
op = INTEL_PT_OP_CALL;
branch = INTEL_PT_BR_UNCONDITIONAL;
break;
case 0x9a: /* call far absolute */
op = INTEL_PT_OP_CALL;
branch = INTEL_PT_BR_INDIRECT;
break;
case 0xe0 ... 0xe2: /* loop */
op = INTEL_PT_OP_LOOP;
branch = INTEL_PT_BR_CONDITIONAL;
break;
case 0xe3: /* jcc */
op = INTEL_PT_OP_JCC;
branch = INTEL_PT_BR_CONDITIONAL;
break;
case 0xe9: /* jmp */
case 0xeb: /* jmp */
Annotation
- Immediate include surface: `linux/kernel.h`, `stdio.h`, `string.h`, `endian.h`, `byteswap.h`, `../../../arch/x86/include/asm/insn.h`, `event.h`, `intel-pt-insn-decoder.h`.
- Detected declarations: `function Copyright`, `function intel_pt_get_insn`, `function arch_is_uncond_branch`, `function intel_pt_insn_desc`, `function intel_pt_insn_type`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.