From 7b34893f9de39b33826ee766327d7085aca2cf61 Mon Sep 17 00:00:00 2001 From: Ivan Velickovic Date: Thu, 14 May 2026 11:51:49 +1000 Subject: [PATCH 1/2] tool: avoid unsigned overflow in calculation This has not been an issue in the past since we always build the tool in release mode so the Rust compiler was not doing overflow checks. Since the kernel headers use the constants, and we're trying to follow what the kernel does, use them as well rather than doing the calculation. Signed-off-by: Ivan Velickovic --- tool/microkit/src/sel4.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tool/microkit/src/sel4.rs b/tool/microkit/src/sel4.rs index cb6db529d..641fa63c6 100644 --- a/tool/microkit/src/sel4.rs +++ b/tool/microkit/src/sel4.rs @@ -310,6 +310,7 @@ pub struct Config { } impl Config { + /// Refers to 'seL4_UserTop' pub fn user_top(&self) -> u64 { match self.arch { Arch::Aarch64 => match self.hypervisor { @@ -325,16 +326,17 @@ impl Config { } } + /// Refers to the 'PPTR_BASE' define in kernel source pub fn virtual_base(&self) -> u64 { match self.arch { Arch::Aarch64 => match self.hypervisor { true => 0x0000008000000000, - false => u64::pow(2, 64) - u64::pow(2, 39), + false => 0xffffff8000000000, }, Arch::Riscv64 => match self.riscv_pt_levels.unwrap() { - RiscvVirtualMemory::Sv39 => u64::pow(2, 64) - u64::pow(2, 38), + RiscvVirtualMemory::Sv39 => 0xffffffc000000000, }, - Arch::X86_64 => u64::pow(2, 64) - u64::pow(2, 39), + Arch::X86_64 => 0xffffff8000000000, } } From 47f472cc104f56c7c8ccc5fbf0ed8837cbd06b87 Mon Sep 17 00:00:00 2001 From: Ivan Velickovic Date: Thu, 14 May 2026 11:52:19 +1000 Subject: [PATCH 2/2] dev_build.py: do not use --release for tool This script is for developing, so it makes more sense that we have all the Rust debug checks available. Signed-off-by: Ivan Velickovic --- dev_build.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev_build.py b/dev_build.py index b464424eb..303fb4275 100644 --- a/dev_build.py +++ b/dev_build.py @@ -81,7 +81,7 @@ def main(): if not BUILD_DIR.exists(): BUILD_DIR.mkdir() - tool_rebuild = f"cd {CWD / 'tool/microkit'} && cargo build --release" + tool_rebuild = f"cd {CWD / 'tool/microkit'} && cargo build" r = system(tool_rebuild) assert r == 0 @@ -90,7 +90,7 @@ def main(): make_env["MICROKIT_BOARD"] = args.board make_env["MICROKIT_CONFIG"] = args.config make_env["MICROKIT_SDK"] = str(release) - make_env["MICROKIT_TOOL"] = (CWD / "target/release/microkit").absolute() + make_env["MICROKIT_TOOL"] = (CWD / "target/debug/microkit").absolute() make_env["LLVM"] = str(args.llvm) # Choose the makefile based on the `--example-from-sdk` command line flag