X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=deps%2Flightrec%2Fdisassembler.c;h=5111d173c7136b2d9cbd0008f8b3c9a9f432b4ee;hb=2fb8465594a7ffb7ccbac39fdedf7c70085d7f63;hp=1a217bc28e2788901674359d423de915c11e39a0;hpb=ba3814c189d3bd2332b66fb6c633a7d028e618fe;p=pcsx_rearmed.git diff --git a/deps/lightrec/disassembler.c b/deps/lightrec/disassembler.c index 1a217bc2..5111d173 100644 --- a/deps/lightrec/disassembler.c +++ b/deps/lightrec/disassembler.c @@ -40,6 +40,10 @@ static const char * const std_opcodes[] = { [OP_SWR] = "swr ", [OP_LWC2] = "lwc2 ", [OP_SWC2] = "swc2 ", + [OP_META_MULT2] = "mult2 ", + [OP_META_MULTU2] = "multu2 ", + [OP_META_LWU] = "lwu ", + [OP_META_SWU] = "swu ", }; static const char * const special_opcodes[] = { @@ -120,6 +124,13 @@ static const char * const cp2_opcodes[] = { [OP_CP2_NCCT] = "ncct ", }; +static const char * const meta_opcodes[] = { + [OP_META_MOV] = "move ", + [OP_META_EXTC] = "extc ", + [OP_META_EXTS] = "exts ", + [OP_META_COM] = "com ", +}; + static const char * const mult2_opcodes[] = { "mult2 ", "multu2 ", }; @@ -133,6 +144,7 @@ static const char * const opcode_io_flags[] = { "self-modifying code", "no invalidation", "no mask", + "load delay", }; static const char * const opcode_io_modes[] = { @@ -149,6 +161,10 @@ static const char * const opcode_branch_flags[] = { "local branch", }; +static const char * const opcode_movi_flags[] = { + "movi", +}; + static const char * const opcode_multdiv_flags[] = { "No LO", "No HI", @@ -295,7 +311,7 @@ static int print_op_special(union code c, char *buf, size_t len, return snprintf(buf, len, "%s%s,%s", special_opcodes[c.r.op], lightrec_reg_name(c.r.rd), - lightrec_reg_name(c.r.rt)); + lightrec_reg_name(c.r.rs)); case OP_SPECIAL_SYSCALL: case OP_SPECIAL_BREAK: return snprintf(buf, len, "%s", special_opcodes[c.r.op]); @@ -395,10 +411,13 @@ static int print_op(union code c, u32 pc, char *buf, size_t len, pc + 4 + ((s16)c.i.imm << 2)); case OP_ADDI: case OP_ADDIU: + case OP_ORI: + *flags_ptr = opcode_movi_flags; + *nb_flags = ARRAY_SIZE(opcode_movi_flags); + fallthrough; case OP_SLTI: case OP_SLTIU: case OP_ANDI: - case OP_ORI: case OP_XORI: return snprintf(buf, len, "%s%s,%s,0x%04hx", std_opcodes[c.i.op], @@ -407,6 +426,8 @@ static int print_op(union code c, u32 pc, char *buf, size_t len, (u16)c.i.imm); case OP_LUI: + *flags_ptr = opcode_movi_flags; + *nb_flags = ARRAY_SIZE(opcode_movi_flags); return snprintf(buf, len, "%s%s,0x%04hx", std_opcodes[c.i.op], lightrec_reg_name(c.i.rt), @@ -427,6 +448,8 @@ static int print_op(union code c, u32 pc, char *buf, size_t len, case OP_SWL: case OP_SW: case OP_SWR: + case OP_META_LWU: + case OP_META_SWU: *flags_ptr = opcode_io_flags; *nb_flags = ARRAY_SIZE(opcode_io_flags); *is_io = true; @@ -444,18 +467,11 @@ static int print_op(union code c, u32 pc, char *buf, size_t len, lightrec_reg_name(c.i.rt), (s16)c.i.imm, lightrec_reg_name(c.i.rs)); - case OP_META_MOV: - return snprintf(buf, len, "move %s,%s", - lightrec_reg_name(c.r.rd), - lightrec_reg_name(c.r.rs)); - case OP_META_EXTC: - return snprintf(buf, len, "extc %s,%s", - lightrec_reg_name(c.i.rt), - lightrec_reg_name(c.i.rs)); - case OP_META_EXTS: - return snprintf(buf, len, "exts %s,%s", - lightrec_reg_name(c.i.rt), - lightrec_reg_name(c.i.rs)); + case OP_META: + return snprintf(buf, len, "%s%s,%s", + meta_opcodes[c.m.op], + lightrec_reg_name(c.m.rd), + lightrec_reg_name(c.m.rs)); case OP_META_MULT2: case OP_META_MULTU2: *flags_ptr = opcode_multdiv_flags;