From 889ca7f3f29d3b28c56a145f2aa24e1efca0624d Mon Sep 17 00:00:00 2001 From: SarahW Date: Sun, 27 Jan 2019 21:22:35 +0000 Subject: [PATCH] Remove test-USE32-and-mask-PC operation from interpreter as well. --- src/386.c | 2 -- src/386_dynarec.c | 6 ------ src/x86_ops_jump.h | 11 +++++++++++ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/386.c b/src/386.c index 8d18d9a..12428bf 100644 --- a/src/386.c +++ b/src/386.c @@ -263,8 +263,6 @@ dontprint=0; break; } - if (!use32) cpu_state.pc &= 0xffff; - if (cpu_state.abrt) { flags_rebuild(); diff --git a/src/386_dynarec.c b/src/386_dynarec.c index 62af26e..39d1787 100644 --- a/src/386_dynarec.c +++ b/src/386_dynarec.c @@ -567,8 +567,6 @@ void exec386_dynarec(int cycs) x86_opcodes[(opcode | cpu_state.op32) & 0x3ff](fetchdat); } - if (!use32) cpu_state.pc &= 0xffff; - if (((cs + cpu_state.pc) >> 12) != pccache) CPU_BLOCK_END(); @@ -731,8 +729,6 @@ inrecomp=0; break; } - if (!use32) cpu_state.pc &= 0xffff; - /*Cap source code at 4000 bytes per block; this will prevent any block from spanning more than 2 pages. In practice this limit will never be @@ -808,8 +804,6 @@ inrecomp=0; break; } - if (!use32) cpu_state.pc &= 0xffff; - /*Cap source code at 4000 bytes per block; this will prevent any block from spanning more than 2 pages. In practice this limit will never be diff --git a/src/x86_ops_jump.h b/src/x86_ops_jump.h index 292102a..855ddf7 100644 --- a/src/x86_ops_jump.h +++ b/src/x86_ops_jump.h @@ -23,6 +23,8 @@ if (cond_ ## condition) \ { \ cpu_state.pc += offset; \ + if (!(cpu_state.op32 & 0x100)) \ + cpu_state.pc &= 0xffff; \ CLOCK_CYCLES_ALWAYS(timing_bt); \ CPU_BLOCK_END(); \ PREFETCH_RUN(timing_bt+timing_bnt, 2, -1, 0,0,0,0, 0); \ @@ -40,6 +42,7 @@ if (cond_ ## condition) \ { \ cpu_state.pc += offset; \ + cpu_state.pc &= 0xffff; \ CLOCK_CYCLES_ALWAYS(timing_bt); \ CPU_BLOCK_END(); \ PREFETCH_RUN(timing_bt+timing_bnt, 3, -1, 0,0,0,0, 0); \ @@ -95,6 +98,7 @@ static int opLOOPNE_w(uint32_t fetchdat) if (CX && !ZF_SET()) { cpu_state.pc += offset; + cpu_state.pc &= 0xffff; CPU_BLOCK_END(); PREFETCH_FLUSH(); return 1; @@ -126,6 +130,7 @@ static int opLOOPE_w(uint32_t fetchdat) if (CX && ZF_SET()) { cpu_state.pc += offset; + cpu_state.pc &= 0xffff; CPU_BLOCK_END(); PREFETCH_FLUSH(); return 1; @@ -157,6 +162,7 @@ static int opLOOP_w(uint32_t fetchdat) if (CX) { cpu_state.pc += offset; + cpu_state.pc &= 0xffff; CPU_BLOCK_END(); PREFETCH_FLUSH(); return 1; @@ -186,6 +192,7 @@ static int opJCXZ(uint32_t fetchdat) if (!CX) { cpu_state.pc += offset; + cpu_state.pc &= 0xffff; CLOCK_CYCLES(4); CPU_BLOCK_END(); PREFETCH_RUN(9, 2, -1, 0,0,0,0, 0); @@ -217,6 +224,8 @@ static int opJMP_r8(uint32_t fetchdat) { int8_t offset = (int8_t)getbytef(); cpu_state.pc += offset; + if (!(cpu_state.op32 & 0x100)) + cpu_state.pc &= 0xffff; CPU_BLOCK_END(); CLOCK_CYCLES((is486) ? 3 : 7); PREFETCH_RUN(7, 2, -1, 0,0,0,0, 0); @@ -227,6 +236,7 @@ static int opJMP_r16(uint32_t fetchdat) { int16_t offset = (int16_t)getwordf(); cpu_state.pc += offset; + cpu_state.pc &= 0xffff; CPU_BLOCK_END(); CLOCK_CYCLES((is486) ? 3 : 7); PREFETCH_RUN(7, 3, -1, 0,0,0,0, 0); @@ -274,6 +284,7 @@ static int opCALL_r16(uint32_t fetchdat) int16_t addr = (int16_t)getwordf(); PUSH_W(cpu_state.pc); cpu_state.pc += addr; + cpu_state.pc &= 0xffff; CPU_BLOCK_END(); CLOCK_CYCLES((is486) ? 3 : 7); PREFETCH_RUN(7, 3, -1, 0,0,1,0, 0);