• Home
  • Raw
  • Download

Lines Matching refs:ops

32 static void ins__delete(struct ins_operands *ops)  in ins__delete()  argument
34 if (ops == NULL) in ins__delete()
36 zfree(&ops->source.raw); in ins__delete()
37 zfree(&ops->source.name); in ins__delete()
38 zfree(&ops->target.raw); in ins__delete()
39 zfree(&ops->target.name); in ins__delete()
43 struct ins_operands *ops) in ins__raw_scnprintf() argument
45 return scnprintf(bf, size, "%-6.6s %s", ins->name, ops->raw); in ins__raw_scnprintf()
49 struct ins_operands *ops) in ins__scnprintf() argument
51 if (ins->ops->scnprintf) in ins__scnprintf()
52 return ins->ops->scnprintf(ins, bf, size, ops); in ins__scnprintf()
54 return ins__raw_scnprintf(ins, bf, size, ops); in ins__scnprintf()
57 static int call__parse(struct ins_operands *ops, struct map *map) in call__parse() argument
61 ops->target.addr = strtoull(ops->raw, &endptr, 16); in call__parse()
79 ops->target.name = strdup(name); in call__parse()
82 return ops->target.name == NULL ? -1 : 0; in call__parse()
87 struct symbol *sym = map__find_symbol(map, map->map_ip(map, ops->target.addr)); in call__parse()
89 ops->target.name = strdup(sym->name); in call__parse()
91 ops->target.addr = 0; in call__parse()
95 ops->target.addr = strtoull(tok + 1, NULL, 16); in call__parse()
100 struct ins_operands *ops) in call__scnprintf() argument
102 if (ops->target.name) in call__scnprintf()
103 return scnprintf(bf, size, "%-6.6s %s", ins->name, ops->target.name); in call__scnprintf()
105 if (ops->target.addr == 0) in call__scnprintf()
106 return ins__raw_scnprintf(ins, bf, size, ops); in call__scnprintf()
108 return scnprintf(bf, size, "%-6.6s *%" PRIx64, ins->name, ops->target.addr); in call__scnprintf()
118 return ins->ops == &call_ops; in ins__is_call()
121 static int jump__parse(struct ins_operands *ops, struct map *map __maybe_unused) in jump__parse() argument
123 const char *s = strchr(ops->raw, '+'); in jump__parse()
125 ops->target.addr = strtoull(ops->raw, NULL, 16); in jump__parse()
128 ops->target.offset = strtoull(s, NULL, 16); in jump__parse()
130 ops->target.offset = UINT64_MAX; in jump__parse()
136 struct ins_operands *ops) in jump__scnprintf() argument
138 return scnprintf(bf, size, "%-6.6s %" PRIx64, ins->name, ops->target.offset); in jump__scnprintf()
148 return ins->ops == &jump_ops; in ins__is_jump()
176 static int lock__parse(struct ins_operands *ops, struct map *map) in lock__parse() argument
180 ops->locked.ops = zalloc(sizeof(*ops->locked.ops)); in lock__parse()
181 if (ops->locked.ops == NULL) in lock__parse()
184 if (disasm_line__parse(ops->raw, &name, &ops->locked.ops->raw) < 0) in lock__parse()
187 ops->locked.ins = ins__find(name); in lock__parse()
190 if (ops->locked.ins == NULL) in lock__parse()
193 if (!ops->locked.ins->ops) in lock__parse()
196 if (ops->locked.ins->ops->parse && in lock__parse()
197 ops->locked.ins->ops->parse(ops->locked.ops, map) < 0) in lock__parse()
203 zfree(&ops->locked.ops); in lock__parse()
208 struct ins_operands *ops) in lock__scnprintf() argument
212 if (ops->locked.ins == NULL) in lock__scnprintf()
213 return ins__raw_scnprintf(ins, bf, size, ops); in lock__scnprintf()
216 return printed + ins__scnprintf(ops->locked.ins, bf + printed, in lock__scnprintf()
217 size - printed, ops->locked.ops); in lock__scnprintf()
220 static void lock__delete(struct ins_operands *ops) in lock__delete() argument
222 struct ins *ins = ops->locked.ins; in lock__delete()
224 if (ins && ins->ops->free) in lock__delete()
225 ins->ops->free(ops->locked.ops); in lock__delete()
227 ins__delete(ops->locked.ops); in lock__delete()
229 zfree(&ops->locked.ops); in lock__delete()
230 zfree(&ops->target.raw); in lock__delete()
231 zfree(&ops->target.name); in lock__delete()
240 static int mov__parse(struct ins_operands *ops, struct map *map __maybe_unused) in mov__parse() argument
242 char *s = strchr(ops->raw, ','), *target, *comment, prev; in mov__parse()
248 ops->source.raw = strdup(ops->raw); in mov__parse()
251 if (ops->source.raw == NULL) in mov__parse()
272 ops->target.raw = strdup(target); in mov__parse()
275 if (ops->target.raw == NULL) in mov__parse()
284 comment__symbol(ops->source.raw, comment, &ops->source.addr, &ops->source.name); in mov__parse()
285 comment__symbol(ops->target.raw, comment, &ops->target.addr, &ops->target.name); in mov__parse()
290 zfree(&ops->source.raw); in mov__parse()
295 struct ins_operands *ops) in mov__scnprintf() argument
298 ops->source.name ?: ops->source.raw, in mov__scnprintf()
299 ops->target.name ?: ops->target.raw); in mov__scnprintf()
307 static int dec__parse(struct ins_operands *ops, struct map *map __maybe_unused) in dec__parse() argument
311 target = s = ops->raw; in dec__parse()
318 ops->target.raw = strdup(target); in dec__parse()
321 if (ops->target.raw == NULL) in dec__parse()
331 comment__symbol(ops->target.raw, comment, &ops->target.addr, &ops->target.name); in dec__parse()
337 struct ins_operands *ops) in dec__scnprintf() argument
340 ops->target.name ?: ops->target.raw); in dec__scnprintf()
349 struct ins_operands *ops __maybe_unused) in nop__scnprintf()
364 return ins->ops == &ret_ops; in ins__is_ret()
368 { .name = "add", .ops = &mov_ops, },
369 { .name = "addl", .ops = &mov_ops, },
370 { .name = "addq", .ops = &mov_ops, },
371 { .name = "addw", .ops = &mov_ops, },
372 { .name = "and", .ops = &mov_ops, },
374 { .name = "b", .ops = &jump_ops, }, // might also be a call
375 { .name = "bcc", .ops = &jump_ops, },
376 { .name = "bcs", .ops = &jump_ops, },
377 { .name = "beq", .ops = &jump_ops, },
378 { .name = "bge", .ops = &jump_ops, },
379 { .name = "bgt", .ops = &jump_ops, },
380 { .name = "bhi", .ops = &jump_ops, },
381 { .name = "bl", .ops = &call_ops, },
382 { .name = "bls", .ops = &jump_ops, },
383 { .name = "blt", .ops = &jump_ops, },
384 { .name = "blx", .ops = &call_ops, },
385 { .name = "bne", .ops = &jump_ops, },
387 { .name = "bts", .ops = &mov_ops, },
388 { .name = "call", .ops = &call_ops, },
389 { .name = "callq", .ops = &call_ops, },
390 { .name = "cmp", .ops = &mov_ops, },
391 { .name = "cmpb", .ops = &mov_ops, },
392 { .name = "cmpl", .ops = &mov_ops, },
393 { .name = "cmpq", .ops = &mov_ops, },
394 { .name = "cmpw", .ops = &mov_ops, },
395 { .name = "cmpxch", .ops = &mov_ops, },
396 { .name = "dec", .ops = &dec_ops, },
397 { .name = "decl", .ops = &dec_ops, },
398 { .name = "imul", .ops = &mov_ops, },
399 { .name = "inc", .ops = &dec_ops, },
400 { .name = "incl", .ops = &dec_ops, },
401 { .name = "ja", .ops = &jump_ops, },
402 { .name = "jae", .ops = &jump_ops, },
403 { .name = "jb", .ops = &jump_ops, },
404 { .name = "jbe", .ops = &jump_ops, },
405 { .name = "jc", .ops = &jump_ops, },
406 { .name = "jcxz", .ops = &jump_ops, },
407 { .name = "je", .ops = &jump_ops, },
408 { .name = "jecxz", .ops = &jump_ops, },
409 { .name = "jg", .ops = &jump_ops, },
410 { .name = "jge", .ops = &jump_ops, },
411 { .name = "jl", .ops = &jump_ops, },
412 { .name = "jle", .ops = &jump_ops, },
413 { .name = "jmp", .ops = &jump_ops, },
414 { .name = "jmpq", .ops = &jump_ops, },
415 { .name = "jna", .ops = &jump_ops, },
416 { .name = "jnae", .ops = &jump_ops, },
417 { .name = "jnb", .ops = &jump_ops, },
418 { .name = "jnbe", .ops = &jump_ops, },
419 { .name = "jnc", .ops = &jump_ops, },
420 { .name = "jne", .ops = &jump_ops, },
421 { .name = "jng", .ops = &jump_ops, },
422 { .name = "jnge", .ops = &jump_ops, },
423 { .name = "jnl", .ops = &jump_ops, },
424 { .name = "jnle", .ops = &jump_ops, },
425 { .name = "jno", .ops = &jump_ops, },
426 { .name = "jnp", .ops = &jump_ops, },
427 { .name = "jns", .ops = &jump_ops, },
428 { .name = "jnz", .ops = &jump_ops, },
429 { .name = "jo", .ops = &jump_ops, },
430 { .name = "jp", .ops = &jump_ops, },
431 { .name = "jpe", .ops = &jump_ops, },
432 { .name = "jpo", .ops = &jump_ops, },
433 { .name = "jrcxz", .ops = &jump_ops, },
434 { .name = "js", .ops = &jump_ops, },
435 { .name = "jz", .ops = &jump_ops, },
436 { .name = "lea", .ops = &mov_ops, },
437 { .name = "lock", .ops = &lock_ops, },
438 { .name = "mov", .ops = &mov_ops, },
439 { .name = "movb", .ops = &mov_ops, },
440 { .name = "movdqa",.ops = &mov_ops, },
441 { .name = "movl", .ops = &mov_ops, },
442 { .name = "movq", .ops = &mov_ops, },
443 { .name = "movslq", .ops = &mov_ops, },
444 { .name = "movzbl", .ops = &mov_ops, },
445 { .name = "movzwl", .ops = &mov_ops, },
446 { .name = "nop", .ops = &nop_ops, },
447 { .name = "nopl", .ops = &nop_ops, },
448 { .name = "nopw", .ops = &nop_ops, },
449 { .name = "or", .ops = &mov_ops, },
450 { .name = "orl", .ops = &mov_ops, },
451 { .name = "test", .ops = &mov_ops, },
452 { .name = "testb", .ops = &mov_ops, },
453 { .name = "testl", .ops = &mov_ops, },
454 { .name = "xadd", .ops = &mov_ops, },
455 { .name = "xbeginl", .ops = &jump_ops, },
456 { .name = "xbeginq", .ops = &jump_ops, },
457 { .name = "retq", .ops = &ret_ops, },
720 if (!dl->ins->ops) in disasm_line__init_ins()
723 if (dl->ins->ops->parse && dl->ins->ops->parse(&dl->ops, map) < 0) in disasm_line__init_ins()
778 if (disasm_line__parse(dl->line, &dl->name, &dl->ops.raw) < 0) in disasm_line__new()
798 if (dl->ins && dl->ins->ops->free) in disasm_line__free()
799 dl->ins->ops->free(&dl->ops); in disasm_line__free()
801 ins__delete(&dl->ops); in disasm_line__free()
808 return scnprintf(bf, size, "%-6.6s %s", dl->name, dl->ops.raw); in disasm_line__scnprintf()
810 return ins__scnprintf(dl->ins, bf, size, &dl->ops); in disasm_line__scnprintf()
1160 if (dl->ops.target.offset == UINT64_MAX) in symbol__parse_objdump_line()
1161 dl->ops.target.offset = dl->ops.target.addr - in symbol__parse_objdump_line()
1165 if (dl->ins && ins__is_call(dl->ins) && !dl->ops.target.name) { in symbol__parse_objdump_line()
1168 .addr = dl->ops.target.addr, in symbol__parse_objdump_line()
1173 dl->ops.target.name = strdup(target.sym->name); in symbol__parse_objdump_line()
1195 if (dl->ins && dl->ins->ops) { in delete_last_nop()
1196 if (dl->ins->ops != &nop_ops) in delete_last_nop()
1778 if (dl->ops.raw[0] != '\0') { in disasm_line__fprintf()
1780 dl->ops.raw); in disasm_line__fprintf()