source: rtems/testsuites/sptests/spfatal26/init.c @ 815994f

4.115
Last change on this file since 815994f was 815994f, checked in by Sebastian Huber <sebastian.huber@…>, on 11/25/12 at 16:48:11

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.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/*
2 * Copyright (c) 2012 embedded brains GmbH.  All rights reserved.
3 *
4 *  embedded brains GmbH
5 *  Obere Lagerstr. 30
6 *  82178 Puchheim
7 *  Germany
8 *  <rtems@embedded-brains.de>
9 *
10 * The license and distribution terms for this file may be
11 * found in the file LICENSE in this distribution or at
12 * http://www.rtems.com/license/LICENSE.
13 */
14
15#ifdef HAVE_CONFIG_H
16  #include "config.h"
17#endif
18
19#include "tmacros.h"
20
21#include <limits.h>
22
23#include <rtems.h>
24
25static void provoke_aligment_or_data_access_exception( void )
26{
27  uintptr_t one = 1;
28  int i = sizeof(void *) * CHAR_BIT;
29  uintptr_t n = 1;
30  uintptr_t base = 0;
31  uintptr_t inc;
32
33  *(volatile uint64_t *) base;
34
35  do {
36    int j;
37
38    --i;
39    base = one << i;
40    inc = base << 1;
41
42    for (j = 0; j < n; ++j, base += inc) {
43      *(volatile uint64_t *) base;
44    }
45
46    n <<= 1;
47  } while (i > 0);
48}
49
50static void Init( rtems_task_argument arg )
51{
52  printk( "\n\n*** TEST SPFATAL 26 ***\n" );
53
54  provoke_aligment_or_data_access_exception();
55
56  rtems_test_assert( 0 );
57}
58
59static void fatal_extension(
60  rtems_fatal_source source,
61  bool is_internal,
62  rtems_fatal_code code
63)
64{
65  rtems_test_assert( source == RTEMS_FATAL_SOURCE_EXCEPTION );
66  rtems_test_assert( !is_internal );
67
68  rtems_exception_frame_print( (const rtems_exception_frame *) code );
69
70  printk( "*** END OF TEST SPFATAL 26 ***\n" );
71}
72
73#define CONFIGURE_INITIAL_EXTENSIONS { .fatal = fatal_extension }
74
75#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
76
77#define CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
78
79#define CONFIGURE_MAXIMUM_TASKS 1
80
81#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
82
83#define CONFIGURE_INIT
84
85#include <rtems/confdefs.h>
Note: See TracBrowser for help on using the repository browser.