Skip to content

Commit

Permalink
Fix decode_formatXI
Browse files Browse the repository at this point in the history
  • Loading branch information
imbillow committed Jan 19, 2024
1 parent e5ef61e commit 9488249
Showing 1 changed file with 39 additions and 33 deletions.
72 changes: 39 additions & 33 deletions librz/asm/arch/v850/v850_disas.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,39 +651,46 @@ static bool decode_formatXI(V850_Inst *inst) {
return false;
}
switch (inst->sub_opcode) {
case 0b0001110111: inst->id == V850_CAXI; break;
case 0b0101100000: inst->id == V850_DIV; break;
case 0b0101000000: inst->id == V850_DIVH; break;
case 0b0101000001: inst->id == V850_DIVHU; break;
case 0b0101111110: inst->id == V850_DIVQ; break;
case 0b0101111111: inst->id == V850_DIVQU; break;
case 0b0101100001: inst->id == V850_DIVU; break;
case 0b0100010000: inst->id == V850_MUL; break;
case 0b0100010001: inst->id == V850_MULU; break;
case 0b0001010001: inst->id == V850_SAR; break;
case 0b0111011101: inst->id == V850_SATADD; break;
case 0b0111001101: inst->id == V850_SATSUB; break;
case 0b0001100001: inst->id == V850_SHL; break;
case 0b0001000001: inst->id == V850_SHR; break;
case 0b0001110111: inst->id = V850_CAXI; break;
case 0b0101100000: inst->id = V850_DIV; break;
case 0b0101000000: inst->id = V850_DIVH; break;
case 0b0101000001: inst->id = V850_DIVHU; break;
case 0b0101111110: inst->id = V850_DIVQ; break;
case 0b0101111111: inst->id = V850_DIVQU; break;
case 0b0101100001: inst->id = V850_DIVU; break;
case 0b0100010000: inst->id = V850_MUL; break;
case 0b0100010001: inst->id = V850_MULU; break;
case 0b0001010001: inst->id = V850_SAR; break;
case 0b0111011101: inst->id = V850_SATADD; break;
case 0b0111001101: inst->id = V850_SATSUB; break;
case 0b0001100001: inst->id = V850_SHL; break;
case 0b0001000001: inst->id = V850_SHR; break;
default:
if (inst->reg2 == 0x18 && inst->sub_opcode == 0b0010110000) {
inst->id == V850_JARL;
} else if (inst->reg2 == 0x0c && inst->sub_opcode == 0b0010110000) {
inst->id = V850_POPSP;
} else if (inst->reg2 == 0x08 && inst->sub_opcode == 0b0010110000) {
inst->id = V850_PUSHSP;
} else if ((inst->sub_opcode >> 4) == 0b011101) {
inst->id == V850_ADF;
} else if ((inst->sub_opcode >> 4) == 0b011100) {
inst->id == V850_SBF;
} else if ((inst->sub_opcode >> 4) == 0b011001) {
inst->id == V850_CMOV;
} else if (extract(inst->w2, 5, 7) == 0b0011110) {
inst->id == V850_MAC;
} else if (extract(inst->w2, 5, 7) == 0b0011111) {
inst->id == V850_MACU;
} else {
return false;
switch (inst->sub_opcode) {
case 0b0010110000:
switch (inst->reg2) {
case 0x18: inst->id = V850_JARL; break;
case 0x0c: inst->id = V850_POPSP; break;
case 0x08: inst->id = V850_PUSHSP; break;
default: break;
}
break;
default: {
ut16 sub_opcode_shifted = inst->sub_opcode >> 4;
switch (sub_opcode_shifted) {
case 0b011101: inst->id = V850_ADF; break;
case 0b011100: inst->id = V850_SBF; break;
case 0b011001: inst->id = V850_CMOV; break;
default: {
ut16 ext_res = extract(inst->w2, 5, 7);
switch (ext_res) {
case 0b0011110: inst->id = V850_MAC; break;
case 0b0011111: inst->id = V850_MACU; break;
default: return false;
}
}
}
}
}
break;
}
Expand Down Expand Up @@ -790,7 +797,6 @@ static bool decode_formatXIV(V850_Inst *inst) {
inst->sub_opcode = (inst->w2 & 0xf) | ((inst->w1 >> 11) << 4);

ut16 sub_opcode2 = (inst->w2 & 0x1f) | ((inst->w1 >> 11) << 5);
;
switch (inst->opcode | inst->sub_opcode << 6) {
case 0b111100 | (0b0101 << 6): inst->id = V850_LDB; break;
case 0b111101 | (0b0101 << 6): inst->id = V850_LDBU; break;
Expand Down

0 comments on commit 9488249

Please sign in to comment.