arch/riscv/RiscvMapping.c
void RISCV_get_insn_id(cs_struct *h, cs_insn *insn, unsigned int id)
{
	unsigned int i;

	i = insn_find(insns, ARR_SIZE(insns), id, &h->insn_cache);
	if (i != 0) {
		insn->id = insns[i].mapid;

		if (h->detail) {
#ifndef CAPSTONE_DIET
			memcpy(insn->detail->regs_read, insns[i].regs_use, sizeof(insns[i].regs_use));
			insn->detail->regs_read_count = (uint8_t)count_positive(insns[i].regs_use);

			memcpy(insn->detail->regs_write, insns[i].regs_mod, sizeof(insns[i].regs_mod));
			insn->detail->regs_write_count = (uint8_t)count_positive(insns[i].regs_mod);

			memcpy(insn->detail->groups, insns[i].groups, sizeof(insns[i].groups));
			insn->detail->groups_count = (uint8_t)count_positive(insns[i].groups);

			if (insns[i].branch || insns[i].indirect_branch) {
				// this insn also belongs to JUMP group. add JUMP group
				insn->detail->groups[insn->detail->groups_count] = MIPS_GRP_JUMP;
				insn->detail->groups_count++;
			}
#endif
		}
	}
}
// given internal insn id, return public instruction info
given internal insn id, return public instruction info
given internal insn id return public instruction info
void RISCV_get_insn_id(cs_struct *h, cs_insn *insn, unsigned int id)
{
	unsigned int i;
	i = insn_find(insns, ARR_SIZE(insns), id, &h->insn_cache);
	if (i != 0) {
		insn->id = insns[i].mapid;
		if (h->detail) {
#ifndef CAPSTONE_DIET
			memcpy(insn->detail->regs_read, insns[i].regs_use, sizeof(insns[i].regs_use));
			insn->detail->regs_read_count = (uint8_t)count_positive(insns[i].regs_use);
			memcpy(insn->detail->regs_write, insns[i].regs_mod, sizeof(insns[i].regs_mod));
			insn->detail->regs_write_count = (uint8_t)count_positive(insns[i].regs_mod);
			memcpy(insn->detail->groups, insns[i].groups, sizeof(insns[i].groups));
			insn->detail->groups_count = (uint8_t)count_positive(insns[i].groups);
			if (insns[i].branch || insns[i].indirect_branch) {
				insn->detail->groups[insn->detail->groups_count] = MIPS_GRP_JUMP;
				insn->detail->groups_count++;
			}
#endif
		}
	}
}
void RISCV_get_insn_id ( cs_struct * h , cs_insn * insn , unsigned int id ) { unsigned int i ; i = insn_find ( insns , ARR_SIZE ( insns ) , id , & h -> insn_cache ) ; if ( i != 0 ) { insn -> id = insns [ i ] . mapid ; if ( h -> detail ) { #ifndef CAPSTONE_DIET memcpy ( insn -> detail -> regs_read , insns [ i ] . regs_use , sizeof ( insns [ i ] . regs_use ) ) ; insn -> detail -> regs_read_count = ( uint8_t ) count_positive ( insns [ i ] . regs_use ) ; memcpy ( insn -> detail -> regs_write , insns [ i ] . regs_mod , sizeof ( insns [ i ] . regs_mod ) ) ; insn -> detail -> regs_write_count = ( uint8_t ) count_positive ( insns [ i ] . regs_mod ) ; memcpy ( insn -> detail -> groups , insns [ i ] . groups , sizeof ( insns [ i ] . groups ) ) ; insn -> detail -> groups_count = ( uint8_t ) count_positive ( insns [ i ] . groups ) ; if ( insns [ i ] . branch || insns [ i ] . indirect_branch ) { insn -> detail -> groups [ insn -> detail -> groups_count ] = MIPS_GRP_JUMP ; insn -> detail -> groups_count ++ ; } #endif } } }
given internal insn id, return public instruction info
given internal insn id return public instruction info
// this insn also belongs to JUMP group. add JUMP group