score: Add CPU_Exception_frame

Add CPU port type CPU_Exception_frame and function
_CPU_Exception_frame_print().

The CPU ports of avr, bfin, h8300, lm32, m32c, m32r, m68k, nios2, sh,
sparc64, and v850 use an empty default implementation of
_CPU_Exception_frame_print().

Add rtems_exception_frame and rtems_exception_frame_print().

Add RTEMS_FATAL_SOURCE_EXCEPTION for CPU exceptions.  Use rtems_fatal()
with source RTEMS_FATAL_SOURCE_EXCEPTION in CPU ports of i386, powerpc,
and sparc for unexpected exceptions.

Add third parameter to RTEMS_BSP_CLEANUP_OPTIONS() which controls the
BSP_PRINT_EXCEPTION_CONTEXT define used in the default
bsp_fatal_extension().

Add test sptests/spfatal26.
This commit is contained in:
Sebastian Huber
2012-11-25 17:48:11 +01:00
parent d2202ac56d
commit 815994fd17
64 changed files with 702 additions and 65 deletions

View File

@@ -9,10 +9,11 @@ dnl
dnl To be used in bsp-configure scripts
dnl USAGE:
dnl RTEMS_BSP_CLEANUP_OPTIONS([0|1], [0|1])
dnl RTEMS_BSP_CLEANUP_OPTIONS([0|1], [0|1], [0|1])
dnl WHERE:
dnl argument 1 indicates the default value for BSP_PRESS_KEY_FOR_RESET
dnl argument 2 indicates the default value for BSP_RESET_BOARD_AT_EXIT
dnl argument 3 indicates the default value for BSP_PRINT_EXCEPTION_CONTEXT
AC_DEFUN([RTEMS_BSP_CLEANUP_OPTIONS],[
RTEMS_BSPOPTS_SET([BSP_PRESS_KEY_FOR_RESET],[*],[$1])
@@ -23,4 +24,8 @@ RTEMS_BSPOPTS_HELP([BSP_PRESS_KEY_FOR_RESET],
RTEMS_BSPOPTS_SET([BSP_RESET_BOARD_AT_EXIT],[*],[$2])
RTEMS_BSPOPTS_HELP([BSP_RESET_BOARD_AT_EXIT],
[If defined, reset the board when the application exits.])
RTEMS_BSPOPTS_SET([BSP_PRINT_EXCEPTION_CONTEXT],[*],[$3])
RTEMS_BSPOPTS_HELP([BSP_PRINT_EXCEPTION_CONTEXT],
[If defined, prints the exception context when an unexpected exception occurs.])
])

View File

@@ -24,9 +24,7 @@
#include <rtems/bspIo.h>
#include <bsp/irq-generic.h>
void mips_vector_exceptions( CPU_Interrupt_frame *frame );
static const char *cause_strings[32] =
static const char *const cause_strings[32] =
{
/* 0 */ "Int",
/* 1 */ "TLB Mods",
@@ -79,7 +77,7 @@ static const struct regdef dumpregs[]= {
{ R_EPC,"R_EPC"}, { -1, NULL }
};
static void mips_dump_exception_frame( CPU_Interrupt_frame *frame )
void _BSP_Exception_frame_print( const CPU_Exception_frame *frame )
{
uint32_t *frame_u32;
int i, j;

View File

@@ -45,7 +45,7 @@ Note that the policy can still be defined by the application
CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK this feature is removed
and a little memory is saved.])
RTEMS_BSP_CLEANUP_OPTIONS(0, 1)
RTEMS_BSP_CLEANUP_OPTIONS(0, 1, 1)
# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile])

View File

@@ -16,7 +16,7 @@
void bsp_fatal_extension(
rtems_fatal_source source,
bool is_internal,
rtems_fatal_code error
rtems_fatal_code code
)
{
#if (BSP_PRESS_KEY_FOR_RESET)
@@ -31,6 +31,12 @@ void bsp_fatal_extension(
printk("\n");
#endif
#if (BSP_PRINT_EXCEPTION_CONTEXT)
if ( source == RTEMS_FATAL_SOURCE_EXCEPTION ) {
rtems_exception_frame_print( (const rtems_exception_frame *) code );
}
#endif
/*
* Check both conditions -- if you want to ask for reboot, then
* you must have meant to reset the board.

View File

@@ -42,7 +42,7 @@ RTEMS_BSPOPTS_HELP([ENABLE_SIS_QUIRKS],
BSP will be enabled. In particular, SIS requires special
initialization not used on real ERC32 hardware.])
RTEMS_BSP_CLEANUP_OPTIONS(0,1)
RTEMS_BSP_CLEANUP_OPTIONS(0,1,1)
# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile])

View File

@@ -16,20 +16,15 @@
#include <bsp.h>
#include <rtems/bspIo.h>
/*
* bsp_spurious_handler
*
* Print a message on the debug console and then die
*/
rtems_isr bsp_spurious_handler(
rtems_vector_number trap,
CPU_Interrupt_frame *isf
)
void _BSP_Exception_frame_print( const CPU_Exception_frame *frame )
{
uint32_t trap;
uint32_t real_trap;
const CPU_Interrupt_frame *isf;
trap = frame->trap;
real_trap = SPARC_REAL_TRAP_NUMBER(trap);
isf = frame->isf;
printk( "Unexpected trap (%2d) at address 0x%08x\n", real_trap, isf->tpc);
@@ -121,12 +116,22 @@ rtems_isr bsp_spurious_handler(
default:
break;
}
}
/*
* What else can we do but stop ...
*/
rtems_isr bsp_spurious_handler(
rtems_vector_number trap,
CPU_Interrupt_frame *isf
)
{
CPU_Exception_frame frame = {
.trap = trap,
.isf = isf
};
__asm__ volatile( "mov 1, %g1; ta 0x0" );
rtems_fatal(
RTEMS_FATAL_SOURCE_EXCEPTION,
(rtems_fatal_code) &frame
);
}
/*

View File

@@ -16,20 +16,15 @@
#include <bsp.h>
#include <rtems/bspIo.h>
/*
* bsp_spurious_handler
*
* Print a message on the debug console and then die
*/
rtems_isr bsp_spurious_handler(
rtems_vector_number trap,
CPU_Interrupt_frame *isf
)
void _BSP_Exception_frame_print( const CPU_Exception_frame *frame )
{
uint32_t trap;
uint32_t real_trap;
const CPU_Interrupt_frame *isf;
trap = frame->trap;
real_trap = SPARC_REAL_TRAP_NUMBER(trap);
isf = frame->isf;
printk( "Unexpected trap (%2d) at address 0x%08x\n", real_trap, isf->tpc);
@@ -102,12 +97,22 @@ rtems_isr bsp_spurious_handler(
default:
break;
}
}
/*
* What else can we do but stop ...
*/
rtems_isr bsp_spurious_handler(
rtems_vector_number trap,
CPU_Interrupt_frame *isf
)
{
CPU_Exception_frame frame = {
.trap = trap,
.isf = isf
};
__asm__ volatile( "mov 1, %g1; ta 0x0" );
rtems_fatal(
RTEMS_FATAL_SOURCE_EXCEPTION,
(rtems_fatal_code) &frame
);
}
/*

View File

@@ -18,23 +18,17 @@
*/
#include <bsp.h>
#include <rtems/bspIo.h>
/*
* bsp_spurious_handler
*
* Print a message on the debug console and then die
*/
rtems_isr bsp_spurious_handler(
rtems_vector_number trap,
CPU_Interrupt_frame *isf
)
void _BSP_Exception_frame_print( const CPU_Exception_frame *frame )
{
uint32_t trap;
uint32_t real_trap;
const CPU_Interrupt_frame *isf;
trap = frame->trap;
real_trap = SPARC_REAL_TRAP_NUMBER(trap);
isf = frame->isf;
printk( "Unexpected trap (0x%02x) at address 0x%08x\n", real_trap, isf->tpc);
@@ -113,12 +107,22 @@ rtems_isr bsp_spurious_handler(
default:
break;
}
}
/*
* What else can we do but stop ...
*/
rtems_isr bsp_spurious_handler(
rtems_vector_number trap,
CPU_Interrupt_frame *isf
)
{
CPU_Exception_frame frame = {
.trap = trap,
.isf = isf
};
__asm__ volatile( "mov 1, %g1; ta 0x0" );
rtems_fatal(
RTEMS_FATAL_SOURCE_EXCEPTION,
(rtems_fatal_code) &frame
);
}
/*

View File

@@ -188,7 +188,8 @@ mpc5xx_timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
include_libcpu_HEADERS += mpc5xx/vectors/vectors.h
noinst_PROGRAMS += mpc5xx/vectors.rel
mpc5xx_vectors_rel_SOURCES = mpc5xx/vectors/vectors_init.c mpc5xx/vectors/vectors.S
mpc5xx_vectors_rel_SOURCES = mpc5xx/vectors/vectors_init.c mpc5xx/vectors/vectors.S \
new-exceptions/bspsupport/ppc_exc_print.c
mpc5xx_vectors_rel_CPPFLAGS = $(AM_CPPFLAGS)
mpc5xx_vectors_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
endif

View File

@@ -24,7 +24,7 @@ exception_handler_t globalExceptHdl = C_exception_handler;
void C_exception_handler(BSP_Exception_frame *excPtr)
{
rtems_fatal(
RTEMS_FATAL_SOURCE_POWERPC_EXCEPTION,
RTEMS_FATAL_SOURCE_EXCEPTION,
(rtems_fatal_code) excPtr
);
}

View File

@@ -85,7 +85,7 @@ void BSP_printStackTrace(const BSP_Exception_frame *excPtr)
}
}
void ppc_exc_print_frame_and_context(const BSP_Exception_frame *excPtr)
void _BSP_Exception_frame_print(const CPU_Exception_frame *excPtr)
{
const Thread_Control *executing = _Thread_Executing;
bool synch = (int) excPtr->_EXC_number >= 0;

View File

@@ -271,8 +271,6 @@ extern exception_handler_t globalExceptHdl;
*/
void C_exception_handler(BSP_Exception_frame* excPtr);
void ppc_exc_print_frame_and_context(const BSP_Exception_frame *excPtr);
void BSP_printStackTrace(const BSP_Exception_frame *excPtr);
/**

View File

@@ -36,6 +36,23 @@ extern "C" {
* @{
*/
/**
* @brief Exception frame.
*/
typedef CPU_Exception_frame rtems_exception_frame;
/**
* @brief Prints the exception frame via printk().
*
* @see rtems_fatal() and RTEMS_FATAL_SOURCE_EXCEPTION.
*/
static inline void rtems_exception_frame_print(
const rtems_exception_frame *frame
)
{
_CPU_Exception_frame_print( frame );
}
/**
* @brief Invokes the internal error handler with a source of
* INTERNAL_ERROR_RTEMS_API and is internal set to false.

View File

@@ -18,9 +18,11 @@ libscorecpu_a_SOURCES += arm_exc_abort.S
libscorecpu_a_SOURCES += arm_exc_interrupt.S
libscorecpu_a_SOURCES += arm_exc_handler_low.S
libscorecpu_a_SOURCES += arm_exc_handler_high.c
libscorecpu_a_SOURCES += arm-exception-frame-print.c
libscorecpu_a_SOURCES += armv7m-context-initialize.c
libscorecpu_a_SOURCES += armv7m-context-restore.c
libscorecpu_a_SOURCES += armv7m-context-switch.c
libscorecpu_a_SOURCES += armv7m-exception-frame-print.c
libscorecpu_a_SOURCES += armv7m-exception-handler-get.c
libscorecpu_a_SOURCES += armv7m-exception-handler-set.c
libscorecpu_a_SOURCES += armv7m-exception-priority-get.c

View File

@@ -0,0 +1,28 @@
/*
* Copyright (c) 2012 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Obere Lagerstr. 30
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/score/cpu.h>
#ifdef ARM_MULTILIB_ARCH_V4
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame )
{
/* TODO */
}
#endif /* ARM_MULTILIB_ARCH_V4 */

View File

@@ -0,0 +1,28 @@
/*
* Copyright (c) 2012 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Obere Lagerstr. 30
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/score/cpu.h>
#ifdef ARM_MULTILIB_ARCH_V7M
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame )
{
/* TODO */
}
#endif /* ARM_MULTILIB_ARCH_V7M */

View File

@@ -582,8 +582,13 @@ typedef CPU_Exception_frame CPU_Interrupt_frame;
typedef void CPU_Interrupt_frame;
/* FIXME */
typedef CPU_Interrupt_frame CPU_Exception_frame;
#endif /* !defined(ARM_MULTILIB_ARCH_V4) */
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame );
#ifdef __cplusplus
}
#endif

