From 487a0d30fb05f18609a9aa7f88179e9983a1de8c Mon Sep 17 00:00:00 2001 From: Extrems Date: Mon, 21 Nov 2022 15:38:32 -0500 Subject: [PATCH] Other minor fixes. --- r4300/ppc/MIPS-to-PPC.c | 17 +++++++++-------- r4300/ppc/Recompile.c | 6 +++--- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/r4300/ppc/MIPS-to-PPC.c b/r4300/ppc/MIPS-to-PPC.c index 73c03fe..1e90c2f 100644 --- a/r4300/ppc/MIPS-to-PPC.c +++ b/r4300/ppc/MIPS-to-PPC.c @@ -2082,6 +2082,8 @@ static int LWC1(MIPS_instr mips){ int _rs = MIPS_GET_RS(mips), _rt = MIPS_GET_RT(mips); short immed = MIPS_GET_SIMMED(mips); + genCheckFP(); + #ifdef FASTMEM if(!isDelaySlot){ while(has_next_src() && !is_j_dst(1)){ @@ -2155,6 +2157,8 @@ static int LDC1(MIPS_instr mips){ int _rs = MIPS_GET_RS(mips), _rt = MIPS_GET_RT(mips); short immed = MIPS_GET_SIMMED(mips); + genCheckFP(); + #ifdef FASTMEM if(!isDelaySlot){ while(has_next_src() && !is_j_dst(1)){ @@ -2228,6 +2232,8 @@ static int SWC1(MIPS_instr mips){ int _rs = MIPS_GET_RS(mips), _rt = MIPS_GET_RT(mips); short immed = MIPS_GET_SIMMED(mips); + genCheckFP(); + #ifdef FASTMEM if(!isDelaySlot){ while(has_next_src() && !is_j_dst(1)){ @@ -2301,6 +2307,8 @@ static int SDC1(MIPS_instr mips){ int _rs = MIPS_GET_RS(mips), _rt = MIPS_GET_RT(mips); short immed = MIPS_GET_SIMMED(mips); + genCheckFP(); + #ifdef FASTMEM if(!isDelaySlot){ while(has_next_src() && !is_j_dst(1)){ @@ -5506,15 +5514,8 @@ static void genCallDynaMem(memType type, int count, int _rs, int _rt, short imme if(type < MEM_SW || type > MEM_SD) isUncached = 0; - if(type == MEM_LWC1 || type == MEM_LDC1 || type == MEM_SWC1 || type == MEM_SDC1) - genCheckFP(); - - if(isVirtual){ - flushRegisters(); - reset_code_addr(); - } - int rs = mapRegister(_rs); + if(isVirtual) flushRegisters(); mapRegisterFixed(R3); if(immed || rs != R3){ diff --git a/r4300/ppc/Recompile.c b/r4300/ppc/Recompile.c index 8b40b9e..177da1d 100644 --- a/r4300/ppc/Recompile.c +++ b/r4300/ppc/Recompile.c @@ -86,7 +86,7 @@ int has_next_src(void){ return (src_last-src) > 0; } int is_j_dst(int i){ return isJmpDst[i + ((get_src_pc()&0xfff)>>2)]; } // Returns the MIPS PC unsigned int get_src_pc(void){ return addr_first + ((src-1-src_first)<<2); } -void set_next_dst(PowerPC_instr i){ *(dst++) = i; ++code_length; } +void set_next_dst(PowerPC_instr ppc){ *(dst++) = ppc; ++code_length; } // Adjusts the code_addr for the current instruction to account for flushes void reset_code_addr(void){ if(src<=src_last) code_addr[src-1-src_first] = dst; } @@ -169,7 +169,7 @@ PowerPC_func* recompile_block(PowerPC_block* ppc_block, unsigned int addr){ func->end_addr == (*node)->function->end_addr){ // func is a hole in fn->function PowerPC_func_hole_node* hole = malloc(sizeof(PowerPC_func_hole_node)); - hole->addr = func->start_addr&0xffff; + hole->addr = func->start_addr; hole->next = (*node)->function->holes; (*node)->function->holes = hole; // Free this func since its just a hole now @@ -460,7 +460,7 @@ static int pass0(PowerPC_block* ppc_block){ opcode == MIPS_OPCODE_B || (opcode == MIPS_OPCODE_COP1 && MIPS_GET_RS(*src) == MIPS_FRMT_BC)){ - short bd = MIPS_GET_IMMED(*src); + short bd = MIPS_GET_SIMMED(*src); src+=2; ++pc; if(!is_j_out(bd, 0)){ assert( index + 1 + bd >= 0 && index + 1 + bd < 1024 );