From 4ccc521156dcf99bcc2411b55d76ecf483fb8253 Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Sat, 7 Mar 2026 12:19:40 +0100 Subject: [PATCH] Show grant flags in the debugger --- src/debugger.rs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/debugger.rs b/src/debugger.rs index cd43dce923..ceb97a8a99 100644 --- a/src/debugger.rs +++ b/src/debugger.rs @@ -78,11 +78,20 @@ pub unsafe fn debugger(target_id: Option<*const ContextLock>, token: &mut CleanL for (base, info) in addr_space.grants.iter() { let size = info.page_count() * PAGE_SIZE; + let flags = format_args!( + "{}{}{}{}", + if info.flags().has_user() { "u" } else { "k" }, + if info.flags().has_present() { "r" } else { "-" }, + if info.flags().has_write() { "w" } else { "-" }, + if info.flags().has_execute() { "x" } else { "-" }, + ); + #[cfg(target_arch = "aarch64")] println!( - " virt 0x{:016x}:0x{:016x} size 0x{:08x} {:?}", + " virt 0x{:016x}:0x{:016x} {} size 0x{:08x} {:?}", base.start_address().data(), base.next_by(info.page_count() - 1).start_address().data() + 0xFFF, + flags, size, info.provider, ); @@ -91,18 +100,20 @@ pub unsafe fn debugger(target_id: Option<*const ContextLock>, token: &mut CleanL #[cfg(target_arch = "x86")] println!( - " virt 0x{:08x}:0x{:08x} size 0x{:08x} {:?}", + " virt 0x{:08x}:0x{:08x} {} size 0x{:08x} {:?}", base.start_address().data(), base.next_by(info.page_count()).start_address().data() + 0xFFF, + flags, size, info.provider, ); #[cfg(target_arch = "x86_64")] println!( - " virt 0x{:016x}:0x{:016x} size 0x{:08x} {:?}", + " virt 0x{:016x}:0x{:016x} {} size 0x{:08x} {:?}", base.start_address().data(), base.start_address().data() + size - 1, + flags, size, info.provider, );