From 7799749ee2db86f4fb66c4a7a69fb9fb0b46334e Mon Sep 17 00:00:00 2001 From: Patrick Williams Date: Mon, 21 Nov 2011 15:44:52 -0600 Subject: Interactive debug tool. - Modify debug fw to support writing data. - Modify debug fw to support clocking model forward. - Add simics environment support for both. - Kernel support to start a task when directed. - Write debug tool to modify kernel structure for debug. Change-Id: Ic001dfd45f91392aefbc9d5096c5344018d5190e Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/518 Tested-by: Jenkins Server Reviewed-by: Andrew J. Geissler Reviewed-by: Daniel M. Crowell Reviewed-by: A. Patrick Williams III --- src/include/kernel/cpumgr.H | 7 ++-- src/include/kernel/idebug.H | 85 ++++++++++++++++++++++++++++++++++++++++++++ src/include/kernel/taskmgr.H | 9 +++-- 3 files changed, 96 insertions(+), 5 deletions(-) create mode 100644 src/include/kernel/idebug.H (limited to 'src/include/kernel') diff --git a/src/include/kernel/cpumgr.H b/src/include/kernel/cpumgr.H index 78ade4ae3..1499fba98 100644 --- a/src/include/kernel/cpumgr.H +++ b/src/include/kernel/cpumgr.H @@ -26,12 +26,13 @@ #include #include #include +#include class CpuManager { public: - enum - { + enum + { MAXCPUS = KERNEL_MAX_SUPPORTED_CPUS, CPU_PERIODIC_CHECK_MEMORY = 64, CPU_PERIODIC_FLUSH_PAGETABLE = 512, //TODO 1024 not currently hit @@ -105,6 +106,8 @@ class CpuManager // The status code that needs to be posted during shutdown static uint64_t cv_shutdown_status; + + static InteractiveDebug cv_interactive_debug; }; #endif diff --git a/src/include/kernel/idebug.H b/src/include/kernel/idebug.H new file mode 100644 index 000000000..584dacf80 --- /dev/null +++ b/src/include/kernel/idebug.H @@ -0,0 +1,85 @@ +// IBM_PROLOG_BEGIN_TAG +// This is an automatically generated prolog. +// +// $Source: src/include/kernel/idebug.H $ +// +// IBM CONFIDENTIAL +// +// COPYRIGHT International Business Machines Corp. 2011 +// +// 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 +#ifndef __KERNEL_IDEBUG_H +#define __KERNEL_IDEBUG_H + +/** @file idebug.H + * @brief Structure for interactive debug support. + */ + +#include +#include + +/** @class InteractiveDebug + * @brief Structure that defines data needed for an interactive-debug call. + */ +class InteractiveDebug +{ + public: + /** Union to contain the state information between the kernel and + * the debug tool. + */ + union + { + struct + { + /** Boolean for 'ready' state. */ + uint8_t ready; + /** Boolean to mark kernel running request. */ + uint8_t running; + /** Boolean to mark execution is complete. */ + uint8_t complete; + uint8_t __reserved[5]; + }; + /** Word so that state can be atomically updated. */ + uint64_t state_value; + }; + + /** Address of the desired function's TOC. */ + uint64_t entry_point_toc; + /** Return value from function. */ + uint64_t return_value; + + /** Desired function parameters. */ + uint64_t parms[8]; + + /** @brief Returns the 'ready' state from the union. */ + bool isReady() { return ready != 0; }; + + /** @brief Creates a userspace task to execute debug call. + * + * @pre 'ready' state set and entry_point/parms are initialized by + * the debug tool. + * + * @post A detached task is created to execute the function. + */ + void startDebugTask(); + + private: + /** @brief Entry point for 'task_create' of debug task. + * @param[in] idebug - Pointer to this interactive-debug structure. + */ + static void debugEntryPoint(void* idebug); +}; + +#endif diff --git a/src/include/kernel/taskmgr.H b/src/include/kernel/taskmgr.H index 8f1deb264..63aa76484 100644 --- a/src/include/kernel/taskmgr.H +++ b/src/include/kernel/taskmgr.H @@ -21,7 +21,7 @@ // // IBM_PROLOG_END #ifndef __KERNEL_TASKMGR_H -#define __KENREL_TASKMGR_H +#define __KERNEL_TASKMGR_H #include #include @@ -114,8 +114,11 @@ class TaskManager * * @param[in] t - The entry point to start the task at. * @param[in] p - An argument pointer to pass to the task. + * @param[in] kernelParent - Should the kernel be assigned the parent + * of the new task. */ - static task_t* createTask(task_fn_t t, void* p); + static task_t* createTask(task_fn_t t, void* p, + bool kernelParent = false); /** @brief End / destroy a task object. * @@ -156,7 +159,7 @@ class TaskManager // Internal implementations of non-static / non-_ functions. task_t* _createIdleTask(); - task_t* _createTask(task_fn_t, void*, bool); + task_t* _createTask(task_fn_t, void*, bool, bool); void _endTask(task_t*, void*, int); void _waitTask(task_t*, int64_t, int*, void**); -- cgit v1.2.1