diff options
| author | Cyril Bur <cyrilbur@gmail.com> | 2016-09-23 02:18:18 -0400 |
|---|---|---|
| committer | Michael Ellerman <mpe@ellerman.id.au> | 2016-10-04 05:10:14 -0400 |
| commit | 8e03bd4e70b6a4c70ac3ea6766b2bc06a8ad91a3 (patch) | |
| tree | 9bff224a04565625b7847cf1a2a1b026e909303e /tools/testing | |
| parent | 0886c6d4d21edc9902adfbf02e6e74916287ae04 (diff) | |
selftests/powerpc: Add TM tcheck helpers in C
Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'tools/testing')
| -rw-r--r-- | tools/testing/selftests/powerpc/tm/tm.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tools/testing/selftests/powerpc/tm/tm.h b/tools/testing/selftests/powerpc/tm/tm.h index 60318bad7d7a..2c8da74304e7 100644 --- a/tools/testing/selftests/powerpc/tm/tm.h +++ b/tools/testing/selftests/powerpc/tm/tm.h | |||
| @@ -52,4 +52,31 @@ static inline bool failure_is_nesting(void) | |||
| 52 | return (__builtin_get_texasru() & 0x400000); | 52 | return (__builtin_get_texasru() & 0x400000); |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | static inline int tcheck(void) | ||
| 56 | { | ||
| 57 | long cr; | ||
| 58 | asm volatile ("tcheck 0" : "=r"(cr) : : "cr0"); | ||
| 59 | return (cr >> 28) & 4; | ||
| 60 | } | ||
| 61 | |||
| 62 | static inline bool tcheck_doomed(void) | ||
| 63 | { | ||
| 64 | return tcheck() & 8; | ||
| 65 | } | ||
| 66 | |||
| 67 | static inline bool tcheck_active(void) | ||
| 68 | { | ||
| 69 | return tcheck() & 4; | ||
| 70 | } | ||
| 71 | |||
| 72 | static inline bool tcheck_suspended(void) | ||
| 73 | { | ||
| 74 | return tcheck() & 2; | ||
| 75 | } | ||
| 76 | |||
| 77 | static inline bool tcheck_transactional(void) | ||
| 78 | { | ||
| 79 | return tcheck() & 6; | ||
| 80 | } | ||
| 81 | |||
| 55 | #endif /* _SELFTESTS_POWERPC_TM_TM_H */ | 82 | #endif /* _SELFTESTS_POWERPC_TM_TM_H */ |
