xref: /openbmc/linux/tools/testing/selftests/rseq/rseq-bits-template.h (revision 9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e)
1*ae315738SMathieu Desnoyers /* SPDX-License-Identifier: LGPL-2.1 OR MIT */
2*ae315738SMathieu Desnoyers /*
3*ae315738SMathieu Desnoyers  * rseq-bits-template.h
4*ae315738SMathieu Desnoyers  *
5*ae315738SMathieu Desnoyers  * (C) Copyright 2016-2022 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6*ae315738SMathieu Desnoyers  */
7*ae315738SMathieu Desnoyers 
8*ae315738SMathieu Desnoyers #ifdef RSEQ_TEMPLATE_CPU_ID
9*ae315738SMathieu Desnoyers # define RSEQ_TEMPLATE_CPU_ID_OFFSET	RSEQ_CPU_ID_OFFSET
10*ae315738SMathieu Desnoyers # define RSEQ_TEMPLATE_CPU_ID_FIELD	cpu_id
11*ae315738SMathieu Desnoyers # ifdef RSEQ_TEMPLATE_MO_RELEASE
12*ae315738SMathieu Desnoyers #  define RSEQ_TEMPLATE_SUFFIX		_release_cpu_id
13*ae315738SMathieu Desnoyers # elif defined (RSEQ_TEMPLATE_MO_RELAXED)
14*ae315738SMathieu Desnoyers #  define RSEQ_TEMPLATE_SUFFIX		_relaxed_cpu_id
15*ae315738SMathieu Desnoyers # else
16*ae315738SMathieu Desnoyers #  error "Never use <rseq-bits-template.h> directly; include <rseq.h> instead."
17*ae315738SMathieu Desnoyers # endif
18*ae315738SMathieu Desnoyers #elif defined(RSEQ_TEMPLATE_MM_CID)
19*ae315738SMathieu Desnoyers # define RSEQ_TEMPLATE_CPU_ID_OFFSET	RSEQ_MM_CID_OFFSET
20*ae315738SMathieu Desnoyers # define RSEQ_TEMPLATE_CPU_ID_FIELD	mm_cid
21*ae315738SMathieu Desnoyers # ifdef RSEQ_TEMPLATE_MO_RELEASE
22*ae315738SMathieu Desnoyers #  define RSEQ_TEMPLATE_SUFFIX		_release_mm_cid
23*ae315738SMathieu Desnoyers # elif defined (RSEQ_TEMPLATE_MO_RELAXED)
24*ae315738SMathieu Desnoyers #  define RSEQ_TEMPLATE_SUFFIX		_relaxed_mm_cid
25*ae315738SMathieu Desnoyers # else
26*ae315738SMathieu Desnoyers #  error "Never use <rseq-bits-template.h> directly; include <rseq.h> instead."
27*ae315738SMathieu Desnoyers # endif
28*ae315738SMathieu Desnoyers #elif defined (RSEQ_TEMPLATE_CPU_ID_NONE)
29*ae315738SMathieu Desnoyers # ifdef RSEQ_TEMPLATE_MO_RELEASE
30*ae315738SMathieu Desnoyers #  define RSEQ_TEMPLATE_SUFFIX		_release
31*ae315738SMathieu Desnoyers # elif defined (RSEQ_TEMPLATE_MO_RELAXED)
32*ae315738SMathieu Desnoyers #  define RSEQ_TEMPLATE_SUFFIX		_relaxed
33*ae315738SMathieu Desnoyers # else
34*ae315738SMathieu Desnoyers #  error "Never use <rseq-bits-template.h> directly; include <rseq.h> instead."
35*ae315738SMathieu Desnoyers # endif
36*ae315738SMathieu Desnoyers #else
37*ae315738SMathieu Desnoyers # error "Never use <rseq-bits-template.h> directly; include <rseq.h> instead."
38*ae315738SMathieu Desnoyers #endif
39*ae315738SMathieu Desnoyers 
40*ae315738SMathieu Desnoyers #define RSEQ_TEMPLATE_IDENTIFIER(x)	RSEQ_COMBINE_TOKENS(x, RSEQ_TEMPLATE_SUFFIX)
41*ae315738SMathieu Desnoyers 
42