View File

@@ -161,6 +161,7 @@ include_rtems_avr_HEADERS += avr/wdt.h
noinst_LIBRARIES = libscorecpu.a
libscorecpu_a_SOURCES = cpu.c cpu_asm.S
libscorecpu_a_SOURCES += avr-exception-frame-print.c
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
include $(srcdir)/preinstall.am

View File

@@ -0,0 +1,24 @@
/*
* Copyright (c) 2012 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Obere Lagerstr. 30
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/score/cpu.h>
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame )
{
/* TODO */
}

View File

@@ -1112,6 +1112,11 @@ void _CPU_Context_restore_fp(
Context_Control_fp **fp_context_ptr
);
/* FIXME */
typedef CPU_Interrupt_frame CPU_Exception_frame;
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame );
/* The following routine swaps the endian format of an unsigned int.
* It must be static because it is referenced indirectly.
*

View File

@@ -16,6 +16,7 @@ include_rtems_score_HEADERS += rtems/score/types.h
noinst_LIBRARIES = libscorecpu.a
libscorecpu_a_SOURCES = cpu.c cpu_asm.S
libscorecpu_a_SOURCES += bfin-exception-frame-print.c
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
include $(srcdir)/preinstall.am

View File

@@ -0,0 +1,24 @@
/*
* Copyright (c) 2012 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Obere Lagerstr. 30
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/score/cpu.h>
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame )
{
/* TODO */
}

