diff options
| author | Yang Liu <liuyang22@iscas.ac.cn> | 2023-09-11 11:00:21 +0000 |
|---|---|---|
| committer | Yang Liu <liuyang22@iscas.ac.cn> | 2023-09-11 11:00:21 +0000 |
| commit | 7b0e8b47a28522f205c8e3b6e83d592feb305bde (patch) | |
| tree | 48fb2957edcd4e5132d8d1f9013d198af167c369 /src | |
| parent | 14e799ebe5d38323b607558d76b524f9d53c7788 (diff) | |
| download | box64-7b0e8b47a28522f205c8e3b6e83d592feb305bde.tar.gz box64-7b0e8b47a28522f205c8e3b6e83d592feb305bde.zip | |
Try to fix memory instructions detection
Diffstat (limited to 'src')
| -rw-r--r-- | src/rv64detect.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/rv64detect.c b/src/rv64detect.c index 4ab9ec62..e1b3b40a 100644 --- a/src/rv64detect.c +++ b/src/rv64detect.c @@ -11,7 +11,7 @@ // Detect RV64 extensions, by executing on of the opcode with a SIGILL signal handler static sigjmp_buf sigbuf = {0}; -typedef void(*vFii_t)(int, int); +typedef void(*vFiip_t)(int, int, void*); static void detect_sigill(int sig) { siglongjmp(sigbuf, 1); @@ -19,6 +19,7 @@ static void detect_sigill(int sig) static int Check(void* block) { + static uint64_t buf[2] = {0}; // Clear instruction cache __clear_cache(block, block+box64_pagesize); // Setup SIGILL signal handler @@ -28,7 +29,7 @@ static int Check(void* block) signal(SIGILL, old); return 0; } - ((vFii_t)block)(0, 1); + ((vFiip_t)block)(0, 1, buf); // done... signal(SIGILL, old); return 1; @@ -95,19 +96,19 @@ void RV64_Detect_Function() // Test XTheadMemIdx with TH_LBIA block = (uint32_t*)my_block; - TH_LBIA(A0, A1, 1, 1); + 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, A0, 1); + 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, A0, A1, 1); + TH_FLRD(A0, A2, xZR, 0); BR(xRA); rv64_xtheadfmemidx = Check(my_block); |