X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=deps%2Flightrec%2Finterpreter.c;h=2112b5539b7de1b64ff95ad2c25781f607d72a94;hb=e26c79a878ed1c0ee25cf7dffbb023dca7a871b9;hp=80a07f32534d6279ff07f337814db5ab8c4a6558;hpb=02a5662c31c401081716623cc80bb1c4ab1dbb19;p=pcsx_rearmed.git diff --git a/deps/lightrec/interpreter.c b/deps/lightrec/interpreter.c index 80a07f32..2112b553 100644 --- a/deps/lightrec/interpreter.c +++ b/deps/lightrec/interpreter.c @@ -74,7 +74,7 @@ static inline u32 jump_skip(struct interpreter *inter) static inline u32 jump_next(struct interpreter *inter) { - inter->cycles += lightrec_cycles_of_opcode(inter->op->c); + inter->cycles += lightrec_cycles_of_opcode(inter->state, inter->op->c); if (unlikely(inter->delay_slot)) return 0; @@ -84,7 +84,7 @@ static inline u32 jump_next(struct interpreter *inter) static inline u32 jump_after_branch(struct interpreter *inter) { - inter->cycles += lightrec_cycles_of_opcode(inter->op->c); + inter->cycles += lightrec_cycles_of_opcode(inter->state, inter->op->c); if (unlikely(inter->delay_slot)) return 0; @@ -100,11 +100,11 @@ static void update_cycles_before_branch(struct interpreter *inter) u32 cycles; if (!inter->delay_slot) { - cycles = lightrec_cycles_of_opcode(inter->op->c); + cycles = lightrec_cycles_of_opcode(inter->state, inter->op->c); if (!op_flag_no_ds(inter->op->flags) && has_delay_slot(inter->op->c)) - cycles += lightrec_cycles_of_opcode(next_op(inter)->c); + cycles += lightrec_cycles_of_opcode(inter->state, next_op(inter)->c); inter->cycles += cycles; inter->state->current_cycle += inter->cycles; @@ -155,7 +155,7 @@ static u32 int_delay_slot(struct interpreter *inter, u32 pc, bool branch) bool run_first_op = false, dummy_ld = false, save_rs = false, load_in_ds, branch_in_ds = false, branch_at_addr = false, branch_taken; - u32 old_rs, new_rs, new_rt; + u32 old_rs, new_rt, new_rs = 0; u32 next_pc, ds_next_pc; u32 cause, epc; @@ -236,7 +236,7 @@ static u32 int_delay_slot(struct interpreter *inter, u32 pc, bool branch) branch_taken = is_branch_taken(reg_cache, op_next); pr_debug("Target of impossible branch is a branch, " "%staken.\n", branch_taken ? "" : "not "); - inter->cycles += lightrec_cycles_of_opcode(op_next); + inter->cycles += lightrec_cycles_of_opcode(inter->state, op_next); old_rs = reg_cache[op_next.r.rs]; } else { new_op.c = op_next; @@ -252,7 +252,7 @@ static u32 int_delay_slot(struct interpreter *inter, u32 pc, bool branch) reg_cache[op->r.rs] = old_rs; } - inter->cycles += lightrec_cycles_of_opcode(op_next); + inter->cycles += lightrec_cycles_of_opcode(inter->state, op_next); } } else { next_pc = int_get_ds_pc(inter, 2); @@ -293,7 +293,7 @@ static u32 int_delay_slot(struct interpreter *inter, u32 pc, bool branch) if (dummy_ld) reg_cache[op->r.rt] = new_rt; - inter->cycles += lightrec_cycles_of_opcode(op->c); + inter->cycles += lightrec_cycles_of_opcode(inter->state, op->c); if (branch_at_addr && branch_taken) { /* If the branch at the target of the branch opcode is taken, @@ -306,7 +306,7 @@ static u32 int_delay_slot(struct interpreter *inter, u32 pc, bool branch) inter2.op = &new_op; inter2.block = NULL; - inter->cycles += lightrec_cycles_of_opcode(op_next); + inter->cycles += lightrec_cycles_of_opcode(inter->state, op_next); pr_debug("Running delay slot of branch at target of impossible " "branch\n"); @@ -318,9 +318,9 @@ static u32 int_delay_slot(struct interpreter *inter, u32 pc, bool branch) static u32 int_unimplemented(struct interpreter *inter) { - pr_warn("Unimplemented opcode 0x%08x\n", inter->op->opcode); + lightrec_set_exit_flags(inter->state, LIGHTREC_EXIT_UNKNOWN_OP); - return jump_next(inter); + return inter->block->pc + (inter->offset << 2); } static u32 int_jump(struct interpreter *inter, bool link) @@ -1191,7 +1191,7 @@ static u32 lightrec_emulate_block_list(struct lightrec_state *state, pc = lightrec_int_op(&inter); /* Add the cycles of the last branch */ - inter.cycles += lightrec_cycles_of_opcode(inter.op->c); + inter.cycles += lightrec_cycles_of_opcode(inter.state, inter.op->c); state->current_cycle += inter.cycles;