9 #define GET_BIT(x, n) ((((x)) >> ((n))) & 1)
97 return (instr >> 9) & 0xF;
105 return (instr >> 13) & 1;
113 return (instr >> 5) & 0xF;
117 return (instr >> 1) & 0xF;
128 return (
opc & 1) | ((
opc >> 8) & 0xFE);
139 ut8 opcode = instr >> 14;
141 if (opcode >=
sizeof(
ld_sw) /
sizeof(
void *) || !
ld_sw[opcode]) {
202 "$0x%02x,0x%08x", sh, abs);
391 switch ((
in & 0x1F) ^ 0x11) {
393 if ((
in & 0x1) == 0x1) {
454 if ((
c & 0xC0) != 0xC0) {
463 disp32 = disp16 | ((
c & 0x0100) << 9) | ((
c & 0x0020) << 11);
480 if (!(
c & 0x1) || ((
c >> 6) & 0x3) != 0x3) {
497 switch ((
c >> 11) & (~0x4)) {
508 disp32 = disp16 | (((
c >> 9) & 0x3) << 16);
520 disp32 = disp16 | (((
c >> 9) & 0x3) << 16);
535 disp32 = disp16 | (((
c >> 9) & 0x3) << 16);
550 disp32 = disp16 | (((
c >> 9) & 0x3) << 16);
567 disp16 = (
c & 0x1) | ((
c >> 8) & 0x1E);
573 disp16 = (
c & 0x1) | ((
c >> 8) & 0x1E);
648 return ((
c >> 5) & 0xF);
678 ((
c >> 5) & 0x3) + 1,
695 if (((
c >> 5) & 0xf) == 0xE) {
761 if (((
c >> 5) & 0xF) == 0xE) {
763 if (((
c >> 1) & 0x7) == 0x7) {
769 disp32 = disp | (((
c >> 4) & 0x1) << 16);
774 if (disp32 & 0x10000) {
775 disp32 |= 0xFFFE0000;
778 cmd->reladdr = disp32;
787 disp32 = disp | (((
c >> 1) & 0x7) << 17) | (((
c >> 4) & 1) << 16);
788 if (disp32 & 0x80000) {
789 disp32 |= 0xFFF00000;
792 cmd->reladdr = disp32;
796 disp = (
c & 0x1F) | ((
c >> 4) & 0x1E0);
821 disp32 = disp | (
GET_BIT(
c, 4) << 16);
822 if (disp32 & 0x80000) {
823 disp32 |= 0xFFF00000;
826 cmd->reladdr = disp32;
830 disp = (
c & 0x1F) | ((
c >> 4) & 0x1E0);
866 switch ((
c >> 6) & 0x3) {
903 cmd->operands[0] =
'\0';
934 "0x%x", (
c >> 1) & 0xF);
964 disp32 = disp16 | (((
c >> 1) & 0xF) << 16);
985 if ((
c & 0x1F) != 4) {
992 ((
c >> 5) & 0x3) + 1);
1048 imm32 =
imm | (((
c >> 4) & 1) << 16) | (((
c >> 9) & 1) << 20) | (((
c >> 1) & 0x7) << 17);
1129 if (((
c >> 6) & 0x3) == 0x3) {
1144 switch (((
c >> 13) & 0x2) | (
c & 0x1)) {
1152 abs18 = disp16 | ((
reg & 0x1) << 16) | ((
reg >> 3) << 17);
1155 "$0x%02x,0x%08x", position, abs18);
1167 "$0x%02x,0x%04x(%s)", position,
1173 "$0x%02x,0(%s)", position,
1234 switch ((
in >> 13)) {
const lzma_allocator const uint8_t * in
static int cr16_decode_push_pop(const ut8 *instr, struct cr16_cmd *cmd, int len)
static ut8 cr16_get_opcode_low(const ut16 instr)
static int cr16_decode_bal(const ut8 *instr, struct cr16_cmd *cmd, int len)
static int cr16_print_reg_rel_reg(struct cr16_cmd *cmd, ut32 rel, ut8 srcreg, ut8 dstreg, ut8 swap)
static int cr16_print_reg_reg_rel(struct cr16_cmd *cmd, ut8 src, ut16 rel, ut8 dst, ut8 swap)
int cr16_decode_loadm_storm(const ut8 *instr, struct cr16_cmd *cmd, int len)
static ut8 cr16_get_opcode_i(const ut16 instr)
static int cr16_print_longregreg_reg(struct cr16_cmd *cmd, ut32 rel, ut8 src, ut8 dst, ut8 swap)
static const char * ops_biti[]
static int cr16_decode_r_r(const ut8 *instr, struct cr16_cmd *cmd, int len)
static int cr16_decode_bcond01i(const ut8 *instr, struct cr16_cmd *cmd, int len)
static ut8 cr16_get_cond(const ut16 c)
static ut8 cr16_get_opcode_hi(const ut16 instr)
static int cr16_print_short_abs18(struct cr16_cmd *cmd, ut8 sh, ut32 abs)
static int cr16_print_4biti_opcode(struct cr16_cmd *cmd, ut16 instr)
static const char * cr16_regs_names[]
static int cr16_check_instrs_4bit_bndrs(const ut8 opcode)
static int cr16_print_short_reg_rel(struct cr16_cmd *cmd, ut8 sh, ut16 rel, ut8 reg)
static int cr16_print_reg_med(struct cr16_cmd *cmd, ut16 med, ut8 reg)
static int cr16_print_reg_short(struct cr16_cmd *cmd, ut8 sh, ut8 reg)
int cr16_decode_movd(const ut8 *instr, struct cr16_cmd *cmd, int len)
static ut8 cr16_get_srcreg(const ut16 instr)
static int cr16_print_long_reg(struct cr16_cmd *cmd, ut32 l, ut8 reg, ut8 swap)
static int cr16_decode_misc(const ut8 *instr, struct cr16_cmd *cmd, int len)
static int cr16_print_reg_reg(struct cr16_cmd *cmd, ut8 src, ut8 dst)
int cr16_decode_movz(const ut8 *instr, struct cr16_cmd *cmd, int len)
static int cr16_print_short_reg(struct cr16_cmd *cmd, ut8 sh, ut8 reg)
int cr16_decode_scond(const ut8 *instr, struct cr16_cmd *cmd, int len)
static int cr16_decode_ld_st(const ut8 *instr, struct cr16_cmd *cmd, int len)
static int cr16_check_reg_boundaries(const ut8 reg)
static ut8 cr16_get_dstreg(const ut16 instr)
static int cr16_decode_i_r(const ut8 *instr, struct cr16_cmd *cmd, int len)
static int cr16_decode_jmp(const ut8 *instr, struct cr16_cmd *cmd, int len)
static int cr16_decode_bcond_br(const ut8 *instr, struct cr16_cmd *cmd, int len)
int cr16_decode_muls(const ut8 *instr, struct cr16_cmd *cmd, int len)
static ut16 cr16_get_opcode_159_0(const ut16 opc)
static int cr16_print_ld_sw_opcode(struct cr16_cmd *cmd, ut16 instr)
static const char * ld_sw[]
int cr16_decode_biti(const ut8 *instr, struct cr16_cmd *cmd, int len)
static ut8 cr16_get_short_imm(const ut16 instr)
static const char * instrs_4bit[]
int cr16_decode_command(const ut8 *instr, struct cr16_cmd *cmd, int len)
static int cr16_print_med_reg(struct cr16_cmd *cmd, ut16 med, ut8 reg)
static void cr16_analysis_4bit_opcode(const ut16 in, struct cr16_cmd *cmd)
static int cr16_print_4bit_opcode(struct cr16_cmd *cmd, ut16 instr)
static const char * dedicated_regs[]
static int cr16_decode_slpr(const ut8 *instr, struct cr16_cmd *cmd, int len)
#define CR16_INSTR_MAXLEN
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags cmd
static ut16 rz_read_at_le16(const void *src, size_t offset)
static ut16 rz_read_le16(const void *src)
RZ_API size_t rz_str_ncpy(char *dst, const char *src, size_t n)
Secure string copy with null terminator.