X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/1025235c72c31f7fa7b648c0e32ddcaa68a8f66a..d15268ba6eadf89a38087995ff407f50418485fb:/lunaix-os/arch/LConfig diff --git a/lunaix-os/arch/LConfig b/lunaix-os/arch/LConfig index 30c67b6..78d557a 100644 --- a/lunaix-os/arch/LConfig +++ b/lunaix-os/arch/LConfig @@ -1,13 +1,50 @@ -include("i386/LConfig") +from . import x86 -@Collection +@"Platform" def architecture_support(): """ Config ISA related features """ - @Term - def arch(): - """ Config ISA support """ - type(["i386", "x86_64", "aarch64", "rv64"]) - default("i386") + @flag + def arch_x86_32() -> bool: + return arch.val == "i386" + + @flag + def arch_x86_64() -> bool: + return arch.val == "x86_64" + + @flag + def arch_x86() -> bool: + return arch.val in ["x86_64", "i386"] + + @"Architecture" + def arch() -> "i386" | "x86_64": + """ + Config ISA support + """ + _arch = env("ARCH") + return _arch if _arch else "x86_64" + + @"Base operand size" + @readonly + def arch_bits() -> 32 | 64: + """ + Defines the base size of a general register of the + current selected ISA. + + This the 'bits' part when we are talking about a CPU + """ + + match arch.val: + case "i386": + return 32 + case "aarch64": + return 64 + case "rv64": + return 64 + case "x86_64": + return 64 + case _: + return 32 + \ No newline at end of file