summaryrefslogtreecommitdiffstats
path: root/src/usr/pore/poreve/porevesrc/hookmanager.H
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/pore/poreve/porevesrc/hookmanager.H')
-rw-r--r--src/usr/pore/poreve/porevesrc/hookmanager.H85
1 files changed, 61 insertions, 24 deletions
diff --git a/src/usr/pore/poreve/porevesrc/hookmanager.H b/src/usr/pore/poreve/porevesrc/hookmanager.H
index 2b86659ee..991ee95cc 100644
--- a/src/usr/pore/poreve/porevesrc/hookmanager.H
+++ b/src/usr/pore/poreve/porevesrc/hookmanager.H
@@ -1,30 +1,29 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/usr/pore/poreve/porevesrc/hookmanager.H $
- *
- * IBM CONFIDENTIAL
- *
- * COPYRIGHT International Business Machines Corp. 2012
- *
- * p1
- *
- * Object Code Only (OCO) source materials
- * Licensed Internal Code Source Materials
- * IBM HostBoot Licensed Internal Code
- *
- * The source code for this program is not published or other-
- * wise divested of its trade secrets, irrespective of what has
- * been deposited with the U.S. Copyright Office.
- *
- * Origin: 30
- *
- * IBM_PROLOG_END_TAG
- */
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/pore/poreve/porevesrc/hookmanager.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2012,2013 */
+/* */
+/* p1 */
+/* */
+/* Object Code Only (OCO) source materials */
+/* Licensed Internal Code Source Materials */
+/* IBM HostBoot Licensed Internal Code */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
#ifndef __VSBE_HOOKMANAGER_H
#define __VSBE_HOOKMANAGER_H
-// $Id: hookmanager.H,v 1.16 2012/01/06 21:25:25 bcbrock Exp $
+// $Id: hookmanager.H,v 1.17 2013/02/05 16:14:38 bcbrock Exp $
/// \file hookmanager.H
/// \brief A portable symbol table and hook execution facility
@@ -56,6 +55,7 @@
#include <list>
#include <map>
#include <utility>
+#include <vector>
#include <fapi.H>
@@ -469,6 +469,23 @@ public:
virtual ~HookManager();
+ /// Delete the singleton instance of the HookManager
+ ///
+ /// This method is required to support the case that multiple runs of the
+ /// PoreVe with different hooks need to be made in the same process. Along
+ /// with destroying the HookManager object, all hook DLLs will also need
+ /// to be unloaded to ensure that another run of the PoreVe will
+ /// succeed. The application can use the HookManager::dlopen() API rather
+ /// than the standard dlopen() to allow the HookManager to take care
+ /// of unloading the DLLs when the HookManager is destroyed.
+ static void destroy() {
+ if (s_instance != 0) {
+ delete s_instance;
+ s_instance = 0;
+ }
+ }
+
+
///////////////////////////// Accessors //////////////////////////////
/// Access the singleton instance
@@ -631,6 +648,23 @@ public:
//////////////////////////// Manipulators ////////////////////////////
+ /// Dynmaic load of a hook DLL with internal registration
+ ///
+ /// \param[in] i_fileName The name of a (putative) hook DLL
+ ///
+ /// \param[in] i_flags Flags to dlopen()
+ ///
+ /// This method uses dlopen to open a putative hook DLL. If successful,
+ /// then the DLL 'handle' is recorded by the HookManager. This allows the
+ /// HookManager to dlclose() the DLL when the HookManager object is
+ /// destroyed. This method is required to support the case that multiple
+ /// runs of the PoreVe with different hooks need to be made in the same
+ /// process.
+ ///
+ /// \returns The 'handle' returned by dlopen().
+ static void*
+ dlopen(const char* i_fileName, int i_flags);
+
/// Register a HOOKI instruction hook with the HookManager
///
/// \param[in] i_index The hook index as it will be stored in the HOOKI
@@ -793,6 +827,9 @@ public:
protected:
+ /// The vector of DLL handles
+ std::vector<void*> iv_dllHandles;
+
/// The instruction hook map
InstructionHookMap iv_instructionHookMap;
OpenPOWER on IntegriCloud