1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright 2015, Cyril Bur, IBM Corp.
5 * This test attempts to see if the VMX registers change across a syscall (fork).
11 #include <sys/syscall.h>
14 #include <sys/types.h>
18 vector
int varray
[] = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10,11,12},
19 {13,14,15,16},{17,18,19,20},{21,22,23,24},
20 {25,26,27,28},{29,30,31,32},{33,34,35,36},
21 {37,38,39,40},{41,42,43,44},{45,46,47,48}};
23 extern int test_vmx(vector
int *varray
, pid_t
*pid
);
31 for (i
= 0; i
< 1000; i
++) {
32 /* test_vmx will fork() */
33 ret
= test_vmx(varray
, &fork_pid
);
38 waitpid(fork_pid
, &child_ret
, 0);
46 int test_vmx_syscall(void)
49 * Setup an environment with much context switching
56 // vcmpequd used in vmx_asm.S is v2.07
57 SKIP_IF(!have_hwcap2(PPC_FEATURE2_ARCH_2_07
));
64 /* Can't FAIL_IF(pid2 == -1); because we've already forked */
67 * Couldn't fork, ensure child_ret is set and is a fail
72 waitpid(pid2
, &child_ret
, 0);
80 waitpid(pid
, &child_ret
, 0);
84 FAIL_IF(ret
|| child_ret
);
88 int main(int argc
, char *argv
[])
90 return test_harness(test_vmx_syscall
, "vmx_syscall");