diff options
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/kernel/block.H | 10 | ||||
| -rw-r--r-- | src/include/kernel/heapmgr.H | 11 | ||||
| -rw-r--r-- | src/include/kernel/pagemgr.H | 8 | ||||
| -rw-r--r-- | src/include/kernel/segmentmgr.H | 9 | ||||
| -rw-r--r-- | src/include/kernel/taskmgr.H | 14 | ||||
| -rw-r--r-- | src/include/usr/debugpointers.H | 117 |
6 files changed, 163 insertions, 6 deletions
diff --git a/src/include/kernel/block.H b/src/include/kernel/block.H index 80f62b3e0..219c7d3e2 100644 --- a/src/include/kernel/block.H +++ b/src/include/kernel/block.H @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2011,2014 */ +/* Contributors Listed Below - COPYRIGHT 2011,2018 */ +/* [+] International Business Machines Corp. */ +/* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ @@ -149,6 +151,11 @@ class Block void updateRefCount( uint64_t i_vaddr, PageTableManager::UsageStats_t i_stats ); + /** + * Add pointers to the global debug area + */ + static void addDebugPointers(); + friend class Segment; friend class BaseSegment; friend class StackSegment; @@ -285,7 +292,6 @@ class Block uint64_t i_size, task_t* i_task); - private: /** Base address of the block */ const uint64_t iv_baseAddr; diff --git a/src/include/kernel/heapmgr.H b/src/include/kernel/heapmgr.H index 9f1d0a7ed..8710e40c7 100644 --- a/src/include/kernel/heapmgr.H +++ b/src/include/kernel/heapmgr.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2010,2017 */ +/* Contributors Listed Below - COPYRIGHT 2010,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -116,6 +116,10 @@ class HeapManager */ static void free(void * i_ptr); + /** + * Add pointers to the global debug area + */ + static void addDebugPointers(); protected: @@ -224,6 +228,11 @@ class HeapManager */ void test_pages(); + /** + * Add pointers to the global debug area + */ + void _addDebugPointers(); + private: // data Util::Lockfree::Stack<chunk_t> first_chunk[BUCKETS]; //!< free pool diff --git a/src/include/kernel/pagemgr.H b/src/include/kernel/pagemgr.H index c842a9360..2431c613d 100644 --- a/src/include/kernel/pagemgr.H +++ b/src/include/kernel/pagemgr.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2010,2016 */ +/* Contributors Listed Below - COPYRIGHT 2010,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -181,6 +181,11 @@ class PageManager */ static void addMemory(size_t i_addr, size_t i_pageCount); + /** + * Add pointers to the global debug area + */ + static void addDebugPointers(); + enum { KERNEL_HEAP_RESERVED_PAGES = 4, @@ -208,6 +213,7 @@ class PageManager void _freePage(void*, size_t); //!< see freePage() void _coalesce( void ); //!< see coalesce() void _addMemory(size_t, size_t); //!< see addMemory() + void _addDebugPointers(); //!< see addDebugPointers() /** see queryAvail() */ ALWAYS_INLINE uint64_t _queryAvail() const diff --git a/src/include/kernel/segmentmgr.H b/src/include/kernel/segmentmgr.H index 34bbe8fb6..2534590bc 100644 --- a/src/include/kernel/segmentmgr.H +++ b/src/include/kernel/segmentmgr.H @@ -5,7 +5,7 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2011,2015 */ +/* Contributors Listed Below - COPYRIGHT 2011,2018 */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -154,6 +154,10 @@ class SegmentManager */ static int devUnmap(void* ea); + /** + * Add pointers to the global debug area + */ + static void addDebugPointers(); private: @@ -188,6 +192,9 @@ class SegmentManager return i_addr >> SLBE_s; } + /** See addDebugPointers */ + void _addDebugPointers(); + /** Array of segment objects to associated segment IDs. */ Segment* iv_segments[MAX_SEGMENTS]; }; diff --git a/src/include/kernel/taskmgr.H b/src/include/kernel/taskmgr.H index 2b2e17f34..71dc6cfc9 100644 --- a/src/include/kernel/taskmgr.H +++ b/src/include/kernel/taskmgr.H @@ -5,7 +5,9 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* COPYRIGHT International Business Machines Corp. 2010,2014 */ +/* Contributors Listed Below - COPYRIGHT 2010,2018 */ +/* [+] International Business Machines Corp. */ +/* */ /* */ /* Licensed under the Apache License, Version 2.0 (the "License"); */ /* you may not use this file except in compliance with the License. */ @@ -144,6 +146,11 @@ class TaskManager static void waitTask(task_t* t, int64_t tid, int* status, void** retval); + /** + * Add pointers to the global debug area + */ + static void addDebugPointers(); + friend class CpuManager; protected: @@ -174,6 +181,11 @@ class TaskManager */ void removeTracker(task_tracking_t* t); + /** + * Add pointers to the global debug area + */ + void _addDebugPointers(); + /** Atomic monotonically increasing counter to use for TIDs. */ Util::Lockfree::Counter<tid_t> iv_nextTid; diff --git a/src/include/usr/debugpointers.H b/src/include/usr/debugpointers.H new file mode 100644 index 000000000..01de1a0d8 --- /dev/null +++ b/src/include/usr/debugpointers.H @@ -0,0 +1,117 @@ +/* IBM_PROLOG_BEGIN_TAG */ +/* This is an automatically generated prolog. */ +/* */ +/* $Source: src/include/usr/debugpointers.H $ */ +/* */ +/* OpenPOWER HostBoot Project */ +/* */ +/* Contributors Listed Below - COPYRIGHT 2018 */ +/* [+] International Business Machines Corp. */ +/* */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); */ +/* you may not use this file except in compliance with the License. */ +/* You may obtain a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */ +/* implied. See the License for the specific language governing */ +/* permissions and limitations under the License. */ +/* */ +/* IBM_PROLOG_END_TAG */ +#ifndef _DEBUGPOINTERS_H +#define _DEBUGPOINTERS_H + +/** + * This file contains details on a list of pointers that can be used + * by our debug framework without requiring an exact build match. + */ + +// Static space allocated in start.S +// This points to a dynamically allocated instance of a DebugPointers_t +extern void* debug_pointers; + +namespace DEBUG +{ +// Maximum number of entries +constexpr uint16_t MAX_ENTRIES = 20; + +// Eyecatcher to detect levels without this support +// = DEBUGPTR +constexpr uint64_t EYECATCHER = 0x4445425547505452; + +// Only 1 version so far but allow for others +constexpr uint16_t VERSION_LATEST = 0x0001; + +// A pair of pointers +struct PointerPair_t +{ + union { + char label[8]; + uint64_t label_num; //Makes assignments and checking simpler + }; + uint32_t size; // bytes + uint32_t pointer; // we never use all 64-bits of a native pointer +} PACKED; + +// Table of Debug Pointers +struct DebugPointers_t +{ + uint64_t eyecatcher; + uint16_t version; + uint16_t numEntries; + uint32_t reserved; + PointerPair_t pairs[MAX_ENTRIES]; + + DebugPointers_t() + : eyecatcher(EYECATCHER), + version(VERSION_LATEST), + numEntries(MAX_ENTRIES), + reserved(0) + { + memset( pairs, 0, sizeof(pairs) ); + } +} PACKED; + +/* + * List of known debug pointers + * Note: Must keep debug tools in sync if these values change + */ +constexpr uint64_t PRINTK = 0x5052494e544b2020; //'PRINTK ' +constexpr uint64_t TRACESERVICE = 0x5452414345535643; //'TRACESVC' +constexpr uint64_t TRACEDAEMON = 0x5452414345444D4E; //'TRACEDMN' +constexpr uint64_t TASKMANAGER = 0x5441534b4c495354; //'TASKLIST' +constexpr uint64_t ERRORLOGS = 0x4552524f524c4f47; //'ERRORLOG' +constexpr uint64_t HEAPMANAGER = 0x484541504d475220; //'HEAPMGR ' +constexpr uint64_t HEAPMANAGERLARGEPAGECOUNT = 0x484541504d4c5043; //'HEAPMLPC' +constexpr uint64_t HEAPMANAGERLARGEPAGEMAX = 0x484541504d4c504d; //'HEAPMLPM' +constexpr uint64_t HEAPMANAGERSMALLPAGECOUNT = 0x484541504d535043; //'HEAPMSPC' +constexpr uint64_t HEAPMANAGERCOALESCECOUNT = 0x484541504d434e54; //'HEAPMCNT' +constexpr uint64_t HEAPMANAGERFREEBYTES = 0x4845415042595445; //'HEAPBYTE' +constexpr uint64_t HEAPMANAGERFREECHUNKS = 0x4845415043484e4b; //'HEAPCHNK' +constexpr uint64_t PAGEMANAGER = 0x504147454d475220; //'PAGEMGR ' +constexpr uint64_t PAGEMANAGERCOALESCECOUNT = 0x504147454d434e54; //'PAGEMCNT' +constexpr uint64_t PAGEMANAGERLOWPAGECOUNT = 0x504147454d4c5043; //'PAGEMLPC' +constexpr uint64_t SEGMENTMANAGER = 0x53474d4e544d4752; //'SGMNTMGR' +constexpr uint64_t BLOCKREADONLYEVICT = 0x424c4f434b524f45; //'BLOCKROE' +constexpr uint64_t BLOCKREADWRITEEVICT = 0x424c4f434b525745; //'BLOCKRWE' +// Number of values cannot exceed MAX_ENTRIES + + +/* + * @brief Save off a pointer to the master list + * + * @param[in] Pointer Label + * @param[in] Pointer Value + */ +void add_debug_pointer( uint64_t i_label, + void* i_ptr, + size_t i_size ); + +}; //namespace + + +#endif //_DEBUGPOINTERS_H |