View File

@@ -1204,6 +1204,11 @@ void _CPU_Context_restore_fp(
Context_Control_fp **fp_context_ptr
);
/* FIXME */
typedef CPU_Interrupt_frame CPU_Exception_frame;
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame );
/**
* @ingroup CPUEndian
* The following routine swaps the endian format of an unsigned int.

View File

@@ -10,6 +10,7 @@ include_rtems_score_HEADERS += rtems/score/types.h
noinst_LIBRARIES = libscorecpu.a
libscorecpu_a_SOURCES = cpu.c cpu_asm.S
libscorecpu_a_SOURCES += h8300-exception-frame-print.c
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
include $(srcdir)/preinstall.am

View File

@@ -0,0 +1,24 @@
/*
* Copyright (c) 2012 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Obere Lagerstr. 30
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/score/cpu.h>
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame )
{
/* TODO */
}

View File

@@ -1095,6 +1095,11 @@ void _CPU_Context_restore_fp(
Context_Control_fp **fp_context_ptr
);
/* FIXME */
typedef CPU_Interrupt_frame CPU_Exception_frame;
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame );
/* The following routine swaps the endian format of an unsigned int.
* It must be static because it is referenced indirectly.
*

View File

@@ -117,7 +117,7 @@ struct Frame_ {
uintptr_t pc;
};
static void _defaultExcHandler (CPU_Exception_frame *ctx)
void _CPU_Exception_frame_print (const CPU_Exception_frame *ctx)
{
unsigned int faultAddr = 0;
printk("----------------------------------------------------------\n");
@@ -148,7 +148,6 @@ static void _defaultExcHandler (CPU_Exception_frame *ctx)
* because the eip points to the faulty instruction so...
*/
printk("Exception while executing ISR!!!. System locked\n");
_CPU_Fatal_halt(faultAddr);
}
else {
struct Frame_ *fp = (struct Frame_*)ctx->ebp;
@@ -171,10 +170,17 @@ static void _defaultExcHandler (CPU_Exception_frame *ctx)
printk(" ************ FAULTY THREAD WILL BE SUSPENDED **************\n");
rtems_task_suspend(_Thread_Executing->Object.id);
#endif
bsp_reset();
}
}
static void _defaultExcHandler (CPU_Exception_frame *ctx)
{
rtems_fatal(
RTEMS_FATAL_SOURCE_EXCEPTION,
(rtems_fatal_code) ctx
);
}
cpuExcHandlerType _currentExcHandler = _defaultExcHandler;
extern void rtems_exception_prologue_0(void);

