Lines Matching refs:ops
31 static void ins__delete(struct ins_operands *ops) in ins__delete() argument
33 if (ops == NULL) in ins__delete()
35 zfree(&ops->source.raw); in ins__delete()
36 zfree(&ops->source.name); in ins__delete()
37 zfree(&ops->target.raw); in ins__delete()
38 zfree(&ops->target.name); in ins__delete()
42 struct ins_operands *ops) in ins__raw_scnprintf() argument
44 return scnprintf(bf, size, "%-6.6s %s", ins->name, ops->raw); in ins__raw_scnprintf()
48 struct ins_operands *ops) in ins__scnprintf() argument
50 if (ins->ops->scnprintf) in ins__scnprintf()
51 return ins->ops->scnprintf(ins, bf, size, ops); in ins__scnprintf()
53 return ins__raw_scnprintf(ins, bf, size, ops); in ins__scnprintf()
56 static int call__parse(struct ins_operands *ops) in call__parse() argument
60 ops->target.addr = strtoull(ops->raw, &endptr, 16); in call__parse()
73 ops->target.name = strdup(name); in call__parse()
76 return ops->target.name == NULL ? -1 : 0; in call__parse()
81 ops->target.addr = 0; in call__parse()
89 ops->target.addr = strtoull(tok + 1, NULL, 16); in call__parse()
94 struct ins_operands *ops) in call__scnprintf() argument
96 if (ops->target.name) in call__scnprintf()
97 return scnprintf(bf, size, "%-6.6s %s", ins->name, ops->target.name); in call__scnprintf()
99 if (ops->target.addr == 0) in call__scnprintf()
100 return ins__raw_scnprintf(ins, bf, size, ops); in call__scnprintf()
102 return scnprintf(bf, size, "%-6.6s *%" PRIx64, ins->name, ops->target.addr); in call__scnprintf()
112 return ins->ops == &call_ops; in ins__is_call()
115 static int jump__parse(struct ins_operands *ops) in jump__parse() argument
117 const char *s = strchr(ops->raw, '+'); in jump__parse()
119 ops->target.addr = strtoull(ops->raw, NULL, 16); in jump__parse()
122 ops->target.offset = strtoull(s, NULL, 16); in jump__parse()
124 ops->target.offset = UINT64_MAX; in jump__parse()
130 struct ins_operands *ops) in jump__scnprintf() argument
132 return scnprintf(bf, size, "%-6.6s %" PRIx64, ins->name, ops->target.offset); in jump__scnprintf()
142 return ins->ops == &jump_ops; in ins__is_jump()
170 static int lock__parse(struct ins_operands *ops) in lock__parse() argument
174 ops->locked.ops = zalloc(sizeof(*ops->locked.ops)); in lock__parse()
175 if (ops->locked.ops == NULL) in lock__parse()
178 if (disasm_line__parse(ops->raw, &name, &ops->locked.ops->raw) < 0) in lock__parse()
181 ops->locked.ins = ins__find(name); in lock__parse()
184 if (ops->locked.ins == NULL) in lock__parse()
187 if (!ops->locked.ins->ops) in lock__parse()
190 if (ops->locked.ins->ops->parse && in lock__parse()
191 ops->locked.ins->ops->parse(ops->locked.ops) < 0) in lock__parse()
197 zfree(&ops->locked.ops); in lock__parse()
202 struct ins_operands *ops) in lock__scnprintf() argument
206 if (ops->locked.ins == NULL) in lock__scnprintf()
207 return ins__raw_scnprintf(ins, bf, size, ops); in lock__scnprintf()
210 return printed + ins__scnprintf(ops->locked.ins, bf + printed, in lock__scnprintf()
211 size - printed, ops->locked.ops); in lock__scnprintf()
214 static void lock__delete(struct ins_operands *ops) in lock__delete() argument
216 struct ins *ins = ops->locked.ins; in lock__delete()
218 if (ins && ins->ops->free) in lock__delete()
219 ins->ops->free(ops->locked.ops); in lock__delete()
221 ins__delete(ops->locked.ops); in lock__delete()
223 zfree(&ops->locked.ops); in lock__delete()
224 zfree(&ops->target.raw); in lock__delete()
225 zfree(&ops->target.name); in lock__delete()
234 static int mov__parse(struct ins_operands *ops) in mov__parse() argument
236 char *s = strchr(ops->raw, ','), *target, *comment, prev; in mov__parse()
242 ops->source.raw = strdup(ops->raw); in mov__parse()
245 if (ops->source.raw == NULL) in mov__parse()
262 ops->target.raw = strdup(target); in mov__parse()
265 if (ops->target.raw == NULL) in mov__parse()
274 comment__symbol(ops->source.raw, comment, &ops->source.addr, &ops->source.name); in mov__parse()
275 comment__symbol(ops->target.raw, comment, &ops->target.addr, &ops->target.name); in mov__parse()
280 zfree(&ops->source.raw); in mov__parse()
285 struct ins_operands *ops) in mov__scnprintf() argument
288 ops->source.name ?: ops->source.raw, in mov__scnprintf()
289 ops->target.name ?: ops->target.raw); in mov__scnprintf()
297 static int dec__parse(struct ins_operands *ops) in dec__parse() argument
301 target = s = ops->raw; in dec__parse()
308 ops->target.raw = strdup(target); in dec__parse()
311 if (ops->target.raw == NULL) in dec__parse()
321 comment__symbol(ops->target.raw, comment, &ops->target.addr, &ops->target.name); in dec__parse()
327 struct ins_operands *ops) in dec__scnprintf() argument
330 ops->target.name ?: ops->target.raw); in dec__scnprintf()
339 struct ins_operands *ops __maybe_unused) in nop__scnprintf()
352 { .name = "add", .ops = &mov_ops, },
353 { .name = "addl", .ops = &mov_ops, },
354 { .name = "addq", .ops = &mov_ops, },
355 { .name = "addw", .ops = &mov_ops, },
356 { .name = "and", .ops = &mov_ops, },
357 { .name = "bts", .ops = &mov_ops, },
358 { .name = "call", .ops = &call_ops, },
359 { .name = "callq", .ops = &call_ops, },
360 { .name = "cmp", .ops = &mov_ops, },
361 { .name = "cmpb", .ops = &mov_ops, },
362 { .name = "cmpl", .ops = &mov_ops, },
363 { .name = "cmpq", .ops = &mov_ops, },
364 { .name = "cmpw", .ops = &mov_ops, },
365 { .name = "cmpxch", .ops = &mov_ops, },
366 { .name = "dec", .ops = &dec_ops, },
367 { .name = "decl", .ops = &dec_ops, },
368 { .name = "imul", .ops = &mov_ops, },
369 { .name = "inc", .ops = &dec_ops, },
370 { .name = "incl", .ops = &dec_ops, },
371 { .name = "ja", .ops = &jump_ops, },
372 { .name = "jae", .ops = &jump_ops, },
373 { .name = "jb", .ops = &jump_ops, },
374 { .name = "jbe", .ops = &jump_ops, },
375 { .name = "jc", .ops = &jump_ops, },
376 { .name = "jcxz", .ops = &jump_ops, },
377 { .name = "je", .ops = &jump_ops, },
378 { .name = "jecxz", .ops = &jump_ops, },
379 { .name = "jg", .ops = &jump_ops, },
380 { .name = "jge", .ops = &jump_ops, },
381 { .name = "jl", .ops = &jump_ops, },
382 { .name = "jle", .ops = &jump_ops, },
383 { .name = "jmp", .ops = &jump_ops, },
384 { .name = "jmpq", .ops = &jump_ops, },
385 { .name = "jna", .ops = &jump_ops, },
386 { .name = "jnae", .ops = &jump_ops, },
387 { .name = "jnb", .ops = &jump_ops, },
388 { .name = "jnbe", .ops = &jump_ops, },
389 { .name = "jnc", .ops = &jump_ops, },
390 { .name = "jne", .ops = &jump_ops, },
391 { .name = "jng", .ops = &jump_ops, },
392 { .name = "jnge", .ops = &jump_ops, },
393 { .name = "jnl", .ops = &jump_ops, },
394 { .name = "jnle", .ops = &jump_ops, },
395 { .name = "jno", .ops = &jump_ops, },
396 { .name = "jnp", .ops = &jump_ops, },
397 { .name = "jns", .ops = &jump_ops, },
398 { .name = "jnz", .ops = &jump_ops, },
399 { .name = "jo", .ops = &jump_ops, },
400 { .name = "jp", .ops = &jump_ops, },
401 { .name = "jpe", .ops = &jump_ops, },
402 { .name = "jpo", .ops = &jump_ops, },
403 { .name = "jrcxz", .ops = &jump_ops, },
404 { .name = "js", .ops = &jump_ops, },
405 { .name = "jz", .ops = &jump_ops, },
406 { .name = "lea", .ops = &mov_ops, },
407 { .name = "lock", .ops = &lock_ops, },
408 { .name = "mov", .ops = &mov_ops, },
409 { .name = "movb", .ops = &mov_ops, },
410 { .name = "movdqa",.ops = &mov_ops, },
411 { .name = "movl", .ops = &mov_ops, },
412 { .name = "movq", .ops = &mov_ops, },
413 { .name = "movslq", .ops = &mov_ops, },
414 { .name = "movzbl", .ops = &mov_ops, },
415 { .name = "movzwl", .ops = &mov_ops, },
416 { .name = "nop", .ops = &nop_ops, },
417 { .name = "nopl", .ops = &nop_ops, },
418 { .name = "nopw", .ops = &nop_ops, },
419 { .name = "or", .ops = &mov_ops, },
420 { .name = "orl", .ops = &mov_ops, },
421 { .name = "test", .ops = &mov_ops, },
422 { .name = "testb", .ops = &mov_ops, },
423 { .name = "testl", .ops = &mov_ops, },
424 { .name = "xadd", .ops = &mov_ops, },
425 { .name = "xbeginl", .ops = &jump_ops, },
426 { .name = "xbeginq", .ops = &jump_ops, },
674 if (!dl->ins->ops) in disasm_line__init_ins()
677 if (dl->ins->ops->parse && dl->ins->ops->parse(&dl->ops) < 0) in disasm_line__init_ins()
731 if (disasm_line__parse(dl->line, &dl->name, &dl->ops.raw) < 0) in disasm_line__new()
751 if (dl->ins && dl->ins->ops->free) in disasm_line__free()
752 dl->ins->ops->free(&dl->ops); in disasm_line__free()
754 ins__delete(&dl->ops); in disasm_line__free()
761 return scnprintf(bf, size, "%-6.6s %s", dl->name, dl->ops.raw); in disasm_line__scnprintf()
763 return ins__scnprintf(dl->ins, bf, size, &dl->ops); in disasm_line__scnprintf()
1025 if (dl->ops.target.offset == UINT64_MAX) in symbol__parse_objdump_line()
1026 dl->ops.target.offset = dl->ops.target.addr - in symbol__parse_objdump_line()
1030 if (dl->ins && ins__is_call(dl->ins) && !dl->ops.target.name) { in symbol__parse_objdump_line()
1033 .addr = dl->ops.target.addr, in symbol__parse_objdump_line()
1038 dl->ops.target.name = strdup(target.sym->name); in symbol__parse_objdump_line()
1060 if (dl->ins && dl->ins->ops) { in delete_last_nop()
1061 if (dl->ins->ops != &nop_ops) in delete_last_nop()
1590 if (dl->ops.raw[0] != '\0') { in disasm_line__fprintf()
1592 dl->ops.raw); in disasm_line__fprintf()