FreeBSD: add file descriptor tracking for _umtx_op
[valgrind.git] / none / tests / s390x / stck.c
blob2925d5e65827bc9585a4f34bf8d79008850daaa0
1 #include<stdio.h>
2 #include<time.h>
3 #include<stdlib.h>
4 #include<unistd.h>
6 int stck(unsigned long *addr)
8 int cc;
9 asm volatile ( "stck %0\n"
10 "ipm %1\n"
11 "srl %1,28\n"
12 :"=Q" (*addr), "=d"(cc)::"memory", "cc");
13 return cc;
16 unsigned long clockticks_in_msec(unsigned long b, unsigned long a)
18 return (b - a) / 4096000UL;
21 int main()
24 int cc;
25 unsigned long start, end, diff;
27 cc = stck(&start);
28 if (cc)
29 printf("cc != 0!\n");
30 sleep(1);
31 cc = stck(&end);
32 if (cc)
33 printf("cc != 0!\n");
34 diff = clockticks_in_msec(end, start);
35 if (diff >= 1000 && diff < 1500)
36 printf("OK.....Testcase passed\n");
37 else
38 printf("FAILED.....Testcase failed\n");
39 return 0;