|
|
147e83 |
commit 302949e2940a9da3f6364a1574619e621b7e1e71
|
|
|
147e83 |
Author: Marcus Shawcroft <marcus.shawcroft@arm.com>
|
|
|
147e83 |
Date: Fri Mar 7 14:05:20 2014 +0000
|
|
|
147e83 |
|
|
|
147e83 |
[PATCH] [AArch64] Optional trapping exceptions support.
|
|
|
147e83 |
|
|
|
147e83 |
Trapping exceptions in AArch64 are optional. The relevant exception
|
|
|
147e83 |
control bits in FPCR are are defined as RES0 hence the absence of
|
|
|
147e83 |
support can be detected by reading back the FPCR and comparing with
|
|
|
147e83 |
the desired value.
|
|
|
147e83 |
|
|
|
147e83 |
--- glibc-2.17-c758a686/ports/sysdeps/aarch64/fpu/feenablxcpt.c
|
|
|
147e83 |
+++ glibc-2.17-c758a686/ports/sysdeps/aarch64/fpu/feenablxcpt.c
|
|
|
147e83 |
@@ -35,5 +35,18 @@ feenableexcept (int excepts)
|
|
|
147e83 |
|
|
|
147e83 |
_FPU_SETCW (fpcr);
|
|
|
147e83 |
|
|
|
147e83 |
+ /* Trapping exceptions are optional in AArch64 the relevant enable
|
|
|
147e83 |
+ bits in FPCR are RES0 hence the absence of support can be
|
|
|
147e83 |
+ detected by reading back the FPCR and comparing with the required
|
|
|
147e83 |
+ value. */
|
|
|
147e83 |
+ if (excepts)
|
|
|
147e83 |
+ {
|
|
|
147e83 |
+ fpu_control_t updated_fpcr;
|
|
|
147e83 |
+
|
|
|
147e83 |
+ _FPU_GETCW (updated_fpcr);
|
|
|
147e83 |
+ if (((updated_fpcr >> FE_EXCEPT_SHIFT) & excepts) != excepts)
|
|
|
147e83 |
+ return -1;
|
|
|
147e83 |
+ }
|
|
|
147e83 |
+
|
|
|
147e83 |
return original_excepts;
|
|
|
147e83 |
}
|
|
|
147e83 |
--- glibc-2.17-c758a686/ports/sysdeps/aarch64/fpu/fesetenv.c
|
|
|
147e83 |
+++ glibc-2.17-c758a686/ports/sysdeps/aarch64/fpu/fesetenv.c
|
|
|
147e83 |
@@ -24,6 +24,7 @@ fesetenv (const fenv_t *envp)
|
|
|
147e83 |
{
|
|
|
147e83 |
fpu_control_t fpcr;
|
|
|
147e83 |
fpu_fpsr_t fpsr;
|
|
|
147e83 |
+ fpu_control_t updated_fpcr;
|
|
|
147e83 |
|
|
|
147e83 |
_FPU_GETCW (fpcr);
|
|
|
147e83 |
_FPU_GETFPSR (fpsr);
|
|
|
147e83 |
@@ -51,6 +52,15 @@ fesetenv (const fenv_t *envp)
|
|
|
147e83 |
|
|
|
147e83 |
_FPU_SETCW (fpcr);
|
|
|
147e83 |
|
|
|
147e83 |
+ /* Trapping exceptions are optional in AArch64 the relevant enable
|
|
|
147e83 |
+ bits in FPCR are RES0 hence the absence of support can be
|
|
|
147e83 |
+ detected by reading back the FPCR and comparing with the required
|
|
|
147e83 |
+ value. */
|
|
|
147e83 |
+
|
|
|
147e83 |
+ _FPU_GETCW (updated_fpcr);
|
|
|
147e83 |
+ if ((updated_fpcr & fpcr) != fpcr)
|
|
|
147e83 |
+ return 1;
|
|
|
147e83 |
+
|
|
|
147e83 |
return 0;
|
|
|
147e83 |
}
|
|
|
147e83 |
|
|
|
147e83 |
commit 423a7160af7fcffc61aac5e2e36d0b6b5b083214
|
|
|
147e83 |
Author: Wilco <wdijkstr@arm.com>
|
|
|
147e83 |
Date: Thu Apr 17 09:39:27 2014 +0100
|
|
|
147e83 |
|
|
|
147e83 |
Add fenv test support for targets which don't have FP traps.
|
|
|
147e83 |
|
|
|
147e83 |
(removed unnecessary code to limit it to test-fenv.c --kyle)
|
|
|
147e83 |
|
|
|
147e83 |
--- glibc-2.17-c758a686/math/test-fenv.c
|
|
|
147e83 |
+++ glibc-2.17-c758a686/math/test-fenv.c
|
|
|
147e83 |
@@ -233,14 +234,9 @@ feenv_nomask_test (const char *flag_name, int fe_exc)
|
|
|
147e83 |
#if defined FE_NOMASK_ENV
|
|
|
147e83 |
int status;
|
|
|
147e83 |
pid_t pid;
|
|
|
147e83 |
- fenv_t saved;
|
|
|
147e83 |
|
|
|
147e83 |
- fegetenv (&saved);
|
|
|
147e83 |
- errno = 0;
|
|
|
147e83 |
- fesetenv (FE_NOMASK_ENV);
|
|
|
147e83 |
- status = errno;
|
|
|
147e83 |
- fesetenv (&saved);
|
|
|
147e83 |
- if (status == ENOSYS)
|
|
|
147e83 |
+ if (1
|
|
|
147e83 |
+ && fesetenv (FE_NOMASK_ENV) != 0)
|
|
|
147e83 |
{
|
|
|
147e83 |
printf ("Test: not testing FE_NOMASK_ENV, it isn't implemented.\n");
|
|
|
147e83 |
return;
|
|
|
147e83 |
@@ -349,7 +345,13 @@ feexcp_nomask_test (const char *flag_name, int fe_exc)
|
|
|
147e83 |
int status;
|
|
|
147e83 |
pid_t pid;
|
|
|
147e83 |
|
|
|
147e83 |
- printf ("Test: after fedisableexcept (%s) processes will abort\n",
|
|
|
147e83 |
+ if (1 && feenableexcept (fe_exc) == -1)
|
|
|
147e83 |
+ {
|
|
|
147e83 |
+ printf ("Test: not testing feenableexcept, it isn't implemented.\n");
|
|
|
147e83 |
+ return;
|
|
|
147e83 |
+ }
|
|
|
147e83 |
+
|
|
|
147e83 |
+ printf ("Test: after feenableexcept (%s) processes will abort\n",
|
|
|
147e83 |
flag_name);
|
|
|
147e83 |
printf (" when feraiseexcept (%s) is called.\n", flag_name);
|
|
|
147e83 |
pid = fork ();
|
|
|
147e83 |
@@ -470,7 +472,6 @@ feenable_test (const char *flag_name, int fe_exc)
|
|
|
147e83 |
{
|
|
|
147e83 |
int excepts;
|
|
|
147e83 |
|
|
|
147e83 |
-
|
|
|
147e83 |
printf ("Tests for feenableexcepts etc. with flag %s\n", flag_name);
|
|
|
147e83 |
|
|
|
147e83 |
/* First disable all exceptions. */
|
|
|
147e83 |
@@ -488,8 +489,12 @@ feenable_test (const char *flag_name, int fe_exc)
|
|
|
147e83 |
flag_name, excepts);
|
|
|
147e83 |
++count_errors;
|
|
|
147e83 |
}
|
|
|
147e83 |
-
|
|
|
147e83 |
excepts = feenableexcept (fe_exc);
|
|
|
147e83 |
+ if (1 && excepts == -1)
|
|
|
147e83 |
+ {
|
|
|
147e83 |
+ printf ("Test: not testing feenableexcept, it isn't implemented.\n");
|
|
|
147e83 |
+ return;
|
|
|
147e83 |
+ }
|
|
|
147e83 |
if (excepts == -1)
|
|
|
147e83 |
{
|
|
|
147e83 |
printf ("Test: feenableexcept (%s) failed\n", flag_name);
|