Skip to content

Commit

Permalink
Other minor fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Extrems committed Nov 21, 2022
1 parent 261abf9 commit 487a0d3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
17 changes: 9 additions & 8 deletions r4300/ppc/MIPS-to-PPC.c
Expand Up @@ -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)){
Expand Down Expand Up @@ -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)){
Expand Down Expand Up @@ -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)){
Expand Down Expand Up @@ -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)){
Expand Down Expand Up @@ -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){
Expand Down
6 changes: 3 additions & 3 deletions r4300/ppc/Recompile.c
Expand Up @@ -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; }

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 );
Expand Down

0 comments on commit 487a0d3

Please sign in to comment.