|
28 | 28 | #endif // HAVE_LIBPFM |
29 | 29 | #include <linux/prctl.h> // For PR_PAC_* constants |
30 | 30 | #include <sys/prctl.h> |
31 | | -#ifndef PR_PAC_SET_ENABLED_KEYS |
32 | | -#define PR_PAC_SET_ENABLED_KEYS 60 |
33 | | -#endif |
34 | | -#ifndef PR_PAC_GET_ENABLED_KEYS |
35 | | -#define PR_PAC_GET_ENABLED_KEYS 61 |
36 | | -#endif |
37 | 31 | #ifndef PR_PAC_APIAKEY |
38 | 32 | #define PR_PAC_APIAKEY (1UL << 0) |
39 | 33 | #endif |
|
54 | 48 | namespace llvm { |
55 | 49 | namespace exegesis { |
56 | 50 |
|
57 | | -bool isPointerAuth(unsigned Opcode) { |
58 | | - switch (Opcode) { |
59 | | - default: |
60 | | - return false; |
61 | | - |
62 | | - // FIXME: Pointer Authentication instructions. |
63 | | - // We would like to measure these instructions, but they can behave |
64 | | - // differently on different platforms, and maybe the snippets need to look |
65 | | - // different for these instructions, |
66 | | - // Platform-specific handling: On Linux, we disable authentication, may |
67 | | - // interfere with measurements. On non-Linux platforms, disable opcodes for |
68 | | - // now. |
69 | | - case AArch64::AUTDA: |
70 | | - case AArch64::AUTDB: |
71 | | - case AArch64::AUTDZA: |
72 | | - case AArch64::AUTDZB: |
73 | | - case AArch64::AUTIA: |
74 | | - case AArch64::AUTIA1716: |
75 | | - case AArch64::AUTIASP: |
76 | | - case AArch64::AUTIAZ: |
77 | | - case AArch64::AUTIB: |
78 | | - case AArch64::AUTIB1716: |
79 | | - case AArch64::AUTIBSP: |
80 | | - case AArch64::AUTIBZ: |
81 | | - case AArch64::AUTIZA: |
82 | | - case AArch64::AUTIZB: |
83 | | - return true; |
84 | | - } |
85 | | -} |
86 | | - |
87 | | -bool isLoadTagMultiple(unsigned Opcode) { |
88 | | - switch (Opcode) { |
89 | | - default: |
90 | | - return false; |
91 | | - |
92 | | - // Load tag multiple instruction |
93 | | - case AArch64::LDGM: |
94 | | - return true; |
95 | | - } |
96 | | -} |
97 | | - |
98 | 51 | static unsigned getLoadImmediateOpcode(unsigned RegBitWidth) { |
99 | 52 | switch (RegBitWidth) { |
100 | 53 | case 32: |
@@ -334,35 +287,6 @@ class ExegesisAArch64Target : public ExegesisTarget { |
334 | 287 | // Function return is a pseudo-instruction that needs to be expanded |
335 | 288 | PM.add(createAArch64ExpandPseudoPass()); |
336 | 289 | } |
337 | | - |
338 | | - const char *getIgnoredOpcodeReasonOrNull(const LLVMState &State, |
339 | | - unsigned Opcode) const override { |
340 | | - if (const char *Reason = |
341 | | - ExegesisTarget::getIgnoredOpcodeReasonOrNull(State, Opcode)) |
342 | | - return Reason; |
343 | | - |
344 | | - if (isPointerAuth(Opcode)) { |
345 | | -#if defined(__aarch64__) && defined(__linux__) |
346 | | - // Disable all PAC keys. Note that while we expect the measurements to |
347 | | - // be the same with PAC keys disabled, they could potentially be lower |
348 | | - // since authentication checks are bypassed. |
349 | | - if (prctl(PR_PAC_SET_ENABLED_KEYS, |
350 | | - PR_PAC_APIAKEY | PR_PAC_APIBKEY | PR_PAC_APDAKEY | |
351 | | - PR_PAC_APDBKEY, // all keys |
352 | | - 0, // disable all |
353 | | - 0, 0) < 0) { |
354 | | - return "Failed to disable PAC keys"; |
355 | | - } |
356 | | -#else |
357 | | - return "Unsupported opcode: isPointerAuth"; |
358 | | -#endif |
359 | | - } |
360 | | - |
361 | | - if (isLoadTagMultiple(Opcode)) |
362 | | - return "Unsupported opcode: load tag multiple"; |
363 | | - |
364 | | - return nullptr; |
365 | | - } |
366 | 290 | MCRegister getScratchMemoryRegister(const Triple &) const override; |
367 | 291 | void fillMemoryOperands(InstructionTemplate &IT, MCRegister Reg, |
368 | 292 | unsigned Offset) const override; |
|
0 commit comments