From 7615414ee5ffc83a9c2c9d65770c57f69d37fc4e Mon Sep 17 00:00:00 2001 From: Thi Tran Date: Sun, 1 Dec 2013 09:39:35 -0600 Subject: VSBE update SW213552 Change-Id: I1e8d075ace452816183c584561fe948d338ea756 CQ:SW213552 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/7468 Tested-by: Jenkins Server Reviewed-by: Thi N. Tran Reviewed-by: A. Patrick Williams III --- src/usr/pore/fapiporeve/fapiPoreVe.C | 5 +- src/usr/pore/poreve/model/poremodel.C | 12 +-- src/usr/pore/poreve/pore_model/ibuf/pore_bus.c | 1 + src/usr/pore/poreve/pore_model/ibuf/pore_fi2c.c | 1 + src/usr/pore/poreve/pore_model/ibuf/pore_fi2c.h | 45 ++++++------ src/usr/pore/poreve/pore_model/ibuf/pore_ibuf.h | 46 ++++++------ .../poreve/pore_model/ibuf/pore_inline_decode.c | 46 ++++++------ .../poreve/pore_model/ibuf/pore_inline_decode.h | 46 ++++++------ src/usr/pore/poreve/pore_model/ibuf/pore_model.c | 14 ++-- src/usr/pore/poreve/pore_model/ibuf/pore_regs.h | 1 + .../pore/poreve/pore_model/include/pore_model.h | 1 + src/usr/pore/poreve/pore_model/include/vsbe.H | 45 ++++++------ src/usr/pore/poreve/pore_model/wrapper/vsbe.C | 1 + src/usr/pore/poreve/porevesrc/create.C | 48 ++++++------ src/usr/pore/poreve/porevesrc/hookmanager.C | 45 +++++++++++- src/usr/pore/poreve/porevesrc/hookmanager.H | 85 ++++++++++++++++------ src/usr/pore/poreve/porevesrc/pibmem.C | 5 +- src/usr/pore/poreve/porevesrc/pibmem.H | 47 ++++++------ 18 files changed, 292 insertions(+), 202 deletions(-) (limited to 'src/usr/pore') diff --git a/src/usr/pore/fapiporeve/fapiPoreVe.C b/src/usr/pore/fapiporeve/fapiPoreVe.C index 6c6c8fd4c..2cd36af83 100644 --- a/src/usr/pore/fapiporeve/fapiPoreVe.C +++ b/src/usr/pore/fapiporeve/fapiPoreVe.C @@ -21,7 +21,7 @@ /* */ /* IBM_PROLOG_END_TAG */ // -*- mode: C++; c-file-style: "linux"; -*- -// $Id: fapiPoreVe.C,v 1.32 2013/04/05 19:35:32 jeshua Exp $ +// $Id: fapiPoreVe.C,v 1.33 2013/06/25 19:08:33 thi Exp $ // $Source: /afs/awd/projects/eclipz/KnowledgeBase/.cvsroot/eclipz/poreve/working/fapiporeve/fapiPoreVe.C,v $ //------------------------------------------------------------------------------ // *! (C) Copyright International Business Machines Corp. 2011 @@ -845,6 +845,9 @@ This section is automatically updated by CVS when you check in this file. Be sure to create CVS comments when you commit so that they are included here. $Log: fapiPoreVe.C,v $ +Revision 1.33 2013/06/25 19:08:33 thi +Fix Hostboot compile error + Revision 1.32 2013/04/05 19:35:32 jeshua Use dumpOnce() instead of trying to track it ourselves diff --git a/src/usr/pore/poreve/model/poremodel.C b/src/usr/pore/poreve/model/poremodel.C index eeefe779f..5bd38dde1 100644 --- a/src/usr/pore/poreve/model/poremodel.C +++ b/src/usr/pore/poreve/model/poremodel.C @@ -20,7 +20,7 @@ /* Origin: 30 */ /* */ /* IBM_PROLOG_END_TAG */ -// $Id: poremodel.C,v 1.24 2012/08/06 15:11:06 jeshua Exp $ +// $Id: poremodel.C,v 1.25 2013/05/30 00:30:43 bcbrock Exp $ /// \file poremodel.C /// \brief The PORE hardware engine model and interface to the virtual @@ -132,26 +132,26 @@ PoreModel::run(const uint64_t i_instructions, uint64_t& o_ran) ModelError me = ME_SUCCESS; bool stepped; bool writeControl = false; - int iv_status; + int status; do { o_ran = 0; iv_stopCode = 0; - iv_status = getStatus(); + status = getStatus(); - if (iv_status & (PORE_STATUS_ERROR_HALT | PORE_STATUS_MODEL_ERROR)) { + if (status & (PORE_STATUS_ERROR_HALT | PORE_STATUS_MODEL_ERROR)) { break; } me = registerRead(PORE_CONTROL, control); if (me != 0) break; - if (iv_status & PORE_STATUS_HARDWARE_STOP) { + if (status & PORE_STATUS_HARDWARE_STOP) { control &= ~BE64_BIT(0); writeControl = true; } - if (iv_status & (PORE_STATUS_BREAKPOINT | PORE_STATUS_TRAP)) { + if (status & (PORE_STATUS_BREAKPOINT | PORE_STATUS_TRAP)) { control |= BE64_BIT(1); writeControl = true; } diff --git a/src/usr/pore/poreve/pore_model/ibuf/pore_bus.c b/src/usr/pore/poreve/pore_model/ibuf/pore_bus.c index c14c1738a..ef589f166 100644 --- a/src/usr/pore/poreve/pore_model/ibuf/pore_bus.c +++ b/src/usr/pore/poreve/pore_model/ibuf/pore_bus.c @@ -20,6 +20,7 @@ /* Origin: 30 */ /* */ /* IBM_PROLOG_END_TAG */ +// $Id: pore_bus.c,v 1.11 2013/11/27 15:36:44 thi Exp $ /****************************************************************************** * * Virtual PORe Engine diff --git a/src/usr/pore/poreve/pore_model/ibuf/pore_fi2c.c b/src/usr/pore/poreve/pore_model/ibuf/pore_fi2c.c index a5b1de5f6..d398bdcdd 100644 --- a/src/usr/pore/poreve/pore_model/ibuf/pore_fi2c.c +++ b/src/usr/pore/poreve/pore_model/ibuf/pore_fi2c.c @@ -20,6 +20,7 @@ /* Origin: 30 */ /* */ /* IBM_PROLOG_END_TAG */ +// $Id: pore_fi2c.c,v 1.8 2013/11/27 15:44:13 thi Exp $ /****************************************************************************** * * Virtual PORe Engine diff --git a/src/usr/pore/poreve/pore_model/ibuf/pore_fi2c.h b/src/usr/pore/poreve/pore_model/ibuf/pore_fi2c.h index 6284e3648..80332e0f2 100644 --- a/src/usr/pore/poreve/pore_model/ibuf/pore_fi2c.h +++ b/src/usr/pore/poreve/pore_model/ibuf/pore_fi2c.h @@ -1,25 +1,26 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/usr/pore/poreve/pore_model/ibuf/pore_fi2c.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 +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/pore/poreve/pore_model/ibuf/pore_fi2c.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 */ +// $Id: pore_fi2c.h,v 1.2 2013/11/27 15:50:47 thi Exp $ #ifndef __PORE_FI2C_H__ #define __PORE_FI2C_H__ diff --git a/src/usr/pore/poreve/pore_model/ibuf/pore_ibuf.h b/src/usr/pore/poreve/pore_model/ibuf/pore_ibuf.h index 5f19a0b47..864364b18 100644 --- a/src/usr/pore/poreve/pore_model/ibuf/pore_ibuf.h +++ b/src/usr/pore/poreve/pore_model/ibuf/pore_ibuf.h @@ -1,26 +1,26 @@ -/* IBM_PROLOG_BEGIN_TAG - * This is an automatically generated prolog. - * - * $Source: src/usr/pore/poreve/pore_model/ibuf/pore_ibuf.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/pore_model/ibuf/pore_ibuf.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 */ +// $Id: pore_ibuf.h,v 1.8 2013/11/27 15:51:36 thi Exp $ #ifndef __PORE_IBUF_H__ #define __PORE_IBUF_H__ diff --git a/src/usr/pore/poreve/pore_model/ibuf/pore_inline_decode.c b/src/usr/pore/poreve/pore_model/ibuf/pore_inline_decode.c index bc8d28c90..11d7a9618 100644 --- a/src/usr/pore/poreve/pore_model/ibuf/pore_inline_decode.c +++ b/src/usr/pore/poreve/pore_model/ibuf/pore_inline_decode.c @@ -1,26 +1,26 @@ -/* IBM_PROLOG_BEGIN_TAG - * This is an automatically generated prolog. - * - * $Source: src/usr/pore/poreve/pore_model/ibuf/pore_inline_decode.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_TAG - */ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/pore/poreve/pore_model/ibuf/pore_inline_decode.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: pore_inline_decode.c,v 1.4 2013/11/27 15:52:00 thi Exp $ #include #include "pore_inline_decode.h" diff --git a/src/usr/pore/poreve/pore_model/ibuf/pore_inline_decode.h b/src/usr/pore/poreve/pore_model/ibuf/pore_inline_decode.h index 604f32d7e..e78ac4bfb 100644 --- a/src/usr/pore/poreve/pore_model/ibuf/pore_inline_decode.h +++ b/src/usr/pore/poreve/pore_model/ibuf/pore_inline_decode.h @@ -1,26 +1,26 @@ -/* IBM_PROLOG_BEGIN_TAG - * This is an automatically generated prolog. - * - * $Source: src/usr/pore/poreve/pore_model/ibuf/pore_inline_decode.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/pore_model/ibuf/pore_inline_decode.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 */ +// $Id: pore_inline_decode.h,v 1.4 2013/11/27 15:52:18 thi Exp $ #ifndef __PORE_INLINE_DECODE_H__ #define __PORE_INLINE_DECODE_H__ diff --git a/src/usr/pore/poreve/pore_model/ibuf/pore_model.c b/src/usr/pore/poreve/pore_model/ibuf/pore_model.c index 8b0d5747c..5d4593e1a 100644 --- a/src/usr/pore/poreve/pore_model/ibuf/pore_model.c +++ b/src/usr/pore/poreve/pore_model/ibuf/pore_model.c @@ -20,6 +20,7 @@ /* Origin: 30 */ /* */ /* IBM_PROLOG_END_TAG */ +// $Id: pore_model.c,v 1.26 2013/11/27 15:52:41 thi Exp $ /****************************************************************************** * * Virtual PORe Engine @@ -486,8 +487,10 @@ static int setAluFlags(pore_model_t p, int64_t op1, int64_t op2, } /* C: set carry bit */ - if (((op1 & 0x7fffffffffffffffull) + - (op2 & 0x7FFFFFFFFFFFFFFFull)) & (0x1ull << 63)) { + if( op2 == 0) { + id_flags->c = 1; + } else if (((op1 & 0x7fffffffffffffffull) + + (op2 & 0x7FFFFFFFFFFFFFFFull)) & (0x1ull << 63)) { if ((PORE_GET_BIT(op1,0) + PORE_GET_BIT(op2,0) + 1 ) >> 1) { id_flags->c = 1; @@ -1063,10 +1066,9 @@ int pore_writeReg(pore_model_t p, pore_reg_t reg, uint64_t val, uint64_t msk) case PORE_R_CONTROL: /* SIDE EFFECTS */ return pore_control_reg_write(p, val, msk); - case PORE_R_RESET: - write_under_mask(&p->reset.val, - val & PORE_RESET_VALID_BITS, msk); - break; + case PORE_R_RESET: /* SIDE EFFECTS */ + return pore_reset_reg_write(p, val, msk); + case PORE_R_ERROR_MASK: write_under_mask(&p->error_mask.val, val & PORE_ERROR_MASK_VALID_BITS, msk); diff --git a/src/usr/pore/poreve/pore_model/ibuf/pore_regs.h b/src/usr/pore/poreve/pore_model/ibuf/pore_regs.h index 0716984f1..afd004aa1 100644 --- a/src/usr/pore/poreve/pore_model/ibuf/pore_regs.h +++ b/src/usr/pore/poreve/pore_model/ibuf/pore_regs.h @@ -20,6 +20,7 @@ /* Origin: 30 */ /* */ /* IBM_PROLOG_END_TAG */ +// $Id: pore_regs.h,v 1.9 2013/11/27 15:53:11 thi Exp $ #ifndef __PORE_REGS__ #define __PORE_REGS__ diff --git a/src/usr/pore/poreve/pore_model/include/pore_model.h b/src/usr/pore/poreve/pore_model/include/pore_model.h index ef3425f64..5190151ad 100644 --- a/src/usr/pore/poreve/pore_model/include/pore_model.h +++ b/src/usr/pore/poreve/pore_model/include/pore_model.h @@ -20,6 +20,7 @@ /* Origin: 30 */ /* */ /* IBM_PROLOG_END_TAG */ +// $Id: pore_model.h,v 1.17 2013/11/27 17:13:23 thi Exp $ #ifndef __PORE_MODEL__ #define __PORE_MODEL__ diff --git a/src/usr/pore/poreve/pore_model/include/vsbe.H b/src/usr/pore/poreve/pore_model/include/vsbe.H index 393053303..adcf5d308 100644 --- a/src/usr/pore/poreve/pore_model/include/vsbe.H +++ b/src/usr/pore/poreve/pore_model/include/vsbe.H @@ -1,25 +1,26 @@ -// IBM_PROLOG_BEGIN_TAG -// This is an automatically generated prolog. -// -// $Source: src/usr/pore/poreve/pore_model/include/vsbe.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 +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/pore/poreve/pore_model/include/vsbe.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 */ +// $Id: vsbe.H,v 1.9 2013/11/27 17:21:19 thi Exp $ #ifndef __VSBE_H #define __VSBE_H diff --git a/src/usr/pore/poreve/pore_model/wrapper/vsbe.C b/src/usr/pore/poreve/pore_model/wrapper/vsbe.C index 832f8f3f3..95c140f75 100644 --- a/src/usr/pore/poreve/pore_model/wrapper/vsbe.C +++ b/src/usr/pore/poreve/pore_model/wrapper/vsbe.C @@ -20,6 +20,7 @@ /* Origin: 30 */ /* */ /* IBM_PROLOG_END_TAG */ +// $Id: vsbe.C,v 1.17 2013/11/27 17:24:37 thi Exp $ /****************************************************************************** * * \file vsbe.C 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 +#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::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 #include #include +#include #include @@ -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 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" -- cgit v1.2.1