Rizin
unix-like reverse engineering framework and cli tools
cstool_systemz.c File Reference
#include <stdio.h>
#include <capstone/capstone.h>

Go to the source code of this file.

Functions

void print_string_hex (char *comment, unsigned char *str, size_t len)
 
void print_insn_detail_sysz (csh handle, cs_insn *ins)
 

Function Documentation

◆ print_insn_detail_sysz()

void print_insn_detail_sysz ( csh  handle,
cs_insn *  ins 
)

Definition at line 10 of file cstool_systemz.c.

11 {
12  cs_sysz *sysz;
13  int i;
14 
15  // detail can be NULL on "data" instruction if SKIPDATA option is turned ON
16  if (ins->detail == NULL)
17  return;
18 
19  sysz = &(ins->detail->sysz);
20  if (sysz->op_count)
21  printf("\top_count: %u\n", sysz->op_count);
22 
23  for (i = 0; i < sysz->op_count; i++) {
24  cs_sysz_op *op = &(sysz->operands[i]);
25  switch((int)op->type) {
26  default:
27  break;
28  case SYSZ_OP_REG:
29  printf("\t\toperands[%u].type: REG = %s\n", i, cs_reg_name(handle, op->reg));
30  break;
31  case SYSZ_OP_ACREG:
32  printf("\t\toperands[%u].type: ACREG = %u\n", i, op->reg);
33  break;
34  case SYSZ_OP_IMM:
35  printf("\t\toperands[%u].type: IMM = 0x%" PRIx64 "\n", i, op->imm);
36  break;
37  case SYSZ_OP_MEM:
38  printf("\t\toperands[%u].type: MEM\n", i);
39  if (op->mem.base != SYSZ_REG_INVALID)
40  printf("\t\t\toperands[%u].mem.base: REG = %s\n",
41  i, cs_reg_name(handle, op->mem.base));
42  if (op->mem.index != SYSZ_REG_INVALID)
43  printf("\t\t\toperands[%u].mem.index: REG = %s\n",
44  i, cs_reg_name(handle, op->mem.index));
45  if (op->mem.length != 0)
46  printf("\t\t\toperands[%u].mem.length: 0x%" PRIx64 "\n", i, op->mem.length);
47  if (op->mem.disp != 0)
48  printf("\t\t\toperands[%u].mem.disp: 0x%" PRIx64 "\n", i, op->mem.disp);
49 
50  break;
51  }
52  }
53 
54  if (sysz->cc != 0)
55  printf("\tCode condition: %u\n", sysz->cc);
56 }
lzma_index ** i
Definition: index.h:629
static mcore_handle handle
Definition: asm_mcore.c:8
@ SYSZ_OP_MEM
= CS_OP_MEM (Memory operand).
Definition: systemz.h:42
@ SYSZ_OP_IMM
= CS_OP_IMM (Immediate operand).
Definition: systemz.h:41
@ SYSZ_OP_ACREG
Access register operand.
Definition: systemz.h:43
@ SYSZ_OP_REG
= CS_OP_REG (Register operand).
Definition: systemz.h:40
@ SYSZ_REG_INVALID
Definition: systemz.h:48
#define NULL
Definition: cris-opc.c:27
CAPSTONE_EXPORT const char *CAPSTONE_API cs_reg_name(csh ud, unsigned int reg)
Definition: cs.c:1154
_Use_decl_annotations_ int __cdecl printf(const char *const _Format,...)
Definition: cs_driver.c:93
Instruction operand.
Definition: systemz.h:101
sysz_cc cc
Definition: systemz.h:112
cs_sysz_op operands[6]
operands for this instruction.
Definition: systemz.h:116
uint8_t op_count
Definition: systemz.h:115
#define PRIx64
Definition: sysdefs.h:94
Definition: dis.c:32

References cs_sysz::cc, cs_reg_name(), handle, i, NULL, cs_sysz::op_count, cs_sysz::operands, printf(), PRIx64, SYSZ_OP_ACREG, SYSZ_OP_IMM, SYSZ_OP_MEM, SYSZ_OP_REG, and SYSZ_REG_INVALID.

Referenced by print_details().

◆ print_string_hex()

void print_string_hex ( char *  comment,
unsigned char *  str,
size_t  len 
)