about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorZoHan <114734429+LiZhuoheng-coder@users.noreply.github.com>2024-04-03 18:04:07 +0800
committerGitHub <noreply@github.com>2024-04-03 12:04:07 +0200
commitaf685a263b2f0063d9ee40fc0f772ea5bb0983d4 (patch)
tree20c95349851ea1919dba844920fc5d9c18ef01a6 /src
parent31e8afa622f39b10fab41cde4250cf2152bb2340 (diff)
downloadbox64-af685a263b2f0063d9ee40fc0f772ea5bb0983d4.tar.gz
box64-af685a263b2f0063d9ee40fc0f772ea5bb0983d4.zip
[RV64_DYNAREC] Add 1E/1F opcode (#1407)
* [RV64_DYNAREC] Add 1E/1F opcode

* modify the format

* modify the format
Diffstat (limited to 'src')
-rw-r--r--src/dynarec/rv64/dynarec_rv64_00_0.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/dynarec/rv64/dynarec_rv64_00_0.c b/src/dynarec/rv64/dynarec_rv64_00_0.c
index a0d074fe..716671d5 100644
--- a/src/dynarec/rv64/dynarec_rv64_00_0.c
+++ b/src/dynarec/rv64/dynarec_rv64_00_0.c
@@ -108,15 +108,17 @@ uintptr_t dynarec64_00_0(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int
             } else {
                 DEFAULT;
             }
+            break;
         case 0x07:
             if (rex.is32bits) {
                 INST_NAME("POP ES");
                 POP1_32(x1);
                 SH(x1, xEmu, offsetof(x64emu_t, segs[_ES]));
-                SW(x1, xEmu, offsetof(x64emu_t, segs_serial[_ES]));
+                SW(xZR, xEmu, offsetof(x64emu_t, segs_serial[_ES]));
             } else {
                 DEFAULT;
             }
+            break;
         case 0x08:
             INST_NAME("OR Eb, Gb");
             SETFLAGS(X_ALL, SF_SET_PENDING);
@@ -135,7 +137,6 @@ uintptr_t dynarec64_00_0(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int
             emit_or32(dyn, ninst, rex, ed, gd, x3, x4);
             WBACK;
             break;
-
         case 0x0A:
             INST_NAME("OR Gb, Eb");
             SETFLAGS(X_ALL, SF_SET_PENDING);
@@ -250,16 +251,18 @@ uintptr_t dynarec64_00_0(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int
             } else {
                 DEFAULT;
             }
+            break;
         case 0x17:
             if (rex.is32bits) {
                 INST_NAME("POP SS");
                 SMREAD();
                 POP1_32(x1);
                 SH(x1, xEmu, offsetof(x64emu_t, segs[_SS]));
-                SW(x1, xEmu, offsetof(x64emu_t, segs_serial[_SS]));
+                SW(xZR, xEmu, offsetof(x64emu_t, segs_serial[_SS]));
             } else {
                 DEFAULT;
             }
+            break;
         case 0x18:
             INST_NAME("SBB Eb, Gb");
             READFLAGS(X_CF);
@@ -317,7 +320,27 @@ uintptr_t dynarec64_00_0(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int
             MOV64xw(x2, i64);
             emit_sbb32(dyn, ninst, rex, xRAX, x2, x3, x4, x5);
             break;
-
+        case 0x1E:
+            if (rex.is32bits) {
+                INST_NAME("PUSH DS");
+                LHU(x1, xEmu, offsetof(x64emu_t, segs[_DS]));
+                PUSH1_32(x1);
+                SMWRITE();
+            } else {
+                DEFAULT;
+            }
+            break;
+        case 0x1F:
+            if(rex.is32bits) {
+                INST_NAME("POP DS");
+                SMREAD();
+                POP1_32(x1);
+                SH(x1, xEmu, offsetof(x64emu_t, segs[_DS]));
+                SW(xZR, xEmu, offsetof(x64emu_t, segs_serial[_DS]));
+            } else {
+                DEFAULT;
+            }
+            break;
         case 0x20:
             INST_NAME("AND Eb, Gb");
             SETFLAGS(X_ALL, SF_SET_PENDING);