From 10154b8372c02486ae65d716722d4491624708be Mon Sep 17 00:00:00 2001 From: bunnie Date: Fri, 5 Jan 2024 16:47:31 +0800 Subject: [PATCH] add some comments and an assert to check consistency --- services/root-keys/src/implementation.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/root-keys/src/implementation.rs b/services/root-keys/src/implementation.rs index 3287f3a3f..5596a6c42 100644 --- a/services/root-keys/src/implementation.rs +++ b/services/root-keys/src/implementation.rs @@ -226,6 +226,11 @@ impl<'a> RootKeys { 4096, // map just the backup block xous::MemoryFlags::R, ).expect("couldn't map in the kernel region"); + // This is a good assumption, but calling it out here -- we're mapping a region that is assumed to + // match HEADER_TOTAL_SIZE, but part of the reason we hard code the number is because KERNEL_BACKUP_OFFSET + // is in the xous crate (maybe it shouldn't be?) and is hard-coded to 4096 (0x1000), so for now we have + // this assert to catch a consistency problem in assumptions down the road. + assert!(HEADER_TOTAL_SIZE == 4096); // determine the ostensible length of the kernel from an unprotected length hint. This is // later verified to match the signed version that is contained within the block that is mapped // in this address.