From 4ca9139acd5d263e2f00d5f8ec786b4a4290f1b1 Mon Sep 17 00:00:00 2001
From: whh8b <whh8b@git.zephyr-software.com>
Date: Fri, 1 Jan 2016 16:11:26 +0000
Subject: [PATCH] Update Memory Space to handle reserved ranges

Allow for reserved ranges to be plopped. Ie, selectively
call Reserve when plopping bytes instead of always doing it.
---
 include/zipr_mem_space.h | 3 ++-
 src/zipr.cpp             | 6 ------
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/include/zipr_mem_space.h b/include/zipr_mem_space.h
index 595c2ce..493c054 100644
--- a/include/zipr_mem_space.h
+++ b/include/zipr_mem_space.h
@@ -74,7 +74,8 @@ class ZiprMemorySpace_t : public MemorySpace_t
 			min_plopped=std::min(addr,min_plopped);
 			max_plopped=std::max(addr,max_plopped);
 
-			if(this->find(addr) == this->end() )
+			if(this->find(addr) == this->end() &&
+			   IsValidRange(FindFreeRange(addr))) /* and, the range is free. */
 				this->SplitFreeRange(addr);
 			(*this)[addr]=the_byte;
 		}
diff --git a/src/zipr.cpp b/src/zipr.cpp
index 9e1a1aa..19f541f 100644
--- a/src/zipr.cpp
+++ b/src/zipr.cpp
@@ -1515,12 +1515,6 @@ void ZiprImpl_t::PlaceDollops()
 			cout << "Reserving " << std::hex << placement.GetStart()
 			     << ", " << std::hex << cur_addr << "." << endl;
 		memory_space.SplitFreeRange(Range_t(placement.GetStart(), cur_addr));
-		for (RangeAddress_t i = placement.GetStart();
-		     i<cur_addr;
-				 i++)
-		{
-			memory_space[i] = 0x0;
-		}
 	}
 }
 
-- 
GitLab