Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | tools/lib/traceevent/event-parse.c |
static void list_events_sort(struct tep_event **events, int nr_events,
enum tep_event_sort_type sort_type) {
int (*sort)(const void *a, const void *b);
switch (sort_type) {
case TEP_EVENT_SORT_ID:
sort = events_id_cmp;
break;
case TEP_EVENT_SORT_NAME:
sort = events_nam... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | enum tep_errno tep_parse_event(struct tep_handle *tep, const char *buf,
unsigned long size, const char *sys) {
struct tep_event *event = NULL;
return __parse_event(tep, &event, buf, size, sys);
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c |
int get_field_val(struct trace_seq *s, struct tep_format_field *field,
const char *name, struct tep_record *record,
unsigned long long *val, int err) {
if (!field) {
if (err)
trace_seq_printf(s, "<CANT FIND FIELD %s>", name);
return -1;
}
if (tep_read_number_fie... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | int tep_get_any_field_val(struct trace_seq *s, struct tep_event *event,
const char *name, struct tep_record *record,
unsigned long long *val, int err) {
struct tep_format_field *field;
if (!event)
return -1;
field = tep_find_any_field(event, name);
retu... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | int tep_print_num_field(struct trace_seq *s, const char *fmt,
struct tep_event *event, const char *name,
struct tep_record *record, int err) {
struct tep_format_field *field = tep_find_field(event, name);
unsigned long long val;
if (!field)
goto failed;
if (... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | static struct tep_event *search_event(struct tep_handle *tep, int id,
const char *sys_name,
const char *event_name) {
struct tep_event *event;
if (id >= 0) {
event = tep_find_event(tep, id);
if (!event)
return NULL;
if (... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-parse.c | int tep_unregister_event_handler(struct tep_handle *tep, int id,
const char *sys_name, const char *event_name,
tep_event_handler_func func, void *context) {
struct tep_event *event;
struct event_handler *handle;
struct event_handler **next;
even... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-plugin.c | static int update_option(const char *file, struct tep_plugin_option *option) {
struct trace_plugin_options *op;
char *plugin;
int ret = 0;
if (option->plugin_alias) {
plugin = strdup(option->plugin_alias);
if (!plugin)
return -1;
} else {
char *p;
plugin = strdup(file);
if (!plugin)... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-plugin.c |
static int process_option(const char *plugin, const char *option,
const char *val) {
struct tep_plugin_option *op;
op = find_registered_option(plugin, option);
if (!op)
return 0;
return update_option_value(op, val);
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/event-plugin.c | int tep_plugin_add_option(const char *name, const char *val) {
struct trace_plugin_options *op;
char *option_str;
char *plugin;
option_str = strdup(name);
if (!option_str)
return -ENOMEM;
if (parse_option_name(&option_str, &plugin) < 0)
return -ENOMEM;
for (op = trace_plugin_options; op; op = o... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-plugin.c |
static void load_plugin(struct tep_handle *tep, const char *path,
const char *file, void *data) {
struct tep_plugin_list **plugin_list = data;
struct tep_plugin_option *options;
tep_plugin_load_func func;
struct tep_plugin_list *list;
const char *alias;
char *plugin;
void *handle;... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/event-plugin.c | void tep_load_plugins_hook(struct tep_handle *tep, const char *suffix,
void (*load_plugin)(struct tep_handle *tep,
const char *path,
const char *name, void *data),
void *da... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/kbuffer-parse.c |
static int do_swap(struct kbuffer *kbuf) {
return ((kbuf->flags & KBUFFER_FL_HOST_BIG_ENDIAN) + kbuf->flags) &
ENDIAN_MASK;
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/kbuffer-parse.c |
static unsigned long long __read_8(void *ptr) {
unsigned long long data = *(unsigned long long *)ptr;
return data;
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/kbuffer-parse.c |
static unsigned int __read_4_sw(void *ptr) {
unsigned int data = *(unsigned int *)ptr;
unsigned int swap;
swap = ((data & 0xffULL) << 24) | ((data & (0xffULL << 8)) << 8) |
((data & (0xffULL << 16)) >> 8) | ((data & (0xffULL << 24)) >> 24);
return swap;
} | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/kbuffer-parse.c |
static unsigned long long __read_long_4(struct kbuffer *kbuf, void *ptr) {
return kbuf->read_4(ptr);
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/kbuffer-parse.c |
static unsigned long long read_long(struct kbuffer *kbuf, void *ptr) {
return kbuf->read_long(kbuf, ptr);
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/kbuffer-parse.c |
static unsigned int type4host(struct kbuffer *kbuf, unsigned int type_len_ts) {
if (kbuf->flags & KBUFFER_FL_BIG_ENDIAN)
return (type_len_ts >> 29) & 3;
else
return type_len_ts & 3;
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/kbuffer-parse.c |
static unsigned int translate_data(struct kbuffer *kbuf, void *data,
void **rptr, unsigned long long *delta,
int *length) {
unsigned long long extend;
unsigned int type_len_ts;
unsigned int type_len;
type_len_ts = read_4(kbuf, data);
data... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/kbuffer-parse.c | void *kbuffer_translate_data(int swap, void *data, unsigned int *size) {
unsigned long long delta;
struct kbuffer kbuf;
int type_len;
int length;
void *ptr;
if (swap) {
kbuf.read_8 = __read_8_sw;
kbuf.read_4 = __read_4_sw;
kbuf.flags = host_is_bigendian() ? 0 : KBUFFER_FL_BIG_ENDIAN;
} else {... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/kbuffer-parse.c |
static int next_event(struct kbuffer *kbuf) { return kbuf->next_event(kbuf); } | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/kbuffer-parse.c | void *kbuffer_next_event(struct kbuffer *kbuf, unsigned long long *ts) {
int ret;
if (!kbuf || !kbuf->subbuffer)
return NULL;
ret = next_event(kbuf);
if (ret < 0)
return NULL;
if (ts)
*ts = kbuf->timestamp;
return kbuf->data + kbuf->index;
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/kbuffer-parse.c | unsigned int kbuffer_ptr_delta(struct kbuffer *kbuf, void *ptr) {
unsigned int type_len_ts;
type_len_ts = read_4(kbuf, ptr);
return ts4host(kbuf, type_len_ts);
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/kbuffer-parse.c | void *kbuffer_read_at_offset(struct kbuffer *kbuf, int offset,
unsigned long long *ts) {
void *data;
if (offset < kbuf->start)
offset = 0;
else
offset -= kbuf->start;
kbuffer_load_subbuffer(kbuf, kbuf->subbuffer);
data = kbuffer_read_event(kbuf, ts);
while (kbuf->curr... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/kbuffer-parse.c | int kbuffer_start_of_data(struct kbuffer *kbuf) { return kbuf->start; } | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/parse-filter.c |
static struct tep_filter_type *add_filter_type(struct tep_event_filter *filter,
int id) {
struct tep_filter_type *filter_type;
int i;
filter_type = find_filter_type(filter, id);
if (filter_type)
return filter_type;
filter_type = realloc(filter->event_filte... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/parse-filter.c |
static int add_event(struct event_list **events, struct tep_event *event) {
struct event_list *list;
list = malloc(sizeof(*list));
if (list == NULL)
return -1;
list->next = *events;
*events = list;
list->event = event;
return 0;
} | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/parse-filter.c |
static struct tep_filter_arg *create_arg_exp(enum tep_filter_exp_type etype) {
struct tep_filter_arg *arg;
arg = allocate_arg();
if (!arg)
return NULL;
arg->type = TEP_FILTER_ARG_EXP;
arg->exp.type = etype;
return arg;
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/parse-filter.c |
static struct tep_filter_arg *rotate_op_right(struct tep_filter_arg *a,
struct tep_filter_arg *b) {
struct tep_filter_arg *arg;
arg = a->op.right;
a->op.right = b;
return arg;
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/parse-filter.c | static int collapse_tree(struct tep_filter_arg *arg,
struct tep_filter_arg **arg_collapsed,
char *error_str) {
int ret;
ret = test_arg(arg, arg, error_str);
switch (ret) {
case FILTER_VAL_NORM:
break;
case FILTER_VAL_TRUE:
case FILTER_VAL_FALSE:
fr... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/parse-filter.c |
static void free_filter_type(struct tep_filter_type *filter_type) {
free_arg(filter_type->filter);
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/parse-filter.c | static int test_num(struct tep_event *event, struct tep_filter_arg *arg,
struct tep_record *record, enum tep_errno *err) {
unsigned long long lval, rval;
lval = get_arg_value(event, arg->num.left, record, err);
rval = get_arg_value(event, arg->num.right, record, err);
if (*err) {
retu... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/parse-filter.c | static const char *get_field_str(struct tep_filter_arg *arg,
struct tep_record *record) {
struct tep_event *event;
struct tep_handle *tep;
unsigned long long addr;
const char *val = NULL;
unsigned int size;
char hex[64];
if (arg->str.field->flags & TEP_FIELD_IS_STRING) {
... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/parse-filter.c |
static int test_op(struct tep_event *event, struct tep_filter_arg *arg,
struct tep_record *record, enum tep_errno *err) {
switch (arg->op.type) {
case TEP_FILTER_OP_AND:
return test_filter(event, arg->op.left, record, err) &&
test_filter(event, arg->op.right, record, err);
case... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/parse-filter.c | static int test_filter(struct tep_event *event, struct tep_filter_arg *arg,
struct tep_record *record, enum tep_errno *err) {
if (*err) {
return 0;
}
switch (arg->type) {
case TEP_FILTER_ARG_BOOLEAN:
/* easy case */
return arg->boolean.value;
case TEP_FILTER_ARG_OP:
r... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/parse-filter.c |
static char *exp_to_str(struct tep_event_filter *filter,
struct tep_filter_arg *arg) {
char *lstr;
char *rstr;
char *op;
char *str = NULL;
lstr = arg_to_str(filter, arg->exp.left);
rstr = arg_to_str(filter, arg->exp.right);
if (!lstr || !rstr)
goto out;
switch (arg->exp.ty... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/parse-filter.c | static char *str_to_str(struct tep_event_filter *filter,
struct tep_filter_arg *arg) {
char *str = NULL;
char *op = NULL;
switch (arg->str.type) {
case TEP_FILTER_CMP_MATCH:
op = "==";
case TEP_FILTER_CMP_NOT_MATCH:
if (!op)
op = "!=";
case TEP_FILTER_CMP_REGEX:
... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/parse-utils.c |
void __vpr_stat(const char *fmt, va_list ap) {
vprintf(fmt, ap);
printf("\n");
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/plugins/plugin_function.c |
static void show_function(struct trace_seq *s, struct tep_handle *tep,
const char *func, unsigned long long function) {
unsigned long long offset;
trace_seq_printf(s, "%s", func);
if (ftrace_offset->set) {
offset = tep_find_function_address(tep, function);
trace_seq_printf(s, "... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/plugins/plugin_function.c |
static int function_handler(struct trace_seq *s, struct tep_record *record,
struct tep_event *event, void *context) {
struct tep_handle *tep = event->tep;
unsigned long long function;
unsigned long long pfunction;
const char *func;
const char *parent;
int index = 0;
if (tep_g... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/plugins/plugin_function.c |
int TEP_PLUGIN_LOADER(struct tep_handle *tep) {
tep_register_event_handler(tep, -1, "ftrace", "function", function_handler,
NULL);
tep_register_event_handler(tep, -1, "ftrace", "kernel_stack",
trace_stack_handler, NULL);
tep_register_event_handler(tep, ... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/plugins/plugin_futex.c |
static int futex_handler(struct trace_seq *s, struct tep_record *record,
struct tep_event *event, void *context) {
const struct futex_op *fop;
struct futex_args args;
unsigned long long cmd;
if (tep_get_field_val(s, event, "uaddr", record, &args.uaddr, 1))
return 1;
if (tep_get... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/plugins/plugin_hrtimer.c |
void TEP_PLUGIN_UNLOADER(struct tep_handle *tep) {
tep_unregister_event_handler(tep, -1, "timer", "hrtimer_expire_entry",
timer_expire_handler, NULL);
tep_unregister_event_handler(tep, -1, "timer", "hrtimer_start",
timer_start_handler, NULL);
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/plugins/plugin_jbd2.c |
void TEP_PLUGIN_UNLOADER(struct tep_handle *tep) {
tep_unregister_print_function(tep, process_jbd2_dev_to_name,
"jbd2_dev_to_name");
tep_unregister_print_function(tep, process_jiffies_to_msecs,
"jiffies_to_msecs");
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/plugins/plugin_kmem.c |
int TEP_PLUGIN_LOADER(struct tep_handle *tep) {
tep_register_event_handler(tep, -1, "kmem", "kfree", call_site_handler, NULL);
tep_register_event_handler(tep, -1, "kmem", "kmalloc", call_site_handler,
NULL);
tep_register_event_handler(tep, -1, "kmem", "kmalloc_node", call_site_hand... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/plugins/plugin_kvm.c |
static const char *find_exit_reason(unsigned isa, int val) {
struct str_values *strings = NULL;
int i;
for (i = 0; isa_exit_reasons[i].strings; ++i)
if (isa_exit_reasons[i].isa == isa) {
strings = isa_exit_reasons[i].strings;
break;
}
if (!strings)
return "UNKNOWN-ISA";
for (i = 0; s... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/plugins/plugin_kvm.c |
static int kvm_nested_vmexit_inject_handler(struct trace_seq *s,
struct tep_record *record,
struct tep_event *event,
void *context) {
if (print_exit_reason(s, record, event, "exit_code... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/plugins/plugin_kvm.c |
int TEP_PLUGIN_LOADER(struct tep_handle *tep) {
init_disassembler();
tep_register_event_handler(tep, -1, "kvm", "kvm_exit", kvm_exit_handler,
NULL);
tep_register_event_handler(tep, -1, "kvm", "kvm_emulate_insn",
kvm_emulate_insn_handler, NULL);
tep_r... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/plugins/plugin_mac80211.c |
static int drv_bss_info_changed(struct trace_seq *s, struct tep_record *record,
struct tep_event *event, void *context) {
void *data = record->data;
print_string(s, event, "wiphy_name", data);
trace_seq_printf(s, " vif:");
print_string(s, event, "vif_name", data);
tep_print_n... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/plugins/plugin_sched_switch.c |
static void write_state(struct trace_seq *s, int val) {
const char states[] = "SDTtZXxW";
int found = 0;
int i;
for (i = 0; i < (sizeof(states) - 1); i++) {
if (!(val & (1 << i)))
continue;
if (found)
trace_seq_putc(s, '|');
found = 1;
trace_seq_putc(s, states[i]);
}
if (!fo... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/plugins/plugin_sched_switch.c |
static int sched_switch_handler(struct trace_seq *s, struct tep_record *record,
struct tep_event *event, void *context) {
struct tep_format_field *field;
unsigned long long val;
if (tep_get_field_val(s, event, "prev_pid", record, &val, 1))
return trace_seq_putc(s, '!');
fi... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/plugins/plugin_scsi.c |
static const char *scsi_trace_rw6(struct trace_seq *p, unsigned char *cdb,
int len) {
const char *ret = p->buffer + p->len;
sector_t lba = 0, txlen = 0;
lba |= ((cdb[1] & 0x1F) << 16);
lba |= (cdb[2] << 8);
lba |= cdb[3];
txlen = cdb[4];
trace_seq_printf(p, "lba=%llu t... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/plugins/plugin_scsi.c |
static const char *scsi_trace_rw12(struct trace_seq *p, unsigned char *cdb,
int len) {
const char *ret = p->buffer + p->len;
sector_t lba = 0, txlen = 0;
lba |= (cdb[2] << 24);
lba |= (cdb[3] << 16);
lba |= (cdb[4] << 8);
lba |= cdb[5];
txlen |= (cdb[6] << 24);
txlen... | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/plugins/plugin_scsi.c |
static const char *scsi_trace_rw16(struct trace_seq *p, unsigned char *cdb,
int len) {
const char *ret = p->buffer + p->len;
sector_t lba = 0, txlen = 0;
lba |= ((u64)cdb[2] << 56);
lba |= ((u64)cdb[3] << 48);
lba |= ((u64)cdb[4] << 40);
lba |= ((u64)cdb[5] << 32);
lba... | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/plugins/plugin_scsi.c |
unsigned long long process_scsi_trace_parse_cdb(struct trace_seq *s,
unsigned long long *args) {
scsi_trace_parse_cdb(s, (unsigned char *)(unsigned long)args[1], args[2]);
return 0;
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/plugins/plugin_scsi.c |
void TEP_PLUGIN_UNLOADER(struct tep_handle *tep) {
tep_unregister_print_function(tep, process_scsi_trace_parse_cdb,
"scsi_trace_parse_cdb");
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/plugins/plugin_tlb.c |
void TEP_PLUGIN_UNLOADER(struct tep_handle *tep) {
tep_unregister_event_handler(tep, -1, "tlb", "tlb_flush", tlb_flush_handler,
NULL);
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/plugins/plugin_xen.c |
static const char *xen_hypercall_name(unsigned op) {
if (op < ARRAY_SIZE(xen_hypercall_names) && xen_hypercall_names[op] != NULL)
return xen_hypercall_names[op];
return "";
} | [
0,
0
] |
Linux Kernel | tools/lib/traceevent/trace-seq.c | void trace_seq_init(struct trace_seq *s) {
s->len = 0;
s->readpos = 0;
s->buffer_size = TRACE_SEQ_BUF_SIZE;
s->buffer = malloc(s->buffer_size);
if (s->buffer != NULL)
s->state = TRACE_SEQ__GOOD;
else
s->state = TRACE_SEQ__MEM_ALLOC_FAILED;
} | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/trace-seq.c | void trace_seq_destroy(struct trace_seq *s) {
if (!s)
return;
TRACE_SEQ_CHECK_RET(s);
free(s->buffer);
s->buffer = TRACE_SEQ_POISON;
} | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/trace-seq.c |
static void expand_buffer(struct trace_seq *s) {
char *buf;
buf = realloc(s->buffer, s->buffer_size + TRACE_SEQ_BUF_SIZE);
if (WARN_ONCE(!buf, "Can't allocate trace_seq buffer memory")) {
s->state = TRACE_SEQ__MEM_ALLOC_FAILED;
return;
}
s->buffer = buf;
s->buffer_size += TRACE_SEQ_BUF_SIZE;
} | [
1,
0
] |
Linux Kernel | tools/lib/traceevent/trace-seq.c | int trace_seq_vprintf(struct trace_seq *s, const char *fmt, va_list args) {
int len;
int ret;
try_again:
TRACE_SEQ_CHECK_RET0(s);
len = (s->buffer_size - 1) - s->len;
ret = vsnprintf(s->buffer + s->len, len, fmt, args);
if (ret >= len) {
expand_buffer(s);
goto try_again;
}
if (ret > 0)
... | [
1,
0
] |
Linux Kernel | tools/lib/vsprintf.c |
int scnprintf_pad(char *buf, size_t size, const char *fmt, ...) {
ssize_t ssize = size;
va_list args;
int i;
va_start(args, fmt);
i = vscnprintf(buf, size, fmt, args);
va_end(args);
if (i < (int)size) {
for (; i < (int)size; i++)
buf[i] = ' ';
buf[i] = 0x0;
}
return (i >= ssize) ? (s... | [
1,
0
] |
Linux Kernel | tools/lib/zalloc.c |
void __zfree(void **ptr) {
free(*ptr);
*ptr = NULL;
} | [
1,
0
] |
Linux Kernel | tools/objtool/arch/x86/decode.c |
static int is_x86_64(const struct elf *elf) {
switch (elf->ehdr.e_machine) {
case EM_X86_64:
return 1;
case EM_386:
return 0;
default:
WARN("unexpected ELF machine type %d", elf->ehdr.e_machine);
return -1;
}
} | [
0,
0
] |
Linux Kernel | tools/objtool/arch/x86/decode.c |
bool arch_callee_saved_reg(unsigned char reg) {
switch (reg) {
case CFI_BP:
case CFI_BX:
case CFI_R12:
case CFI_R13:
case CFI_R14:
case CFI_R15:
return true;
case CFI_AX:
case CFI_CX:
case CFI_DX:
case CFI_SI:
case CFI_DI:
case CFI_SP:
case CFI_R8:
case CFI_R9:
case CFI_R10:
case... | [
0,
0
] |
Linux Kernel | tools/objtool/arch/x86/decode.c |
static bool has_notrack_prefix(struct insn *insn) {
int i;
for (i = 0; i < insn->prefixes.nbytes; i++) {
if (insn->prefixes.bytes[i] == 0x3e)
return true;
}
return false;
} | [
0,
0
] |
Linux Kernel | tools/objtool/arch/x86/decode.c |
const char *arch_ret_insn(int len) {
static const char ret[5][5] = {
{BYTE_RET},
{BYTE_RET, 0xcc},
{BYTE_RET, 0xcc, BYTES_NOP1},
{BYTE_RET, 0xcc, BYTES_NOP2},
{BYTE_RET, 0xcc, BYTES_NOP3},
};
if (len < 1 || len > 5) {
WARN("invalid RET size: %d\n", len);
return NULL;
}
... | [
1,
0
] |
Linux Kernel | tools/objtool/arch/x86/special.c | bool arch_support_alt_relocation(struct special_alt *special_alt,
struct instruction *insn,
struct reloc *reloc) {
return insn->offset == special_alt->new_off &&
(insn->type == INSN_CALL || is_jump(insn));
} | [
0,
0
] |
Linux Kernel | tools/objtool/arch/x86/special.c | struct reloc *arch_find_switch_table(struct objtool_file *file,
struct instruction *insn) {
struct reloc *text_reloc, *rodata_reloc;
struct section *table_sec;
unsigned long table_offset;
text_reloc =
find_reloc_by_dest_range(file->elf, insn->sec, insn->offset, insn->... | [
1,
1
] |
Linux Kernel | tools/objtool/builtin-check.c |
int cmd_parse_options(int argc, const char **argv, const char *const usage[]) {
const char *envv[16] = {};
char *env;
int envc;
env = getenv("OBJTOOL_ARGS");
if (env) {
envv[0] = "OBJTOOL_ARGS";
for (envc = 1; envc < ARRAY_SIZE(envv);) {
envv[envc++] = env;
env = strchr(env, ' ');
... | [
0,
0
] |
Linux Kernel | tools/objtool/builtin-check.c |
int objtool_run(int argc, const char **argv) {
const char *objname;
struct objtool_file *file;
int ret;
argc = cmd_parse_options(argc, argv, check_usage);
objname = argv[0];
if (!opts_valid())
return 1;
if (opts.dump_orc)
return orc_dump(objname);
file = objtool_open_read(objname);
if (!f... | [
0,
0
] |
Linux Kernel | tools/objtool/check.c |
static struct instruction *next_insn_same_sec(struct objtool_file *file,
struct instruction *insn) {
struct instruction *next = list_next_entry(insn, list);
if (!next || &next->list == &file->insn_list || next->sec != insn->sec)
return NULL;
return next;
} | [
0,
0
] |
Linux Kernel | tools/objtool/check.c |
static bool dead_end_function(struct objtool_file *file, struct symbol *func) {
return __dead_end_function(file, func, 0);
} | [
0,
0
] |
Linux Kernel | tools/objtool/check.c |
static void init_cfi_state(struct cfi_state *cfi) {
int i;
for (i = 0; i < CFI_NUM_REGS; i++) {
cfi->regs[i].base = CFI_UNDEFINED;
cfi->vals[i].base = CFI_UNDEFINED;
}
cfi->cfa.base = CFI_UNDEFINED;
cfi->drap_reg = CFI_UNDEFINED;
cfi->drap_offset = -1;
} | [
0,
0
] |
Linux Kernel | tools/objtool/check.c | static int init_pv_ops(struct objtool_file *file) {
static const char *pv_ops_tables[] = {
"pv_ops", "xen_cpu_ops", "xen_irq_ops", "xen_mmu_ops", NULL,
};
const char *pv_ops;
struct symbol *sym;
int idx, nr;
if (!opts.noinstr)
return 0;
file->pv_ops = NULL;
sym = find_symbol_by_name(file->e... | [
1,
0
] |
Linux Kernel | tools/objtool/check.c |
static int create_retpoline_sites_sections(struct objtool_file *file) {
struct instruction *insn;
struct section *sec;
int idx;
sec = find_section_by_name(file->elf, ".retpoline_sites");
if (sec) {
WARN("file already has .retpoline_sites, skipping");
return 0;
}
idx = 0;
list_for_each_entry(i... | [
1,
0
] |
Linux Kernel | tools/objtool/check.c |
static int create_return_sites_sections(struct objtool_file *file) {
struct instruction *insn;
struct section *sec;
int idx;
sec = find_section_by_name(file->elf, ".return_sites");
if (sec) {
WARN("file already has .return_sites, skipping");
return 0;
}
idx = 0;
list_for_each_entry(insn, &fil... | [
1,
0
] |
Linux Kernel | tools/objtool/check.c |
static int create_mcount_loc_sections(struct objtool_file *file) {
struct section *sec;
unsigned long *loc;
struct instruction *insn;
int idx;
sec = find_section_by_name(file->elf, "__mcount_loc");
if (sec) {
INIT_LIST_HEAD(&file->mcount_loc_list);
WARN("file already has __mcount_loc section, skip... | [
1,
0
] |
Linux Kernel | tools/objtool/check.c | static void add_ignores(struct objtool_file *file) {
struct instruction *insn;
struct section *sec;
struct symbol *func;
struct reloc *reloc;
sec = find_section_by_name(file->elf,
".rela.discard.func_stack_frame_non_standard");
if (!sec)
return;
list_for_each_entry(reloc... | [
1,
0
] |
Linux Kernel | tools/objtool/check.c | static int add_ignore_alternatives(struct objtool_file *file) {
struct section *sec;
struct reloc *reloc;
struct instruction *insn;
sec = find_section_by_name(file->elf, ".rela.discard.ignore_alts");
if (!sec)
return 0;
list_for_each_entry(reloc, &sec->reloc_list, list) {
if (reloc->sym->type != S... | [
1,
1
] |
Linux Kernel | tools/objtool/check.c |
__weak bool arch_is_retpoline(struct symbol *sym) { return false; } | [
0,
0
] |
Linux Kernel | tools/objtool/check.c |
static struct reloc *insn_reloc(struct objtool_file *file,
struct instruction *insn) {
if (insn->reloc == NEGATIVE_RELOC)
return NULL;
if (!insn->reloc) {
if (!file)
return NULL;
insn->reloc =
find_reloc_by_dest_range(file->elf, insn->sec, insn->offset, i... | [
0,
0
] |
Linux Kernel | tools/objtool/check.c | static void add_call_dest(struct objtool_file *file, struct instruction *insn,
struct symbol *dest, bool sibling) {
insn->call_dest = dest;
if (!dest)
return;
remove_insn_ops(insn);
annotate_call_site(file, insn, sibling);
} | [
0,
0
] |
Linux Kernel | tools/objtool/check.c | static void add_retpoline_call(struct objtool_file *file,
struct instruction *insn) {
switch (insn->type) {
case INSN_CALL:
insn->type = INSN_CALL_DYNAMIC;
break;
case INSN_JUMP_UNCONDITIONAL:
insn->type = INSN_JUMP_DYNAMIC;
break;
case INSN_JUMP_CONDITIONAL:
... | [
0,
0
] |
Linux Kernel | tools/objtool/check.c |
static bool same_function(struct instruction *insn1,
struct instruction *insn2) {
return insn1->func->pfunc == insn2->func->pfunc;
} | [
1,
0
] |
Linux Kernel | tools/objtool/check.c | static struct reloc *find_jump_table(struct objtool_file *file,
struct symbol *func,
struct instruction *insn) {
struct reloc *table_reloc;
struct instruction *dest_insn, *orig_insn = insn;
for (; insn && insn->func && insn->func->pfunc ==... | [
1,
0
] |
Linux Kernel | tools/objtool/check.c |
static int read_instr_hints(struct objtool_file *file) {
struct section *sec;
struct instruction *insn;
struct reloc *reloc;
sec = find_section_by_name(file->elf, ".rela.discard.instr_end");
if (!sec)
return 0;
list_for_each_entry(reloc, &sec->reloc_list, list) {
if (reloc->sym->type != STT_SECTI... | [
1,
0
] |
Linux Kernel | tools/objtool/check.c |
static int classify_symbols(struct objtool_file *file) {
struct section *sec;
struct symbol *func;
for_each_sec(file, sec) {
list_for_each_entry(func, &sec->symbol_list, list) {
if (func->bind != STB_GLOBAL)
continue;
if (!strncmp(func->name, STATIC_CALL_TRAMP_PREFIX_STR,
... | [
0,
0
] |
Linux Kernel | tools/objtool/check.c | static void mark_rodata(struct objtool_file *file) {
struct section *sec;
bool found = false;
for_each_sec(file, sec) {
if (!strncmp(sec->name, ".rodata", 7) && !strstr(sec->name, ".str1.")) {
sec->rodata = true;
found = true;
}
}
file->rodata = found;
} | [
0,
0
] |
Linux Kernel | tools/objtool/check.c |
static void restore_reg(struct cfi_state *cfi, unsigned char reg) {
cfi->regs[reg].base = initial_func_cfi.regs[reg].base;
cfi->regs[reg].offset = initial_func_cfi.regs[reg].offset;
} | [
0,
0
] |
Linux Kernel | tools/objtool/check.c |
static int validate_sibling_call(struct objtool_file *file,
struct instruction *insn,
struct insn_state *state) {
if (has_modified_stack_frame(insn, state)) {
WARN_FUNC(
"sibling call from callable instruction with modified stack frame",
... | [
0,
0
] |
Linux Kernel | tools/objtool/check.c |
static int validate_unwind_hints(struct objtool_file *file,
struct section *sec) {
struct instruction *insn;
struct insn_state state;
int ret, warnings = 0;
if (!file->hints)
return 0;
init_insn_state(file, &state, sec);
if (sec) {
insn = find_insn(file, sec, 0);... | [
0,
0
] |
Linux Kernel | tools/objtool/check.c | static int validate_unret(struct objtool_file *file) {
struct instruction *insn;
int ret, warnings = 0;
for_each_insn(file, insn) {
if (!insn->entry)
continue;
ret = validate_entry(file, insn);
if (ret < 0) {
WARN_FUNC("Failed UNRET validation", insn->sec, insn->offset);
return ret... | [
0,
0
] |
Linux Kernel | tools/objtool/check.c |
static int validate_noinstr_sections(struct objtool_file *file) {
struct section *sec;
int warnings = 0;
sec = find_section_by_name(file->elf, ".noinstr.text");
if (sec) {
warnings += validate_section(file, sec);
warnings += validate_unwind_hints(file, sec);
}
sec = find_section_by_name(file->elf... | [
0,
0
] |
Linux Kernel | tools/objtool/check.c |
static int validate_ibt_data_reloc(struct objtool_file *file,
struct reloc *reloc) {
struct instruction *dest;
dest = find_insn(file, reloc->sym->sec, reloc->sym->offset + reloc->addend);
if (!dest)
return 0;
if (dest->type == INSN_ENDBR) {
mark_endbr_used(dest);
... | [
1,
0
] |
Linux Kernel | tools/objtool/elf.c |
static inline u32 str_hash(const char *str) {
return jhash(str, strlen(str), 0);
}
#define __elf_table(name) (elf->name##_hash)
#define __elf_bits(name) (elf->name##_bits)
#define elf_hash_add(name, node, key) \
hlist_add_head(node, &__elf_table(name)[hash_min(key, __elf_... | [
1,
0
] |
Linux Kernel | tools/objtool/elf.c |
static struct symbol *find_symbol_by_index(struct elf *elf, unsigned int idx) {
struct symbol *sym;
elf_hash_for_each_possible(symbol, sym, hash, idx) {
if (sym->idx == idx)
return sym;
}
return NULL;
} | [
0,
0
] |
Linux Kernel | tools/objtool/elf.c |
struct symbol *find_symbol_containing(const struct section *sec,
unsigned long offset) {
struct rb_node *node;
rb_for_each(node, &offset, &sec->symbol_tree, symbol_by_offset) {
struct symbol *s = rb_entry(node, struct symbol, node);
if (s->type != STT_SECTION)
... | [
0,
0
] |
Linux Kernel | tools/objtool/elf.c | int find_symbol_hole_containing(const struct section *sec,
unsigned long offset) {
struct symbol_hole hole = {
.key = offset,
.sym = NULL,
};
struct rb_node *n;
struct symbol *s;
n = rb_find(&hole, &sec->symbol_tree, symbol_hole_by_offset);
/* found a symbol tha... | [
0,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.