1 /* SPDX-License-Identifier: GPL-2.0 */
2 /* Copyright (C) 2019 ARM Limited */
4 #ifndef __TEST_SIGNALS_H__
5 #define __TEST_SIGNALS_H__
12 * Using ARCH specific and sanitized Kernel headers installed by KSFT
13 * framework since we asked for it by setting flag KSFT_KHDR_INSTALL
16 #include <asm/ptrace.h>
17 #include <asm/hwcap.h>
19 #define __stringify_1(x...) #x
20 #define __stringify(x...) __stringify_1(x)
22 #define get_regval(regname, out) \
24 asm volatile("mrs %0, " __stringify(regname) \
31 * Feature flags used in tdescr.feats_required to specify
32 * any feature by the test
39 #define FEAT_SSBS (1UL << FSSBS_BIT)
42 * A descriptor used to describe and configure a test case.
43 * Fields with a non-trivial meaning are described inline in the following.
46 /* KEEP THIS FIELD FIRST for easier lookup from assembly */
48 /* when disabled token based sanity checking is skipped in handler */
50 /* just a name for the test-case; manadatory field */
53 unsigned long feats_required
;
54 /* bitmask of effectively supported feats: populated at run-time */
55 unsigned long feats_supported
;
57 unsigned int minsigstksz
;
58 /* signum used as a test trigger. Zero if no trigger-signal is used */
61 * signum considered as a successful test completion.
62 * Zero when no signal is expected on success
65 /* signum expected on unsupported CPU features. */
67 /* a timeout in second for test completion */
72 /* optional sa_flags for the installed handler */
75 /* used by get_current_ctx() */
78 volatile sig_atomic_t live_uc_valid
;
79 /* optional test private data */
82 /* a custom setup: called alternatively to default_setup */
83 int (*setup
)(struct tdescr
*td
);
84 /* a custom init: called by default test init after test_setup */
85 bool (*init
)(struct tdescr
*td
);
86 /* a custom cleanup function called before test exits */
87 void (*cleanup
)(struct tdescr
*td
);
88 /* an optional function to be used as a trigger for starting test */
89 int (*trigger
)(struct tdescr
*td
);
91 * the actual test-core: invoked differently depending on the
92 * presence of the trigger function above; this is mandatory
94 int (*run
)(struct tdescr
*td
, siginfo_t
*si
, ucontext_t
*uc
);
95 /* an optional function for custom results' processing */
96 void (*check_result
)(struct tdescr
*td
);
99 extern struct tdescr tde
;