]>
Commit | Line | Data |
---|---|---|
d9dc34cd | 1 | /* Check __ppc_get_timebase() for architecture changes |
d614a753 | 2 | Copyright (C) 2012-2020 Free Software Foundation, Inc. |
d9dc34cd TMQMF |
3 | This file is part of the GNU C Library. |
4 | ||
5 | The GNU C Library is free software; you can redistribute it and/or | |
6 | modify it under the terms of the GNU Lesser General Public | |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the License, or (at your option) any later version. | |
9 | ||
10 | The GNU C Library is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | Lesser General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU Lesser General Public | |
16 | License along with the GNU C Library; if not, see | |
5a82c748 | 17 | <https://www.gnu.org/licenses/>. */ |
d9dc34cd TMQMF |
18 | |
19 | /* Test if __ppc_get_timebase() is compatible with the current processor and if | |
20 | it's changing between reads. A read failure might indicate a Power ISA or | |
21 | binutils change. */ | |
22 | ||
23 | #include <inttypes.h> | |
24 | #include <stdio.h> | |
e054f494 | 25 | #include <stdint.h> |
d9dc34cd TMQMF |
26 | |
27 | #include <sys/platform/ppc.h> | |
28 | ||
29 | static int | |
30 | do_test (void) | |
31 | { | |
32 | uint64_t t1, t2, t3; | |
33 | t1 = __ppc_get_timebase (); | |
34 | printf ("Time Base = %"PRIu64"\n", t1); | |
35 | t2 = __ppc_get_timebase (); | |
36 | printf ("Time Base = %"PRIu64"\n", t2); | |
37 | t3 = __ppc_get_timebase (); | |
38 | printf ("Time Base = %"PRIu64"\n", t3); | |
39 | if (t1 != t2 && t1 != t3 && t2 != t3) | |
40 | return 0; | |
41 | ||
4a2552c3 | 42 | printf ("Fail: timebase reads should always be different.\n"); |
d9dc34cd TMQMF |
43 | return 1; |
44 | } | |
45 | ||
ee6df1e6 | 46 | #include <support/test-driver.c> |