tools/perf/util/dwarf-regs-arch/dwarf-regs-x86.c
Source file repositories/reference/linux-study-clean/tools/perf/util/dwarf-regs-arch/dwarf-regs-x86.c
File Facts
- System
- Linux kernel
- Corpus path
tools/perf/util/dwarf-regs-arch/dwarf-regs-x86.c- Extension
.c- Size
- 6669 bytes
- Lines
- 261
- 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
errno.hstring.hlinux/kernel.hdwarf-regs.h../../../arch/x86/include/uapi/asm/perf_regs.h
Detected Declarations
struct dwarf_regs_idxfunction get_regnumfunction __get_dwarf_regnum_i386function __get_dwarf_regnum_x86_64function __get_dwarf_regnum_for_perf_regnum_i386function __get_dwarf_regnum_for_perf_regnum_x86_64
Annotated Snippet
struct dwarf_regs_idx {
const char *name;
int dwarf_regnum;
};
static const struct dwarf_regs_idx i386_regidx_table[] = {
{ "eax", 0 }, { "ax", 0 }, { "al", 0 },
{ "ecx", 1 }, { "cx", 1 }, { "cl", 1 },
{ "edx", 2 }, { "dx", 2 }, { "dl", 2 },
{ "ebx", 3 }, { "bx", 3 }, { "bl", 3 },
{ "esp", 4 }, { "sp", 4 }, { "$stack", 4},
{ "ebp", 5 }, { "bp", 5 },
{ "esi", 6 }, { "si", 6 },
{ "edi", 7 }, { "di", 7 },
// 8 - Return Address RA
{ "eflags", 9}, { "flags", 9},
// 10 - reserved
{ "st0", 11},
{ "st1", 12},
{ "st2", 13},
{ "st3", 14},
{ "st4", 15},
{ "st5", 16},
{ "st6", 17},
{ "st7", 18},
// 19-20 - reserved
{ "xmm0", 21},
{ "xmm1", 22},
{ "xmm2", 23},
{ "xmm3", 24},
{ "xmm4", 25},
{ "xmm5", 26},
{ "xmm6", 27},
{ "xmm7", 28},
{ "mm0", 29},
{ "mm1", 30},
{ "mm2", 31},
{ "mm3", 32},
{ "mm4", 33},
{ "mm5", 34},
{ "mm6", 35},
{ "mm7", 36},
// 37-38 - unknown
{ "mxcsr", 39}, // 128-bit Media Control and Status
{ "es", 40},
{ "cs", 41},
{ "ss", 42},
{ "ds", 43},
{ "fs", 44},
{ "gs", 45},
// 46-47 - reserved
{ "tr", 48}, // Task Register
{ "ldtr", 49}, // LDT Register
// 50-92 - reserved
{ "fs.base", 92},
{ "gs.base", 93},
// End of regular dwarf registers.
{ "eip", DWARF_REG_PC }, { "ip", DWARF_REG_PC },
};
static const struct dwarf_regs_idx x86_64_regidx_table[] = {
{ "rax", 0 }, { "eax", 0 }, { "ax", 0 }, { "al", 0 },
{ "rdx", 1 }, { "edx", 1 }, { "dx", 1 }, { "dl", 1 },
{ "rcx", 2 }, { "ecx", 2 }, { "cx", 2 }, { "cl", 2 },
{ "rbx", 3 }, { "edx", 3 }, { "bx", 3 }, { "bl", 3 },
{ "rsi", 4 }, { "esi", 4 }, { "si", 4 }, { "sil", 4 },
{ "rdi", 5 }, { "edi", 5 }, { "di", 5 }, { "dil", 5 },
{ "rbp", 6 }, { "ebp", 6 }, { "bp", 6 }, { "bpl", 6 },
{ "rsp", 7 }, { "esp", 7 }, { "sp", 7 }, { "spl", 7 },
{ "r8", 8 }, { "r8d", 8 }, { "r8w", 8 }, { "r8b", 8 },
{ "r9", 9 }, { "r9d", 9 }, { "r9w", 9 }, { "r9b", 9 },
{ "r10", 10 }, { "r10d", 10 }, { "r10w", 10 }, { "r10b", 10 },
{ "r11", 11 }, { "r11d", 11 }, { "r11w", 11 }, { "r11b", 11 },
{ "r12", 12 }, { "r12d", 12 }, { "r12w", 12 }, { "r12b", 12 },
{ "r13", 13 }, { "r13d", 13 }, { "r13w", 13 }, { "r13b", 13 },
{ "r14", 14 }, { "r14d", 14 }, { "r14w", 14 }, { "r14b", 14 },
{ "r15", 15 }, { "r15d", 15 }, { "r15w", 15 }, { "r15b", 15 },
// 16 - Return Address RA
{ "xmm0", 17},
{ "xmm1", 18},
{ "xmm2", 19},
{ "xmm3", 20},
{ "xmm4", 21},
{ "xmm5", 22},
{ "xmm6", 23},
{ "xmm7", 24},
{ "xmm8", 25},
{ "xmm9", 26},
{ "xmm10", 27},
{ "xmm11", 28},
Annotation
- Immediate include surface: `errno.h`, `string.h`, `linux/kernel.h`, `dwarf-regs.h`, `../../../arch/x86/include/uapi/asm/perf_regs.h`.
- Detected declarations: `struct dwarf_regs_idx`, `function get_regnum`, `function __get_dwarf_regnum_i386`, `function __get_dwarf_regnum_x86_64`, `function __get_dwarf_regnum_for_perf_regnum_i386`, `function __get_dwarf_regnum_for_perf_regnum_x86_64`.
- 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.