about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorYang Liu <liuyang22@iscas.ac.cn>2023-11-26 23:46:21 +0800
committerGitHub <noreply@github.com>2023-11-26 16:46:21 +0100
commit6ad9435b4d5720c70fed6e0ade85cb56f9be204d (patch)
tree0bc78ef0d6336a36da67a2749203acd53227fc91
parente853892282b5f43767ec4c1a4c6b12c8b9dfb553 (diff)
downloadbox64-6ad9435b4d5720c70fed6e0ade85cb56f9be204d.tar.gz
box64-6ad9435b4d5720c70fed6e0ade85cb56f9be204d.zip
[DYNAREC_RV64] Fixed BTS BTR BTC for zbs extension (#1084)
-rw-r--r--docs/USAGE.md2
-rw-r--r--docs/box64.pod2
-rw-r--r--src/dynarec/rv64/dynarec_rv64_0f.c3
-rw-r--r--src/main.c2
4 files changed, 6 insertions, 3 deletions
diff --git a/docs/USAGE.md b/docs/USAGE.md
index 6f7a53c2..a7b419c8 100644
--- a/docs/USAGE.md
+++ b/docs/USAGE.md
@@ -52,7 +52,7 @@ Only on build with trace enabled. Trace allow the logging of all instruction exe
  * 0xXXXXXXX-0xYYYYYYY : Trace only between the 2 addresses.

 

 #### BOX64_TRACE_INIT *

-Use BOX64_TRACE_INIT instead of BOX_TRACE to start trace before the initialisation of libraries and the running program

+Use BOX64_TRACE_INIT instead of BOX64_TRACE to start trace before the initialisation of libraries and the running program

  * 0 : No trace. (Default.)

  * 1 : Trace enabled. The trace start with the initialisation of all depending libraries is done.

 

diff --git a/docs/box64.pod b/docs/box64.pod
index a14f9b73..3da39c71 100644
--- a/docs/box64.pod
+++ b/docs/box64.pod
@@ -151,7 +151,7 @@ Only on build with trace enabled. Trace allow the logging of all instruction exe
 
 =item B<BOX64_TRACE_INIT>=I<0|1>
 
-Use B<BOX64_TRACE_INIT> instead of B<BOX_TRACE> to start trace before the
+Use B<BOX64_TRACE_INIT> instead of B<BOX64_TRACE> to start trace before the
 initialization of libraries and the running program
 
     * 0 : No trace. (Default.)
diff --git a/src/dynarec/rv64/dynarec_rv64_0f.c b/src/dynarec/rv64/dynarec_rv64_0f.c
index 32211e31..ba40f297 100644
--- a/src/dynarec/rv64/dynarec_rv64_0f.c
+++ b/src/dynarec/rv64/dynarec_rv64_0f.c
@@ -1045,6 +1045,7 @@ uintptr_t dynarec64_0F(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
             ANDI(xFlags, xFlags, ~1);
             OR(xFlags, xFlags, x4);
             ADDI(x3, xZR, 1);
+            ANDI(x2, gd, rex.w ? 0x3f : 0x1f);
             SLL(x3, x3, x2);
             OR(ed, ed, x3);
             if (wback) {
@@ -1190,6 +1191,7 @@ uintptr_t dynarec64_0F(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
             ANDI(xFlags, xFlags, ~1);
             OR(xFlags, xFlags, x4);
             ADDI(x5, xZR, 1);
+            ANDI(x2, gd, rex.w ? 0x3f : 0x1f);
             SLL(x5, x5, x2);
             NOT(x5, x5);
             AND(ed, ed, x5);
@@ -1351,6 +1353,7 @@ uintptr_t dynarec64_0F(dynarec_rv64_t* dyn, uintptr_t addr, uintptr_t ip, int ni
             ANDI(xFlags, xFlags, ~1);
             OR(xFlags, xFlags, x4);
             ADDI(x3, xZR, 1);
+            ANDI(x2, gd, rex.w ? 0x3f : 0x1f);
             SLL(x3, x3, x2);
             XOR(ed, ed, x3);
             if (wback) {
diff --git a/src/main.c b/src/main.c
index 4fae8d7f..ddd918b4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1087,7 +1087,7 @@ void PrintHelp() {
     printf(" BOX64_TRACE with 1 to enable x86_64 execution trace\n");
     printf("    or with XXXXXX-YYYYYY to enable x86_64 execution trace only between address\n");
     printf("    or with FunctionName to enable x86_64 execution trace only in one specific function\n");
-    printf("  use BOX64_TRACE_INIT instead of BOX_TRACE to start trace before init of Libs and main program\n\t (function name will probably not work then)\n");
+    printf("  use BOX64_TRACE_INIT instead of BOX64_TRACE to start trace before init of Libs and main program\n\t (function name will probably not work then)\n");
     printf(" BOX64_TRACE_EMM with 1 to enable dump of MMX registers along with regular registers\n");
     printf(" BOX64_TRACE_XMM with 1 to enable dump of SSE registers along with regular registers\n");
     printf(" BOX64_TRACE_COLOR with 1 to enable detection of changed general register values\n");