18
18
#include <pthread.h>
19
19
20
20
#include "utils.h"
21
+ #include "fpu.h"
21
22
22
23
/* Number of times each thread should receive the signal */
23
24
#define ITERATIONS 10
27
28
*/
28
29
#define THREAD_FACTOR 8
29
30
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 ];
33
32
34
33
bool bad_context ;
35
34
int threads_starting ;
@@ -43,9 +42,9 @@ void signal_fpu_sig(int sig, siginfo_t *info, void *context)
43
42
ucontext_t * uc = context ;
44
43
mcontext_t * mc = & uc -> uc_mcontext ;
45
44
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 ]) {
49
48
bad_context = true;
50
49
break ;
51
50
}
@@ -54,7 +53,6 @@ void signal_fpu_sig(int sig, siginfo_t *info, void *context)
54
53
55
54
void * signal_fpu_c (void * p )
56
55
{
57
- int i ;
58
56
long rc ;
59
57
struct sigaction act ;
60
58
act .sa_sigaction = signal_fpu_sig ;
@@ -64,9 +62,7 @@ void *signal_fpu_c(void *p)
64
62
return p ;
65
63
66
64
srand (pthread_self ());
67
- for (i = 0 ; i < 21 ; i ++ )
68
- darray [i ] = rand ();
69
-
65
+ randomise_darray (darray , ARRAY_SIZE (darray ));
70
66
rc = preempt_fpu (darray , & threads_starting , & running );
71
67
72
68
return (void * ) rc ;
0 commit comments