about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-04-19 14:28:28 +0000
committerptitSeb <sebastien.chev@gmail.com>2023-04-19 14:28:37 +0000
commitc0eace067a1fdfdb2244a4c483a4c86a2d81703d (patch)
tree2a49420235b6543d64ce1b1579b7f0bb2d4b90bc /src
parent9d6835737be2685e69d10c00d93021aac722bfd8 (diff)
downloadbox64-c0eace067a1fdfdb2244a4c483a4c86a2d81703d.tar.gz
box64-c0eace067a1fdfdb2244a4c483a4c86a2d81703d.zip
[RV64_DYNAREC] Some fixes and small improvement to a few opcodes
Diffstat (limited to 'src')
-rw-r--r--src/dynarec/rv64/dynarec_rv64_64.c32
-rw-r--r--src/dynarec/rv64/dynarec_rv64_f20f.c2
-rw-r--r--src/dynarec/rv64/dynarec_rv64_helper.h4
3 files changed, 20 insertions, 18 deletions
diff --git a/src/dynarec/rv64/dynarec_rv64_64.c b/src/dynarec/rv64/dynarec_rv64_64.c
index 0f5c9087..455a8d72 100644
--- a/src/dynarec/rv64/dynarec_rv64_64.c
+++ b/src/dynarec/rv64/dynarec_rv64_64.c
@@ -74,15 +74,15 @@ uintptr_t dynarec64_64(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
             emit_sub32(dyn, ninst, rex, gd, ed, x3, x4, x5);
             break;
 
-        // case 0x33:
-        //     INST_NAME("XOR Gd, Seg:Ed");
-        //     SETFLAGS(X_ALL, SF_SET_PENDING);
-        //     grab_segdata(dyn, addr, ninst, x4, seg);
-        //     nextop = F8;
-        //     GETGD;
-        //     GETEDO(x4, 0, x5);
-        //     emit_xor32(dyn, ninst, rex, gd, ed, x3, x4);
-        //     break;
+        case 0x33:
+            INST_NAME("XOR Gd, Seg:Ed");
+            SETFLAGS(X_ALL, SF_SET_PENDING);
+            grab_segdata(dyn, addr, ninst, x4, seg);
+            nextop = F8;
+            GETGD;
+            GETEDO(x4, 0, x5);
+            emit_xor32(dyn, ninst, rex, gd, ed, x3, x4);
+            break;
 
         case 0x88:
             INST_NAME("MOV Seg:Eb, Gb");
@@ -121,9 +121,9 @@ uintptr_t dynarec64_64(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
                     OR(eb1, x1, gd);
                 }
             } else {
-                addr = geted(dyn, addr, ninst, nextop, &ed, x2, x1, &fixedaddress, rex, NULL, 0, 0);
+                addr = geted(dyn, addr, ninst, nextop, &ed, x2, x1, &fixedaddress, rex, NULL, 1, 0);
                 ADD(x4, ed, x4);
-                SB(gb1, x4, 0);
+                SB(gb1, x4, fixedaddress);
                 SMWRITE2();
             }
             break;
@@ -137,7 +137,7 @@ uintptr_t dynarec64_64(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
             } else {                    // mem <= reg
                 addr = geted(dyn, addr, ninst, nextop, &ed, x2, x1, &fixedaddress, rex, NULL, 1, 0);
                 ADD(x4, ed, x4);
-                SDxw(gd, x4, 0);
+                SDxw(gd, x4, fixedaddress);
                 SMWRITE2();
             }
             break;
@@ -151,9 +151,9 @@ uintptr_t dynarec64_64(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
                 MVxw(gd, xRAX+(nextop&7)+(rex.b<<3));
             } else {       // mem <= reg
                 SMREAD();
-                addr = geted(dyn, addr, ninst, nextop, &ed, x2, x1, &fixedaddress, rex, NULL, 0, 0);
+                addr = geted(dyn, addr, ninst, nextop, &ed, x2, x1, &fixedaddress, rex, NULL, 1, 0);
                 ADD(x4, ed, x4);
-                LDxw(gd, x4, 0);
+                LDxw(gd, x4, fixedaddress);
             }
             break;
         case 0xC7:
@@ -165,11 +165,11 @@ uintptr_t dynarec64_64(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
                 ed = xRAX+(nextop&7)+(rex.b<<3);
                 MOV64xw(ed, i64);
             } else {                    // mem <= i32
-                addr = geted(dyn, addr, ninst, nextop, &ed, x2, x1, &fixedaddress, rex, NULL, 0, 4);
+                addr = geted(dyn, addr, ninst, nextop, &ed, x2, x1, &fixedaddress, rex, NULL, 1, 4);
                 i64 = F32S;
                 MOV64xw(x3, i64);
                 ADD(x4, ed, x4);
-                SDxw(x3, x4, 0);
+                SDxw(x3, x4, fixedaddress);
                 SMWRITE2();
             }
             break;
diff --git a/src/dynarec/rv64/dynarec_rv64_f20f.c b/src/dynarec/rv64/dynarec_rv64_f20f.c
index fed2e5d5..fe902ac1 100644
--- a/src/dynarec/rv64/dynarec_rv64_f20f.c
+++ b/src/dynarec/rv64/dynarec_rv64_f20f.c
@@ -108,6 +108,8 @@ uintptr_t dynarec64_F20F(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int
                 FSFLAGSI(xZR);  // // reset all bits
             }
             FCVTLDxw(gd, v0, RD_RTZ);
+            if(!rex.w)
+                ZEROUP(gd);
             if(!box64_dynarec_fastround) {
                 FRFLAGS(x5);   // get back FPSR to check the IOC bit
                 ANDI(x5, x5, (1<<FR_NV)|(1<<FR_OF));
diff --git a/src/dynarec/rv64/dynarec_rv64_helper.h b/src/dynarec/rv64/dynarec_rv64_helper.h
index 652ef437..867190e1 100644
--- a/src/dynarec/rv64/dynarec_rv64_helper.h
+++ b/src/dynarec/rv64/dynarec_rv64_helper.h
@@ -154,9 +154,9 @@
                     wback = 0;                          \
                 } else {                                \
                     SMREAD();                           \
-                    addr = geted(dyn, addr, ninst, nextop, &wback, x2, S, &fixedaddress, rex, NULL, 0, D); \
+                    addr = geted(dyn, addr, ninst, nextop, &wback, x2, S, &fixedaddress, rex, NULL, 1, D); \
                     ADD(S, wback, O);                   \
-                    LDxw(x1, S, 0);                     \
+                    LDxw(x1, S, fixedaddress);          \
                     ed = x1;                            \
                 }