View File

@@ -665,6 +665,8 @@ void _CPU_Context_restore_fp(
} while (0)
#endif
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame );
#endif /* ASM */
#ifdef __cplusplus

View File

@@ -11,6 +11,7 @@ include_rtems_score_HEADERS += rtems/score/types.h
noinst_LIBRARIES = libscorecpu.a
libscorecpu_a_SOURCES = cpu.c cpu_asm.S irq.c
libscorecpu_a_SOURCES += lm32-exception-frame-print.c
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
include $(srcdir)/preinstall.am

View File

@@ -0,0 +1,24 @@
/*
* Copyright (c) 2012 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Obere Lagerstr. 30
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/score/cpu.h>
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame )
{
/* TODO */
}

View File

@@ -1195,6 +1195,11 @@ void _CPU_Context_restore_fp(
Context_Control_fp **fp_context_ptr
);
/* FIXME */
typedef CPU_Interrupt_frame CPU_Exception_frame;
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame );
/**
* @ingroup CPUEndian
* The following routine swaps the endian format of an unsigned int.

View File

@@ -14,6 +14,7 @@ include_rtems_score_HEADERS += rtems/score/types.h
noinst_LIBRARIES = libscorecpu.a
libscorecpu_a_SOURCES = cpu.c cpu_asm.c context_switch.S context_init.c \
varvects.S
libscorecpu_a_SOURCES += m32c-exception-frame-print.c
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
include $(srcdir)/preinstall.am

View File

@@ -0,0 +1,24 @@
/*
* Copyright (c) 2012 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Obere Lagerstr. 30
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/score/cpu.h>
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame )
{
/* TODO */
}

