summaryrefslogtreecommitdiffstats
path: root/cpukit/score/cpu/microblaze
diff options
context:
space:
mode:
authorKinsey Moore <kinsey.moore@oarcorp.com>2022-01-26 10:33:31 -0600
committerJoel Sherrill <joel@rtems.org>2022-02-04 11:30:59 -0600
commit530a8c2494126c67073861a55fd81cd0e7f0f902 (patch)
tree7b360ba8ee1a87d206bcec6715a717330f41c1a2 /cpukit/score/cpu/microblaze
parentcpukit/microblaze: Add exception framework (diff)
downloadrtems-530a8c2494126c67073861a55fd81cd0e7f0f902.tar.bz2
cpukit/microblaze: Add debug vector and handler
This patch adds a vector for debug events along with a hook similar to the exception framework. The debug vector generates an exception frame for use by libdebugger.
Diffstat (limited to 'cpukit/score/cpu/microblaze')
-rw-r--r--cpukit/score/cpu/microblaze/cpu.c26
-rw-r--r--cpukit/score/cpu/microblaze/include/rtems/score/cpu.h9
2 files changed, 35 insertions, 0 deletions
diff --git a/cpukit/score/cpu/microblaze/cpu.c b/cpukit/score/cpu/microblaze/cpu.c
index 7ff8ca3071..fe55ef5546 100644
--- a/cpukit/score/cpu/microblaze/cpu.c
+++ b/cpukit/score/cpu/microblaze/cpu.c
@@ -203,3 +203,29 @@ void _MicroBlaze_Exception_handle( CPU_Exception_frame *ef )
rtems_fatal( RTEMS_FATAL_SOURCE_EXCEPTION, (rtems_fatal_code) ef );
}
+
+MicroBlaze_Exception_handler installed_debug_handler = NULL;
+
+void _MicroBlaze_Debug_install_handler(
+ MicroBlaze_Exception_handler new_handler,
+ MicroBlaze_Exception_handler *old_handler
+)
+{
+ if ( old_handler != NULL ) {
+ *old_handler = installed_debug_handler;
+ }
+
+ installed_debug_handler = new_handler;
+}
+
+void _MicroBlaze_Debug_handle( CPU_Exception_frame *ef )
+{
+ /* BiP is not set for software debug events, set it here */
+ ef->msr |= MICROBLAZE_MSR_BIP;
+
+ if ( installed_debug_handler != NULL ) {
+ installed_debug_handler( ef );
+ }
+
+ rtems_fatal( RTEMS_FATAL_SOURCE_EXCEPTION, (rtems_fatal_code) ef );
+}
diff --git a/cpukit/score/cpu/microblaze/include/rtems/score/cpu.h b/cpukit/score/cpu/microblaze/include/rtems/score/cpu.h
index a9c5066399..fe0d9a8996 100644
--- a/cpukit/score/cpu/microblaze/include/rtems/score/cpu.h
+++ b/cpukit/score/cpu/microblaze/include/rtems/score/cpu.h
@@ -344,6 +344,15 @@ void _MicroBlaze_Exception_handle(
CPU_Exception_frame *ef
);
+void _MicroBlaze_Debug_install_handler(
+ MicroBlaze_Exception_handler new_handler,
+ MicroBlaze_Exception_handler *old_handler
+);
+
+void _MicroBlaze_Debug_handle(
+ CPU_Exception_frame *ef
+);
+
void _CPU_Context_switch(
Context_Control *run,
Context_Control *heir