about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorYang Liu <liuyang22@iscas.ac.cn>2025-01-14 16:20:25 +0800
committerGitHub <noreply@github.com>2025-01-14 09:20:25 +0100
commit613f2cccf15674f91c9b539fe2ed6f5c4a1164c8 (patch)
tree8c725dc0594a73df1776d7c8ef547946bcc30942 /src
parentd91461f4681ebb61310a227a519cd6982e135e1a (diff)
downloadbox64-613f2cccf15674f91c9b539fe2ed6f5c4a1164c8.tar.gz
box64-613f2cccf15674f91c9b539fe2ed6f5c4a1164c8.zip
[CORE] Simplified xhead* detection and standardized extension display (#2261)
Diffstat (limited to 'src')
-rw-r--r--src/core.c43
-rw-r--r--src/rv64detect.c59
2 files changed, 32 insertions, 70 deletions
diff --git a/src/core.c b/src/core.c
index ff58e096..967af6b6 100644
--- a/src/core.c
+++ b/src/core.c
@@ -517,6 +517,7 @@ HWCAP2_AFP
         printf_log(LOG_INFO, " AFP");
     if(arm64_rndr)
         printf_log(LOG_INFO, " RNDR");
+    printf_log(LOG_INFO, "\n");
 #elif defined(LA64)
     printf_log(LOG_INFO, "Dynarec for LoongArch ");
     char* p = getenv("BOX64_DYNAREC_LA64NOEXT");
@@ -540,6 +541,7 @@ HWCAP2_AFP
         if ((la64_scq = (cpucfg2 >> 30) & 0b1))
             printf_log(LOG_INFO, " SCQ");
     }
+    printf_log(LOG_INFO, "\n");
 #elif defined(RV64)
     void RV64_Detect_Function();
     // private env. variable for the developer ;)
@@ -571,24 +573,25 @@ HWCAP2_AFP
         }
     }
 
-    printf_log(LOG_INFO, "Dynarec for RISC-V ");
-    printf_log(LOG_INFO, "With extension: I M A F D C");
-    if(rv64_zba) printf_log(LOG_INFO, " Zba");
-    if(rv64_zbb) printf_log(LOG_INFO, " Zbb");
-    if(rv64_zbc) printf_log(LOG_INFO, " Zbc");
-    if(rv64_zbs) printf_log(LOG_INFO, " Zbs");
-    if (rv64_vector && !rv64_xtheadvector) printf_log(LOG_INFO, " Vector (vlen: %d)", rv64_vlen);
-    if (rv64_xtheadvector) printf_log(LOG_INFO, " XTheadVector (vlen: %d)", rv64_vlen);
-    if(rv64_xtheadba) printf_log(LOG_INFO, " XTheadBa");
-    if(rv64_xtheadbb) printf_log(LOG_INFO, " XTheadBb");
-    if(rv64_xtheadbs) printf_log(LOG_INFO, " XTheadBs");
-    if (rv64_xtheadmempair) printf_log(LOG_INFO, " XTheadMemPair");
-    if (rv64_xtheadcondmov) printf_log(LOG_INFO, " XTheadCondMov");
-    if (rv64_xtheadmemidx) printf_log(LOG_INFO, " XTheadMemIdx");
+    printf_log(LOG_INFO, "Dynarec for rv64g");
+    if (rv64_vector && !rv64_xtheadvector) printf_log(LOG_INFO, "v");
+    if (rv64_zba) printf_log(LOG_INFO, "_zba");
+    if (rv64_zbb) printf_log(LOG_INFO, "_zbb");
+    if (rv64_zbc) printf_log(LOG_INFO, "_zbc");
+    if (rv64_zbs) printf_log(LOG_INFO, "_zbs");
+    if (rv64_vector && !rv64_xtheadvector) printf_log(LOG_INFO, "_zvl%d", rv64_vlen);
+    if (rv64_xtheadba) printf_log(LOG_INFO, "_xtheadba");
+    if (rv64_xtheadbb) printf_log(LOG_INFO, "_xtheadbb");
+    if (rv64_xtheadbs) printf_log(LOG_INFO, "_xtheadbs");
+    if (rv64_xtheadmempair) printf_log(LOG_INFO, "_xtheadmempair");
+    if (rv64_xtheadcondmov) printf_log(LOG_INFO, "_xtheadcondmov");
+    if (rv64_xtheadmemidx) printf_log(LOG_INFO, "_xtheadmemidx");
     // Disable the display since these are only detected but never used.