View File

@@ -1131,6 +1131,11 @@ void _CPU_Context_restore(
Context_Control *new_context
) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE;
/* FIXME */
typedef CPU_Interrupt_frame CPU_Exception_frame;
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame );
/**
* @ingroup CPUEndian
* The following routine swaps the endian format of an unsigned int.

View File

@@ -13,6 +13,7 @@ include_rtems_score_HEADERS += rtems/score/types.h
noinst_LIBRARIES = libscorecpu.a
libscorecpu_a_SOURCES = cpu.c cpu_asm.c context_switch.S context_init.c
libscorecpu_a_SOURCES += m32r-exception-frame-print.c
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
include $(srcdir)/preinstall.am

View File

@@ -0,0 +1,24 @@
/*
* Copyright (c) 2012 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Obere Lagerstr. 30
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/score/cpu.h>
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame )
{
/* TODO */
}

View File

@@ -1189,6 +1189,11 @@ void _CPU_Context_restore_fp(
Context_Control_fp **fp_context_ptr
);
/* FIXME */
typedef CPU_Interrupt_frame CPU_Exception_frame;
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame );
/**
* @ingroup CPUEndian
* The following routine swaps the endian format of an unsigned int.

View File

@@ -18,6 +18,7 @@ include_rtems_score_HEADERS += rtems/score/m68k.h
include_rtems_score_HEADERS += rtems/score/types.h
libscorecpu_a_SOURCES = cpu.c cpu_asm.S
libscorecpu_a_SOURCES += m68k-exception-frame-print.c
include $(srcdir)/preinstall.am
include $(top_srcdir)/automake/local.am

View File

@@ -0,0 +1,24 @@
/*
* Copyright (c) 2012 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Obere Lagerstr. 30
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/score/cpu.h>
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame )
{
/* TODO */
}

