summaryrefslogtreecommitdiffstats
path: root/testsuites/sptests/spfatal31/init.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-07-12 18:05:19 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-07-15 15:37:35 +0200
commitb177cfc1c96bf1d5deb57cf1de368a4d55a9eb87 (patch)
treee178c30e534499da467a621035859f2d18eb38bf /testsuites/sptests/spfatal31/init.c
parent19e4a3d25c0baac7b09de57914cfcfb86696c397 (diff)
downloadrtems-b177cfc1c96bf1d5deb57cf1de368a4d55a9eb87.tar.bz2
sparc: Prefer RTEMS_FATAL_SOURCE_EXCEPTION
Prefer RTEMS_FATAL_SOURCE_EXCEPTION over INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT since the fatal code (rtems_exception_frame) provides more context.
Diffstat (limited to '')
-rw-r--r--testsuites/sptests/spfatal31/init.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/testsuites/sptests/spfatal31/init.c b/testsuites/sptests/spfatal31/init.c
index 5aab6630dc..782e7632cc 100644
--- a/testsuites/sptests/spfatal31/init.c
+++ b/testsuites/sptests/spfatal31/init.c
@@ -22,8 +22,27 @@
const char rtems_test_name[] = "SPFATAL 31";
-#if SPARC_HAS_FPU == 1
-#define EXPECT_ILLEGAL_USE_OF_FLOATING_POINT_UNIT
+#if defined(SPARC_USE_LAZY_FP_SWITCH)
+
+#define EXPECTED_FATAL_SOURCE INTERNAL_ERROR_CORE
+
+static bool is_expected_fatal_code( rtems_fatal_code code )
+{
+ return code == INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT;
+}
+
+#elif defined(SPARC_USE_SYNCHRONOUS_FP_SWITCH)
+
+#define EXPECTED_FATAL_SOURCE RTEMS_FATAL_SOURCE_EXCEPTION
+
+static bool is_expected_fatal_code( rtems_fatal_code code )
+{
+ const rtems_exception_frame *frame;
+
+ frame = (const rtems_exception_frame *) code;
+ return frame->trap == 4;
+}
+
#endif
static volatile double f = 1.0;
@@ -49,7 +68,7 @@ static void Init(rtems_task_argument arg)
sc = rtems_task_wake_after(2);
rtems_test_assert(sc == RTEMS_SUCCESSFUL);
-#ifdef EXPECT_ILLEGAL_USE_OF_FLOATING_POINT_UNIT
+#ifdef EXPECTED_FATAL_SOURCE
rtems_test_assert(0);
#else
TEST_END();
@@ -57,7 +76,7 @@ static void Init(rtems_task_argument arg)
#endif
}
-#ifdef EXPECT_ILLEGAL_USE_OF_FLOATING_POINT_UNIT
+#ifdef EXPECTED_FATAL_SOURCE
static void fatal_extension(
rtems_fatal_source source,
bool always_set_to_false,
@@ -65,9 +84,9 @@ static void fatal_extension(
)
{
if (
- source == INTERNAL_ERROR_CORE
+ source == EXPECTED_FATAL_SOURCE
&& !always_set_to_false
- && code == INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT
+ && is_expected_fatal_code( code )
) {
TEST_END();
}
@@ -77,11 +96,11 @@ static void fatal_extension(
{ .fatal = fatal_extension }, \
RTEMS_TEST_INITIAL_EXTENSION
-#else /* EXPECT_ILLEGAL_USE_OF_FLOATING_POINT_UNIT */
+#else /* EXPECTED_FATAL_SOURCE */
#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
-#endif /* EXPECT_ILLEGAL_USE_OF_FLOATING_POINT_UNIT */
+#endif /* EXPECTED_FATAL_SOURCE */
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER