diff options
| author | Yang Liu <liuyang22@iscas.ac.cn> | 2023-04-02 16:19:29 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-02 10:19:29 +0200 |
| commit | 2a346ef0b951ce9a2dd7296fbad15f24b7566971 (patch) | |
| tree | fe89ba0440c78eaabf0b8923466f44cf6d51239d /src | |
| parent | 83a2b2080bc27f3ec5185caf9b7790104d9f5461 (diff) | |
| download | box64-2a346ef0b951ce9a2dd7296fbad15f24b7566971.tar.gz box64-2a346ef0b951ce9a2dd7296fbad15f24b7566971.zip | |
[RV64_DYNAREC] Small fixes caught by cosim (#661)
* [RV64_DYNAREC] Fixed emit_xor16 * [RV64_DYNAREC] Fixed an issue with 66 83 /5 SUB * [RV64_DYNAREC] Fixed GETED for 32bit * [RV64_DYNAREC] Fixed more emit_xor*
Diffstat (limited to 'src')
| -rw-r--r-- | src/dynarec/rv64/dynarec_rv64_66.c | 2 | ||||
| -rw-r--r-- | src/dynarec/rv64/dynarec_rv64_emit_logic.c | 10 | ||||
| -rw-r--r-- | src/dynarec/rv64/dynarec_rv64_helper.h | 1 |
3 files changed, 9 insertions, 4 deletions
diff --git a/src/dynarec/rv64/dynarec_rv64_66.c b/src/dynarec/rv64/dynarec_rv64_66.c index 94d3b511..cecb4313 100644 --- a/src/dynarec/rv64/dynarec_rv64_66.c +++ b/src/dynarec/rv64/dynarec_rv64_66.c @@ -320,7 +320,7 @@ uintptr_t dynarec64_66(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni GETEW(x1, (opcode==0x81)?2:1); if(opcode==0x81) i16 = F16S; else i16 = F8S; MOV32w(x5, i16); - emit_sub16(dyn, ninst, x1, x5, x2, x4, x5); + emit_sub16(dyn, ninst, x1, x5, x2, x4, x6); EWBACK; break; case 6: // XOR diff --git a/src/dynarec/rv64/dynarec_rv64_emit_logic.c b/src/dynarec/rv64/dynarec_rv64_emit_logic.c index 8ccb1785..c72e5add 100644 --- a/src/dynarec/rv64/dynarec_rv64_emit_logic.c +++ b/src/dynarec/rv64/dynarec_rv64_emit_logic.c @@ -33,6 +33,7 @@ void emit_xor8(dynarec_rv64_t* dyn, int ninst, int s1, int s2, int s3, int s4) SET_DFNONE(); } XOR(s1, s1, s2); + ANDI(s1, s1, 0xff); IFX(X_SF) { SRLI(s3, s1, 7); BEQZ(s3, 8); @@ -60,6 +61,7 @@ void emit_xor8c(dynarec_rv64_t* dyn, int ninst, int s1, int32_t c, int s3, int s SET_DFNONE(); } XORI(s1, s1, c&0xff); + ANDI(s1, s1, 0xff); IFX(X_SF) { SRLI(s3, s1, 7); BEQZ(s3, 8); @@ -161,18 +163,20 @@ void emit_xor16(dynarec_rv64_t* dyn, int ninst, int s1, int s2, int s3, int s4, } XOR(s1, s1, s2); + SLLI(s1, s1, 48); + SRLI(s1, s1, 48); IFX(X_PEND) { SH(s1, xEmu, offsetof(x64emu_t, res)); } IFX(X_ZF | X_SF) { - SLLI(s3, s1, 48); IFX(X_ZF) { - BNEZ(s3, 8); + BNEZ(s1, 8); ORI(xFlags, xFlags, 1 << F_ZF); } IFX(X_SF) { - BGE(s3, xZR, 8); + SRLI(s3, s1, 15); + BEQZ(s3, 8); ORI(xFlags, xFlags, 1 << F_SF); } } diff --git a/src/dynarec/rv64/dynarec_rv64_helper.h b/src/dynarec/rv64/dynarec_rv64_helper.h index be5931d6..adbf3989 100644 --- a/src/dynarec/rv64/dynarec_rv64_helper.h +++ b/src/dynarec/rv64/dynarec_rv64_helper.h @@ -66,6 +66,7 @@ #define GETED(D) if(MODREG) { \ ed = xRAX+(nextop&7)+(rex.b<<3); \ wback = 0; \ + if (!rex.w) ZEROUP(ed); \ } else { \ SMREAD() \ addr = geted(dyn, addr, ninst, nextop, &wback, x2, x1, &fixedaddress, rex, NULL, 1, D); \ |