View File

@@ -709,6 +709,8 @@ void _CPU_Context_restore_fp(
Context_Control_fp **fp_context_ptr
);
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame );
#if (M68K_HAS_FPSP_PACKAGE == 1)
/*
* Hooks for the Floating Point Support Package (FPSP) provided by Motorola

View File

@@ -609,6 +609,8 @@ typedef struct
} CPU_Interrupt_frame;
typedef CPU_Interrupt_frame CPU_Exception_frame;
/*
* This variable is optional. It is used on CPUs on which it is difficult
* to generate an "uninitialized" FP context. It is filled in by
@@ -703,6 +705,8 @@ extern unsigned int mips_interrupt_number_of_vectors;
#define CPU_STACK_ALIGNMENT CPU_ALIGNMENT
void mips_vector_exceptions( CPU_Interrupt_frame *frame );
/*
* ISR handler macros
*/
@@ -1112,6 +1116,15 @@ void _CPU_Context_restore_fp(
Context_Control_fp **fp_context_ptr
);
void _BSP_Exception_frame_print( const CPU_Exception_frame *frame );
static inline void _CPU_Exception_frame_print(
const CPU_Exception_frame *frame
)
{
_BSP_Exception_frame_print( frame );
}
/* The following routine swaps the endian format of an unsigned int.
* It must be static because it is referenced indirectly.
*

View File

@@ -24,6 +24,7 @@ libscorecpu_a_SOURCES += nios2-context-initialize.c
libscorecpu_a_SOURCES += nios2-context-switch.S
libscorecpu_a_SOURCES += nios2-eic-il-low-level.S
libscorecpu_a_SOURCES += nios2-eic-rsie-low-level.S
libscorecpu_a_SOURCES += nios2-exception-frame-print.c
libscorecpu_a_SOURCES += nios2-fatal-halt.c
libscorecpu_a_SOURCES += nios2-iic-low-level.S
libscorecpu_a_SOURCES += nios2-initialize.c

View File

@@ -0,0 +1,24 @@
/*
* Copyright (c) 2012 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Obere Lagerstr. 30
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/score/cpu.h>
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame )
{
/* TODO */
}

View File

@@ -338,6 +338,8 @@ void _CPU_Context_restore(
Context_Control *new_context
) RTEMS_COMPILER_NO_RETURN_ATTRIBUTE;
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame );
static inline uint32_t CPU_swap_u32( uint32_t value )
{
uint32_t byte1, byte2, byte3, byte4, swapped;

View File

@@ -1263,6 +1263,28 @@ void _CPU_Context_restore_fp(
Context_Control_fp **fp_context_ptr
);
/**
* @brief The set of registers that specifies the complete processor state.
*
* The CPU exception frame may be available in fatal error conditions like for
* example illegal opcodes, instruction fetch errors, or data access errors.
*
* @see rtems_fatal(), RTEMS_FATAL_SOURCE_EXCEPTION, and
* rtems_exception_frame_print().
*/
typedef struct {
uint32_t processor_state_register;
uint32_t integer_registers [1];
double float_registers [1];
} CPU_Exception_frame;
/**
* @brief Prints the exception frame via printk().
*
* @see rtems_fatal() and RTEMS_FATAL_SOURCE_EXCEPTION.
*/
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame );
/**
* @ingroup CPUEndian
* The following routine swaps the endian format of an unsigned int.

View File

@@ -1036,6 +1036,15 @@ typedef struct {
PPC_GPR_TYPE GPR31;
} CPU_Exception_frame;
void _BSP_Exception_frame_print( const CPU_Exception_frame *frame );
static inline void _CPU_Exception_frame_print(
const CPU_Exception_frame *frame
)
{
_BSP_Exception_frame_print( frame );
}
/*
* _CPU_Initialize_altivec()
*

View File

@@ -11,6 +11,7 @@ include_rtems_score_HEADERS += rtems/score/sh_io.h
noinst_LIBRARIES = libscorecpu.a
libscorecpu_a_SOURCES = cpu.c context.c
libscorecpu_a_SOURCES += sh-exception-frame-print.c
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
include $(srcdir)/preinstall.am

View File

@@ -885,6 +885,10 @@ void _CPU_Context_restore_fp(
Context_Control_fp **fp_context_ptr
);
/* FIXME */
typedef CPU_Interrupt_frame CPU_Exception_frame;
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame );
#ifdef __cplusplus
}

