- if (forceraw)
- goto raw;
-
- if (!(operand & 0x800)) {
- stmt->u.insn.operands[out_idx] = disasm_mem_operand(operand);
- return;
- } else if ((operand & 0xC00) == 0xC00) {
- stmt->u.insn.operands[out_idx] = disasm_imm_operand(operand);
- return;
- } else if ((operand & 0xFC0) == 0xBC0) {
- stmt->u.insn.operands[out_idx] = disasm_gpr_operand(operand);
- return;
- } else if ((operand & 0xE00) == 0x800) {
- stmt->u.insn.operands[out_idx] = disasm_spr_operand(operand);
- return;
- } else if ((operand & 0xFF8) == 0x860) {
- stmt->u.insn.operands[out_idx] = disasm_offr_operand(operand);
- return;
- } else if ((operand & 0xE00) == 0xA00) {
- stmt->u.insn.operands[out_idx] = disasm_indirect_mem_operand(operand);
- return;
+ switch (cmdargs.arch) {
+ case 5:
+ if (!(operand & 0x800)) {
+ stmt->u.insn.operands[out_idx] = disasm_mem_operand(operand);
+ return;
+ } else if ((operand & 0xC00) == 0xC00) {
+ stmt->u.insn.operands[out_idx] = disasm_imm_operand(operand);
+ return;
+ } else if ((operand & 0xFC0) == 0xBC0) {
+ stmt->u.insn.operands[out_idx] = disasm_gpr_operand(operand);
+ return;
+ } else if ((operand & 0xE00) == 0x800) {
+ stmt->u.insn.operands[out_idx] = disasm_spr_operand(operand);
+ return;
+ } else if ((operand & 0xE00) == 0xA00) {
+ stmt->u.insn.operands[out_idx] = disasm_indirect_mem_operand(operand);
+ return;
+ }
+ break;
+ case 15:
+ if (!(operand & 0x1000)) {
+ stmt->u.insn.operands[out_idx] = disasm_mem_operand(operand);
+ return;
+ } else if ((operand & 0x1800) == 0x1800) {
+ stmt->u.insn.operands[out_idx] = disasm_imm_operand(operand);
+ return;
+ } else if ((operand & 0x1F80) == 0x1780) {
+ stmt->u.insn.operands[out_idx] = disasm_gpr_operand(operand);
+ return;
+ } else if ((operand & 0x1C00) == 0x1000) {
+ stmt->u.insn.operands[out_idx] = disasm_spr_operand(operand);
+ return;
+ } else if ((operand & 0x1C00) == 0x1400) {
+ stmt->u.insn.operands[out_idx] = disasm_indirect_mem_operand(operand);
+ return;
+ }
+ break;
+ default:
+ dasm_int_error("disasm_std_operand invalid arch");
+ }
+ /* No luck. Disassemble to raw operand. */
+ disasm_raw_operand(stmt, oper_idx, out_idx);
+}
+
+static void disasm_opcode_raw(struct disassembler_context *ctx,
+ struct statement *stmt,
+ int raw_operands)
+{
+ stmt->u.insn.name = gen_raw_code(stmt->u.insn.bin->opcode);
+ if (raw_operands) {
+ disasm_raw_operand(stmt, 0, 0);
+ disasm_raw_operand(stmt, 1, 1);
+ disasm_raw_operand(stmt, 2, 2);
+ } else {
+ disasm_std_operand(stmt, 0, 0);
+ disasm_std_operand(stmt, 1, 1);
+ disasm_std_operand(stmt, 2, 2);