Skip to content

Commit 0e26ac6

Browse files
author
Fox Snowpatch
committed
1 parent 484dba3 commit 0e26ac6

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

tools/testing/selftests/powerpc/math/fpu_signal.c

+6-10
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <pthread.h>
1919

2020
#include "utils.h"
21+
#include "fpu.h"
2122

2223
/* Number of times each thread should receive the signal */
2324
#define ITERATIONS 10
@@ -27,9 +28,7 @@
2728
*/
2829
#define THREAD_FACTOR 8
2930

30-
__thread double darray[] = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0,
31-
1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0,
32-
2.1};
31+
__thread double darray[32];
3332

3433
bool bad_context;
3534
int threads_starting;
@@ -43,9 +42,9 @@ void signal_fpu_sig(int sig, siginfo_t *info, void *context)
4342
ucontext_t *uc = context;
4443
mcontext_t *mc = &uc->uc_mcontext;
4544

46-
/* Only the non volatiles were loaded up */
47-
for (i = 14; i < 32; i++) {
48-
if (mc->fp_regs[i] != darray[i - 14]) {
45+
// Don't check f30/f31, they're used as scratches in check_all_fprs()
46+
for (i = 0; i < 30; i++) {
47+
if (mc->fp_regs[i] != darray[i]) {
4948
bad_context = true;
5049
break;
5150
}
@@ -54,7 +53,6 @@ void signal_fpu_sig(int sig, siginfo_t *info, void *context)
5453

5554
void *signal_fpu_c(void *p)
5655
{
57-
int i;
5856
long rc;
5957
struct sigaction act;
6058
act.sa_sigaction = signal_fpu_sig;
@@ -64,9 +62,7 @@ void *signal_fpu_c(void *p)
6462
return p;
6563

6664
srand(pthread_self());
67-
for (i = 0; i < 21; i++)
68-
darray[i] = rand();
69-
65+
randomise_darray(darray, ARRAY_SIZE(darray));
7066
rc = preempt_fpu(darray, &threads_starting, &running);
7167

7268
return (void *) rc;

0 commit comments

Comments
 (0)