2 * Copyright 2015, Cyril Bur, IBM Corp.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
9 * This test attempts to see if the FPU registers change across a syscall (fork).
14 #include <sys/syscall.h>
16 #include <sys/types.h>
22 extern int test_fpu(double *darray
, pid_t
*pid
);
24 double darray
[] = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0,
25 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0,
34 for (i
= 0; i
< 1000; i
++) {
35 /* test_fpu will fork() */
36 ret
= test_fpu(darray
, &fork_pid
);
41 waitpid(fork_pid
, &child_ret
, 0);
49 int test_syscall_fpu(void)
52 * Setup an environment with much context switching
61 /* Can't FAIL_IF(pid2 == -1); because already forked once */
64 * Couldn't fork, ensure test is a fail
70 waitpid(pid2
, &child_ret
, 0);
78 waitpid(pid
, &child_ret
, 0);
82 FAIL_IF(ret
|| child_ret
);
86 int main(int argc
, char *argv
[])
88 return test_harness(test_syscall_fpu
, "syscall_fpu");