-    // if(rv64_xtheadfmemidx) printf_log(LOG_INFO, " XTheadFMemIdx");
-    // if(rv64_xtheadmac) printf_log(LOG_INFO, " XTheadMac");
-    // if(rv64_xtheadfmv) printf_log(LOG_INFO, " XTheadFmv");
+    // if(rv64_xtheadfmemidx) printf_log(LOG_INFO, " xtheadfmemidx");
+    // if(rv64_xtheadmac) printf_log(LOG_INFO, " xtheadmac");
+    // if(rv64_xtheadfmv) printf_log(LOG_INFO, " xtheadfmv");
+    if (rv64_xtheadvector) printf_log(LOG_INFO, "_xthvector");
+    printf_log(LOG_INFO, "\n");
 #else
 #error Unsupported architecture
 #endif
@@ -1344,7 +1347,7 @@ void LoadLogEnv()
     // grab cpu name
     int ncpu = getNCpu();
     const char* cpuname = getCpuName();
-    printf_log(LOG_INFO, " PageSize:%zd Running on %s with %d core%s\n", box64_pagesize, cpuname, ncpu, ncpu > 1 ? "s" : "");
+    printf_log(LOG_INFO, "Running on %s with %d core%s, pagesize: %zd\n", cpuname, ncpu, ncpu > 1 ? "s" : "", box64_pagesize);
     // grab and calibrate hardware counter
     computeRDTSC();
 }
@@ -1460,7 +1463,7 @@ void PrintFlags() {
 }
 
 void PrintHelp() {
-    printf("This is Box64, The Linux x86_64 emulator with a twist\n");
+    printf("This is Box64, the Linux x86_64 emulator with a twist.\n");
     printf("\nUsage is 'box64 [options] path/to/software [args]' to launch x86_64 software.\n");
     printf(" options are:\n");
     printf("    '-v'|'--version' to print box64 version and quit\n");
@@ -1774,7 +1777,7 @@ void setupTrace()
                     if(!search)
                         search = ElfGetSymTabStartEnd(my_context->elfs[i], &s_trace_start, &s_trace_end, p);
                 }
-            } 
+            }
             if(search) {
                 SetTraceEmu(s_trace_start, s_trace_end);
                 printf_log(LOG_INFO, "TRACE on %s only (%p-%p)\n", p, (void*)s_trace_start, (void*)s_trace_end);
diff --git a/src/rv64detect.c b/src/rv64detect.c
index b0664b05..ec41b482 100644
--- a/src/rv64detect.c
+++ b/src/rv64detect.c
@@ -92,59 +92,18 @@ void RV64_Detect_Function()
 
     // THead vendor extensions
     if (!rv64_zba) {
-        // Test XTheadBa with TH_ADDSL
         block = (uint32_t*)my_block;
         TH_ADDSL(A0, A0, A1, 1);
         BR(xRA);
-        rv64_xtheadba = Check(my_block);
-
-        // Test XTheadBb with TH_SRRI
-        block = (uint32_t*)my_block;
-        TH_SRRI(A0, A1, 1);
-        BR(xRA);
-        rv64_xtheadbb = Check(my_block);
-
-        // Test XTheadBs with TH_TST
-        block = (uint32_t*)my_block;
-        TH_TST(A0, A1, 1);
-        BR(xRA);
-        rv64_xtheadbs = Check(my_block);
-
-        // Test XTheadCondMov with TH_MVEQZ
-        block = (uint32_t*)my_block;
-        TH_MVEQZ(A0, A0, A1);
-        BR(xRA);
-        rv64_xtheadcondmov = Check(my_block);
-
-        // Test XTheadMemIdx with TH_LBIA
-        block = (uint32_t*)my_block;
-        TH_LBIA(A0, A2, 1, 1);
-        BR(xRA);
-        rv64_xtheadmemidx = Check(my_block);
-
-        // Test XTheadMemPair with TH_LDD
-        block = (uint32_t*)my_block;
-        TH_LDD(A0, A1, A2, 0);
-        BR(xRA);
-        rv64_xtheadmempair = Check(my_block);
-
-        // Test XTheadFMemIdx with TH_FLRD
-        block = (uint32_t*)my_block;
-        TH_FLRD(A0, A2, xZR, 0);
-        BR(xRA);
-        rv64_xtheadfmemidx = Check(my_block);
-
-        // Test XTheadMac with TH_MULA
-        block = (uint32_t*)my_block;
-        TH_MULA(A0, A0, A1);
-        BR(xRA);
-        rv64_xtheadmac = Check(my_block);
-
-        // Test XTheadFmv with TH_FMV_X_HW
-        block = (uint32_t*)my_block;
-        TH_FMV_X_HW(A0, A1);
-        BR(xRA);
-        rv64_xtheadfmv = Check(my_block);
+        rv64_xtheadba
+            = rv64_xtheadbb
+            = rv64_xtheadbs
+            = rv64_xtheadcondmov
+            = rv64_xtheadmemidx
+            = rv64_xtheadmempair
+            = rv64_xtheadfmemidx
+            = rv64_xtheadmac
+            = rv64_xtheadfmv = Check(my_block);
     }
 
     // Finish