Commit | Line | Data |
---|---|---|
44ec21eb MJ |
1 | /* SPDX-License-Identifier: MIT */ |
2 | /* SPDX-FileCopyrightText: 2016-2022 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> */ | |
3 | ||
4 | /* | |
5 | * rseq/arch.h | |
6 | */ | |
7 | ||
8 | #include <rseq/thread-pointer.h> | |
9 | ||
10 | /* | |
11 | * Architecture detection using compiler defines. | |
12 | * | |
13 | * The following defines are used internally for architecture specific code. | |
14 | * | |
15 | * URCU_ARCH_X86 : All x86 variants 32 and 64 bits | |
16 | * URCU_ARCH_I386 : Specific to the i386 | |
17 | * URCU_ARCH_AMD64 : All 64 bits x86 variants | |
18 | * | |
19 | * URCU_ARCH_PPC : All PowerPC variants 32 and 64 bits | |
20 | * URCU_ARCH_PPC64 : Specific to 64 bits variants | |
21 | * | |
22 | * URCU_ARCH_S390 : All IBM s390 / s390x variants | |
23 | * URCU_ARCH_S390X : Specific to z/Architecture 64 bits | |
24 | * | |
25 | * URCU_ARCH_ARM : All ARM 32 bits variants | |
26 | * URCU_ARCH_AARCH64 : All ARM 64 bits variants | |
27 | * URCU_ARCH_MIPS : All MIPS variants | |
28 | * URCU_ARCH_RISCV : All RISC-V variants | |
29 | */ | |
30 | ||
31 | #ifndef _RSEQ_ARCH_H | |
32 | #define _RSEQ_ARCH_H | |
33 | ||
34 | #if (defined(__amd64__) \ | |
35 | || defined(__amd64) \ | |
36 | || defined(__x86_64__) \ | |
37 | || defined(__x86_64)) | |
38 | ||
39 | #define RSEQ_ARCH_X86 1 | |
40 | #define RSEQ_ARCH_AMD64 1 | |
41 | #include <rseq/arch/x86.h> | |
42 | ||
43 | #elif (defined(__i386__) || defined(__i386)) | |
44 | ||
45 | #define RSEQ_ARCH_X86 1 | |
46 | #include <rseq/arch/x86.h> | |
47 | ||
48 | #elif (defined(__arm__) || defined(__arm)) | |
49 | ||
50 | #define RSEQ_ARCH_ARM 1 | |
51 | #include <rseq/arch/arm.h> | |
52 | ||
53 | #elif defined(__aarch64__) | |
54 | ||
55 | #define RSEQ_ARCH_AARCH64 1 | |
56 | #include <rseq/arch/aarch64.h> | |
57 | ||
58 | #elif (defined(__powerpc64__) || defined(__ppc64__)) | |
59 | ||
60 | #define RSEQ_ARCH_PPC 1 | |
61 | #define RSEQ_ARCH_PPC64 1 | |
62 | #include <rseq/arch/ppc.h> | |
63 | ||
64 | #elif (defined(__powerpc__) \ | |
65 | || defined(__powerpc) \ | |
66 | || defined(__ppc__)) | |
67 | ||
68 | #define RSEQ_ARCH_PPC 1 | |
69 | #include <rseq/arch/ppc.h> | |
70 | ||
71 | #elif (defined(__mips__) || defined(__mips)) | |
72 | ||
73 | #define RSEQ_ARCH_MIPS 1 | |
74 | #include <rseq/arch/mips.h> | |
75 | ||
76 | #elif defined(__s390__) | |
77 | ||
78 | # if (defined(__s390x__) || defined(__zarch__)) | |
79 | # define RSEQ_ARCH_S390X 1 | |
80 | # endif | |
81 | ||
82 | #define RSEQ_ARCH_S390 1 | |
83 | #include <rseq/arch/s390.h> | |
84 | ||
85 | #elif defined(__riscv) | |
86 | ||
87 | #define RSEQ_ARCH_RISCV 1 | |
88 | #include <rseq/arch/riscv.h> | |
89 | ||
90 | #else | |
91 | #error "Cannot build: unrecognized architecture, see <rseq/arch.h>." | |
92 | #endif | |
93 | ||
94 | #endif /* _RSEQ_ARCH_H */ |