Skip to content

Commit

Permalink
[DYNAREC] Fixed some issue with x87 stack managment
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitSeb committed Mar 29, 2024
1 parent 3992ab5 commit 811c4fc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
28 changes: 14 additions & 14 deletions src/dynarec/dynarec_arm_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -729,28 +729,28 @@ static void x87_purgecache_full(dynarec_arm_t* dyn, int ninst, int next, int s1,
//Stack is full, so STi is just x87reg[i]
int j=0;
while(dyn->n.x87cache[j]!=i) ++j; // look for STi
int st = dyn->n.x87cache[j]+dyn->n.stack_pop;
#if STEP == 1
if(!next) { // don't force promotion here
// pre-apply pop, because purge happens in-between
neoncache_promote_double(dyn, ninst, dyn->n.x87cache[j]+dyn->n.stack_pop);
neoncache_promote_double(dyn, ninst, st);
}
#endif
if(next) {
// need to check if a ST_F need local promotion
if(neoncache_get_st_f(dyn, ninst, dyn->n.x87cache[j])>=0) {
VCVT_F64_F32(0, dyn->n.x87reg[j]*2);
VSTM_64_W(0, s1); // save the value
} else {
#if STEP == 3
if(!next && neoncache_get_current_st(dyn, ninst, st)!=NEON_CACHE_ST_D) {
MESSAGE(LOG_DUMP, "Warning, incoherency with purged ST%d cache\n", st);
}
#endif
switch(neoncache_get_current_st(dyn, ninst, st)) {
case NEON_CACHE_ST_D:
VSTM_64_W(dyn->n.x87reg[j], s1); // save the value
}
} else {
// need to check if a ST_F need local promotion
if(neoncache_get_st_f(dyn, ninst, dyn->n.x87cache[j])>=0) {
break;
case NEON_CACHE_ST_F:
VCVT_F64_F32(0, dyn->n.x87reg[j]*2);
VSTM_64_W(0, s1); // save the value
} else {
VSTM_64_W(dyn->n.x87reg[j], s1); // save the value
}
break;
}
if(!next) {
fpu_free_reg_double(dyn, dyn->n.x87reg[j]);
dyn->n.x87reg[j] = -1;
dyn->n.x87cache[j] = -1;
Expand Down
2 changes: 1 addition & 1 deletion src/dynarec/dynarec_arm_pass.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ uintptr_t arm_pass(dynarec_arm_t* dyn, uintptr_t addr)
}
#endif
ip = addr;
fpu_propagate_stack(dyn, ninst);
if (reset_n!=-1) {
if(reset_n==-2) {
MESSAGE(LOG_DEBUG, "Reset Caches to zero\n");
Expand All @@ -88,7 +89,6 @@ uintptr_t arm_pass(dynarec_arm_t* dyn, uintptr_t addr)
}
reset_n = -1;
}
fpu_propagate_stack(dyn, ninst);
NEW_INST;
#if STEP == 0
if(ninst && dyn->insts[ninst-1].x86.barrier_next) {
Expand Down

0 comments on commit 811c4fc

Please sign in to comment.