View File

@@ -0,0 +1,24 @@
/*
* Copyright (c) 2012 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Obere Lagerstr. 30
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/score/cpu.h>
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame )
{
/* TODO */
}

View File

@@ -1221,6 +1221,20 @@ void _CPU_Context_restore_fp(
Context_Control_fp **fp_context_ptr
);
typedef struct {
uint32_t trap;
CPU_Interrupt_frame *isf;
} CPU_Exception_frame;
void _BSP_Exception_frame_print( const CPU_Exception_frame *frame );
static inline void _CPU_Exception_frame_print(
const CPU_Exception_frame *frame
)
{
_BSP_Exception_frame_print( frame );
}
/**
* @brief SPARC Specific Method to Endian Swap an uint32_t
*

View File

@@ -13,6 +13,7 @@ include_rtems_score_HEADERS += rtems/score/types.h
noinst_LIBRARIES = libscorecpu.a
libscorecpu_a_SOURCES = context.S cpu.c
libscorecpu_a_SOURCES += sparc64-exception-frame-print.c
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
include $(srcdir)/preinstall.am

View File

@@ -1024,6 +1024,11 @@ void _CPU_Context_restore_fp(
Context_Control_fp **fp_context_ptr
);
/* FIXME */
typedef CPU_Interrupt_frame CPU_Exception_frame;
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame );
/*
* CPU_swap_u32
*

View File

@@ -0,0 +1,24 @@
/*
* Copyright (c) 2012 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Obere Lagerstr. 30
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/score/cpu.h>
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame )
{
/* TODO */
}

View File

@@ -11,6 +11,7 @@ include_rtems_score_HEADERS += rtems/score/cpu_asm.h rtems/score/types.h
noinst_LIBRARIES = libscorecpu.a
libscorecpu_a_SOURCES = cpu.c
libscorecpu_a_SOURCES += cpu_asm.S
libscorecpu_a_SOURCES += v850-exception-frame-print.c
libscorecpu_a_CPPFLAGS = $(AM_CPPFLAGS)
include $(srcdir)/preinstall.am

View File

@@ -1124,6 +1124,11 @@ void _CPU_Context_restore_fp(
);
#endif
/* FIXME */
typedef CPU_Interrupt_frame CPU_Exception_frame;
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame );
/**
* @ingroup CPUEndian
* The following routine swaps the endian format of an unsigned int.

View File

@@ -0,0 +1,24 @@
/*
* Copyright (c) 2012 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Obere Lagerstr. 30
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/score/cpu.h>
void _CPU_Exception_frame_print( const CPU_Exception_frame *frame )
{
/* TODO */
}

View File

