about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorxctan <xctan@cirno.icu>2024-08-13 02:11:19 +0800
committerGitHub <noreply@github.com>2024-08-12 20:11:19 +0200
commitf364c039646e5bb35c9508384f451e31360e65e3 (patch)
tree80f09d7a2b8c050a31fb6649d72863b1aec2cdb8 /src
parent730eb1f472d823201f65fab41c6880cd2462ec7d (diff)
downloadbox64-f364c039646e5bb35c9508384f451e31360e65e3.tar.gz
box64-f364c039646e5bb35c9508384f451e31360e65e3.zip
[RV64_DYNAREC] More fixes (#1732)
* [RV64_DYNAREC] Fixed pending flag type in emit_sar16

* [RV64_DYNAREC] Fixed imm12 overflow in geted

* [SYSCALL] Added fake sys_init_module
Diffstat (limited to 'src')
-rw-r--r--src/dynarec/rv64/dynarec_rv64_emit_shift.c2
-rw-r--r--src/dynarec/rv64/dynarec_rv64_helper.c6
-rw-r--r--src/emu/x64syscall.c4
3 files changed, 8 insertions, 4 deletions
diff --git a/src/dynarec/rv64/dynarec_rv64_emit_shift.c b/src/dynarec/rv64/dynarec_rv64_emit_shift.c
index 7f858cf9..5bcbcd2b 100644
--- a/src/dynarec/rv64/dynarec_rv64_emit_shift.c
+++ b/src/dynarec/rv64/dynarec_rv64_emit_shift.c
@@ -616,7 +616,7 @@ void emit_sar16(dynarec_rv64_t* dyn, int ninst, int s1, int s2, int s3, int s4,
     IFX(X_PEND) {
         SH(s2, xEmu, offsetof(x64emu_t, op2));
         SH(s1, xEmu, offsetof(x64emu_t, op1));
-        SET_DF(s4, d_sar8);
+        SET_DF(s4, d_sar16);
     } else IFX(X_ALL) {
         SET_DFNONE();
     }
diff --git a/src/dynarec/rv64/dynarec_rv64_helper.c b/src/dynarec/rv64/dynarec_rv64_helper.c
index 3d96dbc2..0deaa093 100644
--- a/src/dynarec/rv64/dynarec_rv64_helper.c
+++ b/src/dynarec/rv64/dynarec_rv64_helper.c
@@ -125,7 +125,7 @@ uintptr_t geted(dynarec_rv64_t* dyn, uintptr_t addr, int ninst, uint8_t nextop,
             i64 = F32S;
         else
             i64 = F8S;
-        if(i64==0 || ((i64>=-2048) && (i64<=2047)  && i12)) {
+        if(i64==0 || ((i64>=-2048) && (i64<=maxval)  && i12)) {
             *fixaddress = i64;
             if((nextop&7)==4) {
                 if (sib_reg!=4) {
@@ -247,7 +247,7 @@ static uintptr_t geted_32(dynarec_rv64_t* dyn, uintptr_t addr, int ninst, uint8_
             i32 = F32S;
         else
             i32 = F8S;
-        if(i32==0 || ((i32>=-2048) && (i32<=2047)  && i12)) {
+        if(i32==0 || ((i32>=-2048) && (i32<=maxval)  && i12)) {
             *fixaddress = i32;
             if((nextop&7)==4) {
                 if (sib_reg!=4) {
@@ -385,7 +385,7 @@ uintptr_t geted32(dynarec_rv64_t* dyn, uintptr_t addr, int ninst, uint8_t nextop
             i64 = F32S;
         else
             i64 = F8S;
-        if(i64==0 || ((i64>=-2048) && (i64<=2047)  && i12)) {
+        if(i64==0 || ((i64>=-2048) && (i64<=maxval)  && i12)) {
             *fixaddress = i64;
             if((nextop&7)==4) {
                 if (sib_reg!=4) {
diff --git a/src/emu/x64syscall.c b/src/emu/x64syscall.c
index 4142daf2..02b18598 100644
--- a/src/emu/x64syscall.c
+++ b/src/emu/x64syscall.c
@@ -720,6 +720,10 @@ void EXPORT x64Syscall(x64emu_t *emu)
                 S_RAX = -errno;
             break;
         #endif
+        case 175: // sys_init_module
+            // huh?
+            S_RAX = -EPERM;
+            break;
         #ifndef __NR_time
         case 201: // sys_time
             R_RAX = (uintptr_t)time((void*)R_RDI);