about summary refs log tree commit diff stats
path: root/src/include/hostext.h
diff options
context:
space:
mode:
authorYang Liu <liuyang22@iscas.ac.cn>2025-06-16 20:05:38 +0800
committerGitHub <noreply@github.com>2025-06-16 14:05:38 +0200
commitae0c91dce0671c176321fc72bfa69f1731d4aa2e (patch)
treeb9f65e3e7c2966c74f2bb4a89ae873484bd80ba4 /src/include/hostext.h
parentab6deeb319cf4389f0cfd555c8aa922300065ee6 (diff)
downloadbox64-ae0c91dce0671c176321fc72bfa69f1731d4aa2e.tar.gz
box64-ae0c91dce0671c176321fc72bfa69f1731d4aa2e.zip
[WOW64] Refactored host extention detection and added preliminary support for WowBox64 (#2752)
Diffstat (limited to 'src/include/hostext.h')
-rw-r--r--src/include/hostext.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/include/hostext.h b/src/include/hostext.h
new file mode 100644
index 00000000..579e76ac
--- /dev/null
+++ b/src/include/hostext.h
@@ -0,0 +1,52 @@
+#ifndef __HOSTEXT_H__
+#define __HOSTEXT_H__
+
+#include <stdint.h>
+
+typedef union cpu_ext_s {
+    struct {
+#ifdef ARM64
+        uint64_t atomics : 1; // it's important this is the 1st bit
+        uint64_t asimd : 1;
+        uint64_t aes : 1;
+        uint64_t pmull : 1;
+        uint64_t crc32 : 1;
+        uint64_t sha1 : 1;
+        uint64_t sha2 : 1;
+        uint64_t uscat : 1;
+        uint64_t flagm : 1;
+        uint64_t flagm2 : 1;
+        uint64_t frintts : 1;
+        uint64_t afp : 1;
+        uint64_t rndr : 1;
+#elif defined(RV64)
+        uint64_t vlen : 8; // Not *8, 8bits should be enugh? that's 2048 vector
+        uint64_t zba : 1;
+        uint64_t zbb : 1;
+        uint64_t zbc : 1;
+        uint64_t zbs : 1;
+        uint64_t vector : 1; // rvv 1.0 or xtheadvector
+        uint64_t xtheadvector : 1;
+        uint64_t xtheadba : 1;
+        uint64_t xtheadbb : 1;
+        uint64_t xtheadbs : 1;
+        uint64_t xtheadcondmov : 1;
+        uint64_t xtheadmemidx : 1;
+        uint64_t xtheadmempair : 1;
+        uint64_t xtheadfmemidx : 1;
+        uint64_t xtheadmac : 1;
+        uint64_t xtheadfmv : 1;
+#elif defined(LA64)
+        uint64_t lbt : 1; // it's important it's stay the 1st bit
+        uint64_t lam_bh : 1;
+        uint64_t lamcas : 1;
+        uint64_t scq : 1;
+#endif
+    };
+    uint64_t x;
+} cpu_ext_t;
+
+int DetectHostCpuFeatures(void);
+void PrintHostCpuFeatures(void);
+
+#endif //__HOSTEXT_H__
\ No newline at end of file