From 37a1923f1e74ab4c77c3a1f8d41941b0e4add05f Mon Sep 17 00:00:00 2001 From: Erin Date: Wed, 26 Jul 2023 20:49:23 +0200 Subject: [PATCH] Added some comments --- hbvm/src/mem/bmc.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hbvm/src/mem/bmc.rs b/hbvm/src/mem/bmc.rs index fd43d733..7c4551ae 100644 --- a/hbvm/src/mem/bmc.rs +++ b/hbvm/src/mem/bmc.rs @@ -47,6 +47,7 @@ impl BlockCopier { // Safety: Assuming uninit of array of MaybeUninit is sound let mut buf = AlignedBuf(MaybeUninit::uninit().assume_init()); + // We have at least one buffer size to copy if self.n_buffers != 0 { if let Err(e) = act( memory, @@ -59,6 +60,9 @@ impl BlockCopier { return Poll::Ready(Err(e)); } + // Bump source and destination address + // + // If we are over the address space, bail. match self.src.checked_add(BUF_SIZE as u64) { Some(n) => self.src = n, None => return Poll::Ready(Err(BlkCopyError::OutOfBounds)),