0001
0002
0003
0004 #ifndef __TEST_SIGNALS_H__
0005 #define __TEST_SIGNALS_H__
0006
0007 #include <signal.h>
0008 #include <stdbool.h>
0009 #include <ucontext.h>
0010
0011
0012
0013
0014 #include <asm/ptrace.h>
0015 #include <asm/hwcap.h>
0016
0017 #define __stringify_1(x...) #x
0018 #define __stringify(x...) __stringify_1(x)
0019
0020 #define get_regval(regname, out) \
0021 { \
0022 asm volatile("mrs %0, " __stringify(regname) \
0023 : "=r" (out) \
0024 : \
0025 : "memory"); \
0026 }
0027
0028
0029
0030
0031
0032 enum {
0033 FSSBS_BIT,
0034 FSVE_BIT,
0035 FSME_BIT,
0036 FSME_FA64_BIT,
0037 FMAX_END
0038 };
0039
0040 #define FEAT_SSBS (1UL << FSSBS_BIT)
0041 #define FEAT_SVE (1UL << FSVE_BIT)
0042 #define FEAT_SME (1UL << FSME_BIT)
0043 #define FEAT_SME_FA64 (1UL << FSME_FA64_BIT)
0044
0045
0046
0047
0048
0049 struct tdescr {
0050
0051 void *token;
0052
0053 bool sanity_disabled;
0054
0055 char *name;
0056 char *descr;
0057 unsigned long feats_required;
0058 unsigned long feats_incompatible;
0059
0060 unsigned long feats_supported;
0061 bool initialized;
0062 unsigned int minsigstksz;
0063
0064 int sig_trig;
0065
0066
0067
0068
0069 int sig_ok;
0070
0071 int sig_unsupp;
0072
0073 unsigned int timeout;
0074 bool triggered;
0075 bool pass;
0076 unsigned int result;
0077
0078 int sa_flags;
0079 ucontext_t saved_uc;
0080
0081 size_t live_sz;
0082 ucontext_t *live_uc;
0083 volatile sig_atomic_t live_uc_valid;
0084
0085 void *priv;
0086
0087
0088 int (*setup)(struct tdescr *td);
0089
0090 bool (*init)(struct tdescr *td);
0091
0092 void (*cleanup)(struct tdescr *td);
0093
0094 int (*trigger)(struct tdescr *td);
0095
0096
0097
0098
0099 int (*run)(struct tdescr *td, siginfo_t *si, ucontext_t *uc);
0100
0101 void (*check_result)(struct tdescr *td);
0102 };
0103
0104 extern struct tdescr tde;
0105 #endif