Lines Matching +full:c +full:- +full:define +full:- +full:name
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * dwarf-regs.c : Mapping of DWARF debug register numbers into register names.
4 * Extracted from probe-finder.c
14 #include <dwarf-regs.h>
17 * See arch/x86/kernel/ptrace.c.
20 * - Since struct pt_regs is defined differently for user and kernel,
22 * field name of user's pt_regs), we make REG_OFFSET_NAME to accept
23 * both string name and reg field name.
25 * - Since accessing x86_32's pt_regs from x86_64 building is difficult
26 * and vise versa, we simply fill offset with -1, so
33 * - Order is different from kernel's ptrace.c for get_arch_regstr(). Use
38 const char *name; member
42 #define REG_OFFSET_END {.name = NULL, .offset = 0}
45 # define REG_OFFSET_NAME_64(n, r) {.name = n, .offset = offsetof(struct pt_regs, r)}
46 # define REG_OFFSET_NAME_32(n, r) {.name = n, .offset = -1}
48 # define REG_OFFSET_NAME_64(n, r) {.name = n, .offset = -1}
49 # define REG_OFFSET_NAME_32(n, r) {.name = n, .offset = offsetof(struct pt_regs, r)}
66 #define regoffset_table x86_32_regoffset_table
88 #define regoffset_table x86_64_regoffset_table
92 #define ARCH_MAX_REGS ((sizeof(regoffset_table) / sizeof(regoffset_table[0])) - 1)
94 /* Return architecture dependent register string (for kprobe-tracer) */
97 return (n < ARCH_MAX_REGS) ? regoffset_table[n].name : NULL; in get_arch_regstr()
100 /* Reuse code from arch/x86/kernel/ptrace.c */
102 * regs_query_register_offset() - query register offset from its name
103 * @name: the name of a register
106 * pt_regs from its name. If the name is invalid, this returns -EINVAL;
108 int regs_query_register_offset(const char *name) in regs_query_register_offset() argument
111 for (roff = regoffset_table; roff->name != NULL; roff++) in regs_query_register_offset()
112 if (!strcmp(roff->name, name)) in regs_query_register_offset()
113 return roff->offset; in regs_query_register_offset()
114 return -EINVAL; in regs_query_register_offset()
118 const char *name; member
142 int get_arch_regnum(const char *name) in get_arch_regnum() argument
146 if (*name != '%') in get_arch_regnum()
147 return -EINVAL; in get_arch_regnum()
150 if (!strcmp(x86_regidx_table[i].name, name + 1)) in get_arch_regnum()
152 return -ENOENT; in get_arch_regnum()