refine the documentation, add extra warning messages
[lunaix-os.git] / lunaix-os / arch / LConfig
index 78d557a3f856dd691a4f3310e4828fa228c0be4b..e9eacee132de309e8b2131b5a1345478268f7c19 100644 (file)
@@ -8,23 +8,43 @@ def architecture_support():
 
     @flag
     def arch_x86_32() -> bool:
-        return arch.val == "i386"
+        when (arch is "i386")
     
     @flag
     def arch_x86_64() -> bool:
-        return arch.val == "x86_64"
+        when (arch is "x86_64")
     
     @flag
     def arch_x86() -> bool:
-        return arch.val in ["x86_64", "i386"]
+        when (arch is "i386")
+        when (arch is "x86_64")
+
+    @flag
+    def arch_bits_64() -> bool:
+        when (arch_bits is 64)
+
+    @flag
+    def arch_bits_32() -> bool:
+        when (arch_bits is 32)
 
     @"Architecture"
     def arch() -> "i386" | "x86_64":
         """ 
             Config ISA support 
         """
-        _arch = env("ARCH")
-        return _arch if _arch else "x86_64"
+
+        match env("ARCH"):
+            case "i386": 
+                return "i386"
+            case "aarch64": 
+                return "aarch64"
+            case "rv64": 
+                return "rv64"
+            case "x86_64": 
+                return "x86_64"
+
+        print("unknown ARCH:", env("ARCH"), "default to x86_64")
+        return "x86_64"
 
     @"Base operand size"
     @readonly