diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-06-05 10:23:32 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-06-05 10:23:38 +0200 |
| commit | 05abd88ea59e62e2a3a046a20c1b6b90bc9e4702 (patch) | |
| tree | d4446212e0ea5f1dc5565832228dbb084691438a /src | |
| parent | 42670c0130172da006357ba0f455a2a209bdebf8 (diff) | |
| download | box64-05abd88ea59e62e2a3a046a20c1b6b90bc9e4702.tar.gz box64-05abd88ea59e62e2a3a046a20c1b6b90bc9e4702.zip | |
[DYNAREC] Various small fixes to flags handling
Diffstat (limited to 'src')
| -rwxr-xr-x | src/dynarec/dynarec_arm64_00.c | 16 | ||||
| -rwxr-xr-x | src/dynarec/dynarec_arm64_0f.c | 10 | ||||
| -rwxr-xr-x | src/dynarec/dynarec_arm64_66.c | 4 | ||||
| -rwxr-xr-x | src/dynarec/dynarec_arm64_660f.c | 8 | ||||
| -rwxr-xr-x | src/dynarec/dynarec_arm64_f30f.c | 4 | ||||
| -rwxr-xr-x | src/emu/x64primop.c | 16 |
6 files changed, 29 insertions, 29 deletions
diff --git a/src/dynarec/dynarec_arm64_00.c b/src/dynarec/dynarec_arm64_00.c index a3b0e592..61c2d196 100755 --- a/src/dynarec/dynarec_arm64_00.c +++ b/src/dynarec/dynarec_arm64_00.c @@ -307,7 +307,7 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin break; case 0x24: INST_NAME("AND AL, Ib"); - SETFLAGS(X_ALL, SF_PENDING); + SETFLAGS(X_ALL, SF_SET); u8 = F8; UXTBw(x1, xRAX); emit_and8c(dyn, ninst, x1, u8, x3, x4); @@ -1126,7 +1126,7 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin case 1: case 2: if(rep==1) {INST_NAME("REPNZ CMPSB");} else {INST_NAME("REPZ CMPSB");} - SETFLAGS(X_ALL, SF_SET); + SETFLAGS(X_ALL, SF_MAYSET); CBZx_NEXT(xRCX); TBNZ_MARK2(xFlags, F_DF); MARK; // Part with DF==0 @@ -1225,7 +1225,7 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin case 1: case 2: if(rep==1) {INST_NAME("REPNZ SCASB");} else {INST_NAME("REPZ SCASB");} - SETFLAGS(X_ALL, SF_SET); + SETFLAGS(X_ALL, SF_MAYSET); CBZx_NEXT(xRCX); UBFXw(x1, xRAX, 0, 8); TBNZ_MARK2(xFlags, F_DF); @@ -1589,7 +1589,7 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin INST_NAME("ROL Eb, CL"); ANDSw_mask(x2, xRCX, 0, 0b00100); } - SETFLAGS(X_OF|X_CF, SF_SUBSET); + SETFLAGS(X_OF|X_CF, SF_SET); GETEB(x1, 0); CALL_(rol8, x1, x3); EBBACK; @@ -1602,7 +1602,7 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin INST_NAME("ROR Eb, CL"); ANDSw_mask(x2, xRCX, 0, 0b00100); } - SETFLAGS(X_OF|X_CF, SF_SUBSET); + SETFLAGS(X_OF|X_CF, SF_SET); GETEB(x1, 0); CALL_(ror8, x1, x3); EBBACK; @@ -1792,7 +1792,7 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin case 2: INST_NAME("RCL Ed, CL"); READFLAGS(X_CF); - SETFLAGS(X_OF|X_CF, SF_SUBSET); + SETFLAGS(X_OF|X_CF, SF_SET); if(rex.w) { ANDSx_mask(x2, xRCX, 1, 0, 0b00101); //mask=0x000000000000003f } else { @@ -1807,7 +1807,7 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin case 3: INST_NAME("RCR Ed, CL"); READFLAGS(X_CF); - SETFLAGS(X_OF|X_CF, SF_SUBSET); + SETFLAGS(X_OF|X_CF, SF_SET); if(rex.w) { ANDSx_mask(x2, xRCX, 1, 0, 0b00101); //mask=0x000000000000003f } else { @@ -2041,7 +2041,7 @@ uintptr_t dynarec64_00(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin case 0xF5: INST_NAME("CMC"); READFLAGS(X_CF); - SETFLAGS(X_CF, SF_SET); + SETFLAGS(X_CF, SF_SUBSET); EORw_mask(xFlags, xFlags, 0, 0); //mask=0x00000001 break; case 0xF6: diff --git a/src/dynarec/dynarec_arm64_0f.c b/src/dynarec/dynarec_arm64_0f.c index 37107026..a352d127 100755 --- a/src/dynarec/dynarec_arm64_0f.c +++ b/src/dynarec/dynarec_arm64_0f.c @@ -1307,7 +1307,7 @@ uintptr_t dynarec64_0F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin break; case 0xBB: INST_NAME("BTC Ed, Gd"); - SETFLAGS(X_CF, SF_SET); + SETFLAGS(X_CF, SF_SUBSET); SET_DFNONE(x1); nextop = F8; GETGD; @@ -1343,7 +1343,8 @@ uintptr_t dynarec64_0F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin break; case 0xBC: INST_NAME("BSF Gd, Ed"); - SETFLAGS(X_ZF, SF_SET); + SETFLAGS(X_ZF, SF_SUBSET); + SET_DFNONE(x1); nextop = F8; GETED(0); GETGD; @@ -1354,11 +1355,11 @@ uintptr_t dynarec64_0F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin MARK; CSETw(x1, cEQ); //ZF not set BFIw(xFlags, x1, F_ZF, 1); - SET_DFNONE(x1); break; case 0xBD: INST_NAME("BSR Gd, Ed"); - SETFLAGS(X_ZF, SF_SET); + SETFLAGS(X_ZF, SF_SUBSET); + SET_DFNONE(x1); nextop = F8; GETED(0); GETGD; @@ -1370,7 +1371,6 @@ uintptr_t dynarec64_0F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin MARK; CSETw(x1, cEQ); //ZF not set BFIw(xFlags, x1, F_ZF, 1); - SET_DFNONE(x1); break; case 0xBE: INST_NAME("MOVSX Gd, Eb"); diff --git a/src/dynarec/dynarec_arm64_66.c b/src/dynarec/dynarec_arm64_66.c index ac78b267..f5ca99da 100755 --- a/src/dynarec/dynarec_arm64_66.c +++ b/src/dynarec/dynarec_arm64_66.c @@ -78,7 +78,7 @@ uintptr_t dynarec64_66(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin break; case 0x05: INST_NAME("ADD AX, Iw"); - SETFLAGS(X_ALL, SF_PENDING); + SETFLAGS(X_ALL, SF_SET); i32 = F16; UXTHw(x1, xRAX); MOV32w(x2, i32); @@ -818,7 +818,7 @@ uintptr_t dynarec64_66(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int nin break; case 1: INST_NAME("DEC Ew"); - SETFLAGS(X_ALL&~X_CF, SF_SET); + SETFLAGS(X_ALL&~X_CF, SF_SUBSET); GETEW(x1, 0); emit_dec16(dyn, ninst, x1, x2, x4); EWBACK; diff --git a/src/dynarec/dynarec_arm64_660f.c b/src/dynarec/dynarec_arm64_660f.c index 3cb870bf..76512132 100755 --- a/src/dynarec/dynarec_arm64_660f.c +++ b/src/dynarec/dynarec_arm64_660f.c @@ -1028,7 +1028,8 @@ uintptr_t dynarec64_660F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int n break; case 0xBC: INST_NAME("BSF Ew,Gw"); - SETFLAGS(X_ZF, SF_SET); + SETFLAGS(X_ZF, SF_SUBSET); + SET_DFNONE(x1); nextop = F8; GETGD; GETEW(x1, 0); // Get EW @@ -1040,11 +1041,11 @@ uintptr_t dynarec64_660F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int n MARK; CSETw(x1, cEQ); //ZF not set BFIw(xFlags, x1, F_ZF, 1); - SET_DFNONE(x1); break; case 0xBD: INST_NAME("BSR Ew,Gw"); - SETFLAGS(X_ZF, SF_SET); + SETFLAGS(X_ZF, SF_SUBSET); + SET_DFNONE(x1); nextop = F8; GETGD; GETEW(x1, 0); // Get EW @@ -1058,7 +1059,6 @@ uintptr_t dynarec64_660F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int n MARK; CSETw(x1, cEQ); //ZF not set BFIw(xFlags, x1, F_ZF, 1); - SET_DFNONE(x1); break; case 0xBE: INST_NAME("MOVSX Gw, Eb"); diff --git a/src/dynarec/dynarec_arm64_f30f.c b/src/dynarec/dynarec_arm64_f30f.c index 1fe3fd43..741fb660 100755 --- a/src/dynarec/dynarec_arm64_f30f.c +++ b/src/dynarec/dynarec_arm64_f30f.c @@ -336,11 +336,11 @@ uintptr_t dynarec64_F30F(dynarec_arm_t* dyn, uintptr_t addr, uintptr_t ip, int n case 0xBC: INST_NAME("TZCNT Gd, Ed"); - SETFLAGS(X_CF|X_ZF, SF_SET); + SETFLAGS(X_CF|X_ZF, SF_SUBSET); + SET_DFNONE(x1); nextop = F8; GETED(0); GETGD; - SET_DFNONE(x1); TSTxw_REG(ed, ed); BFIw(xFlags, x1, F_CF, 1); // CF = is source 0? RBITxw(x1, ed); // reverse diff --git a/src/emu/x64primop.c b/src/emu/x64primop.c index 83bcd046..789f4866 100755 --- a/src/emu/x64primop.c +++ b/src/emu/x64primop.c @@ -785,7 +785,7 @@ uint8_t rol8(x64emu_t *emu, uint8_t d, uint8_t s) if((cnt = s % 8) != 0) { d = (d << cnt) + ((d >> (8 - cnt)) & ((1 << cnt) - 1)); } - RESET_FLAGS(emu); + CHECK_FLAGS(emu); /* OF flag is set if s == 1; OF = CF _XOR_ MSB of result */ if(s == 1) { @@ -808,7 +808,7 @@ uint16_t rol16(x64emu_t *emu, uint16_t d, uint8_t s) if((cnt = s % 16) != 0) { d = (d << cnt) + ((d >> (16 - cnt)) & ((1 << cnt) - 1)); } - RESET_FLAGS(emu); + CHECK_FLAGS(emu); /* OF flag is set if s == 1; OF = CF _XOR_ MSB of result */ if(s == 1) { @@ -831,7 +831,7 @@ uint32_t rol32(x64emu_t *emu, uint32_t d, uint8_t s) if((cnt = s % 32) != 0) { d = (d << cnt) + ((d >> (32 - cnt)) & ((1 << cnt) - 1)); } - RESET_FLAGS(emu); + CHECK_FLAGS(emu); /* OF flag is set if s == 1; OF = CF _XOR_ MSB of result */ if(s == 1) { @@ -854,7 +854,7 @@ uint64_t rol64(x64emu_t *emu, uint64_t d, uint8_t s) if((cnt = s % 64) != 0) { d = (d << cnt) + ((d >> (64 - cnt)) & ((1L << cnt) - 1)); } - RESET_FLAGS(emu); + CHECK_FLAGS(emu); /* OF flag is set if s == 1; OF = CF _XOR_ MSB of result */ if(s == 1) { @@ -881,7 +881,7 @@ uint8_t ror8(x64emu_t *emu, uint8_t d, uint8_t s) if((cnt = s % 8) != 0) { d = (d << (8 - cnt)) + ((d >> (cnt)) & ((1 << (8 - cnt)) - 1)); } - RESET_FLAGS(emu); + CHECK_FLAGS(emu); /* OF flag is set if s == 1; OF = MSB _XOR_ (M-1)SB of result */ if(s == 1) { @@ -904,7 +904,7 @@ uint16_t ror16(x64emu_t *emu, uint16_t d, uint8_t s) if((cnt = s % 16) != 0) { d = (d << (16 - cnt)) + ((d >> (cnt)) & ((1 << (16 - cnt)) - 1)); } - RESET_FLAGS(emu); + CHECK_FLAGS(emu); /* OF flag is set if s == 1; OF = MSB _XOR_ (M-1)SB of result */ if(s == 1) { @@ -927,7 +927,7 @@ uint32_t ror32(x64emu_t *emu, uint32_t d, uint8_t s) if((cnt = s % 32) != 0) { d = (d << (32 - cnt)) + ((d >> (cnt)) & ((1 << (32 - cnt)) - 1)); } - RESET_FLAGS(emu); + CHECK_FLAGS(emu); /* OF flag is set if s == 1; OF = MSB _XOR_ (M-1)SB of result */ if(s == 1) { @@ -950,7 +950,7 @@ uint64_t ror64(x64emu_t *emu, uint64_t d, uint8_t s) if((cnt = s % 64) != 0) { d = (d << (64 - cnt)) + ((d >> (cnt)) & ((1L << (64 - cnt)) - 1L)); } - RESET_FLAGS(emu); + CHECK_FLAGS(emu); /* OF flag is set if s == 1; OF = MSB _XOR_ (M-1)SB of result */ if(s == 1) { |