about summary refs log tree commit diff stats
path: root/docs/gen
diff options
context:
space:
mode:
authorYang Liu <liuyang22@iscas.ac.cn>2025-05-14 16:15:01 +0800
committerGitHub <noreply@github.com>2025-05-14 10:15:01 +0200
commit3d0b4ac9e1a861afb2a5def13a10a74a5f2f1b24 (patch)
tree1bd17ca487b634cf7fc510179007521f05145e2b /docs/gen
parent4be5149b8d291268b32a7a8ad93651ecbcd12f1b (diff)
downloadbox64-3d0b4ac9e1a861afb2a5def13a10a74a5f2f1b24.tar.gz
box64-3d0b4ac9e1a861afb2a5def13a10a74a5f2f1b24.zip
[DOCS] Align usage.json and env.h (#2633)
* [DOCS] Align usage.json and env.h

* Removed BOX64_FUTEX_WAITV

* review

* gen
Diffstat (limited to 'docs/gen')
-rw-r--r--docs/gen/gen.py34
-rw-r--r--docs/gen/usage.json62
2 files changed, 77 insertions, 19 deletions
diff --git a/docs/gen/gen.py b/docs/gen/gen.py
index a21dc57d..710e973b 100644
--- a/docs/gen/gen.py
+++ b/docs/gen/gen.py
@@ -186,19 +186,21 @@ with open(env_file, "r") as file:
 
                 if t not in matches:
                     matches[t] = {}
-                matches[t][m.group("define")] = m
-                break
+                if (m.group("define") in matches[t]):
+                    # multiple definitions, no default
+                    matches[t][m.group("define")]['no_default'] = True
+                    break
+                matches[t][m.group("define")] = m.groupdict()
+                matches[t][m.group("define")]['no_default'] = False
 
 for define, m in matches["INTEGER"].items():
-    name = m.group("name")
-    default = (
-        0 if m.group("default") == "DEFAULT_LOG_LEVEL" else int(m.group("default"))
-    )
-    min = int(m.group("min"))
-    max = int(m.group("max"))
+    name = m["name"]
+    default = None if m["no_default"] or not m["default"].isdigit() else int(m["default"])
+    min = int(m["min"])
+    max = int(m["max"])
 
     # Check default in valid range
-    if default < min or default > max:
+    if default and (default < min or default > max):
         print(f"{define:<{PADDING}}: default lays outside of min/max range")
 
     # Check consistency with usage.json
@@ -231,15 +233,15 @@ for define, m in matches["INTEGER"].items():
                 print(
                     f"{define:<{PADDING}}: max value mismatch: env.h={max}, usage.json={max2}{(' (possible false positive)' if blank else '')}"
                 )
-        if default2 and default2 != default:
+        if default2 != default:
             print(
                 f"{define:<{PADDING}}: default value mismatch: env.h={default}, usage.json={default2}"
             )
 
 for define, m in matches["INTEGER64"].items():
     # similar to INTEGER but without min/max
-    name = m.group("name")
-    default = int(m.group("default"))
+    name = m["name"]
+    default = None if m["no_default"] or not m["default"].isdigit() else int(m["default"])
 
     # Check consistency with usage.json
     if e := get_usage_entry(data, define):
@@ -253,14 +255,14 @@ for define, m in matches["INTEGER64"].items():
             if o["default"]:
                 default2 = val
 
-        if default2 and default2 != default:
+        if default2 != default:
             print(
                 f"{define:<{PADDING}}: default value mismatch: env.h={default}, usage.json={default2}"
             )
 
 for define, m in matches["BOOLEAN"].items():
-    name = m.group("name")
-    default = bool(m.group("default"))
+    name = m["name"]
+    default = None if m["no_default"] or m["default"] not in ["0", "1"] else bool(m["default"])
 
     # Check consistency with usage.json
     if e := get_usage_entry(data, define):
@@ -274,7 +276,7 @@ for define, m in matches["BOOLEAN"].items():
             if o["default"]:
                 default2 = val
 
-        if default2 and default2 != default:
+        if default2 != default:
             print(
                 f"{define:<{PADDING}}: default value mismatch: env.h={default}, usage.json={default2}"
             )
diff --git a/docs/gen/usage.json b/docs/gen/usage.json
index 4702a2e9..9dc1a30a 100644
--- a/docs/gen/usage.json
+++ b/docs/gen/usage.json
@@ -51,6 +51,28 @@
     ]
   },
   {
+    "name": "BOX64_AVX",
+    "description": "Expose AVX extension to CPUID and cpuinfo file. Default value is 2 on Arm64 because it's fully implemented in DynaRec, 0 otherwise.",
+    "category": "Compatibility",
+    "options": [
+      {
+        "key": "0",
+        "description": "Do not expose AVX capabilities.",
+        "default": false
+      },
+      {
+        "key": "1",
+        "description": "Expose AVX, BMI1, F16C and VAES extensions to CPUID and cpuinfo file.",
+        "default": false
+      },
+      {
+        "key": "2",
+        "description": "All in 1, plus AVX2, BMI2, FMA, ADX,VPCLMULQDQ and RDRAND extensions.",
+        "default": false
+      }
+    ]
+  },
+  {
     "name": "BOX64_BASH",
     "description": "Path to the bash executable.",
     "category": "Compatibility",
@@ -165,6 +187,23 @@
     ]
   },
   {
+    "name": "BOX64_DYNAREC",
+    "description": "Enable/disable the Dynamic Recompiler (a.k.a DynaRec). This option defaults to 1 if it's enabled in the build options for a supported architecture.",
+    "category": "Performance",
+    "options": [
+      {
+        "key": "0",
+        "description": "Disable DynaRec.",
+        "default": false
+      },
+      {
+        "key": "1",
+        "description": "Enable DynaRec.",
+        "default": false
+      }
+    ]
+  },
+  {
     "name": "BOX64_DYNAREC_ALIGNED_ATOMICS",
     "description": "Generate aligned atomics only (only available on Arm64 for now).",
     "category": "Performance",
@@ -970,13 +1009,13 @@
   },
   {
     "name": "BOX64_LOG",
-    "description": "Enable or disable Box64 logs.",
+    "description": "Enable or disable Box64 logs, default value is 0 if stdout is not terminal, 1 otherwise.",
     "category": "Debugging",
     "options": [
       {
         "key": "0",
         "description": "Disable Box64 logs.",
-        "default": true
+        "default": false
       },
       {
         "key": "1",
@@ -1035,6 +1074,23 @@
     ]
   },
   {
+    "name": "BOX64_MMAP32",
+    "description": "Force 32-bit compatible memory mappings on 64-bit programs that run 32-bit code (like Wine WOW64), can improve performance.",
+    "category": "Performance",
+    "options": [
+      {
+        "key": "0",
+        "description": "Do not force 32-bit memory mappings.",
+        "default": false
+      },
+      {
+        "key": "1",
+        "description": "Force 32-bit memory mappings.",
+        "default": true
+      }
+    ]
+  },
+  {
     "name": "BOX64_NOBANNER",
     "description": "Disable the Box64 banner.",
     "category": "Debugging",
@@ -1042,7 +1098,7 @@
       {
         "key": "0",
         "description": "Show the Box64 banner.",
-        "default": true
+        "default": false
       },
       {
         "key": "1",