selftests/powerpc: Move UCONTEXT_NIA() into utils.h
authorNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Mon, 21 May 2018 15:13:56 +0000 (20:43 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Sat, 20 Oct 2018 02:26:47 +0000 (13:26 +1100)
... so that it can be used by others.

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
tools/testing/selftests/powerpc/include/utils.h
tools/testing/selftests/powerpc/primitives/load_unaligned_zeropad.c

index c58c370828b49e6d712c843f8b5e838ea0ba2fa1..da1b963cdb322ee506372287da192e49e05fb26d 100644 (file)
@@ -80,4 +80,12 @@ do {                                                         \
 #define PPC_FEATURE2_ARCH_3_00 0x00800000
 #endif
 
+#if defined(__powerpc64__)
+#define UCONTEXT_NIA(UC)       (UC)->uc_mcontext.gp_regs[PT_NIP]
+#elif defined(__powerpc__)
+#define UCONTEXT_NIA(UC)       (UC)->uc_mcontext.uc_regs->gregs[PT_NIP]
+#else
+#error implement UCONTEXT_NIA
+#endif
+
 #endif /* _SELFTESTS_POWERPC_UTILS_H */
index ed3239bbfae2db96e9884cd8776d179b0eccf4fa..ee1e9ca22f0d3f47581ffdf574e01b620e5b0d7f 100644 (file)
@@ -65,14 +65,6 @@ static int unprotect_region(void)
 extern char __start___ex_table[];
 extern char __stop___ex_table[];
 
-#if defined(__powerpc64__)
-#define UCONTEXT_NIA(UC)       (UC)->uc_mcontext.gp_regs[PT_NIP]
-#elif defined(__powerpc__)
-#define UCONTEXT_NIA(UC)       (UC)->uc_mcontext.uc_regs->gregs[PT_NIP]
-#else
-#error implement UCONTEXT_NIA
-#endif
-
 struct extbl_entry {
        int insn;
        int fixup;