From b077dc41ceeecc053792bc08961250272e6c9266 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 18 Jan 2002 14:14:17 +0000 Subject: 2002-01-18 Till Straumann * src/powerpc/excep_f.c: This patch addresses the following issues: - exception handler needs to enable MSR_FP if the interrupted thread is FP enabled. - printk message for MSR fixed and added stacktrace NOTE: this requires the stacktrace patch to lib/libbsp/powerpc/shared/vectors/vector_init.c (#ifdef DDEBUG only, however) --- c/src/librdbg/ChangeLog | 11 +++++++++++ c/src/librdbg/src/powerpc/excep_f.c | 19 ++++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) (limited to 'c') diff --git a/c/src/librdbg/ChangeLog b/c/src/librdbg/ChangeLog index c77ce790a6..ec9bd89597 100644 --- a/c/src/librdbg/ChangeLog +++ b/c/src/librdbg/ChangeLog @@ -1,3 +1,14 @@ +2002-01-18 Till Straumann + + * src/powerpc/excep_f.c: This patch addresses the following issues: + - exception handler needs to enable MSR_FP if the interrupted + thread is FP enabled. + - printk message for MSR fixed and added stacktrace + + NOTE: this requires the stacktrace patch to + lib/libbsp/powerpc/shared/vectors/vector_init.c + (#ifdef DDEBUG only, however) + 2001-01-18 Joel Sherrill * src/powerpc/new_exception_processing/remdeb_svc.c: Corrected diff --git a/c/src/librdbg/src/powerpc/excep_f.c b/c/src/librdbg/src/powerpc/excep_f.c index 8580789b99..13adcd1e67 100644 --- a/c/src/librdbg/src/powerpc/excep_f.c +++ b/c/src/librdbg/src/powerpc/excep_f.c @@ -56,6 +56,18 @@ BreakPointExcHdl(CPU_Exception_frame *ctx) rtems_status_code status; rtems_id continueSemId; + /* T. Straumann, 1/16/2002: we must re-enable the floating point engine + * if the interrupted thread is FP. Otherwise, + * the semaphore primitives may crash when they + * try to save FP context while switching this + * thread... + */ + if (ctx->EXC_SRR1 & 0x2000) { + register unsigned long msr; + __asm__ __volatile__("mfmsr %0":"=r"(msr)); + __asm__ __volatile__("mtmsr %0"::"r"(msr|MSR_FP)); + } + if ( (justSaveContext) && (ctx->_EXC_number == ASM_SYS_VECTOR) ) { PushSavedExceptCtx (_Thread_Executing->Object.id, ctx); justSaveContext = 0; @@ -114,7 +126,7 @@ BreakPointExcHdl(CPU_Exception_frame *ctx) printk("\t CTR = %x\n", ctx->EXC_CTR); printk("\t XER = %x\n", ctx->EXC_XER); printk("\t LR = %x\n", ctx->EXC_LR); - printk("\t MSR = %x\n", ctx->EXC_MSR); + printk("\t MSR = %x\n", ctx->EXC_SRR1); #endif status = rtems_semaphore_create (rtems_build_name('D', 'B', 'G', 'c'), @@ -151,6 +163,11 @@ BreakPointExcHdl(CPU_Exception_frame *ctx) default: DPRINTF((" OTHER EXCEPTION !!!\n")); +#ifdef DDEBUG + { extern void BSP_printStackTrace(); + BSP_printStackTrace(ctx); + } +#endif rtems_semaphore_release( wakeupEventSemId ); break; } -- cgit v1.2.3