|
12 | 12 | #if defined(__aarch64__) && defined(__linux__) |
13 | 13 | #include <linux/prctl.h> // For PR_PAC_* constants |
14 | 14 | #include <sys/prctl.h> |
15 | | -#ifndef PR_PAC_SET_ENABLED_KEYS |
16 | | -#define PR_PAC_SET_ENABLED_KEYS 60 |
17 | | -#endif |
18 | | -#ifndef PR_PAC_GET_ENABLED_KEYS |
19 | | -#define PR_PAC_GET_ENABLED_KEYS 61 |
20 | | -#endif |
21 | 15 | #ifndef PR_PAC_APIAKEY |
22 | 16 | #define PR_PAC_APIAKEY (1UL << 0) |
23 | 17 | #endif |
|
38 | 32 | namespace llvm { |
39 | 33 | namespace exegesis { |
40 | 34 |
|
41 | | -bool isPointerAuth(unsigned Opcode) { |
42 | | - switch (Opcode) { |
43 | | - default: |
44 | | - return false; |
45 | | - |
46 | | - // FIXME: Pointer Authentication instructions. |
47 | | - // We would like to measure these instructions, but they can behave |
48 | | - // differently on different platforms, and maybe the snippets need to look |
49 | | - // different for these instructions, |
50 | | - // Platform-specific handling: On Linux, we disable authentication, may |
51 | | - // interfere with measurements. On non-Linux platforms, disable opcodes for |
52 | | - // now. |
53 | | - case AArch64::AUTDA: |
54 | | - case AArch64::AUTDB: |
55 | | - case AArch64::AUTDZA: |
56 | | - case AArch64::AUTDZB: |
57 | | - case AArch64::AUTIA: |
58 | | - case AArch64::AUTIA1716: |
59 | | - case AArch64::AUTIASP: |
60 | | - case AArch64::AUTIAZ: |
61 | | - case AArch64::AUTIB: |
62 | | - case AArch64::AUTIB1716: |
63 | | - case AArch64::AUTIBSP: |
64 | | - case AArch64::AUTIBZ: |
65 | | - case AArch64::AUTIZA: |
66 | | - case AArch64::AUTIZB: |
67 | | - return true; |
68 | | - } |
69 | | -} |
70 | | - |
71 | | -bool isLoadTagMultiple(unsigned Opcode) { |
72 | | - switch (Opcode) { |
73 | | - default: |
74 | | - return false; |
75 | | - |
76 | | - // Load tag multiple instruction |
77 | | - case AArch64::LDGM: |
78 | | - return true; |
79 | | - } |
80 | | -} |
81 | | - |
82 | 35 | static unsigned getLoadImmediateOpcode(unsigned RegBitWidth) { |
83 | 36 | switch (RegBitWidth) { |
84 | 37 | case 32: |
@@ -198,35 +151,6 @@ class ExegesisAArch64Target : public ExegesisTarget { |
198 | 151 | // Function return is a pseudo-instruction that needs to be expanded |
199 | 152 | PM.add(createAArch64ExpandPseudoPass()); |
200 | 153 | } |
201 | | - |
202 | | - const char *getIgnoredOpcodeReasonOrNull(const LLVMState &State, |
203 | | - unsigned Opcode) const override { |
204 | | - if (const char *Reason = |
205 | | - ExegesisTarget::getIgnoredOpcodeReasonOrNull(State, Opcode)) |
206 | | - return Reason; |
207 | | - |
208 | | - if (isPointerAuth(Opcode)) { |
209 | | -#if defined(__aarch64__) && defined(__linux__) |
210 | | - // Disable all PAC keys. Note that while we expect the measurements to |
211 | | - // be the same with PAC keys disabled, they could potentially be lower |
212 | | - // since authentication checks are bypassed. |
213 | | - if (prctl(PR_PAC_SET_ENABLED_KEYS, |
214 | | - PR_PAC_APIAKEY | PR_PAC_APIBKEY | PR_PAC_APDAKEY | |
215 | | - PR_PAC_APDBKEY, // all keys |
216 | | - 0, // disable all |
217 | | - 0, 0) < 0) { |
218 | | - return "Failed to disable PAC keys"; |
219 | | - } |
220 | | -#else |
221 | | - return "Unsupported opcode: isPointerAuth"; |
222 | | -#endif |
223 | | - } |
224 | | - |
225 | | - if (isLoadTagMultiple(Opcode)) |
226 | | - return "Unsupported opcode: load tag multiple"; |
227 | | - |
228 | | - return nullptr; |
229 | | - } |
230 | 154 | }; |
231 | 155 |
|
232 | 156 | } // namespace |
|
0 commit comments