6 #include <asm/unistd.h>
9 #define ASM_INPUT_0 "0" (r0)
11 #define INTERNAL_SYSCALL_SCV(name, nr) \
13 register long int r0 __asm__ ("r0"); \
14 register long int r3 __asm__ ("r3"); \
15 register long int r4 __asm__ ("r4"); \
16 register long int r5 __asm__ ("r5"); \
17 register long int r6 __asm__ ("r6"); \
18 register long int r7 __asm__ ("r7"); \
19 register long int r8 __asm__ ("r8"); \
21 __asm__ __volatile__ \
22 (".machine power9\n" \
26 "=&r" (r3), "=&r" (r4), "=&r" (r5), \
27 "=&r" (r6), "=&r" (r7), "=&r" (r8) \
29 : "r9", "r10", "r11", "r12", \
30 "cr0", "cr1", "cr5", "cr6", "cr7", "xer", \
31 "lr", "ctr", "memory"); \
35 #define INTERNAL_SYSCALL_SC(name, nr) \
37 register long int r0 __asm__ ("r0"); \
38 register long int r3 __asm__ ("r3"); \
39 register long int r4 __asm__ ("r4"); \
40 register long int r5 __asm__ ("r5"); \
41 register long int r6 __asm__ ("r6"); \
42 register long int r7 __asm__ ("r7"); \
43 register long int r8 __asm__ ("r8"); \
45 __asm__ __volatile__ \
50 "=&r" (r3), "=&r" (r4), "=&r" (r5), \
51 "=&r" (r6), "=&r" (r7), "=&r" (r8) \
53 : "r9", "r10", "r11", "r12", \
54 "xer", "cr0", "ctr", "memory"); \
55 r0 & (1 << 28) ? -r3 : r3; \
58 #define PPC_FEATURE2_SCV 0x00100000 /* scv syscall enabled */
68 unsigned long hwcaps2_val
;
70 result
= INTERNAL_SYSCALL_SC(__NR_gettid
, 0);
73 printf("The sc instruction test unexpectedly failed\n");
77 hwcaps2_val
= getauxval(AT_HWCAP2
);
79 if ((hwcaps2_val
& PPC_FEATURE2_SCV
) == PPC_FEATURE2_SCV
) {
80 /* system supports the scv instruction */
81 result
= INTERNAL_SYSCALL_SCV(__NR_gettid
, 0);
84 printf("The scv instruction test unexpectedly failed\n");
91 printf("HAS_ISA_3_00 not detected.\n");