1
0
Fork 0

fix some register backsave (thanks crazyc for noting); skip addr reg saving if possible

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2929
This commit is contained in:
Sebastian Strohhäcker 2007-07-21 08:46:50 +00:00
parent 0620995611
commit 2773ef7adf
5 changed files with 20 additions and 3 deletions

View file

@ -1000,12 +1000,16 @@ static void dyn_add_iocheck_var(Bit8u accessed_port,Bitu access_size) {
// save back the address register
static void gen_protect_addr_reg(void) {
#ifdef DRC_PROTECT_ADDR_REG
gen_mov_word_from_reg(FC_ADDR,&core_dynrec.protected_regs[FC_ADDR],true);
#endif
}
// restore the address register
static void gen_restore_addr_reg(void) {
#ifdef DRC_PROTECT_ADDR_REG
gen_mov_word_to_reg(FC_ADDR,&core_dynrec.protected_regs[FC_ADDR],true);
#endif
}
// save back an arbitrary register

View file

@ -814,7 +814,7 @@ static bool dyn_grp4_ev(void) {
dyn_get_modrm();
if (decode.modrm.mod<3) {
dyn_fill_ea(FC_ADDR);
if (decode.modrm.reg<2) gen_protect_addr_reg();
if ((decode.modrm.reg<2) || (decode.modrm.reg==3) || (decode.modrm.reg==5)) gen_protect_addr_reg();
dyn_read_word(FC_ADDR,FC_OP1,decode.big_op);
} else {
gen_mov_word_to_reg(FC_OP1,DRCD_REG_WORD(decode.modrm.rm,decode.big_op),decode.big_op);
@ -847,6 +847,7 @@ static bool dyn_grp4_ev(void) {
case 0x3: // CALL Ep
case 0x5: // JMP Ep
if (!decode.big_op) gen_extend_word(false,FC_OP1);
if (decode.modrm.mod<3) gen_restore_addr_reg();
gen_protect_reg(FC_OP1);
gen_add_imm(FC_ADDR,decode.big_op?4:2);
dyn_read_word(FC_ADDR,FC_OP2,decode.big_op);

View file

@ -149,8 +149,10 @@ static void dyn_fpu_esc1(){
gen_mov_word_to_reg(FC_OP1,(void*)(&TOP),true);
gen_add_imm(FC_OP1,decode.modrm.rm);
gen_and_imm(FC_OP1,7);
gen_protect_reg(FC_OP1);
gen_call_function_raw((void*)&FPU_PREP_PUSH);
gen_mov_word_to_reg(FC_OP2,(void*)(&TOP),true);
gen_restore_reg(FC_OP1);
gen_call_function_RR((void*)&FPU_FST,FC_OP1,FC_OP2);
break;
case 0x01: /* FXCH STi */

View file

@ -20,6 +20,9 @@
// some configuring defines that specify the capabilities of this architecture
// or aspects of the recompiling
// protect FC_ADDR over function calls if necessaray
// #define DRC_PROTECT_ADDR_REG
// try to use non-flags generating functions if possible
// #define DRC_FLAGS_INVALIDATION
@ -45,7 +48,9 @@ typedef Bit8u HostReg;
// register that holds function return values
#define FC_RETOP HOST_EAX
// register used for address calculations,
// register used for address calculations, if the ABI does not
// state that this register is preserved across function calls
// then define DRC_PROTECT_ADDR_REG above
#define FC_ADDR HOST_EBX
// register that holds the first parameter

View file

@ -20,6 +20,9 @@
// some configuring defines that specify the capabilities of this architecture
// or aspects of the recompiling
// protect FC_ADDR over function calls if necessaray
// #define DRC_PROTECT_ADDR_REG
// try to use non-flags generating functions if possible
#define DRC_FLAGS_INVALIDATION
@ -52,7 +55,9 @@ enum HostReg {
// register that holds function return values
#define FC_RETOP HOST_EAX
// register used for address calculations,
// register used for address calculations, if the ABI does not
// state that this register is preserved across function calls
// then define DRC_PROTECT_ADDR_REG above
#define FC_ADDR HOST_EBX
// register that holds the first parameter