summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pk/kernel/pk_debug_ptrs.c53
-rw-r--r--pk/kernel/pk_debug_ptrs.h39
-rw-r--r--pk/kernel/pk_init.c17
-rw-r--r--pk/kernel/pkkernelfiles.mk2
-rw-r--r--pk/ppe42/ppe42_exceptions.S7
5 files changed, 110 insertions, 8 deletions
diff --git a/pk/kernel/pk_debug_ptrs.c b/pk/kernel/pk_debug_ptrs.c
new file mode 100644
index 00000000..0ed540f4
--- /dev/null
+++ b/pk/kernel/pk_debug_ptrs.c
@@ -0,0 +1,53 @@
+//-----------------------------------------------------------------------------
+// *! (C) Copyright International Business Machines Corp. 2015
+// *! All Rights Reserved -- Property of IBM
+// *! *** IBM Confidential ***
+//-----------------------------------------------------------------------------
+
+/// \file pk_debug_ptrs.c
+/// \brief Defines a table of pointers to important kernel debug data.
+///
+/// This table is placed in a special section named .debug_ptrs which can be
+/// placed at a well-known memory location for tools to find.
+///
+
+#include "pk.h"
+#include "pk_trace.h"
+#include "pk_debug_ptrs.h"
+
+extern PkTimebase ppe42_64bit_timebase;
+
+#if PK_TRACE_SUPPORT
+extern PkTraceBuffer g_pk_trace_buf;
+#endif
+
+pk_debug_ptrs_t pk_debug_ptrs SECTION_ATTRIBUTE(".debug_ptrs") =
+{
+ .debug_ptrs_size = sizeof(pk_debug_ptrs),
+ .debug_ptrs_version = PK_DEBUG_PTRS_VERSION,
+
+#if PK_TRACE_SUPPORT
+ .debug_trace_ptr = &g_pk_trace_buf,
+ .debug_trace_size = sizeof(g_pk_trace_buf),
+#else
+ .debug_trace_ptr = 0,
+ .debug_trace_size = 0,
+#endif /* PK_TRACE_SUPPORT */
+
+#if PK_THREAD_SUPPORT
+ .debug_thread_table_ptr = &__pk_priority_map,
+ .debug_thread_table_size = sizeof(__pk_priority_map),
+ .debug_thread_runq_ptr = (void*)&__pk_run_queue,
+ .debug_thread_runq_size = sizeof(__pk_run_queue),
+#else
+ .debug_thread_table_ptr = 0,
+ .debug_thread_table_size = 0,
+ .debug_thread_runq_ptr = 0,
+ .debug_thread_runq_size = 0,
+#endif /* PK_THREAD_SUPPORT */
+
+ .debug_timebase_ptr = &ppe42_64bit_timebase,
+ .debug_timebase_size = sizeof(ppe42_64bit_timebase),
+
+};
+
diff --git a/pk/kernel/pk_debug_ptrs.h b/pk/kernel/pk_debug_ptrs.h
new file mode 100644
index 00000000..62a36839
--- /dev/null
+++ b/pk/kernel/pk_debug_ptrs.h
@@ -0,0 +1,39 @@
+#ifndef __PK_DEBUG_PTRS_H__
+#define __PK_DEBUG_PTRS_H__
+//-----------------------------------------------------------------------------
+// *! (C) Copyright International Business Machines Corp. 2015
+// *! All Rights Reserved -- Property of IBM
+// *! *** IBM Confidential ***
+//-----------------------------------------------------------------------------
+
+/// \file pk_debug_ptrs.h
+/// \brief Structure for a table of pointers to kernel debug data
+///
+
+#define PK_DEBUG_PTRS_VERSION 1
+
+typedef struct
+{
+ // The size and version of this structure
+ unsigned short debug_ptrs_size;
+ unsigned short debug_ptrs_version;
+
+ // Trace buffer location and size
+ void* debug_trace_ptr;
+ unsigned long debug_trace_size;
+
+ // Thread table location and size
+ void* debug_thread_table_ptr;
+ unsigned long debug_thread_table_size;
+
+ // Thread run queue location and size
+ void* debug_thread_runq_ptr;
+ unsigned long debug_thread_runq_size;
+
+ // Emulated timebase location and size
+ void* debug_timebase_ptr;
+ unsigned long debug_timebase_size;
+
+} pk_debug_ptrs_t;
+
+#endif /*__PK_DEBUG_PTRS_H__*/
diff --git a/pk/kernel/pk_init.c b/pk/kernel/pk_init.c
index 4c7cd138..ebd6323a 100644
--- a/pk/kernel/pk_init.c
+++ b/pk/kernel/pk_init.c
@@ -64,7 +64,7 @@ void pk_set_timebase_rshift(uint32_t timebase_freq_hz)
/// interrupt and bottom-half handlers.
///
/// \param initial_timebase The initial value of the PK timebase.
-/// argument is given as the special value \c PK_TIMEBASE_CONTINUE, then the
+/// If the argument is given as the special value \c PK_TIMEBASE_CONTINUES, then the
/// timebase is not reset.
///
/// \param timebase_frequency_hz The frequency of the PK timebase in Hz.
@@ -88,10 +88,10 @@ void pk_set_timebase_rshift(uint32_t timebase_freq_hz)
// reset everything at initialization.
int
-pk_initialize(PkAddress kernel_stack,
- size_t kernel_stack_size,
- PkTimebase initial_timebase,
- uint32_t timebase_frequency_hz)
+pk_initialize(PkAddress kernel_stack,
+ size_t kernel_stack_size,
+ PkTimebase initial_timebase,
+ uint32_t timebase_frequency_hz)
{
int rc;
@@ -133,8 +133,11 @@ extern PkTraceBuffer g_pk_trace_buf;
//timebase frequency (versus what was hardcoded)
pk_set_timebase_rshift(timebase_frequency_hz);
- //set the timebase ajdustment for trace synchronization
- pk_trace_set_timebase(initial_timebase);
+ if(initial_timebase != PK_TIMEBASE_CONTINUES)
+ {
+ //set the timebase ajdustment for trace synchronization
+ pk_trace_set_timebase(initial_timebase);
+ }
// Schedule the timer that puts a 64bit timestamp in the trace buffer
// periodically. This allows us to use 32bit timestamps.
diff --git a/pk/kernel/pkkernelfiles.mk b/pk/kernel/pkkernelfiles.mk
index bb1c310b..df7872bd 100644
--- a/pk/kernel/pkkernelfiles.mk
+++ b/pk/kernel/pkkernelfiles.mk
@@ -21,7 +21,7 @@
##########################################################################
# Object Files
##########################################################################
-PK-C-SOURCES = pk_core.c pk_init.c pk_stack_init.c pk_bh_core.c
+PK-C-SOURCES = pk_core.c pk_init.c pk_stack_init.c pk_bh_core.c pk_debug_ptrs.c
PK-TIMER-C-SOURCES += pk_timer_core.c pk_timer_init.c
diff --git a/pk/ppe42/ppe42_exceptions.S b/pk/ppe42/ppe42_exceptions.S
index b3ce3551..272c0e41 100644
--- a/pk/ppe42/ppe42_exceptions.S
+++ b/pk/ppe42/ppe42_exceptions.S
@@ -125,6 +125,13 @@ __watchdog_interrupt:
_pk_ctx_push_as_needed watchdog_handler
+### ****************************************************************************
+### The rest of the code in this file doesn't have to be placed anywhere
+### special, so just place it in the .text section.
+### ****************************************************************************
+
+ .section .text, "ax", @progbits
+
## The idle thread has no permanent register context. The idle thread
## entry point is re-entered whenever the idle thread is scheduled.
OpenPOWER on IntegriCloud