Skip to content

Commit 5058c63

Browse files
authored
Decode BH field in print_insn_detail_ppc (#2662)
1 parent 6461ed0 commit 5058c63

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

cstool/cstool_powerpc.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,17 @@ void print_insn_detail_ppc(csh handle, cs_insn *ins)
141141
printf("\tBranch:\n");
142142
printf("\t\tbi: %u\n", ppc->bc.bi);
143143
printf("\t\tbo: %u\n", ppc->bc.bo);
144-
if (ppc->bc.bh != PPC_BH_INVALID)
145-
printf("\t\tbh: %u\n", ppc->bc.bh);
144+
if (ppc->bc.bh != PPC_BH_INVALID) {
145+
int bh=-1;
146+
switch(ppc->bc.bh) {
147+
case PPC_BH_SUBROUTINE_RET: bh=0; break;
148+
case PPC_BH_NO_SUBROUTINE_RET: bh=1; break;
149+
case PPC_BH_NOT_PREDICTABLE: bh=3; break;
150+
case PPC_BH_RESERVED: bh=2; break;
151+
case PPC_BH_INVALID: break;
152+
}
153+
printf("\t\tbh: %u\n", bh);
154+
}
146155
if (ppc->bc.pred_cr != PPC_PRED_INVALID) {
147156
printf("\t\tcrX: %s\n", cs_reg_name(handle, ppc->bc.crX));
148157
printf("\t\tpred CR-bit: %s\n", get_pred_name(ppc->bc.pred_cr));

0 commit comments

Comments
 (0)