aboutsummaryrefslogtreecommitdiff
path: root/tests/tcg/multiarch/nop_func.h
diff options
context:
space:
mode:
authorIlya Leoshkevich <iii@linux.ibm.com>2022-12-23 13:02:52 +0100
committerRichard Henderson <richard.henderson@linaro.org>2023-01-05 11:41:29 -0800
commitd4846c33ebe04d2141dcc613b5558d2f1d8077af (patch)
treee539661999b555bf68097bf561189f059a5afa9f /tests/tcg/multiarch/nop_func.h
parente630c0126c561b7db26790e8288c4fe9b61ae8dc (diff)
tests/tcg/multiarch: add vma-pthread.c
Add a test that locklessly changes and exercises page protection bits from various threads. This helps catch race conditions in the VMA handling. Acked-by: Alex Bennée <alex.bennee@linaro.org> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Message-Id: <20221223120252.513319-1-iii@linux.ibm.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tests/tcg/multiarch/nop_func.h')
-rw-r--r--tests/tcg/multiarch/nop_func.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/tcg/multiarch/nop_func.h b/tests/tcg/multiarch/nop_func.h
new file mode 100644
index 0000000000..f714d21000
--- /dev/null
+++ b/tests/tcg/multiarch/nop_func.h
@@ -0,0 +1,25 @@
+/*
+ * No-op functions that can be safely copied.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#ifndef NOP_FUNC_H
+#define NOP_FUNC_H
+
+static const char nop_func[] = {
+#if defined(__aarch64__)
+ 0xc0, 0x03, 0x5f, 0xd6, /* ret */
+#elif defined(__alpha__)
+ 0x01, 0x80, 0xFA, 0x6B, /* ret */
+#elif defined(__arm__)
+ 0x1e, 0xff, 0x2f, 0xe1, /* bx lr */
+#elif defined(__riscv)
+ 0x67, 0x80, 0x00, 0x00, /* ret */
+#elif defined(__s390__)
+ 0x07, 0xfe, /* br %r14 */
+#elif defined(__i386__) || defined(__x86_64__)
+ 0xc3, /* ret */
+#endif
+};
+
+#endif