From 64ae39295dccbd6401dc19f761a02fe43abf178c 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)),