This adds a confdef option allowing an application to request mapping machine exceptions to POSIX signals. This is required for some languages such as Ada. --- cpukit/doxygen/appl-config.h | 25 +++++++- cpukit/include/rtems/confdefs.h | 1 + cpukit/include/rtems/confdefs/exceptions.h | 71 ++++++++++++++++++++++ cpukit/include/rtems/exceptions.h | 57 +++++++++++++++++ spec/build/cpukit/librtemscpu.yml | 2 + 5 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 cpukit/include/rtems/confdefs/exceptions.h create mode 100644 cpukit/include/rtems/exceptions.h
diff --git a/cpukit/doxygen/appl-config.h b/cpukit/doxygen/appl-config.h index 4b18ac29a7..b007a03a25 100644 --- a/cpukit/doxygen/appl-config.h +++ b/cpukit/doxygen/appl-config.h @@ -3,7 +3,7 @@ /* * Copyright (C) 2019, 2020 embedded brains GmbH (http://www.embedded-brains.de) * Copyright (C) 2010 Gedare Bloom - * Copyright (C) 1988, 2008 On-Line Applications Research Corporation (OAR) + * Copyright (C) 1988, 2021 On-Line Applications Research Corporation (OAR) * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -1414,6 +1414,29 @@ */ #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +/* Generated from spec:/acfg/if/appl-needs-exception-to-signal-mapping */ + +/** + * @brief This configuration option is a boolean feature define. + * + * In case this configuration option is defined, then the machine exception to + * POSIX signal mapping is configured during system initialization. + * + * @par Default Configuration + * If this configuration option is undefined, then the described feature is not + * enabled. + * + * @par Notes + * @parblock + * This device driver is responsible for setting up a mapping from machine + * exceptions to POSIX signals so that applications may consume them and alter + * task execution as necessary. + * + * This is especially useful for applications written in Ada or C++. + * @endparblock + */ +#define CONFIGURE_APPLICATION_NEEDS_EXCEPTION_TO_SIGNAL_MAPPING + /* Generated from spec:/acfg/if/appl-needs-framebuffer-driver */ /** diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h index e6dd3d70ee..8770aa673d 100644 --- a/cpukit/include/rtems/confdefs.h +++ b/cpukit/include/rtems/confdefs.h @@ -64,6 +64,7 @@ #include <rtems/confdefs/clock.h> #include <rtems/confdefs/console.h> #include <rtems/confdefs/extensions.h> +#include <rtems/confdefs/exceptions.h> #include <rtems/confdefs/inittask.h> #include <rtems/confdefs/initthread.h> #include <rtems/confdefs/iodrivers.h> diff --git a/cpukit/include/rtems/confdefs/exceptions.h b/cpukit/include/rtems/confdefs/exceptions.h new file mode 100644 index 0000000000..b60143a900 --- /dev/null +++ b/cpukit/include/rtems/confdefs/exceptions.h @@ -0,0 +1,71 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSImplApplConfig + * + * @brief This header file evaluates configuration options related to + * handling of machine exceptions. + */ + +/* + * Copyright (C) 2021 On-Line Applications Research + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _RTEMS_CONFDEFS_EXCEPTIONS_H +#define _RTEMS_CONFDEFS_EXCEPTIONS_H + +#ifndef __CONFIGURATION_TEMPLATE_h +#error "Do not include this file directly, use <rtems/confdefs.h> instead" +#endif + +#ifdef CONFIGURE_INIT + +#include <rtems/exceptions.h> +#include <rtems/sysinit.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef CONFIGURE_APPLICATION_NEEDS_EXCEPTION_TO_SIGNAL_MAPPING + RTEMS_SYSINIT_ITEM( + _Exception_initialize_signal_mapping, + RTEMS_SYSINIT_DEVICE_DRIVERS, + /* + * This is called as early as possible to set defaults so that later + * initialization can override them without being wiped out. + */ + RTEMS_SYSINIT_ORDER_FIRST + ); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* CONFIGURE_INIT */ + +#endif /* _RTEMS_CONFDEFS_EXCEPTIONS_H */ diff --git a/cpukit/include/rtems/exceptions.h b/cpukit/include/rtems/exceptions.h new file mode 100644 index 0000000000..5e43827d11 --- /dev/null +++ b/cpukit/include/rtems/exceptions.h @@ -0,0 +1,57 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @brief Exception mapping + * + * This file describes the hooks necessary for mapping machine exceptions to + * POSIX signals. + */ + +/* + * Copyright (C) 2021 On-Line Applications Research + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _RTEMS_EXCEPTIONS_H +#define _RTEMS_EXCEPTIONS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Configures the desired mapping for machine exceptions to POSIX + * signals. + * + * See CONFIGURE_APPLICATION_NEEDS_EXCEPTION_TO_SIGNAL_MAPPING documentation in the + * "RTEMS Classic API Guide". + */ +void _Exception_initialize_signal_mapping( void ); + +#ifdef __cplusplus +} +#endif + +#endif /* _RTEMS_EXCEPTIONS_H */ diff --git a/spec/build/cpukit/librtemscpu.yml b/spec/build/cpukit/librtemscpu.yml index 4ed91562f8..9af110fc24 100644 --- a/spec/build/cpukit/librtemscpu.yml +++ b/spec/build/cpukit/librtemscpu.yml @@ -99,6 +99,7 @@ install: - cpukit/include/rtems/dumpbuf.h - cpukit/include/rtems/endian.h - cpukit/include/rtems/error.h + - cpukit/include/rtems/exceptions.h - cpukit/include/rtems/extension.h - cpukit/include/rtems/extensiondata.h - cpukit/include/rtems/extensionimpl.h @@ -193,6 +194,7 @@ install: - cpukit/include/rtems/confdefs/bsp.h - cpukit/include/rtems/confdefs/clock.h - cpukit/include/rtems/confdefs/console.h + - cpukit/include/rtems/confdefs/exceptions.h - cpukit/include/rtems/confdefs/extensions.h - cpukit/include/rtems/confdefs/inittask.h - cpukit/include/rtems/confdefs/initthread.h -- 2.20.1 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel