From 362bbd979111888e5b8572edbd259ed99e3d3d7e Mon Sep 17 00:00:00 2001 From: whh8b <whh8b@git.zephyr-software.com> Date: Sun, 8 Nov 2015 03:16:20 +0000 Subject: [PATCH] Update code to add API for asking plugins where to plop. --- .gitattributes | 1 + include/dollop.h | 46 ++++++++++++++++++++++++++++++++++++++++++ include/memory_space.h | 1 + include/zipr_plugin.h | 10 +++++++++ include/zipr_sdk.h | 1 + 5 files changed, 59 insertions(+) create mode 100644 include/dollop.h diff --git a/.gitattributes b/.gitattributes index 14ce7d7..45b1e8f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,6 +1,7 @@ * text=auto !eol /README -text /SDK_VERSION -text +include/dollop.h -text include/memory_space.h -text include/range.h -text include/zipr.h -text diff --git a/include/dollop.h b/include/dollop.h new file mode 100644 index 0000000..4b8a8a8 --- /dev/null +++ b/include/dollop.h @@ -0,0 +1,46 @@ +/*************************************************************************** + * Copyright (c) 2014 Zephyr Software LLC. All rights reserved. + * + * This software is furnished under a license and/or other restrictive + * terms and may be used and copied only in accordance with such terms + * and the inclusion of the above copyright notice. This software or + * any other copies thereof may not be provided or otherwise made + * available to any other person without the express written consent + * of an authorized representative of Zephyr Software LCC. Title to, + * ownership of, and all rights in the software is retained by + * Zephyr Software LCC. + * + * Zephyr Software LLC. Proprietary Information + * + * Unless otherwise specified, the information contained in this + * directory, following this legend, and/or referenced herein is + * Zephyr Software LLC. (Zephyr) Proprietary Information. + * + * CONTACT + * + * For technical assistance, contact Zephyr Software LCC. at: + * + * + * Zephyr Software, LLC + * 2040 Tremont Rd + * Charlottesville, VA 22911 + * + * E-mail: jwd@zephyr-software.com + **************************************************************************/ + +#ifndef dollop_h +#define dollop_h + +namespace Zipr_SDK +{ +class Dollop_t { + public: + Dollop_t(libIRDB::Instruction_t *start); + size_t GetSize() const { return m_size; } + private: + size_t CalculateWorstCaseSize(); + size_t m_size; + libIRDB::Instruction_t *m_start; +}; +} +#endif diff --git a/include/memory_space.h b/include/memory_space.h index fa263b9..d77af98 100644 --- a/include/memory_space.h +++ b/include/memory_space.h @@ -47,6 +47,7 @@ class MemorySpace_t : public std::map<RangeAddress_t,char> virtual void MergeFreeRange(RangeAddress_t addr)=0; virtual RangeSet_t::iterator FindFreeRange(RangeAddress_t addr)=0; virtual Range_t GetFreeRange(int size)=0; + virtual Range_t GetNearbyFreeRange(const RangeAddress_t hint)=0; virtual void AddFreeRange(Range_t newRange)=0; virtual void RemoveFreeRange(Range_t newRange)=0; diff --git a/include/zipr_plugin.h b/include/zipr_plugin.h index 1034c42..1e463d8 100644 --- a/include/zipr_plugin.h +++ b/include/zipr_plugin.h @@ -3,6 +3,10 @@ namespace Zipr_SDK { typedef std::map<libIRDB::Instruction_t*,Zipr_SDK::RangeAddress_t> InstructionLocationMap_t; +enum ZiprPreference { + None, + Must, +}; class Zipr_t; class ZiprPluginInterface_t @@ -27,6 +31,12 @@ class ZiprPluginInterface_t { } + virtual ZiprPreference PlopAddress( + const RangeAddress_t &jump, const Dollop_t &dollop, Range_t &place) + { + return ZiprPreference::None; + } + virtual bool WillPluginPlop(libIRDB::Instruction_t*) { return false; diff --git a/include/zipr_sdk.h b/include/zipr_sdk.h index c614460..831f5ad 100644 --- a/include/zipr_sdk.h +++ b/include/zipr_sdk.h @@ -48,6 +48,7 @@ // SDK internals #include <range.h> +#include <dollop.h> #include <memory_space.h> #include <zipr_options.h> #include <zipr_plugin.h> -- GitLab