[compiler-rt] 199f7dd - [XRay][X86] Remove sled version 0 support from patchCustomEvent
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 19 15:11:31 PDT 2023
Author: Fangrui Song
Date: 2023-06-19T15:11:26-07:00
New Revision: 199f7dd421e84fb91d2528d30035b3f07af47264
URL: https://github.com/llvm/llvm-project/commit/199f7dd421e84fb91d2528d30035b3f07af47264
DIFF: https://github.com/llvm/llvm-project/commit/199f7dd421e84fb91d2528d30035b3f07af47264.diff
LOG: [XRay][X86] Remove sled version 0 support from patchCustomEvent
This is remnant after D140739.
Added:
Modified:
compiler-rt/lib/xray/xray_x86_64.cpp
Removed:
################################################################################
diff --git a/compiler-rt/lib/xray/xray_x86_64.cpp b/compiler-rt/lib/xray/xray_x86_64.cpp
index 1bf241c1223fc..b9666a40861d4 100644
--- a/compiler-rt/lib/xray/xray_x86_64.cpp
+++ b/compiler-rt/lib/xray/xray_x86_64.cpp
@@ -250,10 +250,8 @@ bool patchCustomEvent(const bool Enable, const uint32_t FuncId,
const XRaySledEntry &Sled) XRAY_NEVER_INSTRUMENT {
// Here we do the dance of replacing the following sled:
//
- // In Version 0:
- //
// xray_sled_n:
- // jmp +20 // 2 bytes
+ // jmp +15 // 2 bytes
// ...
//
// With the following:
@@ -262,36 +260,17 @@ bool patchCustomEvent(const bool Enable, const uint32_t FuncId,
// ...
//
//
- // The "unpatch" should just turn the 'nopw' back to a 'jmp +20'.
- //
- // ---
- //
- // In Version 1 or 2:
- //
- // The jump offset is now 15 bytes (0x0f), so when restoring the nopw back
- // to a jmp, use 15 bytes instead.
- //
+ // The "unpatch" should just turn the 'nopw' back to a 'jmp +15'.
const uint64_t Address = Sled.address();
if (Enable) {
std::atomic_store_explicit(
reinterpret_cast<std::atomic<uint16_t> *>(Address), NopwSeq,
std::memory_order_release);
} else {
- switch (Sled.Version) {
- case 1:
- case 2:
- std::atomic_store_explicit(
- reinterpret_cast<std::atomic<uint16_t> *>(Address), Jmp15Seq,
- std::memory_order_release);
- break;
- case 0:
- default:
- std::atomic_store_explicit(
- reinterpret_cast<std::atomic<uint16_t> *>(Address), Jmp20Seq,
- std::memory_order_release);
- break;
- }
- }
+ std::atomic_store_explicit(
+ reinterpret_cast<std::atomic<uint16_t> *>(Address), Jmp15Seq,
+ std::memory_order_release);
+ }
return false;
}
More information about the llvm-commits
mailing list