From 334b66907333965c931248478086e64e1df0c289 Mon Sep 17 00:00:00 2001
From: whh8b <whh8b@git.zephyr-software.com>
Date: Wed, 17 Feb 2016 03:30:58 +0000
Subject: [PATCH] Update calls to SDK functions

1. Allow AddressDollop() to tell Zipr whether
the dollops should be coalesced. Defaults to true.

2. Allow the plugin to retarget a pin.
---
 include/plugin_man.h |  4 +++-
 src/plugin_man.cpp   | 19 +++++++++++++++++--
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/include/plugin_man.h b/include/plugin_man.h
index 0b6cef8..24a216a 100644
--- a/include/plugin_man.h
+++ b/include/plugin_man.h
@@ -42,7 +42,9 @@ class ZiprPluginManager_t : public ZiprPluginInterface_t
 
 		virtual bool DoesPluginPlop(libIRDB::Instruction_t*,DLFunctionHandle_t&);
 
-		virtual bool DoesPluginAddress(const Dollop_t *, const RangeAddress_t &, Range_t &, DLFunctionHandle_t &);
+		virtual bool DoesPluginAddress(const Dollop_t *, const RangeAddress_t &, Range_t &, bool &coalesce, DLFunctionHandle_t &);
+		virtual bool DoesPluginRetargetPin(const RangeAddress_t &, const Dollop_t *, RangeAddress_t &, DLFunctionHandle_t &) ;
+
 	private:
 
 		void open_plugins
diff --git a/src/plugin_man.cpp b/src/plugin_man.cpp
index 08b4ddb..58bea1e 100644
--- a/src/plugin_man.cpp
+++ b/src/plugin_man.cpp
@@ -81,13 +81,13 @@ void ZiprPluginManager_t::CallbackLinkingEnd()
 	dispatch_to(CallbackLinkingEnd);
 }
 
-bool ZiprPluginManager_t::DoesPluginAddress(const Dollop_t *dollop, const RangeAddress_t &source, Range_t &place, DLFunctionHandle_t &placer)
+bool ZiprPluginManager_t::DoesPluginAddress(const Dollop_t *dollop, const RangeAddress_t &source, Range_t &place, bool &coalesce, DLFunctionHandle_t &placer)
 {
 	DLFunctionHandleSet_t::iterator it=m_handleList.begin();
 	for(m_handleList.begin();it!=m_handleList.end();++it)
 	{
 		ZiprPluginInterface_t* zpi=(ZiprPluginInterface_t*)*it;
-		if (Must == zpi->AddressDollop(dollop, source, place))
+		if (Must == zpi->AddressDollop(dollop, source, place, coalesce))
 		{
 			placer = zpi;
 			return true;
@@ -111,6 +111,21 @@ bool ZiprPluginManager_t::DoesPluginPlop(Instruction_t *insn, DLFunctionHandle_t
 	return false;
 }
 
+bool ZiprPluginManager_t::DoesPluginRetargetPin(const RangeAddress_t &patch_addr, const Dollop_t *target_dollop, RangeAddress_t &target_address, DLFunctionHandle_t &patcher) 
+{
+	DLFunctionHandleSet_t::iterator it=m_handleList.begin();
+	for(m_handleList.begin();it!=m_handleList.end();++it)
+	{
+		ZiprPluginInterface_t* zpi=(ZiprPluginInterface_t*)*it;
+		if (Must == zpi->RetargetPin(patch_addr, target_dollop, target_address))
+		{
+			patcher = zpi;
+			return true;
+		}
+	}
+	return false;
+}
+
 void ZiprPluginManager_t::open_plugins
                         (
 				Zipr_SDK::Zipr_t* zipr_obj,
-- 
GitLab