Skip to content

Commit

Permalink
xtensa: add insn format
Browse files Browse the repository at this point in the history
  • Loading branch information
imbillow committed Nov 4, 2024
1 parent 9939073 commit 0661c6c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions Mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ typedef struct insn_map {
loongarch_suppl_info loongarch;
aarch64_suppl_info aarch64;
systemz_suppl_info systemz;
xtensa_suppl_info xtensa;
} suppl_info; // Supplementary information for each instruction.
#endif
} insn_map;
Expand Down
6 changes: 6 additions & 0 deletions arch/Xtensa/XtensaMapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ static void set_instr_map_data(MCInst *MI)
map_implicit_reads(MI, mapping_insns);
map_implicit_writes(MI, mapping_insns);
map_groups(MI, mapping_insns);

const xtensa_suppl_info *suppl_info =
map_get_suppl_info(MI, mapping_insns);
if (suppl_info) {
Xtensa_get_detail(MI)->format = suppl_info->form;
}
#endif
}

Expand Down
1 change: 1 addition & 0 deletions bindings/python/capstone/xtensa.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class CsXtensa(ctypes.Structure):
_fields_ = (
("op_count", ctypes.c_uint8),
("operands", XtensaOp * 8),
("format", ctypes.c_uint32),
)


Expand Down
5 changes: 5 additions & 0 deletions include/capstone/xtensa.h
Original file line number Diff line number Diff line change
Expand Up @@ -1681,6 +1681,10 @@ typedef enum {
// generated content <XtensaGenCSInsnFormatsEnum.inc> end
} xtensa_insn_form;

typedef struct {
xtensa_insn_form form;
} xtensa_suppl_info;

typedef enum cs_xtensa_op_type {
XTENSA_OP_INVALID = CS_OP_INVALID, ///< = (Uninitialized).
XTENSA_OP_REG = CS_OP_REG, ///< = (Register operand).
Expand Down Expand Up @@ -1712,6 +1716,7 @@ typedef struct cs_xtensa_operand {
typedef struct cs_xtensa {
uint8_t op_count;
cs_xtensa_op operands[MAX_XTENSA_OPS];
xtensa_insn_form format;
} cs_xtensa;

#ifdef __cplusplus
Expand Down

0 comments on commit 0661c6c

Please sign in to comment.