summaryrefslogtreecommitdiffstats
path: root/src/usr/pore/poreve/porevesrc
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr/pore/poreve/porevesrc')
-rw-r--r--src/usr/pore/poreve/porevesrc/create.C48
-rw-r--r--src/usr/pore/poreve/porevesrc/hookmanager.C45
-rw-r--r--src/usr/pore/poreve/porevesrc/hookmanager.H85
-rw-r--r--src/usr/pore/poreve/porevesrc/pibmem.C5
-rw-r--r--src/usr/pore/poreve/porevesrc/pibmem.H47
5 files changed, 154 insertions, 76 deletions
diff --git a/src/usr/pore/poreve/porevesrc/create.C b/src/usr/pore/poreve/porevesrc/create.C
index 8e0d8d636..1ede957e3 100644
--- a/src/usr/pore/poreve/porevesrc/create.C
+++ b/src/usr/pore/poreve/porevesrc/create.C
@@ -1,27 +1,26 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/usr/pore/poreve/porevesrc/create.C $
-//
-// 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
-// $ID$
-
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/pore/poreve/porevesrc/create.C $ */
+/* */
+/* 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 */
+// $Id: create.C,v 1.4 2013/11/27 19:57:47 thi Exp $
/// \file create.C
/// \brief The create method for PoreVe
///
@@ -40,7 +39,6 @@ PoreVe::create(const PoreIbufId i_id,
const fapi::Target i_masterTarget,
const void* i_arg)
{
- // i_arg is needed for subclass to instantiate and the (debug) subclass.
return new PoreVe(i_id, i_masterTarget);
}
diff --git a/src/usr/pore/poreve/porevesrc/hookmanager.C b/src/usr/pore/poreve/porevesrc/hookmanager.C
index 0e4615b03..21e7a55a1 100644
--- a/src/usr/pore/poreve/porevesrc/hookmanager.C
+++ b/src/usr/pore/poreve/porevesrc/hookmanager.C
@@ -20,7 +20,7 @@
/* Origin: 30 */
/* */
/* IBM_PROLOG_END_TAG */
-// $Id: hookmanager.C,v 1.15 2012/12/06 18:03:51 bcbrock Exp $
+// $Id: hookmanager.C,v 1.17 2013/11/27 20:04:36 thi Exp $
/// \file hookmanager.C
/// \brief A portable symbol table and hook execution facility
@@ -30,6 +30,10 @@
#include "hookmanager.H"
+#ifndef __HOSTBOOT_MODULE
+#include <dlfcn.h>
+#endif
+
using namespace vsbe;
using namespace fapi;
@@ -83,8 +87,28 @@ HookManager::HookManager() :
}
+/// \todo This destructor leaks memory; We need to add code to delete all of
+/// the dynamic objects.
+
HookManager::~HookManager()
{
+#ifndef __HOSTBOOT_MODULE
+
+ std::vector<void*>::size_type i;
+ int rc;
+
+ for (i = 0; i < iv_dllHandles.size(); i++) {
+
+ rc = ::dlclose(iv_dllHandles[i]);
+ FAPI_DBG("%d <-- dlclose(%p)", rc, iv_dllHandles[i]);
+ if (rc != 0) {
+ FAPI_ERR("%s:%d: dlclose(%p) (iv_dllHandles[%d]) "
+ "failed with the error below\n%s",
+ __FILE__, __LINE__, iv_dllHandles[i], i, ::dlerror());
+ }
+ }
+
+#endif // __HOSTBOOT_MODULE
}
@@ -313,6 +337,25 @@ HookManager::report(const int i_options)
//////////////////////////// Manipulators ////////////////////////////
+void*
+HookManager::dlopen(const char* i_fileName, int i_flags)
+{
+ void* handle = 0;
+
+#ifndef __HOSTBOOT_MODULE
+
+ handle = ::dlopen(i_fileName, i_flags);
+ FAPI_DBG("%p <-- dlopen(%s, %d)", handle, i_fileName, i_flags);
+ if (handle != 0) {
+ instance()->iv_dllHandles.push_back(handle);
+ }
+
+#endif // __HOSTBOOT_MODULE
+
+ return handle;
+}
+
+
HookError
HookManager::registerInstructionHook(const uint32_t i_index,
HookInstructionHook i_hookRoutine)
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;
diff --git a/src/usr/pore/poreve/porevesrc/pibmem.C b/src/usr/pore/poreve/porevesrc/pibmem.C
index a286b77a7..878a110f6 100644
--- a/src/usr/pore/poreve/porevesrc/pibmem.C
+++ b/src/usr/pore/poreve/porevesrc/pibmem.C
@@ -20,7 +20,7 @@
/* Origin: 30 */
/* */
/* IBM_PROLOG_END_TAG */
-// $Id: pibmem.C,v 1.3 2012/12/06 18:03:51 bcbrock Exp $
+// $Id: pibmem.C,v 1.4 2013/02/05 16:14:39 bcbrock Exp $
/// \file pibmem.C
/// \brief A model of the P8 "PIB-attached Memory"
@@ -290,7 +290,8 @@ Pibmem::memoryOperation(Transaction& io_transaction,
if (rc) {
FAPI_ERR("The previous error was from a PIBMEM operation "
- "targeting the indicated address, issued "
+ "targeting the indicated address.\n"
+ "The operation was issued "
"indirectly through the PIBMEM control "
"register 0x%08x",
saveAddress);
diff --git a/src/usr/pore/poreve/porevesrc/pibmem.H b/src/usr/pore/poreve/porevesrc/pibmem.H
index 205f114e6..5ba5caee6 100644
--- a/src/usr/pore/poreve/porevesrc/pibmem.H
+++ b/src/usr/pore/poreve/porevesrc/pibmem.H
@@ -1,30 +1,29 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/usr/pore/poreve/porevesrc/pibmem.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/pibmem.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_PIBMEM_H
#define __VSBE_PIBMEM_H
-// $Id: pibmem.H,v 1.2 2012/05/21 13:20:34 bcbrock Exp $
+// $Id: pibmem.H,v 1.3 2013/11/27 21:23:21 thi Exp $
/// \file pib2mem.H
/// \brief A model of the P8 "PIB-attached Memory"
OpenPOWER on IntegriCloud