@@ -98,13 +98,13 @@ typedef enum {
RTEMS_FATAL_SOURCE_STACK_CHECKER,
/**
* @brief Fatal source of the PowerPC exceptions.
* @brief Fatal source of the exceptions.
*
* The fatal code is the pointer value of the exception frame pointer.
*
* @see BSP_Exception_frame.
* @see rtems_exception_frame and rtems_exception_frame_print().
*/
RTEMS_FATAL_SOURCE_POWERPC_EXCEPTION,
RTEMS_FATAL_SOURCE_EXCEPTION,
/**
* @brief The last available fatal source.

View File

@@ -199,6 +199,33 @@ NONE
This directive invokes the internal error handler with is internal set to
false. See also @code{@value{DIRPREFIX}fatal_error_occurred}.
@c
@c
@c
@page
@subsection EXCEPTION_FRAME_PRINT - Prints the exception frame
@cindex exception frame
@subheading CALLING SEQUENCE:
@ifset is-C
@findex rtems_exception_frame_print
@example
void rtems_exception_frame_print(
const rtems_exception_frame *frame
);
@end example
@end ifset
@subheading DIRECTIVE STATUS CODES
NONE
@subheading DESCRIPTION:
Prints the exception frame via printk().
@c
@c
@c

View File

@@ -28,6 +28,7 @@ SUBDIRS = \
spsimplesched01 spsimplesched02 spsimplesched03 spnsext01 \
spedfsched01 spedfsched02 spedfsched03 \
spcbssched01 spcbssched02 spcbssched03 spqreslib sptimespec01
SUBDIRS += spfatal26
SUBDIRS += speventtransient01
SUBDIRS += speventsystem01
SUBDIRS += spinternalerror01

View File

@@ -27,6 +27,7 @@ AC_CHECK_SIZEOF([time_t])
# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile
spfatal26/Makefile
spinternalerror02/Makefile
spinternalerror01/Makefile
speventsystem01/Makefile

View File

@@ -0,0 +1,19 @@
rtems_tests_PROGRAMS = spfatal26
spfatal26_SOURCES = init.c
dist_rtems_tests_DATA = spfatal26.scn spfatal26.doc
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../automake/compile.am
include $(top_srcdir)/../automake/leaf.am
AM_CPPFLAGS += -I$(top_srcdir)/../support/include
LINK_OBJS = $(spfatal26_OBJECTS)
LINK_LIBS = $(spfatal26_LDLIBS)
spfatal26$(EXEEXT): $(spfatal26_OBJECTS) $(spfatal26_DEPENDENCIES)
@rm -f spfatal26$(EXEEXT)
$(make-exe)
include $(top_srcdir)/../automake/local.am

View File

@@ -0,0 +1,85 @@
/*
* Copyright (c) 2012 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Obere Lagerstr. 30
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "tmacros.h"
#include <limits.h>
#include <rtems.h>
static void provoke_aligment_or_data_access_exception( void )
{
uintptr_t one = 1;
int i = sizeof(void *) * CHAR_BIT;
uintptr_t n = 1;
uintptr_t base = 0;
uintptr_t inc;
*(volatile uint64_t *) base;
do {
int j;
--i;
base = one << i;
inc = base << 1;
for (j = 0; j < n; ++j, base += inc) {
*(volatile uint64_t *) base;
}
n <<= 1;
} while (i > 0);
}
static void Init( rtems_task_argument arg )
{
printk( "\n\n*** TEST SPFATAL 26 ***\n" );
provoke_aligment_or_data_access_exception();
rtems_test_assert( 0 );
}
static void fatal_extension(
rtems_fatal_source source,
bool is_internal,
rtems_fatal_code code
)
{
rtems_test_assert( source == RTEMS_FATAL_SOURCE_EXCEPTION );
rtems_test_assert( !is_internal );
rtems_exception_frame_print( (const rtems_exception_frame *) code );
printk( "*** END OF TEST SPFATAL 26 ***\n" );
}
#define CONFIGURE_INITIAL_EXTENSIONS { .fatal = fatal_extension }
#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT
#include <rtems/confdefs.h>

View File

@@ -0,0 +1,11 @@
This file describes the directives and concepts tested by this test set.
test set name: spfatal26
directives:
- rtems_exception_frame_print
concepts:
- Ensure that we get an fatal condition with RTEMS_FATAL_SOURCE_EXCEPTION.

View File

@@ -0,0 +1,2 @@
*** TEST SPFATAL 26 ***
*** END OF TEST SPFATAL 26 ***