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>
This commit is contained in:
parent
0886c6d4d2
commit
8e03bd4e70
1 changed files with 27 additions and 0 deletions
|
@ -52,4 +52,31 @@ static inline bool failure_is_nesting(void)
|
|||
return (__builtin_get_texasru() & 0x400000);
|
||||
}
|
||||
|
||||
static inline int tcheck(void)
|
||||
{
|
||||
long cr;
|
||||
asm volatile ("tcheck 0" : "=r"(cr) : : "cr0");
|
||||
return (cr >> 28) & 4;
|
||||
}
|
||||
|
||||
static inline bool tcheck_doomed(void)
|
||||
{
|
||||
return tcheck() & 8;
|
||||
}
|
||||
|
||||
static inline bool tcheck_active(void)
|
||||
{
|
||||
return tcheck() & 4;
|
||||
}
|
||||
|
||||
static inline bool tcheck_suspended(void)
|
||||
{
|
||||
return tcheck() & 2;
|
||||
}
|
||||
|
||||
static inline bool tcheck_transactional(void)
|
||||
{
|
||||
return tcheck() & 6;
|
||||
}
|
||||
|
||||
#endif /* _SELFTESTS_POWERPC_TM_TM_H */
|
||||
|
|
Loading…
Reference in a new issue