summaryrefslogtreecommitdiffstats
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
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--cpukit/score/cpu/sparc/sparc-bad-trap.S14
-rw-r--r--testsuites/sptests/spfatal30/init.c37
-rw-r--r--testsuites/sptests/spfatal31/init.c35
3 files changed, 55 insertions, 31 deletions
diff --git a/cpukit/score/cpu/sparc/sparc-bad-trap.S b/cpukit/score/cpu/sparc/sparc-bad-trap.S
index 2e73a4a7da..c20a97889f 100644
--- a/cpukit/score/cpu/sparc/sparc-bad-trap.S
+++ b/cpukit/score/cpu/sparc/sparc-bad-trap.S
@@ -208,20 +208,6 @@ SYM(_SPARC_Bad_trap):
std %f30, [%l7 + SPARC_EXCEPTION_OFFSET_FP(15)]
#endif
-#if !defined(SPARC_USE_LAZY_FP_SWITCH)
- /*
- * Call
- * _Internal_error( INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT )
- * if necessary.
- */
- cmp %l3, 4
- bne .Lno_fp_disable_trap
- nop
- call SYM(_Internal_error)
- set 38, %o0
-.Lno_fp_disable_trap:
-#endif
-
/*
* Call _Terminate( RTEMS_FATAL_SOURCE_EXCEPTION, %l0 ).
*/
diff --git a/testsuites/sptests/spfatal30/init.c b/testsuites/sptests/spfatal30/init.c
index a02bf062f4..a76fe1f309 100644
--- a/testsuites/sptests/spfatal30/init.c
+++ b/testsuites/sptests/spfatal30/init.c
@@ -22,9 +22,28 @@
const char rtems_test_name[] = "SPFATAL 30";
-#if (CPU_HARDWARE_FP == TRUE && CPU_ALL_TASKS_ARE_FP == FALSE) \
- || SPARC_HAS_FPU == 1
-#define EXPECT_ILLEGAL_USE_OF_FLOATING_POINT_UNIT
+#if ( CPU_HARDWARE_FP == TRUE && CPU_ALL_TASKS_ARE_FP == FALSE ) || \
+ 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;
@@ -35,7 +54,7 @@ static void Init(rtems_task_argument arg)
f *= 123.456;
-#ifdef EXPECT_ILLEGAL_USE_OF_FLOATING_POINT_UNIT
+#ifdef EXPECTED_FATAL_SOURCE
rtems_test_assert(0);
#else
TEST_END();
@@ -43,7 +62,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,
@@ -51,9 +70,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();
}
@@ -63,11 +82,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_DOES_NOT_NEED_CLOCK_DRIVER
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