~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/tools/testing/selftests/arm64/signal/test_signals.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 */
  2 /* Copyright (C) 2019 ARM Limited */
  3 
  4 #ifndef __TEST_SIGNALS_H__
  5 #define __TEST_SIGNALS_H__
  6 
  7 #include <signal.h>
  8 #include <stdbool.h>
  9 #include <ucontext.h>
 10 
 11 /*
 12  * Using ARCH specific and sanitized Kernel headers from the tree.
 13  */
 14 #include <asm/ptrace.h>
 15 #include <asm/hwcap.h>
 16 
 17 #define __stringify_1(x...)     #x
 18 #define __stringify(x...)       __stringify_1(x)
 19 
 20 #define get_regval(regname, out)                        \
 21 {                                                       \
 22         asm volatile("mrs %0, " __stringify(regname)    \
 23         : "=r" (out)                                    \
 24         :                                               \
 25         : "memory");                                    \
 26 }
 27 
 28 /*
 29  * Feature flags used in tdescr.feats_required to specify
 30  * any feature by the test
 31  */
 32 enum {
 33         FSSBS_BIT,
 34         FSVE_BIT,
 35         FSME_BIT,
 36         FSME_FA64_BIT,
 37         FSME2_BIT,
 38         FMAX_END
 39 };
 40 
 41 #define FEAT_SSBS               (1UL << FSSBS_BIT)
 42 #define FEAT_SVE                (1UL << FSVE_BIT)
 43 #define FEAT_SME                (1UL << FSME_BIT)
 44 #define FEAT_SME_FA64           (1UL << FSME_FA64_BIT)
 45 #define FEAT_SME2               (1UL << FSME2_BIT)
 46 
 47 /*
 48  * A descriptor used to describe and configure a test case.
 49  * Fields with a non-trivial meaning are described inline in the following.
 50  */
 51 struct tdescr {
 52         /* KEEP THIS FIELD FIRST for easier lookup from assembly */
 53         void                    *token;
 54         /* when disabled token based sanity checking is skipped in handler */
 55         bool                    sanity_disabled;
 56         /* just a name for the test-case; manadatory field */
 57         char                    *name;
 58         char                    *descr;
 59         unsigned long           feats_required;
 60         unsigned long           feats_incompatible;
 61         /* bitmask of effectively supported feats: populated at run-time */
 62         unsigned long           feats_supported;
 63         bool                    initialized;
 64         unsigned int            minsigstksz;
 65         /* signum used as a test trigger. Zero if no trigger-signal is used */
 66         int                     sig_trig;
 67         /*
 68          * signum considered as a successful test completion.
 69          * Zero when no signal is expected on success
 70          */
 71         int                     sig_ok;
 72         /* signum expected on unsupported CPU features. */
 73         int                     sig_unsupp;
 74         /* a timeout in second for test completion */
 75         unsigned int            timeout;
 76         bool                    triggered;
 77         bool                    pass;
 78         unsigned int            result;
 79         /* optional sa_flags for the installed handler */
 80         int                     sa_flags;
 81         ucontext_t              saved_uc;
 82         /* used by get_current_ctx() */
 83         size_t                  live_sz;
 84         ucontext_t              *live_uc;
 85         volatile sig_atomic_t   live_uc_valid;
 86         /* optional test private data */
 87         void                    *priv;
 88 
 89         /* a custom setup: called alternatively to default_setup */
 90         int (*setup)(struct tdescr *td);
 91         /* a custom init: called by default test init after test_setup */
 92         bool (*init)(struct tdescr *td);
 93         /* a custom cleanup function called before test exits */
 94         void (*cleanup)(struct tdescr *td);
 95         /* an optional function to be used as a trigger for starting test */
 96         int (*trigger)(struct tdescr *td);
 97         /*
 98          * the actual test-core: invoked differently depending on the
 99          * presence of the trigger function above; this is mandatory
100          */
101         int (*run)(struct tdescr *td, siginfo_t *si, ucontext_t *uc);
102         /* an optional function for custom results' processing */
103         void (*check_result)(struct tdescr *td);
104 };
105 
106 extern struct tdescr tde;
107 #endif
108 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php