diff options
Diffstat (limited to 'src/usr')
-rw-r--r-- | src/usr/cxxtest/makefile | 30 | ||||
-rw-r--r-- | src/usr/cxxtest/runtime/makefile | 31 | ||||
-rw-r--r-- | src/usr/cxxtest/runtime/rt_cxxtestexec.C | 76 | ||||
-rw-r--r-- | src/usr/pnor/pnorrp.C | 1 | ||||
-rw-r--r-- | src/usr/testcore/lib/makefile | 30 | ||||
-rw-r--r-- | src/usr/testcore/lib/runtime/makefile | 30 | ||||
-rw-r--r-- | src/usr/testcore/makefile | 30 | ||||
-rw-r--r-- | src/usr/testcore/rtloader/loader.H | 164 | ||||
-rw-r--r-- | src/usr/testcore/rtloader/makefile | 28 | ||||
-rw-r--r-- | src/usr/trace/compdesc.C | 2 | ||||
-rw-r--r-- | src/usr/trace/makefile | 4 | ||||
-rw-r--r-- | src/usr/trace/runtime/makefile | 30 | ||||
-rw-r--r-- | src/usr/trace/runtime/rt_service.C | 96 | ||||
-rw-r--r-- | src/usr/trace/service.H | 4 |
14 files changed, 509 insertions, 47 deletions
diff --git a/src/usr/cxxtest/makefile b/src/usr/cxxtest/makefile index 979ae0bd4..c02f22d8d 100644 --- a/src/usr/cxxtest/makefile +++ b/src/usr/cxxtest/makefile @@ -1,30 +1,30 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. # -# $Source: src/usr/cxxtest/makefile $ +# $Source: src/usr/cxxtest/makefile $ # -# IBM CONFIDENTIAL +# IBM CONFIDENTIAL # -# COPYRIGHT International Business Machines Corp. 2011 +# COPYRIGHT International Business Machines Corp. 2011,2013 # -# p1 +# p1 # -# Object Code Only (OCO) source materials -# Licensed Internal Code Source Materials -# IBM HostBoot Licensed Internal Code +# 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. +# 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 +# Origin: 30 # -# IBM_PROLOG_END +# IBM_PROLOG_END_TAG ROOTPATH = ../../.. MODULE = cxxtest -SUBDIRS=test.d +SUBDIRS=test.d runtime.d OBJS = TestSuite.o cxxtestexec.o diff --git a/src/usr/cxxtest/runtime/makefile b/src/usr/cxxtest/runtime/makefile new file mode 100644 index 000000000..4bdab1441 --- /dev/null +++ b/src/usr/cxxtest/runtime/makefile @@ -0,0 +1,31 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/cxxtest/runtime/makefile $ +# +# IBM CONFIDENTIAL +# +# COPYRIGHT International Business Machines Corp. 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 +HOSTBOOT_RUNTIME = 1 +ROOTPATH = ../../../.. +MODULE = cxxtest_rt + +OBJS = TestSuite.o rt_cxxtestexec.o + +VPATH += .. + +include ${ROOTPATH}/config.mk diff --git a/src/usr/cxxtest/runtime/rt_cxxtestexec.C b/src/usr/cxxtest/runtime/rt_cxxtestexec.C new file mode 100644 index 000000000..08956f00a --- /dev/null +++ b/src/usr/cxxtest/runtime/rt_cxxtestexec.C @@ -0,0 +1,76 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/cxxtest/runtime/rt_cxxtestexec.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 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 */ +#include <cxxtest/TestSuite.H> +#include <limits.h> +#include <hbotcompid.H> +#include <runtime/interface.h> + +#include <kernel/console.H> +#include <vfs/vfs.H> + +trace_desc_t *g_trac_cxxtest = NULL; +TRAC_INIT(&g_trac_cxxtest, CXXTEST_COMP_NAME, KILOBYTE ); + +namespace CxxTest +{ + void execute(void* io_stats) + { + CxxTestStats* stats = reinterpret_cast<CxxTestStats*>(io_stats); + + std::vector<const char*> module_list; + VFS::find_test_modules(module_list); + + printk("Running Runtime CXX Tests: %ld\n", module_list.size()); + + g_ModulesStarted++; + for (std::vector<const char*>::const_iterator i = module_list.begin(); + i != module_list.end(); + ++i) + { + g_ModulesStarted++; + + printk("\tRunning Runtime test: %s\n", *i); + void* (*start_entry)(void*) = reinterpret_cast<void*(*)(void*)>( + vfs_start_entrypoint(vfs_find_module(VFS_MODULES, *i))); + start_entry(NULL); + } + + g_ModulesCompleted++; + + __sync_add_and_fetch(stats->totalTests, g_TotalTests); + __sync_add_and_fetch(stats->traceCalls, g_TraceCalls); + __sync_add_and_fetch(stats->warnings, g_Warnings); + __sync_add_and_fetch(stats->failedTests, g_FailedTests); + __sync_add_and_fetch(stats->modulesStarted, g_ModulesStarted); + __sync_add_and_fetch(stats->modulesCompleted, g_ModulesCompleted); + } + + struct registerCxxTest + { + registerCxxTest() + { + getRuntimeInterfaces()->cxxtestExecute = &execute; + } + }; + registerCxxTest g_register; +} diff --git a/src/usr/pnor/pnorrp.C b/src/usr/pnor/pnorrp.C index 015b9f6ce..debc1bf7e 100644 --- a/src/usr/pnor/pnorrp.C +++ b/src/usr/pnor/pnorrp.C @@ -57,6 +57,7 @@ const char* cv_EYECATCHER[] = { //@todo - convert there to uint64_t "SBE", /**< PNOR::SBE_IPL : Self-Boot Enginer IPL image */ "WINK", /**< PNOR::WINK : Sleep Winkle Reference image */ "PAYLOAD",/**< PNOR::PAYLOAD : HAL/OPAL */ + "HBRT", /**< PNOR::HB_RUNTIME : Hostboot Runtime (for Sapphire) */ "HBD", /**< PNOR::HB_DATA : Hostboot Data */ "GUARD", /**< PNOR::GUARD_DATA : Hostboot Data */ "HBEL", /**< PNOR::HB_ERRLOGS : Hostboot Error log Repository */ diff --git a/src/usr/testcore/lib/makefile b/src/usr/testcore/lib/makefile index e6cd02321..e2516304e 100644 --- a/src/usr/testcore/lib/makefile +++ b/src/usr/testcore/lib/makefile @@ -1,28 +1,30 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. # -# $Source: src/usr/testcore/lib/makefile $ +# $Source: src/usr/testcore/lib/makefile $ # -# IBM CONFIDENTIAL +# IBM CONFIDENTIAL # -# COPYRIGHT International Business Machines Corp. 2011 +# COPYRIGHT International Business Machines Corp. 2011,2013 # -# p1 +# p1 # -# Object Code Only (OCO) source materials -# Licensed Internal Code Source Materials -# IBM HostBoot Licensed Internal Code +# 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. +# 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 +# Origin: 30 # -# IBM_PROLOG_END +# IBM_PROLOG_END_TAG ROOTPATH = ../../../.. MODULE = testsyslib TESTS = *.H +SUBDIRS = runtime.d + include ${ROOTPATH}/config.mk diff --git a/src/usr/testcore/lib/runtime/makefile b/src/usr/testcore/lib/runtime/makefile new file mode 100644 index 000000000..a745479fd --- /dev/null +++ b/src/usr/testcore/lib/runtime/makefile @@ -0,0 +1,30 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/testcore/lib/runtime/makefile $ +# +# IBM CONFIDENTIAL +# +# COPYRIGHT International Business Machines Corp. 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 +HOSTBOOT_RUNTIME = 1 +ROOTPATH = ../../../../.. + +MODULE = testsyslib_rt +TESTCASES = stltest.H string.H +TESTS = $(addprefix ../,$(TESTCASES)) + +include $(ROOTPATH)/config.mk diff --git a/src/usr/testcore/makefile b/src/usr/testcore/makefile index 4e1deec5b..a11fbeb1a 100644 --- a/src/usr/testcore/makefile +++ b/src/usr/testcore/makefile @@ -1,28 +1,28 @@ -# IBM_PROLOG_BEGIN_TAG -# This is an automatically generated prolog. +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. # -# $Source: src/usr/testcore/makefile $ +# $Source: src/usr/testcore/makefile $ # -# IBM CONFIDENTIAL +# IBM CONFIDENTIAL # -# COPYRIGHT International Business Machines Corp. 2011 +# COPYRIGHT International Business Machines Corp. 2011,2013 # -# p1 +# p1 # -# Object Code Only (OCO) source materials -# Licensed Internal Code Source Materials -# IBM HostBoot Licensed Internal Code +# 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. +# 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 +# Origin: 30 # -# IBM_PROLOG_END +# IBM_PROLOG_END_TAG ROOTPATH = ../../.. -SUBDIRS = lib.d kernel.d +SUBDIRS = lib.d kernel.d rtloader.d include ${ROOTPATH}/config.mk diff --git a/src/usr/testcore/rtloader/loader.H b/src/usr/testcore/rtloader/loader.H new file mode 100644 index 000000000..9b17fcea5 --- /dev/null +++ b/src/usr/testcore/rtloader/loader.H @@ -0,0 +1,164 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/testcore/rtloader/loader.H $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 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 __TESTCORE_RTLOADER_LOADER_H +#define __TESTCORE_RTLOADER_LOADER_H + +#include <pnor/pnorif.H> +#include <util/align.H> +#include <sys/mm.h> + +#include <runtime/interface.h> + +class RuntimeLoaderTest : public CxxTest::TestSuite +{ + public: + void testLoader() + { + static const uint64_t HEADER_OFFSET = 0x2000; + + PNOR::SectionInfo_t runtimeSection; + + errlHndl_t l_errl = + PNOR::getSectionInfo(PNOR::HB_RUNTIME, PNOR::CURRENT_SIDE, + runtimeSection); + + if (l_errl) + { + TS_WARN("Could not find runtime section."); + delete l_errl; + return; + } + + if (runtimeSection.size < HEADER_OFFSET) + { + TS_FAIL("Runtime image is not big enough. %x", + runtimeSection.size); + return; + } + + uint64_t imageSize = + *reinterpret_cast<uint64_t*>(runtimeSection.vaddr + + HEADER_OFFSET); + if (runtimeSection.size < imageSize + sizeof(uint64_t)) + { + TS_FAIL("Image header has too big a size: %x, %x", + runtimeSection.size, imageSize); + return; + } + + uint64_t relocations = + *reinterpret_cast<uint64_t*>(runtimeSection.vaddr + imageSize); + imageSize += (relocations + 1) * sizeof(uint64_t); + + if (runtimeSection.size < imageSize) + { + TS_FAIL("Image header + relocations is too big: %x, %x, %d", + runtimeSection.size, imageSize, relocations); + return; + } + + void* imageArea = malloc(ALIGN_PAGE(imageSize)); + memcpy(imageArea, reinterpret_cast<void*>(runtimeSection.vaddr), + imageSize); + mm_icache_invalidate(imageArea, + ALIGN_PAGE(imageSize) / sizeof(uint64_t)); + + + mm_set_permission(imageArea, HEADER_OFFSET, EXECUTABLE); + + TRACFCOMP(g_trac_test, "Runtime image loaded @ %x", imageArea); + + do + { + hostInterfaces_t* intf = new hostInterfaces_t(); + intf->puts = rt_puts; + intf->set_page_execute = rt_setPageExecute; + intf->malloc = malloc; + intf->free = free; + intf->realloc = realloc; + intf->assert = rt_assert; + + // Call init. + runtimeInterfaces_t* rtInterface = + reinterpret_cast<runtimeInterfaces_t*>( + callViaCtr( + reinterpret_cast<uint64_t>(imageArea) + 0x100, + intf, NULL) + ); + if (NULL == rtInterface) + { + TS_FAIL("Failed to init runtime services."); + break; + } + + { + using namespace CxxTest; + + // Initialize statistics structure. + CxxTestStats cxxTestStats = + { &g_TotalTests, &g_TraceCalls, &g_Warnings, + &g_FailedTests, &g_ModulesStarted, + &g_ModulesCompleted }; + + // Call CxxTest entry. + (*rtInterface->cxxtestExecute)(&cxxTestStats); + } + + } while(0); + + mm_set_permission(imageArea, imageSize, WRITABLE); + free(imageArea); + } + + private: + uint64_t callViaCtr(uint64_t entry, void* param0, void* param1) + { + register uint64_t result = 0; + + asm volatile("mtctr %1; mr 3, %2 ; mr 4, %3; " + "std 2, 40(1); bctrl; ld 2, 40(1); " + "mr %0, 3" : + "=r" (result) : "r" (entry), "r" (param0), "r" (param1) : + "lr","ctr","r0","r3","r4","r5","r6","r7","r8","r9", + "r10","r11"); // TODO: Need to double check the ABI here. + + return result; + } + + static void rt_puts(const char* str) + { + TRACFCOMP(g_trac_test, "RUNTIME MSG: %s", str); + } + + static int rt_setPageExecute(void* addr) + { + return mm_set_permission(addr, PAGESIZE, EXECUTABLE); + } + + static void rt_assert() + { + assert(false); + } +}; + +#endif diff --git a/src/usr/testcore/rtloader/makefile b/src/usr/testcore/rtloader/makefile new file mode 100644 index 000000000..0fcd01d42 --- /dev/null +++ b/src/usr/testcore/rtloader/makefile @@ -0,0 +1,28 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/testcore/rtloader/makefile $ +# +# IBM CONFIDENTIAL +# +# COPYRIGHT International Business Machines Corp. 2011,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 +ROOTPATH = ../../../.. + +MODULE = testrtloader +TESTS = *.H + +include ${ROOTPATH}/config.mk diff --git a/src/usr/trace/compdesc.C b/src/usr/trace/compdesc.C index ddfd860dc..35f4de0c5 100644 --- a/src/usr/trace/compdesc.C +++ b/src/usr/trace/compdesc.C @@ -93,6 +93,7 @@ namespace TRACE l_rc = &iv_components.back(); } +#ifndef __HOSTBOOT_RUNTIME // TODO: RTC 79408 // Check for special SCAN component to force enable debug trace on. if (0 == memcmp(l_compName, "SCAN", 5)) { @@ -107,6 +108,7 @@ namespace TRACE l_rc->iv_debugEnabled = true; } } +#endif mutex_unlock(&iv_mutex); return l_rc; diff --git a/src/usr/trace/makefile b/src/usr/trace/makefile index c58a11a4f..6195ae522 100644 --- a/src/usr/trace/makefile +++ b/src/usr/trace/makefile @@ -5,7 +5,7 @@ # # IBM CONFIDENTIAL # -# COPYRIGHT International Business Machines Corp. 2011,2012 +# COPYRIGHT International Business Machines Corp. 2011,2013 # # p1 # @@ -26,6 +26,6 @@ MODULE = trace OBJS = interface.o service.o compdesc.o buffer.o bufferpage.o daemonif.o \ debug.o assert.o -SUBDIRS = daemon.d test.d +SUBDIRS = daemon.d test.d runtime.d include ${ROOTPATH}/config.mk diff --git a/src/usr/trace/runtime/makefile b/src/usr/trace/runtime/makefile new file mode 100644 index 000000000..6c4f21407 --- /dev/null +++ b/src/usr/trace/runtime/makefile @@ -0,0 +1,30 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/usr/trace/runtime/makefile $ +# +# IBM CONFIDENTIAL +# +# COPYRIGHT International Business Machines Corp. 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 +HOSTBOOT_RUNTIME = 1 +ROOTPATH = ../../../.. +MODULE = trace_rt + +OBJS = interface.o assert.o compdesc.o rt_service.o + +VPATH += .. +include $(ROOTPATH)/config.mk diff --git a/src/usr/trace/runtime/rt_service.C b/src/usr/trace/runtime/rt_service.C new file mode 100644 index 000000000..2bb697d3e --- /dev/null +++ b/src/usr/trace/runtime/rt_service.C @@ -0,0 +1,96 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/usr/trace/runtime/rt_service.C $ */ +/* */ +/* IBM CONFIDENTIAL */ +/* */ +/* COPYRIGHT International Business Machines Corp. 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 */ +#include "../service.H" +#include "../compdesc.H" +#include <limits.h> +#include <assert.h> +#include <stdio.h> +#include <runtime/interface.h> + +namespace TRACE +{ + + Service::Service() + { + } + + Service::~Service() + { + // No need to destruct the service. + assert(0); + } + + void Service::writeEntry(ComponentDesc* i_td, + trace_hash_val i_hash, + const char * i_fmt, + uint32_t i_line, + uint32_t i_type, + va_list i_args) + { + if (unlikely(i_type == TRACE_DEBUG)) + { + if (!i_td->iv_debugEnabled) + { + return; + } + } + + char output[KILOBYTE]; + vsprintf(output, i_fmt, i_args); // TODO: RTC 79420 : + // Potential buffer overrun. + g_hostInterfaces->puts(output); + } + + void Service::writeBinEntry(ComponentDesc* i_td, + trace_hash_val i_hash, + uint32_t i_ine, + const void* i_ptr, + uint32_t i_size, + uint32_t i_type) + { + if (unlikely(i_type == TRACE_DEBUG)) + { + if (!i_td->iv_debugEnabled) + { + return; + } + } + + // TODO: RTC 79420 + + } + + size_t Service::getBuffer(ComponentDesc* i_comp, + void * o_data, + size_t i_size) + { + // No way to get the buffer back in runtime. + return 0; + } + + void Service::flushBuffers() + { + // No-op in runtime. + } + +} diff --git a/src/usr/trace/service.H b/src/usr/trace/service.H index 1f81d9a2f..61e9bc494 100644 --- a/src/usr/trace/service.H +++ b/src/usr/trace/service.H @@ -5,7 +5,7 @@ /* */ /* IBM CONFIDENTIAL */ /* */ -/* COPYRIGHT International Business Machines Corp. 2012 */ +/* COPYRIGHT International Business Machines Corp. 2012,2013 */ /* */ /* p1 */ /* */ @@ -144,6 +144,7 @@ namespace TRACE friend class TRACEDAEMON::Daemon; private: +#ifndef __HOSTBOOT_RUNTIME /** Front-size buffers */ Buffer* iv_buffers[BUFFER_COUNT]; // slow / fast buffers. /** Interface to signal daemon. */ @@ -155,6 +156,7 @@ namespace TRACE static Service* getGlobalInstance(); /** Copy the current time into the timestamp. */ void _createTimeStamp(trace_entry_stamp_t* o_entry); +#endif }; } |