1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright 2015, Cyril Bur, IBM Corp.
5 * This test attempts to see if the FPU registers change across a syscall (fork).
10 #include <sys/syscall.h>
12 #include <sys/types.h>
18 extern int test_fpu(double *darray
, pid_t
*pid
);
20 double darray
[] = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0,
21 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0,
30 for (i
= 0; i
< 1000; i
++) {
31 /* test_fpu will fork() */
32 ret
= test_fpu(darray
, &fork_pid
);
37 waitpid(fork_pid
, &child_ret
, 0);
45 int test_syscall_fpu(void)
48 * Setup an environment with much context switching
57 /* Can't FAIL_IF(pid2 == -1); because already forked once */
60 * Couldn't fork, ensure test is a fail
66 waitpid(pid2
, &child_ret
, 0);
74 waitpid(pid
, &child_ret
, 0);
78 FAIL_IF(ret
|| child_ret
);
82 int main(int argc
, char *argv
[])
84 return test_harness(test_syscall_fpu
, "syscall_fpu");